bitboss-ui 2.1.135 → 3.0.0-alpha.4
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/LICENSE +21 -0
- package/README.md +274 -24
- package/bin/bitboss-ui-mcp.mjs +662 -0
- package/bin/bitboss-ui.mjs +710 -0
- package/bin/bitboss-ui.node.test.mjs +113 -0
- package/dist/ai/BbAccordion.md +528 -113
- package/dist/ai/BbAlert.md +380 -197
- package/dist/ai/BbAsterisk.md +46 -0
- package/dist/ai/BbAvatar.md +458 -178
- package/dist/ai/BbBadge.md +697 -225
- package/dist/ai/BbBadgeButton.md +54 -0
- package/dist/ai/BbBaseButton.md +491 -0
- package/dist/ai/BbBaseCheckbox.md +49 -0
- package/dist/ai/BbBaseCheckboxGroup.md +64 -0
- package/dist/ai/BbBaseCheckboxIcon.md +176 -0
- package/dist/ai/BbBaseColorInput.md +64 -0
- package/dist/ai/BbBaseColorPalette.md +39 -0
- package/dist/ai/BbBaseDatePicker.md +42 -0
- package/dist/ai/BbBaseDatePickerInput.md +73 -0
- package/dist/ai/BbBaseInputContainer.md +48 -0
- package/dist/ai/BbBaseNumberInput.md +71 -0
- package/dist/ai/BbBaseRadio.md +46 -0
- package/dist/ai/BbBaseRadioGroup.md +64 -0
- package/dist/ai/BbBaseRadioIcon.md +191 -0
- package/dist/ai/BbBaseRating.md +51 -0
- package/dist/ai/BbBaseSelect.md +88 -0
- package/dist/ai/BbBaseSlider.md +56 -0
- package/dist/ai/BbBaseSwitch.md +49 -0
- package/dist/ai/BbBaseSwitchGroup.md +64 -0
- package/dist/ai/BbBaseSwitchIcon.md +186 -0
- package/dist/ai/BbBaseTag.md +68 -0
- package/dist/ai/BbBaseTextInput.md +75 -0
- package/dist/ai/BbBaseTextarea.md +62 -0
- package/dist/ai/BbBaseTimePickerInput.md +62 -0
- package/dist/ai/BbBreadcrumbs.md +553 -503
- package/dist/ai/BbButton.md +841 -636
- package/dist/ai/BbCheckbox.md +585 -254
- package/dist/ai/BbCheckboxGroup.md +573 -361
- package/dist/ai/BbCollapsible.md +425 -103
- package/dist/ai/BbColorInput.md +536 -323
- package/dist/ai/BbColorPalette.md +569 -330
- package/dist/ai/BbConfirm.md +659 -136
- package/dist/ai/BbConfirmPortal.md +28 -0
- package/dist/ai/BbDatePicker.md +244 -0
- package/dist/ai/BbDatePickerInput.md +720 -388
- package/dist/ai/BbDialog.md +778 -99
- package/dist/ai/BbDropdown.md +1072 -763
- package/dist/ai/BbDropdownButton.md +525 -614
- package/dist/ai/BbDropdownGroup.md +34 -0
- package/dist/ai/BbDropzone.md +1206 -436
- package/dist/ai/BbForm.md +239 -0
- package/dist/ai/BbIcon.md +382 -212
- package/dist/ai/BbIndicator.md +283 -0
- package/dist/ai/BbNumberInput.md +717 -355
- package/dist/ai/BbOffCanvas.md +897 -498
- package/dist/ai/BbPagination.md +489 -535
- package/dist/ai/BbPopover.md +591 -546
- package/dist/ai/BbProgress.md +462 -69
- package/dist/ai/BbRadio.md +352 -229
- package/dist/ai/BbRadioGroup.md +437 -353
- package/dist/ai/BbRating.md +372 -225
- package/dist/ai/BbSelect.md +1399 -536
- package/dist/ai/BbSelectPopover.md +1255 -1578
- package/dist/ai/BbSlider.md +500 -256
- package/dist/ai/BbSmoothHeight.md +485 -139
- package/dist/ai/BbSpinner.md +718 -131
- package/dist/ai/BbSwitch.md +573 -119
- package/dist/ai/BbSwitchGroup.md +521 -214
- package/dist/ai/BbTable.md +1996 -2365
- package/dist/ai/BbTabs.md +1147 -0
- package/dist/ai/BbTabsList.md +29 -0
- package/dist/ai/BbTabsPanes.md +27 -0
- package/dist/ai/BbTabsRoot.md +57 -0
- package/dist/ai/BbTag.md +416 -292
- package/dist/ai/BbTextInput.md +878 -333
- package/dist/ai/BbTextarea.md +850 -255
- package/dist/ai/BbTimePicker.md +231 -0
- package/dist/ai/BbTimePickerInput.md +200 -0
- package/dist/ai/BbToast.md +669 -196
- package/dist/ai/BbToastPortal.md +28 -0
- package/dist/ai/BbTooltip.md +453 -346
- package/dist/ai/BbTree.md +993 -234
- package/dist/ai/ChipsBox.md +27 -199
- package/dist/ai/ClearableButton.md +21 -55
- package/dist/ai/CommaBox.md +25 -200
- package/dist/ai/CommonInputWrapper.md +42 -0
- package/dist/ai/CommonPopover.md +30 -510
- package/dist/ai/ErrorIcon.md +19 -56
- package/dist/ai/FlatListBox.md +35 -379
- package/dist/ai/GroupedListBox.md +37 -535
- package/dist/ai/GuidesComponent.md +21 -0
- package/dist/ai/ListBox.md +38 -231
- package/dist/ai/OptionsContainer.md +34 -253
- package/dist/ai/WarningIcon.md +21 -0
- package/dist/ai/components.json +15897 -0
- package/dist/ai/composables/useBbConfig.md +80 -0
- package/dist/ai/composables/useBbFormContext.md +110 -0
- package/dist/ai/composables/useBbTableContext.md +167 -0
- package/dist/ai/composables/useBbTabsContext.md +118 -0
- package/dist/ai/composables/useBroadcastChannelInstance.md +97 -0
- package/dist/ai/composables/useConfirm.md +313 -0
- package/dist/ai/composables/useCountdown.md +86 -0
- package/dist/ai/composables/useId.md +60 -0
- package/dist/ai/composables/useMobile.md +85 -0
- package/dist/ai/composables/useToast.md +238 -0
- package/dist/ai/guides/agent-contract.md +165 -0
- package/dist/ai/guides/ai-router.md +113 -0
- package/dist/ai/guides/app-layout.md +318 -0
- package/dist/ai/guides/coherence-playbook.md +136 -0
- package/dist/ai/guides/component-picker.md +236 -0
- package/dist/ai/guides/design-language.md +478 -0
- package/dist/ai/guides/design-tokens.md +450 -0
- package/dist/ai/guides/fetch-items-playbook.md +161 -0
- package/dist/ai/guides/floating-bottom-panel.md +130 -0
- package/dist/ai/guides/icons-policy.md +257 -0
- package/dist/ai/guides/inertia-helpers.md +1443 -0
- package/dist/ai/guides/inline-edit-playbook.md +267 -0
- package/dist/ai/guides/installation-and-plugin-setup.md +440 -0
- package/dist/ai/guides/migration/components/bb-alert.md +37 -0
- package/dist/ai/guides/migration/components/bb-avatar.md +24 -0
- package/dist/ai/guides/migration/components/bb-badge.md +110 -0
- package/dist/ai/guides/migration/components/bb-breadcrumbs.md +26 -0
- package/dist/ai/guides/migration/components/bb-button.md +55 -0
- package/dist/ai/guides/migration/components/bb-checkbox-group.md +54 -0
- package/dist/ai/guides/migration/components/bb-checkbox.md +45 -0
- package/dist/ai/guides/migration/components/bb-chip.md +35 -0
- package/dist/ai/guides/migration/components/bb-collapsible.md +26 -0
- package/dist/ai/guides/migration/components/bb-color-input.md +23 -0
- package/dist/ai/guides/migration/components/bb-color-palette.md +31 -0
- package/dist/ai/guides/migration/components/bb-date-picker-input.md +84 -0
- package/dist/ai/guides/migration/components/bb-dialog.md +46 -0
- package/dist/ai/guides/migration/components/bb-dropdown-button.md +31 -0
- package/dist/ai/guides/migration/components/bb-dropdown.md +36 -0
- package/dist/ai/guides/migration/components/bb-dropzone.md +27 -0
- package/dist/ai/guides/migration/components/bb-icon.md +27 -0
- package/dist/ai/guides/migration/components/bb-offcanvas.md +63 -0
- package/dist/ai/guides/migration/components/bb-pagination.md +24 -0
- package/dist/ai/guides/migration/components/bb-popover.md +52 -0
- package/dist/ai/guides/migration/components/bb-rating.md +24 -0
- package/dist/ai/guides/migration/components/bb-select-popover.md +59 -0
- package/dist/ai/guides/migration/components/bb-select.md +69 -0
- package/dist/ai/guides/migration/components/bb-slider.md +25 -0
- package/dist/ai/guides/migration/components/bb-smooth-height.md +45 -0
- package/dist/ai/guides/migration/components/bb-spinner.md +23 -0
- package/dist/ai/guides/migration/components/bb-table.md +66 -0
- package/dist/ai/guides/migration/components/bb-tabs.md +47 -0
- package/dist/ai/guides/migration/components/bb-tag.md +29 -0
- package/dist/ai/guides/migration/components/bb-text-input.md +37 -0
- package/dist/ai/guides/migration/components/bb-toast.md +47 -0
- package/dist/ai/guides/migration/components/bb-tooltip.md +34 -0
- package/dist/ai/guides/migration/components/bb-tree.md +77 -0
- package/dist/ai/guides/migration/components/use-confirm.md +46 -0
- package/dist/ai/guides/migration/v2-to-v3.md +649 -0
- package/dist/ai/guides/options-items-playbook.md +222 -0
- package/dist/ai/guides/page-shell.md +113 -0
- package/dist/ai/guides/validated-forms.md +177 -0
- package/dist/ai/index.md +158 -32
- package/dist/ai/recipes/inertia/approvals-inbox.md +1635 -0
- package/dist/ai/recipes/inertia/inline-edit-workspace.md +1765 -0
- package/dist/ai/recipes/inertia/layout-scaffold.md +385 -0
- package/dist/ai/recipes/inertia/onboarding.md +1791 -0
- package/dist/ai/recipes/inertia/ownership-atlas.md +1327 -0
- package/dist/ai/recipes/inertia/record-form.md +1489 -0
- package/dist/ai/recipes/inertia/records-workspace.md +1416 -0
- package/dist/ai/recipes/inertia/upload-center.md +2003 -0
- package/dist/ai/recipes/inertia/wizard-form.md +1500 -0
- package/dist/ai/recipes/nuxt/approvals-inbox.md +1578 -0
- package/dist/ai/recipes/nuxt/inline-edit-workspace.md +1703 -0
- package/dist/ai/recipes/nuxt/layout-scaffold.md +385 -0
- package/dist/ai/recipes/nuxt/onboarding.md +1724 -0
- package/dist/ai/recipes/nuxt/record-form.md +1502 -0
- package/dist/ai/recipes/nuxt/records-workspace.md +1329 -0
- package/dist/ai/recipes/nuxt/upload-center.md +1886 -0
- package/dist/ai/recipes/nuxt/wizard-form.md +1509 -0
- package/dist/ai/recipes/vue/approvals-inbox.md +1496 -0
- package/dist/ai/recipes/vue/inline-edit-workspace.md +1594 -0
- package/dist/ai/recipes/vue/layout-scaffold.md +385 -0
- package/dist/ai/recipes/vue/onboarding.md +1679 -0
- package/dist/ai/recipes/vue/record-form.md +1586 -0
- package/dist/ai/recipes/vue/records-workspace.md +1245 -0
- package/dist/ai/recipes/vue/upload-center.md +1845 -0
- package/dist/ai/recipes/vue/wizard-form.md +1441 -0
- package/dist/ai/source/BbAccordion.md +123 -0
- package/dist/ai/source/BbAlert.md +401 -0
- package/dist/ai/source/BbAsterisk.md +32 -0
- package/dist/ai/source/BbAvatar.md +258 -0
- package/dist/ai/source/BbBadge.md +560 -0
- package/dist/ai/source/BbBadgeButton.md +490 -0
- package/dist/ai/source/BbBaseButton.md +682 -0
- package/dist/ai/source/BbBaseCheckbox.md +461 -0
- package/dist/ai/source/BbBaseCheckboxGroup.md +554 -0
- package/dist/ai/source/BbBaseCheckboxIcon.md +201 -0
- package/dist/ai/source/BbBaseColorInput.md +416 -0
- package/dist/ai/source/BbBaseColorPalette.md +934 -0
- package/dist/ai/source/BbBaseDatePicker.md +1001 -0
- package/dist/ai/source/BbBaseDatePickerInput.md +1785 -0
- package/dist/ai/source/BbBaseInputContainer.md +1210 -0
- package/dist/ai/source/BbBaseNumberInput.md +617 -0
- package/dist/ai/source/BbBaseRadio.md +377 -0
- package/dist/ai/source/BbBaseRadioGroup.md +533 -0
- package/dist/ai/source/BbBaseRadioIcon.md +153 -0
- package/dist/ai/source/BbBaseRating.md +573 -0
- package/dist/ai/source/BbBaseSelect.md +898 -0
- package/dist/ai/source/BbBaseSlider.md +1085 -0
- package/dist/ai/source/BbBaseSwitch.md +246 -0
- package/dist/ai/source/BbBaseSwitchGroup.md +302 -0
- package/dist/ai/source/BbBaseSwitchIcon.md +206 -0
- package/dist/ai/source/BbBaseTag.md +694 -0
- package/dist/ai/source/BbBaseTextInput.md +511 -0
- package/dist/ai/source/BbBaseTextarea.md +480 -0
- package/dist/ai/source/BbBaseTimePickerInput.md +1031 -0
- package/dist/ai/source/BbBreadcrumbs.md +815 -0
- package/dist/ai/source/BbButton.md +1006 -0
- package/dist/ai/source/BbCheckbox.md +326 -0
- package/dist/ai/source/BbCheckboxGroup.md +419 -0
- package/dist/ai/source/BbCollapsible.md +137 -0
- package/dist/ai/source/BbColorInput.md +322 -0
- package/dist/ai/source/BbColorPalette.md +371 -0
- package/dist/ai/source/BbConfirm.md +193 -0
- package/dist/ai/source/BbConfirmPortal.md +74 -0
- package/dist/ai/source/BbDatePicker.md +729 -0
- package/dist/ai/source/BbDatePickerInput.md +525 -0
- package/dist/ai/source/BbDialog.md +818 -0
- package/dist/ai/source/BbDropdown.md +2387 -0
- package/dist/ai/source/BbDropdownButton.md +315 -0
- package/dist/ai/source/BbDropdownGroup.md +1259 -0
- package/dist/ai/source/BbDropzone.md +864 -0
- package/dist/ai/source/BbForm.md +100 -0
- package/dist/ai/source/BbIcon.md +214 -0
- package/dist/ai/source/BbIndicator.md +298 -0
- package/dist/ai/source/BbNumberInput.md +374 -0
- package/dist/ai/source/BbOffCanvas.md +1266 -0
- package/dist/ai/source/BbPagination.md +835 -0
- package/dist/ai/source/BbPopover.md +860 -0
- package/dist/ai/source/BbProgress.md +140 -0
- package/dist/ai/source/BbRadio.md +303 -0
- package/dist/ai/source/BbRadioGroup.md +420 -0
- package/dist/ai/source/BbRating.md +369 -0
- package/dist/ai/source/BbSelect.md +688 -0
- package/dist/ai/source/BbSelectPopover.md +2234 -0
- package/dist/ai/source/BbSlider.md +378 -0
- package/dist/ai/source/BbSmoothHeight.md +265 -0
- package/dist/ai/source/BbSpinner.md +127 -0
- package/dist/ai/source/BbSwitch.md +175 -0
- package/dist/ai/source/BbSwitchGroup.md +240 -0
- package/dist/ai/source/BbTable.md +3433 -0
- package/dist/ai/source/BbTabs.md +403 -0
- package/dist/ai/source/BbTabsList.md +578 -0
- package/dist/ai/source/BbTabsPanes.md +368 -0
- package/dist/ai/source/BbTabsRoot.md +372 -0
- package/dist/ai/source/BbTag.md +390 -0
- package/dist/ai/source/BbTextInput.md +352 -0
- package/dist/ai/source/BbTextarea.md +337 -0
- package/dist/ai/source/BbTimePicker.md +595 -0
- package/dist/ai/source/BbTimePickerInput.md +376 -0
- package/dist/ai/source/BbToast.md +525 -0
- package/dist/ai/source/BbToastPortal.md +482 -0
- package/dist/ai/source/BbTooltip.md +522 -0
- package/dist/ai/source/BbTree.md +323 -0
- package/dist/ai/source/ChipsBox.md +201 -0
- package/dist/ai/source/ClearableButton.md +70 -0
- package/dist/ai/source/CommaBox.md +202 -0
- package/dist/ai/source/CommonInputWrapper.md +554 -0
- package/dist/ai/source/CommonPopover.md +616 -0
- package/dist/ai/source/ErrorIcon.md +43 -0
- package/dist/ai/source/FlatListBox.md +396 -0
- package/dist/ai/source/GroupedListBox.md +540 -0
- package/dist/ai/source/GuidesComponent.md +383 -0
- package/dist/ai/source/ListBox.md +238 -0
- package/dist/ai/source/OptionsContainer.md +191 -0
- package/dist/ai/source/WarningIcon.md +47 -0
- package/dist/alert-variants.d.ts +19 -0
- package/dist/assets/css/reset.css_inline.js +4 -0
- package/dist/assets/svgs/alert.svg_raw.js +4 -0
- package/dist/assets/svgs/calendar.svg_raw.js +4 -0
- package/dist/assets/svgs/check_stroke.svg_raw.js +4 -0
- package/dist/assets/svgs/chevron_down.svg_raw.js +4 -0
- package/dist/assets/svgs/chevron_right.svg_raw.js +4 -0
- package/dist/assets/svgs/clear.svg_raw.js +4 -0
- package/dist/assets/svgs/clock.svg_raw.js +4 -0
- package/dist/assets/svgs/error.svg_raw.js +4 -0
- package/dist/assets/svgs/search.svg_raw.js +4 -0
- package/dist/assets/svgs/sort.svg_raw.js +4 -0
- package/dist/assets/svgs/spinner.svg_raw.js +4 -0
- package/dist/assets/svgs/user.svg_raw.js +4 -0
- package/dist/badge-variants.d.ts +19 -0
- package/dist/button-variants.d.ts +21 -0
- package/dist/components/BbAccordion/BbAccordion.vue.d.ts +9 -3
- package/dist/components/BbAccordion/BbAccordion.vue.js +6 -0
- package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/BbAccordion/types.d.ts +12 -8
- package/dist/components/BbAlert/BbAlert.vue.d.ts +12 -3
- package/dist/components/BbAlert/BbAlert.vue.js +6 -0
- package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/BbAlert/types.d.ts +56 -12
- package/dist/components/BbAsterisk/BbAsterisk.vue.d.ts +3 -0
- package/dist/components/BbAsterisk/BbAsterisk.vue.js +6 -0
- package/dist/components/BbAsterisk/BbAsterisk.vue_vue_type_script_setup_true_lang.js +13 -0
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +5 -0
- package/dist/components/BbAvatar/BbAvatar.vue.js +6 -0
- package/dist/components/BbAvatar/BbAvatar.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/components/BbAvatar/types.d.ts +6 -5
- package/dist/components/BbBadge/BadgeAppendIcon.vue.d.ts +3 -0
- package/dist/components/BbBadge/BadgeAppendIcon.vue.js +5 -0
- package/dist/components/BbBadge/BadgeAppendIcon.vue_vue_type_script_setup_true_lang.js +22 -0
- package/dist/components/BbBadge/BadgeBodyContent.vue.d.ts +15 -0
- package/dist/components/BbBadge/BadgeBodyContent.vue.js +5 -0
- package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/components/BbBadge/BbBadge.vue.d.ts +8 -1
- package/dist/components/BbBadge/BbBadge.vue.js +6 -0
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/components/BbBadge/BbBadgeButton.vue.d.ts +12 -0
- package/dist/components/BbBadge/BbBadgeButton.vue.js +5 -0
- package/dist/components/BbBadge/BbBadgeButton.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/components/BbBadge/badgeButtonContext.d.ts +27 -0
- package/dist/components/BbBadge/badgeButtonContext.js +5 -0
- package/dist/components/BbBadge/types.d.ts +61 -16
- package/dist/components/BbBaseButton/BbBaseButton.vue.d.ts +13 -0
- package/dist/components/BbBaseButton/BbBaseButton.vue.js +6 -0
- package/dist/components/BbBaseButton/BbBaseButton.vue_vue_type_script_setup_true_lang.js +171 -0
- package/dist/components/BbBaseButton/RouterComponent.vue.js +5 -0
- package/dist/components/BbBaseButton/RouterComponent.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/components/BbBaseButton/types.d.ts +191 -0
- package/dist/components/BbBaseButton/types.js +33 -0
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.d.ts +40 -0
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.js +6 -0
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue_vue_type_script_setup_true_lang.js +145 -0
- package/dist/components/BbBaseCheckbox/types.d.ts +224 -0
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.d.ts +19 -0
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.js +6 -0
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbBaseCheckboxGroup/types.d.ts +257 -0
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue.d.ts +4 -0
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue.js +6 -0
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/components/BbBaseCheckboxIcon/types.d.ts +47 -0
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.d.ts +42 -0
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.js +6 -0
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue_vue_type_script_setup_true_lang.js +178 -0
- package/dist/components/BbBaseColorInput/types.d.ts +210 -0
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue.d.ts +13 -0
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue.js +6 -0
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue_vue_type_script_setup_true_lang.js +395 -0
- package/dist/components/BbBaseColorPalette/types.d.ts +40 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue.js +6 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue_vue_type_script_setup_true_lang.js +300 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.d.ts +44 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.js +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue_vue_type_script_setup_true_lang.js +310 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.d.ts +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.js +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.d.ts +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.js +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/components/BbBaseDatePicker/typeahead.d.ts +112 -0
- package/dist/components/BbBaseDatePicker/typeahead.js +37 -0
- package/dist/components/BbBaseDatePicker/types.d.ts +97 -0
- package/dist/components/BbBaseDatePicker/useDatePickerContext.d.ts +58 -0
- package/dist/components/BbBaseDatePicker/useDatePickerContext.js +11 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.d.ts +30 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.js +6 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue_vue_type_script_setup_true_lang.js +716 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.d.ts +30 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.js +6 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/BbBaseDatePickerInput/types.d.ts +311 -0
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue.d.ts +17 -0
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue.js +6 -0
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue_vue_type_script_setup_true_lang.js +191 -0
- package/dist/components/BbBaseInputContainer/types.d.ts +197 -0
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.d.ts +52 -0
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.js +6 -0
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue_vue_type_script_setup_true_lang.js +215 -0
- package/dist/components/BbBaseNumberInput/types.d.ts +211 -0
- package/dist/components/BbBaseRadio/BbBaseRadio.vue.d.ts +33 -0
- package/dist/components/BbBaseRadio/BbBaseRadio.vue.js +6 -0
- package/dist/components/BbBaseRadio/BbBaseRadio.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/BbBaseRadio/types.d.ts +179 -0
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue.d.ts +19 -0
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue.js +6 -0
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue_vue_type_script_setup_true_lang.js +177 -0
- package/dist/components/BbBaseRadioGroup/types.d.ts +223 -0
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue.d.ts +4 -0
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue.js +6 -0
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/BbBaseRadioIcon/types.d.ts +41 -0
- package/dist/components/BbBaseRating/BbBaseRating.vue.d.ts +38 -0
- package/dist/components/BbBaseRating/BbBaseRating.vue.js +6 -0
- package/dist/components/BbBaseRating/BbBaseRating.vue_vue_type_script_setup_true_lang.js +184 -0
- package/dist/components/BbBaseRating/types.d.ts +168 -0
- package/dist/components/BbBaseSelect/BbBaseSelect.vue.d.ts +19 -0
- package/dist/components/BbBaseSelect/BbBaseSelect.vue.js +6 -0
- package/dist/components/BbBaseSelect/BbBaseSelect.vue_vue_type_script_setup_true_lang.js +307 -0
- package/dist/components/BbBaseSelect/types.d.ts +297 -0
- package/dist/components/BbBaseSlider/BbBaseSlider.vue.d.ts +35 -0
- package/dist/components/BbBaseSlider/BbBaseSlider.vue.js +6 -0
- package/dist/components/BbBaseSlider/BbBaseSlider.vue_vue_type_script_setup_true_lang.js +324 -0
- package/dist/components/BbBaseSlider/types.d.ts +200 -0
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue.d.ts +35 -0
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue.js +6 -0
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/BbBaseSwitch/types.d.ts +10 -0
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.d.ts +19 -0
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.js +6 -0
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbBaseSwitchGroup/types.d.ts +8 -0
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue.d.ts +4 -0
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue.js +6 -0
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/BbBaseSwitchIcon/types.d.ts +48 -0
- package/dist/components/BbBaseTag/BbBaseTag.vue.d.ts +50 -0
- package/dist/components/BbBaseTag/BbBaseTag.vue.js +6 -0
- package/dist/components/BbBaseTag/BbBaseTag.vue_vue_type_script_setup_true_lang.js +266 -0
- package/dist/components/BbBaseTag/types.d.ts +160 -0
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.d.ts +45 -0
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.js +6 -0
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue_vue_type_script_setup_true_lang.js +200 -0
- package/dist/components/BbBaseTextInput/types.d.ts +209 -0
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.d.ts +39 -0
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.js +6 -0
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue_vue_type_script_setup_true_lang.js +175 -0
- package/dist/components/BbBaseTextarea/types.d.ts +170 -0
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.d.ts +27 -0
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.js +6 -0
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue_vue_type_script_setup_true_lang.js +522 -0
- package/dist/components/BbBaseTimePickerInput/types.d.ts +151 -0
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.d.ts +0 -1
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.js +6 -0
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +224 -0
- package/dist/components/BbBreadcrumbs/estimateBreadcrumbItemWidth.js +47 -0
- package/dist/components/BbBreadcrumbs/types.d.ts +37 -22
- package/dist/components/BbButton/BbButton.vue.d.ts +6 -5
- package/dist/components/BbButton/BbButton.vue.js +6 -0
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +181 -0
- package/dist/components/BbButton/types.d.ts +48 -47
- package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +4 -3
- package/dist/components/BbCheckbox/BbCheckbox.vue.js +6 -0
- package/dist/components/BbCheckbox/BbCheckbox.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/BbCheckbox/types.d.ts +31 -10
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +2 -13
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.js +6 -0
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbCheckboxGroup/types.d.ts +51 -23
- package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +2 -1
- package/dist/components/BbCollapsible/BbCollapsible.vue.js +6 -0
- package/dist/components/BbCollapsible/BbCollapsible.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/BbCollapsible/types.d.ts +13 -8
- package/dist/components/BbColorInput/BbColorInput.vue.d.ts +10 -1
- package/dist/components/BbColorInput/BbColorInput.vue.js +6 -0
- package/dist/components/BbColorInput/BbColorInput.vue_vue_type_script_setup_true_lang.js +177 -0
- package/dist/components/BbColorInput/types.d.ts +44 -11
- package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +5 -8
- package/dist/components/BbColorPalette/BbColorPalette.vue.js +5 -0
- package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/components/BbColorPalette/types.d.ts +71 -52
- package/dist/components/BbConfirm/BbConfirm.vue.js +6 -0
- package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +138 -0
- package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +5 -6
- package/dist/components/BbConfirm/BbConfirmPortal.vue.js +5 -0
- package/dist/components/BbConfirm/BbConfirmPortal.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +37 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue.js +6 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +319 -0
- package/dist/components/BbDatePicker/types.d.ts +159 -0
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +3 -1
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.js +6 -0
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +179 -0
- package/dist/components/BbDatePickerInput/types.d.ts +134 -16
- package/dist/components/BbDialog/BbDialog.vue.d.ts +14 -6
- package/dist/components/BbDialog/BbDialog.vue.js +6 -0
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +214 -0
- package/dist/components/BbDialog/types.d.ts +146 -1
- package/dist/components/BbDialog/useDialogStack.d.ts +5 -0
- package/dist/components/BbDialog/useDialogStack.js +20 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue.d.ts +24 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue.js +6 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/components/BbDropdown/BbDropdown.vue.d.ts +14 -7
- package/dist/components/BbDropdown/BbDropdown.vue.js +6 -0
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/BbDropdown/BbDropdownGroup.vue.d.ts +44 -0
- package/dist/components/BbDropdown/BbDropdownGroup.vue.js +5 -0
- package/dist/components/BbDropdown/BbDropdownGroup.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/BbDropdown/BbDropdownList.vue.d.ts +31 -0
- package/dist/components/BbDropdown/BbDropdownList.vue.js +6 -0
- package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +470 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue.d.ts +16 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue.js +5 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/components/BbDropdown/normalizeGroups.d.ts +18 -0
- package/dist/components/BbDropdown/normalizeGroups.js +46 -0
- package/dist/components/BbDropdown/types.d.ts +468 -46
- package/dist/components/BbDropdown/types.js +4 -0
- package/dist/components/BbDropdown/useDropdownContext.d.ts +89 -0
- package/dist/components/BbDropdown/useDropdownContext.js +9 -0
- package/dist/components/BbDropdown/useDropdownGroupRegistry.d.ts +108 -0
- package/dist/components/BbDropdown/useDropdownGroupRegistry.js +5 -0
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +3 -3
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.js +6 -0
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/components/BbDropdownButton/types.d.ts +47 -52
- package/dist/components/BbDropzone/BbDropzone.vue.d.ts +5 -4
- package/dist/components/BbDropzone/BbDropzone.vue.js +6 -0
- package/dist/components/BbDropzone/BbDropzone.vue_vue_type_script_setup_true_lang.js +308 -0
- package/dist/components/BbDropzone/types.d.ts +77 -8
- package/dist/components/BbIcon/BbIcon.vue.d.ts +3 -2
- package/dist/components/BbIcon/BbIcon.vue.js +6 -0
- package/dist/components/BbIcon/BbIcon.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/BbIcon/types.d.ts +6 -19
- package/dist/components/BbIndicator/BbIndicator.vue.d.ts +14 -0
- package/dist/components/BbIndicator/BbIndicator.vue.js +6 -0
- package/dist/components/BbIndicator/BbIndicator.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/components/BbIndicator/types.d.ts +49 -0
- package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +12 -6
- package/dist/components/BbNumberInput/BbNumberInput.vue.js +6 -0
- package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/BbNumberInput/types.d.ts +40 -4
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +16 -10
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.js +6 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +284 -0
- package/dist/components/BbOffCanvas/types.d.ts +71 -39
- package/dist/components/BbOffCanvas/useOffCanvasStack.d.ts +25 -0
- package/dist/components/BbOffCanvas/useOffCanvasStack.js +68 -0
- package/dist/components/BbPagination/BbPagination.vue.d.ts +9 -4
- package/dist/components/BbPagination/BbPagination.vue.js +6 -0
- package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BbPagination/paginationFit.d.ts +38 -0
- package/dist/components/BbPagination/paginationFit.js +13 -0
- package/dist/components/BbPagination/types.d.ts +51 -16
- package/dist/components/BbPopover/BbPopover.vue.d.ts +16 -15
- package/dist/components/BbPopover/BbPopover.vue.js +6 -0
- package/dist/components/BbPopover/BbPopover.vue_vue_type_script_setup_true_lang.js +309 -0
- package/dist/components/BbPopover/escapeStack.d.ts +6 -0
- package/dist/components/BbPopover/escapeStack.js +10 -0
- package/dist/components/BbPopover/types.d.ts +90 -31
- package/dist/components/BbProgress/BbProgress.vue.d.ts +1 -0
- package/dist/components/BbProgress/BbProgress.vue.js +6 -0
- package/dist/components/BbProgress/BbProgress.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/BbProgress/types.d.ts +15 -1
- package/dist/components/BbRadio/BbRadio.vue.d.ts +5 -3
- package/dist/components/BbRadio/BbRadio.vue.js +6 -0
- package/dist/components/BbRadio/BbRadio.vue_vue_type_script_setup_true_lang.js +133 -0
- package/dist/components/BbRadio/types.d.ts +32 -9
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +4 -14
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.js +6 -0
- package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/BbRadioGroup/types.d.ts +48 -22
- package/dist/components/BbRating/BbRating.vue.d.ts +4 -1
- package/dist/components/BbRating/BbRating.vue.js +6 -0
- package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +150 -0
- package/dist/components/BbRating/types.d.ts +44 -10
- package/dist/components/BbSelect/BbSelect.vue.d.ts +2 -11
- package/dist/components/BbSelect/BbSelect.vue.js +6 -0
- package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +241 -0
- package/dist/components/BbSelect/types.d.ts +112 -59
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +1 -10
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.js +6 -0
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +639 -0
- package/dist/components/BbSelectPopover/types.d.ts +197 -105
- package/dist/components/BbSlider/BbSlider.vue.d.ts +3 -6
- package/dist/components/BbSlider/BbSlider.vue.js +6 -0
- package/dist/components/BbSlider/BbSlider.vue_vue_type_script_setup_true_lang.js +166 -0
- package/dist/components/BbSlider/types.d.ts +44 -13
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +3 -1
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.js +6 -0
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/BbSmoothHeight/types.d.ts +17 -2
- package/dist/components/BbSpinner/BbSpinner.vue.d.ts +1 -1
- package/dist/components/BbSpinner/BbSpinner.vue.js +6 -0
- package/dist/components/BbSpinner/BbSpinner.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/BbSpinner/types.d.ts +10 -3
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +5 -3
- package/dist/components/BbSwitch/BbSwitch.vue.js +6 -0
- package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/components/BbSwitch/types.d.ts +3 -1
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +4 -14
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.js +6 -0
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbSwitchGroup/types.d.ts +3 -22
- package/dist/components/BbTable/BbTable.vue.d.ts +58 -31
- package/dist/components/BbTable/BbTable.vue.js +6 -0
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +900 -0
- package/dist/components/BbTable/types.d.ts +213 -37
- package/dist/components/BbTable/utils.d.ts +9 -1
- package/dist/components/BbTable/utils.js +53 -0
- package/dist/components/BbTabs/BbTabs.vue.d.ts +20 -0
- package/dist/components/BbTabs/BbTabs.vue.js +6 -0
- package/dist/components/BbTabs/BbTabs.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/components/BbTabs/BbTabsList.vue.d.ts +19 -0
- package/dist/components/BbTabs/BbTabsList.vue.js +6 -0
- package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/BbTabs/BbTabsPanes.vue.d.ts +16 -0
- package/dist/components/BbTabs/BbTabsPanes.vue.js +6 -0
- package/dist/components/BbTabs/BbTabsPanes.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/components/BbTabs/BbTabsRoot.vue.d.ts +20 -0
- package/dist/components/BbTabs/BbTabsRoot.vue.js +5 -0
- package/dist/components/BbTabs/BbTabsRoot.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/BbTabs/types.d.ts +264 -0
- package/dist/components/BbTag/BbTag.vue.d.ts +19 -6
- package/dist/components/BbTag/BbTag.vue.js +6 -0
- package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/BbTag/types.d.ts +55 -17
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +10 -1
- package/dist/components/BbTextInput/BbTextInput.vue.js +6 -0
- package/dist/components/BbTextInput/BbTextInput.vue_vue_type_script_setup_true_lang.js +195 -0
- package/dist/components/BbTextInput/types.d.ts +31 -4
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +10 -1
- package/dist/components/BbTextarea/BbTextarea.vue.js +6 -0
- package/dist/components/BbTextarea/BbTextarea.vue_vue_type_script_setup_true_lang.js +178 -0
- package/dist/components/BbTextarea/types.d.ts +33 -2
- package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +33 -0
- package/dist/components/BbTimePicker/BbTimePicker.vue.js +6 -0
- package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BbTimePicker/types.d.ts +133 -0
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +25 -0
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.js +6 -0
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/BbTimePickerInput/types.d.ts +174 -0
- package/dist/components/BbToast/BbToast.vue.d.ts +2 -3
- package/dist/components/BbToast/BbToast.vue.js +6 -0
- package/dist/components/BbToast/BbToast.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/components/BbToast/BbToastMessage.vue.d.ts +17 -8
- package/dist/components/BbToast/BbToastMessage.vue.js +5 -0
- package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/BbToast/BbToastPortal.vue.d.ts +30 -0
- package/dist/components/BbToast/BbToastPortal.vue.js +5 -0
- package/dist/components/BbToast/BbToastPortal.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/BbToast/BbToastRegion.vue.d.ts +8 -0
- package/dist/components/BbToast/BbToastRegion.vue.js +5 -0
- package/dist/components/BbToast/BbToastRegion.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/BbToast/types.d.ts +69 -5
- package/dist/components/BbTooltip/BbTooltip.vue.d.ts +10 -3
- package/dist/components/BbTooltip/BbTooltip.vue.js +6 -0
- package/dist/components/BbTooltip/BbTooltip.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/components/BbTooltip/types.d.ts +69 -11
- package/dist/components/BbTree/BbTree.vue.d.ts +28 -13
- package/dist/components/BbTree/BbTree.vue.js +6 -0
- package/dist/components/BbTree/BbTree.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/BbTree/BbTreeLevel.vue.d.ts +19 -0
- package/dist/components/BbTree/BbTreeLevel.vue.js +5 -0
- package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/components/BbTree/context.d.ts +17 -0
- package/dist/components/BbTree/context.js +4 -0
- package/dist/components/BbTree/types.d.ts +94 -41
- package/dist/components/ChipsBox/ChipsBox.vue.d.ts +2 -1
- package/dist/components/ChipsBox/ChipsBox.vue.js +5 -0
- package/dist/components/ChipsBox/ChipsBox.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/components/ChipsBox/types.d.ts +12 -5
- package/dist/components/ClearableButton/ClearableButton.vue.d.ts +2 -1
- package/dist/components/ClearableButton/ClearableButton.vue.js +6 -0
- package/dist/components/ClearableButton/ClearableButton.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/ClearableButton/types.d.ts +7 -1
- package/dist/components/CloseIcon/CloseButton.vue.d.ts +5 -0
- package/dist/components/CloseIcon/CloseButton.vue.js +7 -0
- package/dist/components/CloseIcon/CloseButton.vue_vue_type_script_setup_true_lang.js +23 -0
- package/dist/components/CloseIcon/types.d.ts +2 -0
- package/dist/components/CommaBox/CommaBox.vue.d.ts +2 -1
- package/dist/components/CommaBox/CommaBox.vue.js +6 -0
- package/dist/components/CommaBox/CommaBox.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/components/CommaBox/types.d.ts +6 -7
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue.d.ts +19 -0
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue.js +6 -0
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/components/CommonInputWrapper/types.d.ts +96 -0
- package/dist/components/CommonPopover/CommonPopover.vue.d.ts +9 -3
- package/dist/components/CommonPopover/CommonPopover.vue.js +6 -0
- package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/components/CommonPopover/types.d.ts +65 -16
- package/dist/components/ErrorIcon/ErrorIcon.vue.d.ts +2 -0
- package/dist/components/ErrorIcon/ErrorIcon.vue.js +6 -0
- package/dist/components/ErrorIcon/ErrorIcon.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/components/FlatListBox/FlatListBox.vue.d.ts +2 -5
- package/dist/components/FlatListBox/FlatListBox.vue.js +5 -0
- package/dist/components/FlatListBox/FlatListBox.vue_vue_type_script_setup_true_lang.js +167 -0
- package/dist/components/FlatListBox/types.d.ts +1 -1
- package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +2 -5
- package/dist/components/GroupedListBox/GroupedListBox.vue.js +5 -0
- package/dist/components/GroupedListBox/GroupedListBox.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/ListBox/ListBox.vue.d.ts +3 -6
- package/dist/components/ListBox/ListBox.vue.js +5 -0
- package/dist/components/ListBox/ListBox.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/ListBox/types.d.ts +1 -1
- package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +1 -0
- package/dist/components/OptionsContainer/OptionsContainer.vue.js +5 -0
- package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/components/OptionsContainer/types.d.ts +14 -24
- package/dist/components/Transitions/ScaleFade.vue.d.ts +2 -2
- package/dist/components/Transitions/ScaleFade.vue.js +5 -0
- package/dist/components/Transitions/ScaleFade.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/components/Transitions/Slide.vue.d.ts +15 -0
- package/dist/components/Transitions/Slide.vue.js +7 -0
- package/dist/components/Transitions/Slide.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/WarningIcon/WarningIcon.vue.d.ts +5 -0
- package/dist/components/WarningIcon/WarningIcon.vue.js +6 -0
- package/dist/components/WarningIcon/WarningIcon.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/components/WarningIcon/types.d.ts +3 -0
- package/dist/composables/__testResets.d.ts +1 -0
- package/dist/composables/useActiveInactiveState.d.ts +4 -0
- package/dist/composables/useActiveInactiveState.js +21 -0
- package/dist/composables/useBaseOptions.d.ts +3 -3
- package/dist/composables/useBaseOptions.js +31 -0
- package/dist/composables/useBbConfig.d.ts +8 -37
- package/dist/composables/useBbConfig.js +5 -0
- package/dist/composables/useBbDropdownContext.d.ts +89 -0
- package/dist/composables/useBbDropdownContext.js +46 -0
- package/dist/composables/useBbFormContext.d.ts +90 -0
- package/dist/composables/useBbFormContext.js +69 -0
- package/dist/composables/useBbTableContext.d.ts +195 -0
- package/dist/composables/useBbTableContext.js +208 -0
- package/dist/composables/useBbTabsContext.d.ts +111 -0
- package/dist/composables/useBbTabsContext.js +225 -0
- package/dist/composables/useBreakpoint.d.ts +13 -0
- package/dist/composables/useBreakpoint.js +39 -0
- package/dist/composables/useBroadcastChannelInstance.d.ts +1 -3
- package/dist/composables/useBroadcastChannelInstance.js +39 -0
- package/dist/composables/useCancelableFunction.js +37 -0
- package/dist/composables/useClosingInert.d.ts +28 -0
- package/dist/composables/useClosingInert.js +23 -0
- package/dist/composables/useCoherence.js +16 -0
- package/dist/composables/useConfirm.d.ts +278 -68
- package/dist/composables/useConfirm.js +130 -0
- package/dist/composables/useCountdown.js +42 -0
- package/dist/composables/useHashedWatcher.d.ts +17 -0
- package/dist/composables/useHashedWatcher.js +14 -0
- package/dist/composables/useId.d.ts +3 -2
- package/dist/composables/useIndexById.js +16 -0
- package/dist/composables/useInertiaPage.d.ts +10 -0
- package/dist/composables/useInertiaPage.js +8 -0
- package/dist/composables/useItemText.js +17 -0
- package/dist/composables/useItemValue.js +9 -0
- package/dist/composables/useItemsGetter.d.ts +1 -1
- package/dist/composables/useItemsGetter.js +30 -0
- package/dist/composables/useListboxFocus.js +66 -0
- package/dist/composables/useLocale.d.ts +1 -1
- package/dist/composables/useLocale.js +11 -0
- package/dist/composables/useLogger.d.ts +1 -1
- package/dist/composables/useLogger.js +10 -0
- package/dist/composables/useMinimalQueue.d.ts +1 -1
- package/dist/composables/useMobile.js +7 -0
- package/dist/composables/useOnFalsy.d.ts +2 -0
- package/dist/composables/useOnFalsy.js +9 -0
- package/dist/composables/useOnTruthy.d.ts +7 -0
- package/dist/composables/useOnTruthy.js +9 -0
- package/dist/composables/usePrefill.d.ts +2 -1
- package/dist/composables/usePrefill.js +24 -0
- package/dist/composables/useQuery.d.ts +15 -3
- package/dist/composables/useQuery.js +42 -0
- package/dist/composables/useRoute.js +11 -0
- package/dist/composables/useRouter.js +8 -0
- package/dist/composables/useSafeArea.d.ts +51 -0
- package/dist/composables/useSafeArea.js +16 -0
- package/dist/composables/useSegmentedFields.d.ts +104 -0
- package/dist/composables/useSegmentedFields.js +159 -0
- package/dist/composables/useTableWidthContext.d.ts +5 -0
- package/dist/composables/useTableWidthContext.js +42 -0
- package/dist/composables/useToast.d.ts +40 -70
- package/dist/composables/useToast.js +58 -0
- package/dist/composables/useTopLayer.d.ts +9 -0
- package/dist/composables/useTopLayer.js +7 -0
- package/dist/composables/useUntil.js +13 -0
- package/dist/composables/useViewportWidth.d.ts +17 -0
- package/dist/composables/useViewportWidth.js +6 -0
- package/dist/confirm-variants.d.ts +17 -0
- package/dist/deprecation/ai-deprecations.json.d.ts +784 -0
- package/dist/deprecation/ai-deprecations.json.js +4 -0
- package/dist/deprecation/removedProps.d.ts +3 -0
- package/dist/deprecation/removedProps.js +13 -0
- package/dist/directives/bbColor.d.ts +65 -0
- package/dist/directives/bbColor.js +24 -0
- package/dist/directives/bbDate.d.ts +66 -0
- package/dist/directives/bbDate.js +24 -0
- package/dist/directives/bbDropdown.d.ts +15 -11
- package/dist/directives/bbDropdown.js +23 -0
- package/dist/directives/bbTime.d.ts +64 -0
- package/dist/directives/bbTime.js +24 -0
- package/dist/directives/bbTooltip.d.ts +16 -11
- package/dist/directives/bbTooltip.js +24 -0
- package/dist/directives/createPopoverDirective.js +54 -0
- package/dist/dropdown-item-variants.d.ts +17 -0
- package/dist/i18n/index.d.ts +51 -3
- package/dist/i18n/index.js +27 -0
- package/dist/i18n/locales/cs.json +115 -0
- package/dist/i18n/locales/da.json +115 -0
- package/dist/i18n/locales/de.json +115 -0
- package/dist/i18n/locales/el.json +115 -0
- package/dist/i18n/locales/en.json +115 -0
- package/dist/i18n/locales/es.json +115 -0
- package/dist/i18n/locales/fi.json +115 -0
- package/dist/i18n/locales/fr.json +115 -0
- package/dist/i18n/locales/hu.json +115 -0
- package/dist/i18n/locales/it.json +115 -0
- package/dist/i18n/locales/ja.json +115 -0
- package/dist/i18n/locales/ko.json +115 -0
- package/dist/i18n/locales/nb.json +115 -0
- package/dist/i18n/locales/nl.json +115 -0
- package/dist/i18n/locales/pl.json +115 -0
- package/dist/i18n/locales/pt.json +115 -0
- package/dist/i18n/locales/ro.json +115 -0
- package/dist/i18n/locales/ru.json +115 -0
- package/dist/i18n/locales/sv.json +115 -0
- package/dist/i18n/locales/tr.json +115 -0
- package/dist/i18n/locales/uk.json +115 -0
- package/dist/i18n/locales/zh-cn.json +115 -0
- package/dist/icons-whitelist.d.ts +8 -0
- package/dist/index.d.ts +96 -79
- package/dist/index.js +76 -82
- package/dist/indicator-variants.d.ts +20 -0
- package/dist/llms-full.txt +79703 -0
- package/dist/llms-medium.txt +1514 -0
- package/dist/llms.txt +105 -0
- package/dist/locale-blueprint.json +141 -0
- package/dist/locale-registry.d.ts +37 -0
- package/dist/nuxt-module.d.ts +3 -0
- package/dist/nuxt.js +19 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.js +22 -0
- package/dist/reset.css +1 -0
- package/dist/reset.d.ts +0 -0
- package/dist/runtime/nuxt-plugin.d.ts +2 -0
- package/dist/runtime/nuxt-plugin.js +24 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.ts +0 -0
- package/dist/toast-variants.d.ts +20 -0
- package/dist/tooltip-variants.d.ts +17 -0
- package/dist/types/ActionButton.d.ts +32 -0
- package/dist/types/AlertVariant.d.ts +16 -0
- package/dist/types/BadgeVariant.d.ts +16 -0
- package/dist/types/ButtonVariant.d.ts +17 -0
- package/dist/types/Classes.d.ts +1 -1
- package/dist/types/ColumnName.d.ts +1 -1
- package/dist/types/CommonProps.d.ts +68 -277
- package/dist/types/Config.d.ts +84 -0
- package/dist/types/ConfirmVariant.d.ts +15 -0
- package/dist/types/DropdownItemVariant.d.ts +18 -0
- package/dist/types/Icon.d.ts +5 -7
- package/dist/types/IndicatorVariant.d.ts +16 -0
- package/dist/types/InputDirection.d.ts +15 -0
- package/dist/types/ItemAccessor.d.ts +21 -0
- package/dist/types/Placement.d.ts +6 -0
- package/dist/types/ResponsiveSize.d.ts +20 -0
- package/dist/types/SizeScale.d.ts +8 -0
- package/dist/types/ToastVariant.d.ts +17 -0
- package/dist/types/TooltipVariant.d.ts +18 -0
- package/dist/utilities/functions/bytesToUnit.d.ts +2 -0
- package/dist/utilities/functions/bytesToUnit.js +18 -0
- package/dist/utilities/functions/clampPrecision.js +10 -0
- package/dist/utilities/functions/convertDateValue.d.ts +23 -10
- package/dist/utilities/functions/convertDateValue.js +12 -0
- package/dist/utilities/functions/deburr.js +5 -0
- package/dist/utilities/functions/empty.js +5 -0
- package/dist/utilities/functions/flattenTree.d.ts +1 -1
- package/dist/utilities/functions/hash.js +5 -0
- package/dist/utilities/functions/isDateDisabled.d.ts +1 -0
- package/dist/utilities/functions/isDateDisabled.js +20 -0
- package/dist/utilities/functions/isEqual.js +5 -0
- package/dist/utilities/functions/isNotEmpty.js +5 -0
- package/dist/utilities/functions/matchAnyKey.d.ts +1 -1
- package/dist/utilities/functions/matchAnyKey.js +15 -0
- package/dist/utilities/functions/parseSize.d.ts +1 -1
- package/dist/utilities/functions/parseSize.js +15 -0
- package/dist/utilities/functions/percentage.js +11 -0
- package/dist/utilities/functions/pipe.d.ts +1 -1
- package/dist/utilities/functions/reject.d.ts +25 -0
- package/dist/utilities/functions/reject.js +28 -0
- package/dist/utilities/functions/resolveEnumProp.d.ts +19 -0
- package/dist/utilities/functions/resolveEnumProp.js +5 -0
- package/dist/utilities/functions/slotKey.d.ts +13 -0
- package/dist/utilities/functions/slotKey.js +4 -0
- package/dist/utilities/functions/sort.d.ts +2 -2
- package/dist/utilities/functions/sort.js +19 -0
- package/dist/utilities/functions/throttle.js +5 -0
- package/dist/utilities/functions/waitFor.d.ts +9 -2
- package/dist/utilities/functions/waitFor.js +14 -0
- package/dist/utilities/functions/warnRemovedAttrs.d.ts +11 -0
- package/dist/utilities/functions/warnRemovedAttrs.js +20 -0
- package/dist/utilities/functions/when.js +5 -0
- package/dist/utilities/misc/iconsInjectionKey.d.ts +15 -0
- package/dist/utilities/misc/iconsInjectionKey.js +4 -0
- package/dist/utilities/misc/transitions.d.ts +5 -0
- package/dist/utilities/misc/transitions.js +8 -0
- package/dist/utils/injectLibraryStyles.d.ts +6 -0
- package/dist/utils/injectLibraryStyles.js +38 -0
- package/dist/validated/BbCheckbox.vue.d.ts +29 -0
- package/dist/validated/BbCheckbox.vue.js +5 -0
- package/dist/validated/BbCheckbox.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/validated/BbCheckboxGroup.vue.d.ts +34 -0
- package/dist/validated/BbCheckboxGroup.vue.js +5 -0
- package/dist/validated/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/validated/BbColorInput.vue.d.ts +36 -0
- package/dist/validated/BbColorInput.vue.js +5 -0
- package/dist/validated/BbColorInput.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/validated/BbDatePickerInput.vue.d.ts +41 -0
- package/dist/validated/BbDatePickerInput.vue.js +5 -0
- package/dist/validated/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +90 -0
- package/dist/validated/BbDropzone.vue.d.ts +24 -0
- package/dist/validated/BbDropzone.vue.js +5 -0
- package/dist/validated/BbDropzone.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/validated/BbForm.vue.d.ts +28 -0
- package/dist/validated/BbForm.vue.js +5 -0
- package/dist/validated/BbForm.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/validated/BbNumberInput.vue.d.ts +36 -0
- package/dist/validated/BbNumberInput.vue.js +5 -0
- package/dist/validated/BbNumberInput.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/validated/BbRadioGroup.vue.d.ts +34 -0
- package/dist/validated/BbRadioGroup.vue.js +5 -0
- package/dist/validated/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/validated/BbRating.vue.d.ts +30 -0
- package/dist/validated/BbRating.vue.js +5 -0
- package/dist/validated/BbRating.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/validated/BbSelect.vue.d.ts +46 -0
- package/dist/validated/BbSelect.vue.js +5 -0
- package/dist/validated/BbSelect.vue_vue_type_script_setup_true_lang.js +109 -0
- package/dist/validated/BbSlider.vue.d.ts +36 -0
- package/dist/validated/BbSlider.vue.js +5 -0
- package/dist/validated/BbSlider.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/validated/BbSwitch.vue.d.ts +29 -0
- package/dist/validated/BbSwitch.vue.js +5 -0
- package/dist/validated/BbSwitch.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/validated/BbSwitchGroup.vue.d.ts +34 -0
- package/dist/validated/BbSwitchGroup.vue.js +5 -0
- package/dist/validated/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/validated/BbTag.vue.d.ts +36 -0
- package/dist/validated/BbTag.vue.js +5 -0
- package/dist/validated/BbTag.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/validated/BbTextInput.vue.d.ts +36 -0
- package/dist/validated/BbTextInput.vue.js +5 -0
- package/dist/validated/BbTextInput.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/validated/BbTextarea.vue.d.ts +36 -0
- package/dist/validated/BbTextarea.vue.js +5 -0
- package/dist/validated/BbTextarea.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/validated/BbTimePickerInput.vue.d.ts +37 -0
- package/dist/validated/BbTimePickerInput.vue.js +5 -0
- package/dist/validated/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/validated/index.d.ts +29 -0
- package/dist/validated/useValidatedField.d.ts +93 -0
- package/dist/validated/useValidatedField.js +51 -0
- package/dist/validated.js +21 -0
- package/dist/vite-plugin.d.ts +261 -0
- package/dist/vite.js +603 -0
- package/llms.txt +107 -0
- package/package.json +181 -60
- package/scripts/lib/__fixtures__/validated-manifest.json +65 -0
- package/scripts/lib/ensure-manifest.mjs +39 -0
- package/scripts/lib/eslint-plugin-autofix.node.test.mjs +109 -0
- package/scripts/lib/eslint-plugin-recommended.node.test.mjs +87 -0
- package/scripts/lib/eslint-plugin-slots.node.test.mjs +271 -0
- package/scripts/lib/eslint-plugin.mjs +702 -0
- package/scripts/lib/eslint-plugin.node.test.mjs +193 -0
- package/scripts/lib/html-attributes.mjs +191 -0
- package/scripts/lib/mcp-config.mjs +126 -0
- package/scripts/lib/migrate-fix.mjs +115 -0
- package/scripts/lib/validate-bb-markup.mjs +488 -0
- package/dist/ai/BaseButton.md +0 -449
- package/dist/ai/BaseCheckbox.md +0 -512
- package/dist/ai/BaseCheckboxGroup.md +0 -597
- package/dist/ai/BaseColorInput.md +0 -461
- package/dist/ai/BaseDatePicker.md +0 -739
- package/dist/ai/BaseDatePickerInput.md +0 -1517
- package/dist/ai/BaseDialog.md +0 -610
- package/dist/ai/BaseInputContainer.md +0 -570
- package/dist/ai/BaseNumberInput.md +0 -509
- package/dist/ai/BaseRadio.md +0 -405
- package/dist/ai/BaseRadioGroup.md +0 -535
- package/dist/ai/BaseRating.md +0 -489
- package/dist/ai/BaseSelect.md +0 -1742
- package/dist/ai/BaseSlider.md +0 -871
- package/dist/ai/BaseSwitch.md +0 -322
- package/dist/ai/BaseSwitchGroup.md +0 -298
- package/dist/ai/BaseTag.md +0 -623
- package/dist/ai/BaseTextInput.md +0 -392
- package/dist/ai/BaseTextarea.md +0 -398
- package/dist/ai/BbChip.md +0 -147
- package/dist/ai/BbIntersection.md +0 -120
- package/dist/ai/BbRatio.md +0 -61
- package/dist/ai/BbRows.md +0 -307
- package/dist/ai/BbTab.md +0 -950
- package/dist/ai/CommonInputInnerContainer.md +0 -414
- package/dist/ai/CommonInputOuterContainer.md +0 -55
- package/dist/components/BaseButton/BaseButton.vue.d.ts +0 -14
- package/dist/components/BaseButton/types.d.ts +0 -159
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +0 -39
- package/dist/components/BaseCheckbox/types.d.ts +0 -213
- package/dist/components/BaseCheckboxGroup/BaseCheckboxGroup.vue.d.ts +0 -30
- package/dist/components/BaseCheckboxGroup/types.d.ts +0 -282
- package/dist/components/BaseColorInput/BaseColorInput.vue.d.ts +0 -35
- package/dist/components/BaseColorInput/ColorPalette.vue.d.ts +0 -13
- package/dist/components/BaseColorInput/types.d.ts +0 -233
- package/dist/components/BaseDatePicker/BaseDatePickerHeader.vue.d.ts +0 -15
- package/dist/components/BaseDatePicker/BaseDatePickerInputDaySelector.vue.d.ts +0 -58
- package/dist/components/BaseDatePicker/BaseDatePickerMonthSelector.vue.d.ts +0 -12
- package/dist/components/BaseDatePicker/BaseDatePickerYearSelector.vue.d.ts +0 -12
- package/dist/components/BaseDatePicker/types.d.ts +0 -100
- package/dist/components/BaseDatePickerInput/BaseDatePickerInput.vue.d.ts +0 -26
- package/dist/components/BaseDatePickerInput/types.d.ts +0 -206
- package/dist/components/BaseDialog/BaseDialog.vue.d.ts +0 -37
- package/dist/components/BaseDialog/types.d.ts +0 -180
- package/dist/components/BaseInputContainer/BaseInputContainer.vue.d.ts +0 -18
- package/dist/components/BaseInputContainer/types.d.ts +0 -126
- package/dist/components/BaseNumberInput/BaseNumberInput.vue.d.ts +0 -46
- package/dist/components/BaseNumberInput/types.d.ts +0 -191
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +0 -31
- package/dist/components/BaseRadio/types.d.ts +0 -173
- package/dist/components/BaseRadioGroup/BaseRadioGroup.vue.d.ts +0 -30
- package/dist/components/BaseRadioGroup/types.d.ts +0 -240
- package/dist/components/BaseRating/BaseRating.vue.d.ts +0 -35
- package/dist/components/BaseRating/types.d.ts +0 -144
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +0 -28
- package/dist/components/BaseSelect/types.d.ts +0 -470
- package/dist/components/BaseSlider/BaseSlider.vue.d.ts +0 -38
- package/dist/components/BaseSlider/types.d.ts +0 -201
- package/dist/components/BaseSwitch/BaseSwitch.vue.d.ts +0 -34
- package/dist/components/BaseSwitch/types.d.ts +0 -25
- package/dist/components/BaseSwitchGroup/BaseSwitchGroup.vue.d.ts +0 -30
- package/dist/components/BaseSwitchGroup/types.d.ts +0 -8
- package/dist/components/BaseTag/BaseTag.vue.d.ts +0 -37
- package/dist/components/BaseTag/types.d.ts +0 -136
- package/dist/components/BaseTextInput/BaseTextInput.vue.d.ts +0 -33
- package/dist/components/BaseTextInput/types.d.ts +0 -166
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +0 -31
- package/dist/components/BaseTextarea/types.d.ts +0 -151
- package/dist/components/BbChip/BbChip.vue.d.ts +0 -17
- package/dist/components/BbChip/types.d.ts +0 -23
- package/dist/components/BbIntersection/BbIntersection.vue.d.ts +0 -23
- package/dist/components/BbIntersection/types.d.ts +0 -36
- package/dist/components/BbRatio/BbRatio.vue.d.ts +0 -14
- package/dist/components/BbRatio/types.d.ts +0 -15
- package/dist/components/BbRows/BbRows.vue.d.ts +0 -62
- package/dist/components/BbRows/types.d.ts +0 -21
- package/dist/components/BbTab/BbTab.vue.d.ts +0 -27
- package/dist/components/BbTab/types.d.ts +0 -186
- package/dist/components/CommonInputInnerContainer/CommonInputInnerContainer.vue.d.ts +0 -15
- package/dist/components/CommonInputInnerContainer/types.d.ts +0 -47
- package/dist/components/CommonInputOuterContainer/CommonInputOuterContainer.vue.d.ts +0 -11
- package/dist/components/CommonInputOuterContainer/types.d.ts +0 -16
- package/dist/composables/useModalsState.d.ts +0 -5
- package/dist/composables/useQueue.d.ts +0 -58
- package/dist/composables/useWizard.d.ts +0 -85
- package/dist/i18n/en.d.ts +0 -67
- package/dist/i18n/it.d.ts +0 -67
- package/dist/index.css +0 -2
- package/dist/index100.js +0 -6
- package/dist/index101.js +0 -300
- package/dist/index102.js +0 -16
- package/dist/index103.js +0 -16
- package/dist/index104.js +0 -27
- package/dist/index109.js +0 -19
- package/dist/index11.js +0 -42
- package/dist/index110.js +0 -12
- package/dist/index111.js +0 -19
- package/dist/index112.js +0 -25
- package/dist/index114.js +0 -7
- package/dist/index115.js +0 -241
- package/dist/index116.js +0 -5
- package/dist/index117.js +0 -42
- package/dist/index118.js +0 -5
- package/dist/index119.js +0 -53
- package/dist/index120.js +0 -5
- package/dist/index121.js +0 -32
- package/dist/index122.js +0 -5
- package/dist/index124.js +0 -52
- package/dist/index125.js +0 -5
- package/dist/index126.js +0 -223
- package/dist/index128.js +0 -6
- package/dist/index129.js +0 -162
- package/dist/index13.js +0 -92
- package/dist/index130.js +0 -25
- package/dist/index131.js +0 -51
- package/dist/index132.js +0 -5
- package/dist/index133.js +0 -607
- package/dist/index135.js +0 -6
- package/dist/index136.js +0 -14
- package/dist/index137.js +0 -153
- package/dist/index139.js +0 -6
- package/dist/index14.js +0 -306
- package/dist/index140.js +0 -224
- package/dist/index141.js +0 -5
- package/dist/index143.js +0 -128
- package/dist/index145.js +0 -6
- package/dist/index146.js +0 -8
- package/dist/index147.js +0 -182
- package/dist/index149.js +0 -6
- package/dist/index15.js +0 -10
- package/dist/index151.js +0 -4
- package/dist/index152.js +0 -95
- package/dist/index154.js +0 -6
- package/dist/index155.js +0 -168
- package/dist/index157.js +0 -6
- package/dist/index158.js +0 -145
- package/dist/index16.js +0 -59
- package/dist/index160.js +0 -6
- package/dist/index161.js +0 -53
- package/dist/index163.js +0 -6
- package/dist/index164.js +0 -16
- package/dist/index166.js +0 -35
- package/dist/index168.js +0 -6
- package/dist/index169.js +0 -89
- package/dist/index171.js +0 -6
- package/dist/index172.js +0 -82
- package/dist/index174.js +0 -6
- package/dist/index175.js +0 -38
- package/dist/index176.js +0 -461
- package/dist/index177.js +0 -28
- package/dist/index178.js +0 -66
- package/dist/index18.js +0 -35
- package/dist/index180.js +0 -162
- package/dist/index181.js +0 -5
- package/dist/index182.js +0 -217
- package/dist/index183.js +0 -5
- package/dist/index184.js +0 -112
- package/dist/index185.js +0 -5
- package/dist/index186.js +0 -459
- package/dist/index188.js +0 -6
- package/dist/index19.js +0 -4
- package/dist/index192.js +0 -268
- package/dist/index194.js +0 -6
- package/dist/index195.js +0 -124
- package/dist/index197.js +0 -6
- package/dist/index198.js +0 -174
- package/dist/index2.js +0 -20
- package/dist/index20.js +0 -9
- package/dist/index200.js +0 -6
- package/dist/index201.js +0 -224
- package/dist/index203.js +0 -6
- package/dist/index204.js +0 -135
- package/dist/index206.js +0 -6
- package/dist/index207.js +0 -5
- package/dist/index208.js +0 -170
- package/dist/index21.js +0 -35
- package/dist/index210.js +0 -6
- package/dist/index211.js +0 -37
- package/dist/index213.js +0 -6
- package/dist/index214.js +0 -63
- package/dist/index216.js +0 -6
- package/dist/index217.js +0 -74
- package/dist/index219.js +0 -6
- package/dist/index22.js +0 -6
- package/dist/index220.js +0 -65
- package/dist/index222.js +0 -6
- package/dist/index223.js +0 -67
- package/dist/index225.js +0 -6
- package/dist/index226.js +0 -41
- package/dist/index228.js +0 -6
- package/dist/index229.js +0 -10
- package/dist/index23.js +0 -7
- package/dist/index230.js +0 -22
- package/dist/index232.js +0 -8
- package/dist/index233.js +0 -297
- package/dist/index235.js +0 -6
- package/dist/index236.js +0 -47
- package/dist/index237.js +0 -165
- package/dist/index239.js +0 -6
- package/dist/index24.js +0 -9
- package/dist/index241.js +0 -159
- package/dist/index243.js +0 -6
- package/dist/index244.js +0 -134
- package/dist/index246.js +0 -6
- package/dist/index247.js +0 -167
- package/dist/index249.js +0 -6
- package/dist/index25.js +0 -24
- package/dist/index250.js +0 -147
- package/dist/index252.js +0 -6
- package/dist/index253.js +0 -35
- package/dist/index255.js +0 -6
- package/dist/index256.js +0 -65
- package/dist/index258.js +0 -6
- package/dist/index259.js +0 -19
- package/dist/index260.js +0 -5
- package/dist/index261.js +0 -160
- package/dist/index263.js +0 -6
- package/dist/index264.js +0 -60
- package/dist/index266.js +0 -6
- package/dist/index267.js +0 -134
- package/dist/index269.js +0 -6
- package/dist/index27.js +0 -4
- package/dist/index271.js +0 -206
- package/dist/index273.js +0 -6
- package/dist/index274.js +0 -85
- package/dist/index275.js +0 -5
- package/dist/index276.js +0 -55
- package/dist/index277.js +0 -5
- package/dist/index278.js +0 -164
- package/dist/index28.js +0 -8
- package/dist/index280.js +0 -6
- package/dist/index281.js +0 -145
- package/dist/index283.js +0 -6
- package/dist/index284.js +0 -11
- package/dist/index285.js +0 -200
- package/dist/index287.js +0 -6
- package/dist/index288.js +0 -241
- package/dist/index29.js +0 -7
- package/dist/index290.js +0 -6
- package/dist/index291.js +0 -21
- package/dist/index293.js +0 -6
- package/dist/index294.js +0 -125
- package/dist/index296.js +0 -6
- package/dist/index297.js +0 -161
- package/dist/index299.js +0 -6
- package/dist/index30.js +0 -118
- package/dist/index300.js +0 -127
- package/dist/index302.js +0 -6
- package/dist/index303.js +0 -20
- package/dist/index305.js +0 -6
- package/dist/index306.js +0 -116
- package/dist/index307.js +0 -5
- package/dist/index308.js +0 -507
- package/dist/index31.js +0 -10
- package/dist/index310.js +0 -6
- package/dist/index311.js +0 -196
- package/dist/index313.js +0 -6
- package/dist/index314.js +0 -142
- package/dist/index316.js +0 -6
- package/dist/index317.js +0 -134
- package/dist/index319.js +0 -6
- package/dist/index32.js +0 -28
- package/dist/index320.js +0 -162
- package/dist/index322.js +0 -6
- package/dist/index323.js +0 -319
- package/dist/index325.js +0 -6
- package/dist/index326.js +0 -40
- package/dist/index327.js +0 -43
- package/dist/index328.js +0 -665
- package/dist/index33.js +0 -5
- package/dist/index330.js +0 -6
- package/dist/index331.js +0 -155
- package/dist/index333.js +0 -6
- package/dist/index334.js +0 -142
- package/dist/index336.js +0 -6
- package/dist/index337.js +0 -155
- package/dist/index339.js +0 -6
- package/dist/index34.js +0 -112
- package/dist/index340.js +0 -58
- package/dist/index341.js +0 -5
- package/dist/index342.js +0 -20
- package/dist/index344.js +0 -6
- package/dist/index345.js +0 -142
- package/dist/index347.js +0 -6
- package/dist/index349.js +0 -109
- package/dist/index351.js +0 -6
- package/dist/index352.js +0 -55
- package/dist/index353.js +0 -24
- package/dist/index354.js +0 -23
- package/dist/index355.js +0 -839
- package/dist/index356.js +0 -474
- package/dist/index357.js +0 -52
- package/dist/index358.js +0 -7
- package/dist/index36.js +0 -6
- package/dist/index38.js +0 -63
- package/dist/index39.js +0 -63
- package/dist/index40.js +0 -9
- package/dist/index42.js +0 -8
- package/dist/index43.js +0 -179
- package/dist/index44.js +0 -21
- package/dist/index46.js +0 -385
- package/dist/index48.js +0 -6
- package/dist/index49.js +0 -33
- package/dist/index5.js +0 -34
- package/dist/index50.js +0 -12
- package/dist/index51.js +0 -8
- package/dist/index52.js +0 -106
- package/dist/index53.js +0 -330
- package/dist/index54.js +0 -97
- package/dist/index55.js +0 -328
- package/dist/index56.js +0 -28
- package/dist/index57.js +0 -102
- package/dist/index58.js +0 -157
- package/dist/index6.js +0 -38
- package/dist/index60.js +0 -6
- package/dist/index61.js +0 -131
- package/dist/index62.js +0 -5
- package/dist/index65.js +0 -35
- package/dist/index66.js +0 -26
- package/dist/index68.js +0 -6
- package/dist/index69.js +0 -54
- package/dist/index7.js +0 -58
- package/dist/index71.js +0 -6
- package/dist/index72.js +0 -14
- package/dist/index74.js +0 -6
- package/dist/index75.js +0 -159
- package/dist/index77.js +0 -6
- package/dist/index78.js +0 -4
- package/dist/index79.js +0 -4
- package/dist/index80.js +0 -54
- package/dist/index81.js +0 -5
- package/dist/index82.js +0 -5
- package/dist/index83.js +0 -141
- package/dist/index85.js +0 -6
- package/dist/index86.js +0 -65
- package/dist/index88.js +0 -6
- package/dist/index89.js +0 -30
- package/dist/index9.js +0 -11
- package/dist/index90.js +0 -19
- package/dist/index91.js +0 -17
- package/dist/index92.js +0 -9
- package/dist/index93.js +0 -34
- package/dist/index95.js +0 -16
- package/dist/index96.js +0 -10
- package/dist/index97.js +0 -18
- package/dist/index98.js +0 -189
- package/dist/types/VoidHtmlElements.d.ts +0 -1
- package/dist/utilities/functions/add.d.ts +0 -1
- package/dist/utilities/functions/booleanishToBoolean.d.ts +0 -6
- package/dist/utilities/functions/capitalize.d.ts +0 -4
- package/dist/utilities/functions/cloneDeep.d.ts +0 -1
- package/dist/utilities/functions/debounce.d.ts +0 -1
- package/dist/utilities/functions/drop.d.ts +0 -1
- package/dist/utilities/functions/exceedsPrecision.d.ts +0 -1
- package/dist/utilities/functions/findRight.d.ts +0 -4
- package/dist/utilities/functions/findRightIndex.d.ts +0 -4
- package/dist/utilities/functions/flow.d.ts +0 -1
- package/dist/utilities/functions/getHueFromRGB.d.ts +0 -9
- package/dist/utilities/functions/groupBy.d.ts +0 -6
- package/dist/utilities/functions/gt.d.ts +0 -7
- package/dist/utilities/functions/hexToRGB.d.ts +0 -7
- package/dist/utilities/functions/hslToHex.d.ts +0 -1
- package/dist/utilities/functions/includes.d.ts +0 -1
- package/dist/utilities/functions/initial.d.ts +0 -1
- package/dist/utilities/functions/isCssColor.d.ts +0 -5
- package/dist/utilities/functions/lt.d.ts +0 -7
- package/dist/utilities/functions/makeUrl.d.ts +0 -1
- package/dist/utilities/functions/mapKeys.d.ts +0 -5
- package/dist/utilities/functions/mapValues.d.ts +0 -1
- package/dist/utilities/functions/matchesPropertyInsensitive.d.ts +0 -1
- package/dist/utilities/functions/max.d.ts +0 -2
- package/dist/utilities/functions/mean.d.ts +0 -4
- package/dist/utilities/functions/merge.d.ts +0 -11
- package/dist/utilities/functions/millisecondsTo.d.ts +0 -1
- package/dist/utilities/functions/negate.d.ts +0 -4
- package/dist/utilities/functions/normalizeItemGroups.d.ts +0 -13
- package/dist/utilities/functions/omit.d.ts +0 -2
- package/dist/utilities/functions/overEvery.d.ts +0 -4
- package/dist/utilities/functions/pick.d.ts +0 -1
- package/dist/utilities/functions/replace.d.ts +0 -1
- package/dist/utilities/functions/replaceInTree.d.ts +0 -4
- package/dist/utilities/functions/retry.d.ts +0 -5
- package/dist/utilities/functions/roundToTheNearest.d.ts +0 -8
- package/dist/utilities/functions/set.d.ts +0 -15
- package/dist/utilities/functions/stub.d.ts +0 -6
- package/dist/utilities/functions/transposePercent.d.ts +0 -9
- package/dist/utilities/functions/tryTo.d.ts +0 -2
- package/dist/utilities/functions/uniqBy.d.ts +0 -1
- /package/dist/{index64.js → _virtual/_plugin-vue_export-helper.js} +0 -0
- /package/dist/components/{BaseButton → BbBaseButton}/RouterComponent.vue.d.ts +0 -0
- /package/dist/components/{BaseDatePicker/BaseDatePicker.vue.d.ts → BbBaseDatePicker/BbBaseDatePicker.vue.d.ts} +0 -0
- /package/dist/{index165.js → composables/useArray.js} +0 -0
- /package/dist/{index17.js → composables/useFrameworkDetection.js} +0 -0
- /package/dist/{index12.js → composables/useId.js} +0 -0
- /package/dist/{index107.js → utilities/functions/chunk.js} +0 -0
- /package/dist/{index8.js → utilities/functions/clamp.js} +0 -0
- /package/dist/{index150.js → utilities/functions/curry.js} +0 -0
- /package/dist/{index45.js → utilities/functions/extractDomContainer.js} +0 -0
- /package/dist/{index270.js → utilities/functions/findInTree.js} +0 -0
- /package/dist/{index348.js → utilities/functions/flattenTree.js} +0 -0
- /package/dist/{index41.js → utilities/functions/get.js} +0 -0
- /package/dist/{index189.js → utilities/functions/head.js} +0 -0
- /package/dist/{index108.js → utilities/functions/identity.js} +0 -0
- /package/dist/{index179.js → utilities/functions/indexBy.js} +0 -0
- /package/dist/{index37.js → utilities/functions/isHex.js} +0 -0
- /package/dist/{index94.js → utilities/functions/isNil.js} +0 -0
- /package/dist/{index26.js → utilities/functions/isNotNil.js} +0 -0
- /package/dist/{index105.js → utilities/functions/last.js} +0 -0
- /package/dist/{index142.js → utilities/functions/noop.js} +0 -0
- /package/dist/{index231.js → utilities/functions/parseWidthString.js} +0 -0
- /package/dist/{index240.js → utilities/functions/pickBy.js} +0 -0
- /package/dist/{index123.js → utilities/functions/range.js} +0 -0
- /package/dist/{index190.js → utilities/functions/snapToStep.js} +0 -0
- /package/dist/{index191.js → utilities/functions/transpose.js} +0 -0
- /package/dist/{index106.js → utilities/functions/validateDateFormat.js} +0 -0
- /package/dist/{index10.js → utilities/functions/wait.js} +0 -0
|
@@ -0,0 +1,3433 @@
|
|
|
1
|
+
# BbTable — Implementation Source
|
|
2
|
+
|
|
3
|
+
> Full implementation for deep dives. For everyday usage read the typed contract: [../BbTable.md](../BbTable.md).
|
|
4
|
+
|
|
5
|
+
## Template & Script
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<component
|
|
10
|
+
:is="containerTag"
|
|
11
|
+
:id="id"
|
|
12
|
+
ref="containerRef"
|
|
13
|
+
:aria-busy="loading"
|
|
14
|
+
:class="containerClass"
|
|
15
|
+
:data-bb-table-id="tableId"
|
|
16
|
+
:inert="disabled"
|
|
17
|
+
:style="containerStyle"
|
|
18
|
+
>
|
|
19
|
+
<legend v-if="selectable" class="sr-only">{{ legend }}</legend>
|
|
20
|
+
<table
|
|
21
|
+
ref="tableRef"
|
|
22
|
+
:aria-rowcount="
|
|
23
|
+
hasProvidedAccessibilityData ? contextState.total : undefined
|
|
24
|
+
"
|
|
25
|
+
>
|
|
26
|
+
<caption
|
|
27
|
+
v-if="caption"
|
|
28
|
+
class="bb-table-caption"
|
|
29
|
+
:class="{
|
|
30
|
+
'sr-only': !displayCaption,
|
|
31
|
+
}"
|
|
32
|
+
>
|
|
33
|
+
{{
|
|
34
|
+
caption
|
|
35
|
+
}}
|
|
36
|
+
</caption>
|
|
37
|
+
<colgroup>
|
|
38
|
+
<col
|
|
39
|
+
v-for="track in columnTracks"
|
|
40
|
+
:key="track.key"
|
|
41
|
+
:style="{ width: track.width }"
|
|
42
|
+
/>
|
|
43
|
+
</colgroup>
|
|
44
|
+
<!-- Inert while loading too: sorting or select-all would fire against
|
|
45
|
+
rows that are about to be replaced. -->
|
|
46
|
+
<thead :inert="contentInert">
|
|
47
|
+
<!-- @vue-ignore -->
|
|
48
|
+
<slot name="thead">
|
|
49
|
+
<tr
|
|
50
|
+
:aria-rowindex="hasProvidedAccessibilityData ? 1 : undefined"
|
|
51
|
+
class="bb-table-header-row"
|
|
52
|
+
:class="headerRowClass"
|
|
53
|
+
>
|
|
54
|
+
<th
|
|
55
|
+
v-if="selectable"
|
|
56
|
+
class="bb-table-header bb-table-header--select"
|
|
57
|
+
:class="thClass"
|
|
58
|
+
scope="col"
|
|
59
|
+
>
|
|
60
|
+
<!-- @vue-ignore -->
|
|
61
|
+
<slot
|
|
62
|
+
:multiple="multiple"
|
|
63
|
+
name="header:select"
|
|
64
|
+
:select-all="!!selectAll"
|
|
65
|
+
:text="selectText || t('table.selectText').value"
|
|
66
|
+
>
|
|
67
|
+
<span class="bb-table-header__content">
|
|
68
|
+
<label
|
|
69
|
+
v-if="!disableSelectAll && multiple"
|
|
70
|
+
class="bb-table-check__label"
|
|
71
|
+
:class="{
|
|
72
|
+
'bb-table-check__label--disabled': disabled,
|
|
73
|
+
}"
|
|
74
|
+
>
|
|
75
|
+
<BaseCheckbox
|
|
76
|
+
:key="indeterminate.toString()"
|
|
77
|
+
v-model="selectAll"
|
|
78
|
+
:checked="!!selectAll"
|
|
79
|
+
class="bb-table-check"
|
|
80
|
+
:disabled="disabled"
|
|
81
|
+
:indeterminate="indeterminate"
|
|
82
|
+
:name="`select_all_${name || ''}`"
|
|
83
|
+
:readonly="readonly"
|
|
84
|
+
/>
|
|
85
|
+
<span class="bb-table-check__label-text sr-only"
|
|
86
|
+
>{{ selectAllLabel || t('table.selectAllLabel').value }}
|
|
87
|
+
</span>
|
|
88
|
+
</label>
|
|
89
|
+
<span
|
|
90
|
+
v-else-if="!multiple"
|
|
91
|
+
class="bb-table-radio__label-text sr-only"
|
|
92
|
+
>{{ selectText || t('table.selectText').value }}</span
|
|
93
|
+
>
|
|
94
|
+
</span>
|
|
95
|
+
</slot>
|
|
96
|
+
</th>
|
|
97
|
+
<th
|
|
98
|
+
v-for="(header, index) in mappedHeaders"
|
|
99
|
+
:key="header.key"
|
|
100
|
+
:aria-sort="header.sortDirection"
|
|
101
|
+
class="bb-table-header"
|
|
102
|
+
:class="[
|
|
103
|
+
header.classes,
|
|
104
|
+
{
|
|
105
|
+
'bb-table-header--edge-start': index === 0,
|
|
106
|
+
'bb-table-header--edge-end':
|
|
107
|
+
index === mappedHeaders.length - 1,
|
|
108
|
+
},
|
|
109
|
+
]"
|
|
110
|
+
scope="col"
|
|
111
|
+
>
|
|
112
|
+
<!-- @vue-ignore -->
|
|
113
|
+
<slot
|
|
114
|
+
:classes="header.classes"
|
|
115
|
+
:items="internalItems"
|
|
116
|
+
:label="header.label"
|
|
117
|
+
:name="header.slotName"
|
|
118
|
+
:sort-order="header.sortOrder"
|
|
119
|
+
:sortable="header.sortable"
|
|
120
|
+
:toggle-sort="() => toggleSortFor(header.key)"
|
|
121
|
+
>
|
|
122
|
+
<BbBaseButton
|
|
123
|
+
v-if="header.sortable"
|
|
124
|
+
class="bb-table-sort"
|
|
125
|
+
:class="{
|
|
126
|
+
'bb-table-sort--asc': header.sortOrder === 'asc',
|
|
127
|
+
'bb-table-sort--desc': header.sortOrder === 'desc',
|
|
128
|
+
}"
|
|
129
|
+
type="button"
|
|
130
|
+
@click="() => toggleSortFor(header.key)"
|
|
131
|
+
>
|
|
132
|
+
<span class="bb-table-header__content">{{
|
|
133
|
+
header.label
|
|
134
|
+
}}</span>
|
|
135
|
+
<BbIcon
|
|
136
|
+
class="bb-table-sort__icon"
|
|
137
|
+
:icon="sortIcon"
|
|
138
|
+
size="sm"
|
|
139
|
+
/>
|
|
140
|
+
</BbBaseButton>
|
|
141
|
+
<span v-else class="bb-table-header__content">{{
|
|
142
|
+
header.label
|
|
143
|
+
}}</span>
|
|
144
|
+
</slot>
|
|
145
|
+
</th>
|
|
146
|
+
<th
|
|
147
|
+
v-if="actions"
|
|
148
|
+
class="bb-table-header bb-table-header--actions"
|
|
149
|
+
:class="thClass"
|
|
150
|
+
scope="col"
|
|
151
|
+
>
|
|
152
|
+
<!-- @vue-ignore -->
|
|
153
|
+
<slot
|
|
154
|
+
name="header:actions"
|
|
155
|
+
:text="actionsText || t('table.actionsText').value"
|
|
156
|
+
>
|
|
157
|
+
<span class="bb-table-header__content sr-only">
|
|
158
|
+
{{ actionsText || t('table.actionsText').value }}
|
|
159
|
+
</span>
|
|
160
|
+
</slot>
|
|
161
|
+
</th>
|
|
162
|
+
</tr>
|
|
163
|
+
</slot>
|
|
164
|
+
</thead>
|
|
165
|
+
<tbody>
|
|
166
|
+
<!-- Skeletons only when there is nothing to show. A refetch over
|
|
167
|
+
existing rows keeps them on screen (dimmed, with the busy bar above)
|
|
168
|
+
instead of blanking the table — see `.bb-table--loading` in the CSS. -->
|
|
169
|
+
<slot
|
|
170
|
+
v-if="loading && !options.length"
|
|
171
|
+
:items="internalItems"
|
|
172
|
+
name="loading"
|
|
173
|
+
>
|
|
174
|
+
<template v-for="(_, rowIndex) in skeletonLength" :key="rowIndex">
|
|
175
|
+
<tr
|
|
176
|
+
:aria-rowindex="
|
|
177
|
+
hasProvidedAccessibilityData ? rowIndex + 2 : undefined
|
|
178
|
+
"
|
|
179
|
+
class="bb-table-skeleton__row"
|
|
180
|
+
>
|
|
181
|
+
<td
|
|
182
|
+
v-if="selectable"
|
|
183
|
+
class="bb-table-skeleton__cell bb-table-skeleton__cell--select"
|
|
184
|
+
>
|
|
185
|
+
<div class="bb-table-skeleton__placeholder" />
|
|
186
|
+
</td>
|
|
187
|
+
<td
|
|
188
|
+
v-for="(col, colIndex) in props.columns"
|
|
189
|
+
:key="col.key"
|
|
190
|
+
class="bb-table-skeleton__cell"
|
|
191
|
+
:class="[`bb-table-skeleton__cell--${col.skeleton ?? 'text'}`]"
|
|
192
|
+
>
|
|
193
|
+
<!-- text: 2 lines with dynamic widths -->
|
|
194
|
+
<template v-if="!col.skeleton || col.skeleton === 'text'">
|
|
195
|
+
<div class="bb-table-skeleton__cell-content">
|
|
196
|
+
<div
|
|
197
|
+
class="bb-table-skeleton__line"
|
|
198
|
+
:style="{
|
|
199
|
+
width: `${skeletonLineWidths[(rowIndex + colIndex) % 4]}%`,
|
|
200
|
+
}"
|
|
201
|
+
/>
|
|
202
|
+
<div
|
|
203
|
+
class="bb-table-skeleton__line"
|
|
204
|
+
:style="{
|
|
205
|
+
width: `${skeletonLineWidths[(rowIndex + colIndex + 2) % 4]}%`,
|
|
206
|
+
}"
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
</template>
|
|
210
|
+
<!-- avatar: circle only -->
|
|
211
|
+
<div
|
|
212
|
+
v-else-if="col.skeleton === 'avatar'"
|
|
213
|
+
class="bb-table-skeleton__avatar"
|
|
214
|
+
/>
|
|
215
|
+
<!-- avatar-text: avatar + 2 lines -->
|
|
216
|
+
<div
|
|
217
|
+
v-else-if="col.skeleton === 'avatar-text'"
|
|
218
|
+
class="bb-table-skeleton__avatar-text"
|
|
219
|
+
>
|
|
220
|
+
<div class="bb-table-skeleton__avatar" />
|
|
221
|
+
<div class="bb-table-skeleton__cell-content">
|
|
222
|
+
<div
|
|
223
|
+
class="bb-table-skeleton__line"
|
|
224
|
+
:style="{
|
|
225
|
+
width: `${skeletonLineWidths[(rowIndex + colIndex) % 4]}%`,
|
|
226
|
+
}"
|
|
227
|
+
/>
|
|
228
|
+
<div
|
|
229
|
+
class="bb-table-skeleton__line"
|
|
230
|
+
:style="{
|
|
231
|
+
width: `${skeletonLineWidths[(rowIndex + colIndex + 2) % 4]}%`,
|
|
232
|
+
}"
|
|
233
|
+
/>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
<!-- image: rounded rect -->
|
|
237
|
+
<div
|
|
238
|
+
v-else-if="col.skeleton === 'image'"
|
|
239
|
+
class="bb-table-skeleton__image"
|
|
240
|
+
/>
|
|
241
|
+
<!-- badge: small pill -->
|
|
242
|
+
<div
|
|
243
|
+
v-else-if="col.skeleton === 'badge'"
|
|
244
|
+
class="bb-table-skeleton__badge"
|
|
245
|
+
/>
|
|
246
|
+
</td>
|
|
247
|
+
<td
|
|
248
|
+
v-if="actions"
|
|
249
|
+
class="bb-table-skeleton__cell bb-table-skeleton__cell--actions"
|
|
250
|
+
>
|
|
251
|
+
<div class="bb-table-skeleton__placeholder" />
|
|
252
|
+
</td>
|
|
253
|
+
</tr>
|
|
254
|
+
</template>
|
|
255
|
+
</slot>
|
|
256
|
+
<!-- The empty state's row/cell shell is the table's, not the
|
|
257
|
+
consumer's: the slot fills a full-width cell (the colspan already
|
|
258
|
+
accounts for the selection/actions columns) so custom content is
|
|
259
|
+
centred across the table instead of landing as stray markup inside
|
|
260
|
+
`<tbody>`. -->
|
|
261
|
+
<tr
|
|
262
|
+
v-else-if="!options.length"
|
|
263
|
+
:aria-rowindex="hasProvidedAccessibilityData ? 2 : undefined"
|
|
264
|
+
class="bb-table-no-data__row"
|
|
265
|
+
>
|
|
266
|
+
<td class="bb-table-no-data__cell" :colspan="replacementContentSpan">
|
|
267
|
+
<slot name="no-data">
|
|
268
|
+
<span class="bb-table-no-data__text">{{
|
|
269
|
+
noDataText || t('common.noDataText').value
|
|
270
|
+
}}</span>
|
|
271
|
+
</slot>
|
|
272
|
+
</td>
|
|
273
|
+
</tr>
|
|
274
|
+
<slot v-else name="tbody">
|
|
275
|
+
<template v-for="(item, index) in mappedItems" :key="item.valueHash">
|
|
276
|
+
<tr
|
|
277
|
+
:aria-current="item.highlighted ? 'true' : undefined"
|
|
278
|
+
:aria-rowindex="
|
|
279
|
+
hasProvidedAccessibilityData && item.rowIndex
|
|
280
|
+
? item.rowIndex
|
|
281
|
+
: undefined
|
|
282
|
+
"
|
|
283
|
+
class="bb-table-data__row"
|
|
284
|
+
:class="[
|
|
285
|
+
item.rowClasses,
|
|
286
|
+
{ 'bb-table-data__row--highlighted': item.highlighted },
|
|
287
|
+
]"
|
|
288
|
+
:inert="contentInert"
|
|
289
|
+
:tabindex="
|
|
290
|
+
keyboardNavigation
|
|
291
|
+
? index === activeRowIndex
|
|
292
|
+
? 0
|
|
293
|
+
: -1
|
|
294
|
+
: undefined
|
|
295
|
+
"
|
|
296
|
+
@click="item.onRowClick"
|
|
297
|
+
@contextmenu="item.onRowContextMenu"
|
|
298
|
+
@dblclick="item.onRowDblClick"
|
|
299
|
+
@focus="() => onRowFocus(index)"
|
|
300
|
+
@keydown="(event) => onRowKeydown(event, index)"
|
|
301
|
+
>
|
|
302
|
+
<td
|
|
303
|
+
v-if="selectable"
|
|
304
|
+
class="bb-table-data__cell bb-table-data__cell--select"
|
|
305
|
+
:class="tdClass"
|
|
306
|
+
>
|
|
307
|
+
<!-- @vue-ignore -->
|
|
308
|
+
<slot
|
|
309
|
+
:checked="isSelected(item)"
|
|
310
|
+
:disabled="isSelectToggleBlocked(item)"
|
|
311
|
+
:input-name="randomName"
|
|
312
|
+
:item="item.item"
|
|
313
|
+
name="select"
|
|
314
|
+
:readonly="!!readonly"
|
|
315
|
+
:toggle-selected="() => toggleSelectedFor(item)"
|
|
316
|
+
:value="item.value"
|
|
317
|
+
>
|
|
318
|
+
<!-- We use temp names for these inputs because we don't submit them -->
|
|
319
|
+
<label
|
|
320
|
+
v-if="multiple"
|
|
321
|
+
class="bb-table-check__label"
|
|
322
|
+
:class="{
|
|
323
|
+
'bb-table-check__label--disabled': item.disabled,
|
|
324
|
+
}"
|
|
325
|
+
>
|
|
326
|
+
<BaseCheckbox
|
|
327
|
+
:checked="isSelected(item)"
|
|
328
|
+
class="bb-table-check"
|
|
329
|
+
:disabled="item.disabled"
|
|
330
|
+
:readonly="readonly"
|
|
331
|
+
@change="() => onInputChange(item)"
|
|
332
|
+
/>
|
|
333
|
+
<span class="bb-table-check__label-text sr-only">{{
|
|
334
|
+
item.accessibleLabel
|
|
335
|
+
}}</span>
|
|
336
|
+
</label>
|
|
337
|
+
|
|
338
|
+
<label
|
|
339
|
+
v-else
|
|
340
|
+
class="bb-table-radio__label"
|
|
341
|
+
:class="{
|
|
342
|
+
'bb-table-radio__label--disabled': item.disabled,
|
|
343
|
+
}"
|
|
344
|
+
>
|
|
345
|
+
<BaseRadio
|
|
346
|
+
:checked="item.selected"
|
|
347
|
+
class="bb-table-radio"
|
|
348
|
+
:disabled="item.disabled"
|
|
349
|
+
:name="randomName"
|
|
350
|
+
:readonly="readonly"
|
|
351
|
+
:value="item.value"
|
|
352
|
+
@change="() => onInputChange(item)"
|
|
353
|
+
/>
|
|
354
|
+
<span class="bb-table-radio__label-text sr-only">{{
|
|
355
|
+
item.accessibleLabel
|
|
356
|
+
}}</span>
|
|
357
|
+
</label>
|
|
358
|
+
</slot>
|
|
359
|
+
</td>
|
|
360
|
+
<td
|
|
361
|
+
v-for="(col, colIndex) in item.cols"
|
|
362
|
+
:key="col.key"
|
|
363
|
+
class="bb-table-data__cell"
|
|
364
|
+
:class="[
|
|
365
|
+
col.classes,
|
|
366
|
+
{
|
|
367
|
+
'bb-table-data__cell--edge-start': colIndex === 0,
|
|
368
|
+
'bb-table-data__cell--edge-end':
|
|
369
|
+
colIndex === item.cols.length - 1,
|
|
370
|
+
},
|
|
371
|
+
]"
|
|
372
|
+
>
|
|
373
|
+
<!-- @vue-ignore -->
|
|
374
|
+
<slot
|
|
375
|
+
:classes="col.classes"
|
|
376
|
+
:content="col.content"
|
|
377
|
+
:expand-props="getExpandControllerProps(item)"
|
|
378
|
+
:expanded="item.expanded"
|
|
379
|
+
:highlighted="item.highlighted"
|
|
380
|
+
:item="item.item"
|
|
381
|
+
:name="col.slotName"
|
|
382
|
+
:selected="isSelected(item)"
|
|
383
|
+
:sort-order="sortOrderFor(col.key)"
|
|
384
|
+
:toggle-expanded="() => toggleExpandedFor(item.valueHash)"
|
|
385
|
+
:toggle-highlighted="() => toggleHighlightedFor(item)"
|
|
386
|
+
:toggle-selected="() => toggleSelectedFor(item)"
|
|
387
|
+
:value="item.value"
|
|
388
|
+
>{{ col.content }}</slot
|
|
389
|
+
>
|
|
390
|
+
</td>
|
|
391
|
+
<td
|
|
392
|
+
v-if="actions"
|
|
393
|
+
class="bb-table__cell bb-table__cell--actions"
|
|
394
|
+
:class="tdClass"
|
|
395
|
+
>
|
|
396
|
+
<!-- @vue-ignore -->
|
|
397
|
+
<slot
|
|
398
|
+
:expand-props="getExpandControllerProps(item)"
|
|
399
|
+
:expanded="item.expanded"
|
|
400
|
+
:highlighted="item.highlighted"
|
|
401
|
+
:item="item.item"
|
|
402
|
+
name="actions"
|
|
403
|
+
:selected="isSelected(item)"
|
|
404
|
+
:toggle-expanded="() => toggleExpandedFor(item.valueHash)"
|
|
405
|
+
:toggle-highlighted="() => toggleHighlightedFor(item)"
|
|
406
|
+
:toggle-selected="() => toggleSelectedFor(item)"
|
|
407
|
+
:value="item.value"
|
|
408
|
+
></slot>
|
|
409
|
+
</td>
|
|
410
|
+
</tr>
|
|
411
|
+
<tr
|
|
412
|
+
v-if="item.expanded"
|
|
413
|
+
:id="`expanded_${item.valueHash}`"
|
|
414
|
+
:aria-rowindex="
|
|
415
|
+
hasProvidedAccessibilityData && item.rowIndex
|
|
416
|
+
? item.rowIndex + 1
|
|
417
|
+
: undefined
|
|
418
|
+
"
|
|
419
|
+
class="bb-table-expand__row"
|
|
420
|
+
:class="{ 'bb-table-expand__row--highlighted': item.highlighted }"
|
|
421
|
+
>
|
|
422
|
+
<td
|
|
423
|
+
class="bb-table-expand__cell"
|
|
424
|
+
:colspan="replacementContentSpan"
|
|
425
|
+
>
|
|
426
|
+
<!-- @vue-ignore -->
|
|
427
|
+
<slot
|
|
428
|
+
:expand-props="getExpandControllerProps(item)"
|
|
429
|
+
:expanded="item.expanded"
|
|
430
|
+
:highlighted="item.highlighted"
|
|
431
|
+
:item="item.item"
|
|
432
|
+
name="expand"
|
|
433
|
+
:selected="isSelected(item)"
|
|
434
|
+
:toggle-expanded="() => toggleExpandedFor(item.valueHash)"
|
|
435
|
+
:toggle-highlighted="() => toggleHighlightedFor(item)"
|
|
436
|
+
:toggle-selected="() => toggleSelectedFor(item)"
|
|
437
|
+
:value="item.value"
|
|
438
|
+
></slot>
|
|
439
|
+
</td>
|
|
440
|
+
</tr>
|
|
441
|
+
</template>
|
|
442
|
+
</slot>
|
|
443
|
+
|
|
444
|
+
<!-- The busy announcement belongs to the loading STATE, not to the
|
|
445
|
+
skeleton: it fires for a first load and for a refetch over existing
|
|
446
|
+
rows alike — and now also when a custom `#loading` slot replaces the
|
|
447
|
+
skeleton, which used to swallow it. Deliberately NOT inert (unlike
|
|
448
|
+
the data rows above): `inert` would remove it from the a11y tree and
|
|
449
|
+
the table would go busy in silence. -->
|
|
450
|
+
<tr
|
|
451
|
+
v-if="loading"
|
|
452
|
+
:aria-rowindex="
|
|
453
|
+
hasProvidedAccessibilityData && !options.length
|
|
454
|
+
? skeletonLength + 2
|
|
455
|
+
: undefined
|
|
456
|
+
"
|
|
457
|
+
class="bb-table-loading__row bb-table-loading__row--sr-only"
|
|
458
|
+
>
|
|
459
|
+
<td
|
|
460
|
+
aria-live="polite"
|
|
461
|
+
class="bb-table-loading__cell"
|
|
462
|
+
:colspan="replacementContentSpan"
|
|
463
|
+
role="status"
|
|
464
|
+
>
|
|
465
|
+
<span class="bb-table-loading__text sr-only">{{
|
|
466
|
+
loadingText || t('common.loadingText').value
|
|
467
|
+
}}</span>
|
|
468
|
+
</td>
|
|
469
|
+
</tr>
|
|
470
|
+
</tbody>
|
|
471
|
+
<tfoot>
|
|
472
|
+
<!-- @vue-ignore -->
|
|
473
|
+
<slot :column-count="replacementContentSpan" name="tfoot"></slot>
|
|
474
|
+
</tfoot>
|
|
475
|
+
</table>
|
|
476
|
+
<input v-for="input in hiddenInputs" :key="input.value" v-bind="input" />
|
|
477
|
+
</component>
|
|
478
|
+
</template>
|
|
479
|
+
|
|
480
|
+
<script
|
|
481
|
+
setup
|
|
482
|
+
lang="ts"
|
|
483
|
+
generic="Item = any, T extends ItemKey<Item> = string & {}"
|
|
484
|
+
>
|
|
485
|
+
import {
|
|
486
|
+
computed,
|
|
487
|
+
nextTick,
|
|
488
|
+
onBeforeUnmount,
|
|
489
|
+
onMounted,
|
|
490
|
+
reactive,
|
|
491
|
+
ref,
|
|
492
|
+
toRef,
|
|
493
|
+
watch,
|
|
494
|
+
} from 'vue';
|
|
495
|
+
import { clamp } from '@/utilities/functions/clamp';
|
|
496
|
+
import { hash } from '@/utilities/functions/hash';
|
|
497
|
+
import { isNil } from '@/utilities/functions/isNil';
|
|
498
|
+
import { when } from '@/utilities/functions/when';
|
|
499
|
+
import { useId } from '@/composables/useId';
|
|
500
|
+
import { useItemValue } from '@/composables/useItemValue';
|
|
501
|
+
import { useItemsGetter } from '@/composables/useItemsGetter';
|
|
502
|
+
import { usePrefill } from '@/composables/usePrefill';
|
|
503
|
+
import { useIndexById } from '@/composables/useIndexById';
|
|
504
|
+
import { useBaseOptions } from '@/composables/useBaseOptions';
|
|
505
|
+
import { useHashedWatcher } from '@/composables/useHashedWatcher';
|
|
506
|
+
import { useTableWidthContext } from '@/composables/useTableWidthContext';
|
|
507
|
+
import { useLocale } from '@/composables/useLocale';
|
|
508
|
+
import { removedPropsFor } from '@/deprecation/removedProps';
|
|
509
|
+
import { warnRemovedAttrs } from '@/utilities/functions/warnRemovedAttrs';
|
|
510
|
+
import BaseCheckbox from '../BbBaseCheckbox/BbBaseCheckbox.vue';
|
|
511
|
+
import BaseRadio from '../BbBaseRadio/BbBaseRadio.vue';
|
|
512
|
+
import BbIcon from '../BbIcon/BbIcon.vue';
|
|
513
|
+
import sortIcon from '@/assets/svgs/sort.svg?raw';
|
|
514
|
+
import type { Option as BaseOption } from '@/types/Option';
|
|
515
|
+
import type { Classes } from '@/types/Classes';
|
|
516
|
+
import type { ColumnName } from '@/types/ColumnName';
|
|
517
|
+
import type { PrefixWith } from '@/types/PrefixWith';
|
|
518
|
+
import type {
|
|
519
|
+
BbTableColumn,
|
|
520
|
+
BbTableEvents,
|
|
521
|
+
BbTableProps,
|
|
522
|
+
BbTableSlots,
|
|
523
|
+
BbTableSortEntry,
|
|
524
|
+
ExpandControllerProps,
|
|
525
|
+
ItemKey,
|
|
526
|
+
ReservedColumnKey,
|
|
527
|
+
MappedCell,
|
|
528
|
+
MappedHeader,
|
|
529
|
+
MappedItem,
|
|
530
|
+
} from './types';
|
|
531
|
+
import {
|
|
532
|
+
applyFixedTableColumns,
|
|
533
|
+
columnKeyToSlotName,
|
|
534
|
+
mergeCellClasses,
|
|
535
|
+
mergeHeaderClasses,
|
|
536
|
+
mergeRowClasses,
|
|
537
|
+
} from './utils';
|
|
538
|
+
import { useBbTableContextHost } from '../../composables/useBbTableContext';
|
|
539
|
+
import { useLogger } from '@/composables/useLogger';
|
|
540
|
+
import BbBaseButton from '../BbBaseButton/BbBaseButton.vue';
|
|
541
|
+
|
|
542
|
+
const selectAll = defineModel<boolean>('selectAll', {
|
|
543
|
+
required: false,
|
|
544
|
+
default: false,
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
const sort = defineModel<BbTableSortEntry[]>('sort', {
|
|
548
|
+
required: false,
|
|
549
|
+
default: () => [],
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Highlight: a parallel, UI-intent state to selection ("the row whose details
|
|
554
|
+
* are open"). Single value by default, array with `highlightMultiple`. Purely
|
|
555
|
+
* mechanical — highlighted rows only get a class and `aria-current`, no
|
|
556
|
+
* shipped styling.
|
|
557
|
+
*/
|
|
558
|
+
const highlighted = defineModel<any>('highlighted', {
|
|
559
|
+
required: false,
|
|
560
|
+
default: undefined,
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
const expandedItems = defineModel<any[]>('expandedItems', {
|
|
564
|
+
required: false,
|
|
565
|
+
default: () => [],
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
const props = withDefaults(defineProps<InternalProps<T>>(), {
|
|
569
|
+
align: 'left',
|
|
570
|
+
columns: () => [],
|
|
571
|
+
dependencies: () => [],
|
|
572
|
+
depsDebounceTime: 0,
|
|
573
|
+
fixedColumns: () => [],
|
|
574
|
+
items: () => [],
|
|
575
|
+
max: Infinity,
|
|
576
|
+
multiple: true,
|
|
577
|
+
modelValue: () => [],
|
|
578
|
+
unselectedItems: () => [],
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
const emit = defineEmits<BbTableEvents>();
|
|
582
|
+
|
|
583
|
+
defineSlots<
|
|
584
|
+
BbTableSlots<Item> &
|
|
585
|
+
Partial<
|
|
586
|
+
Record<
|
|
587
|
+
InferredBodySlots,
|
|
588
|
+
(props: {
|
|
589
|
+
classes?: Classes;
|
|
590
|
+
content?: any;
|
|
591
|
+
expanded?: boolean;
|
|
592
|
+
expandProps?: ExpandControllerProps;
|
|
593
|
+
toggleExpanded?: () => void;
|
|
594
|
+
highlighted?: boolean;
|
|
595
|
+
toggleHighlighted?: () => void;
|
|
596
|
+
selected?: boolean;
|
|
597
|
+
toggleSelected?: () => void;
|
|
598
|
+
sortOrder?: 'asc' | 'desc' | null;
|
|
599
|
+
item: Item;
|
|
600
|
+
value?: any;
|
|
601
|
+
}) => any
|
|
602
|
+
>
|
|
603
|
+
> &
|
|
604
|
+
Partial<
|
|
605
|
+
Record<
|
|
606
|
+
InferredHeaderSlots,
|
|
607
|
+
(props: {
|
|
608
|
+
classes?: Classes;
|
|
609
|
+
content?: any;
|
|
610
|
+
items?: Item[];
|
|
611
|
+
label?: string;
|
|
612
|
+
sortable?: boolean;
|
|
613
|
+
sortOrder?: 'asc' | 'desc' | null;
|
|
614
|
+
toggleSort?: () => void;
|
|
615
|
+
}) => any
|
|
616
|
+
>
|
|
617
|
+
>
|
|
618
|
+
>();
|
|
619
|
+
|
|
620
|
+
if (process.env.NODE_ENV !== 'production')
|
|
621
|
+
warnRemovedAttrs('BbTable', removedPropsFor('BbTable'));
|
|
622
|
+
|
|
623
|
+
const { getItemValue } = useItemValue();
|
|
624
|
+
|
|
625
|
+
/** Temporary name for selection inputs; hidden inputs handle real submission. */
|
|
626
|
+
const randomName = useId().id.value;
|
|
627
|
+
|
|
628
|
+
type InternalColumn<K extends string> = Omit<BbTableColumn<Item>, 'key'> & {
|
|
629
|
+
key: K;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
type InternalProps<K extends string> = Omit<BbTableProps<Item>, 'columns'> & {
|
|
633
|
+
/**
|
|
634
|
+
* Array of definitions of how the columns should be rendered.
|
|
635
|
+
*
|
|
636
|
+
* @defaultValue `[]`
|
|
637
|
+
*/
|
|
638
|
+
columns?: Array<InternalColumn<K>>;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
type InferredBodySlots = ColumnName<T>;
|
|
642
|
+
type InferredHeaderSlots = PrefixWith<ColumnName<T>, 'header:'>;
|
|
643
|
+
|
|
644
|
+
if (props.multiple && !Array.isArray(props.modelValue)) {
|
|
645
|
+
const logger = useLogger();
|
|
646
|
+
logger.throw(
|
|
647
|
+
'BbTable is set for multiple selection but modelValue is not an array.'
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// `actions` and `select` are structural columns the table renders itself, from
|
|
652
|
+
// the `actions` / `selectable` props. Declaring one in `columns` instead adds an
|
|
653
|
+
// ordinary data column that reads `item.actions`, so the row shows a stray empty
|
|
654
|
+
// cell and the `#actions` slot never renders — a shape that looks like a slot
|
|
655
|
+
// bug and is really a column-list bug.
|
|
656
|
+
// Annotated with the exported union so the two stay tied: renaming a reserved
|
|
657
|
+
// key in `ReservedColumnKey` fails this list rather than silently disarming the
|
|
658
|
+
// warning.
|
|
659
|
+
const RESERVED_COLUMN_KEYS: readonly ReservedColumnKey[] = [
|
|
660
|
+
'actions',
|
|
661
|
+
'select',
|
|
662
|
+
];
|
|
663
|
+
|
|
664
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
665
|
+
const reserved = props.columns.filter((column) =>
|
|
666
|
+
RESERVED_COLUMN_KEYS.includes(column.key as ReservedColumnKey)
|
|
667
|
+
);
|
|
668
|
+
for (const column of reserved) {
|
|
669
|
+
useLogger().warn(
|
|
670
|
+
`BbTable: \`{ key: '${String(column.key)}' }\` is a reserved column and must not appear in \`columns\`. ` +
|
|
671
|
+
(column.key === 'actions'
|
|
672
|
+
? 'Set the `actions` prop and fill the `#actions` slot instead.'
|
|
673
|
+
: 'Selection is controlled by the `selectable` prop.')
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
const { t } = useLocale();
|
|
679
|
+
|
|
680
|
+
const tableRef = ref<HTMLTableElement>();
|
|
681
|
+
const containerRef = ref<HTMLElement>();
|
|
682
|
+
|
|
683
|
+
const {
|
|
684
|
+
id: tableId,
|
|
685
|
+
parentId,
|
|
686
|
+
parentNode,
|
|
687
|
+
cssVars,
|
|
688
|
+
parentVar,
|
|
689
|
+
setTracks,
|
|
690
|
+
} = useTableWidthContext({
|
|
691
|
+
id: () => props.id,
|
|
692
|
+
container: () => containerRef.value,
|
|
693
|
+
inheritFrom: () =>
|
|
694
|
+
typeof props.inheritColumnWidths === 'string'
|
|
695
|
+
? props.inheritColumnWidths
|
|
696
|
+
: undefined,
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
if (
|
|
700
|
+
props.highlightMultiple &&
|
|
701
|
+
props.highlighted !== undefined &&
|
|
702
|
+
!Array.isArray(props.highlighted)
|
|
703
|
+
) {
|
|
704
|
+
const logger = useLogger();
|
|
705
|
+
logger.throw(
|
|
706
|
+
'BbTable is set for multiple highlight but highlighted is not an array.'
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/** Highlighted values as an array regardless of single/multiple mode. */
|
|
711
|
+
const highlightedValues = computed(() => {
|
|
712
|
+
if (props.highlightMultiple) {
|
|
713
|
+
return Array.isArray(highlighted.value) ? highlighted.value : [];
|
|
714
|
+
}
|
|
715
|
+
return isNil(highlighted.value) ? [] : [highlighted.value];
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
const { data: highlightedIndexedByHash } = useIndexById({
|
|
719
|
+
items: highlightedValues,
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Toggles a row's highlight. Single mode (the default) replaces the previous
|
|
724
|
+
* highlight — toggling the highlighted row itself clears it back to `null` —
|
|
725
|
+
* while `highlightMultiple` adds/removes the value in the array.
|
|
726
|
+
*/
|
|
727
|
+
const toggleHighlightedFor = (
|
|
728
|
+
item: Pick<MappedItem, 'value' | 'valueHash'>
|
|
729
|
+
) => {
|
|
730
|
+
const isHighlighted = item.valueHash in highlightedIndexedByHash.value;
|
|
731
|
+
if (!props.highlightMultiple) {
|
|
732
|
+
highlighted.value = isHighlighted ? null : item.value;
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
highlighted.value = isHighlighted
|
|
736
|
+
? highlightedValues.value.filter((value) => hash(value) !== item.valueHash)
|
|
737
|
+
: [...highlightedValues.value, item.value];
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Clicking anywhere on a row toggles its highlight — the row itself is the
|
|
742
|
+
* primary highlight affordance. Two kinds of clicks are ignored: those
|
|
743
|
+
* originating inside interactive elements (they keep their own semantics —
|
|
744
|
+
* this also covers the built-in selection controls), and those that end a
|
|
745
|
+
* text selection (dragging to copy a cell value must not mutate state).
|
|
746
|
+
*/
|
|
747
|
+
const onRowClickHighlight = (event: MouseEvent, item: BaseOption) => {
|
|
748
|
+
if (!(event.target instanceof Element)) return;
|
|
749
|
+
if (
|
|
750
|
+
event.target.closest(
|
|
751
|
+
'a, button, input, label, select, textarea, [contenteditable], [role="button"]'
|
|
752
|
+
)
|
|
753
|
+
) {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (window.getSelection()?.toString()) return;
|
|
757
|
+
toggleHighlightedFor(item);
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
/** This column's current direction in the sort model, or `null` when unsorted. */
|
|
761
|
+
const sortOrderFor = (key: string): 'asc' | 'desc' | null =>
|
|
762
|
+
sort.value.find(([sortKey]) => sortKey === key)?.[1] ?? null;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Cycles a column's sort: unsorted → asc → desc → unsorted. A direction flip
|
|
766
|
+
* updates the entry in place so the column keeps its priority in a
|
|
767
|
+
* multi-column sort; other columns' entries are never touched.
|
|
768
|
+
*/
|
|
769
|
+
const toggleSortFor = (key: string) => {
|
|
770
|
+
const current = sortOrderFor(key);
|
|
771
|
+
if (current === null) {
|
|
772
|
+
sort.value = [...sort.value, [key, 'asc']];
|
|
773
|
+
} else if (current === 'asc') {
|
|
774
|
+
sort.value = sort.value.map(
|
|
775
|
+
(entry): BbTableSortEntry => (entry[0] === key ? [key, 'desc'] : entry)
|
|
776
|
+
);
|
|
777
|
+
} else {
|
|
778
|
+
sort.value = sort.value.filter(([sortKey]) => sortKey !== key);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Shared table context (see `useBbTableContext`): companion composables and
|
|
784
|
+
* `BbPagination` (via `tableId`) read and drive the same state as the props
|
|
785
|
+
* below. The returned `state` is the table's effective source of truth — the
|
|
786
|
+
* host keeps it two-way synced with every bound v-model, so a context-side
|
|
787
|
+
* write behaves exactly like the equivalent prop (a `page`/`perPage`/`total`
|
|
788
|
+
* set from outside activates the accessibility features automatically).
|
|
789
|
+
*/
|
|
790
|
+
const { state: contextState, isReady: contextIsReady } = useBbTableContextHost(
|
|
791
|
+
() => tableId.value,
|
|
792
|
+
{
|
|
793
|
+
selected: {
|
|
794
|
+
get: () => props.modelValue,
|
|
795
|
+
set: (value) => emit('update:modelValue', value),
|
|
796
|
+
},
|
|
797
|
+
unselected: {
|
|
798
|
+
get: () => props.unselectedItems,
|
|
799
|
+
set: (value) => emit('update:unselectedItems', value),
|
|
800
|
+
},
|
|
801
|
+
all: {
|
|
802
|
+
get: () => selectAll.value,
|
|
803
|
+
set: (value) => {
|
|
804
|
+
selectAll.value = value;
|
|
805
|
+
},
|
|
806
|
+
},
|
|
807
|
+
// The sort model default is `[]` (never undefined), so the table always
|
|
808
|
+
// seeds the context with a stable empty baseline at mount.
|
|
809
|
+
sort: {
|
|
810
|
+
get: () => sort.value,
|
|
811
|
+
set: (value) => {
|
|
812
|
+
sort.value = value;
|
|
813
|
+
},
|
|
814
|
+
},
|
|
815
|
+
// Normalized to the mode's empty shape (`null` single / `[]` multiple)
|
|
816
|
+
// so the context always seeds with a stable, defined baseline.
|
|
817
|
+
highlighted: {
|
|
818
|
+
get: () => highlighted.value ?? (props.highlightMultiple ? [] : null),
|
|
819
|
+
set: (value) => {
|
|
820
|
+
highlighted.value = value;
|
|
821
|
+
},
|
|
822
|
+
},
|
|
823
|
+
page: { get: () => props.page },
|
|
824
|
+
perPage: {
|
|
825
|
+
get: () => props.perPage,
|
|
826
|
+
infer: () =>
|
|
827
|
+
Array.isArray(props.items) ? props.items.length : undefined,
|
|
828
|
+
},
|
|
829
|
+
total: {
|
|
830
|
+
get: () => props.totalItems,
|
|
831
|
+
infer: () =>
|
|
832
|
+
Array.isArray(props.items) ? props.items.length : undefined,
|
|
833
|
+
},
|
|
834
|
+
// A seed for paired paginations, not table state: nothing renders from
|
|
835
|
+
// it here, and the context prefers a page count derived from `total`.
|
|
836
|
+
totalPages: { get: () => props.totalPages },
|
|
837
|
+
}
|
|
838
|
+
);
|
|
839
|
+
|
|
840
|
+
/** Any column pinned to a parent track range — a per-column inherit signal. */
|
|
841
|
+
const hasSnap = computed(() => props.columns.some((c) => c.snap != null));
|
|
842
|
+
|
|
843
|
+
// Opt-in: inherit when explicitly enabled (`true`, or an ancestor id string),
|
|
844
|
+
// or implicitly when any column carries a `snap` — a snap only resolves against
|
|
845
|
+
// a parent's tracks, so asking for one is asking to inherit. An absent prop with
|
|
846
|
+
// no snaps does not inherit, so a plain nested table stays independent. An
|
|
847
|
+
// explicit `false` is authoritative and overrides the implicit snap signal.
|
|
848
|
+
const inheritColumnWidths = computed(
|
|
849
|
+
() => !!props.inheritColumnWidths || hasSnap.value
|
|
850
|
+
);
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Assigned column widths (frozen, snapped, or inherited) are only authoritative
|
|
854
|
+
* under `table-layout: fixed`; in auto layout they behave like a minimum. So a
|
|
855
|
+
* table that drives widths — explicitly `fixed`, inheriting from a parent, or
|
|
856
|
+
* with a column carrying a `width` or `snap` — uses fixed layout even when
|
|
857
|
+
* `fixed` was not set. (`snap` is a width definition: the parent track range.)
|
|
858
|
+
*/
|
|
859
|
+
const fixedLayout = computed(
|
|
860
|
+
() =>
|
|
861
|
+
props.fixed ||
|
|
862
|
+
hasSnap.value ||
|
|
863
|
+
props.columns.some((column) => column.width != null) ||
|
|
864
|
+
(inheritColumnWidths.value && !!parentId.value)
|
|
865
|
+
);
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* A nested table inheriting its parent's widths must size itself to the sum of
|
|
869
|
+
* those columns rather than stretching to fill its container — otherwise fixed
|
|
870
|
+
* layout would distribute the slack and the columns would no longer match the
|
|
871
|
+
* parent. Tables with the same column count already sum to the full width, so
|
|
872
|
+
* this is a no-op for them and only narrows tables with fewer columns.
|
|
873
|
+
*/
|
|
874
|
+
/** True for a nested table that inherits its column widths from a parent. */
|
|
875
|
+
const isInheriting = computed(
|
|
876
|
+
() => inheritColumnWidths.value && !!parentId.value
|
|
877
|
+
);
|
|
878
|
+
|
|
879
|
+
const sizeToColumns = isInheriting;
|
|
880
|
+
|
|
881
|
+
/** Numbers and bare numeric strings (e.g. `400`, `'400'`) default to px; values
|
|
882
|
+
* that already carry a unit/keyword (`'50%'`, `'10rem'`, `'auto'`) pass through. */
|
|
883
|
+
const toLength = (width: number | string) => {
|
|
884
|
+
if (typeof width === 'number') return `${width}px`;
|
|
885
|
+
const trimmed = width.trim();
|
|
886
|
+
return /^-?\d*\.?\d+$/.test(trimmed) ? `${trimmed}px` : trimmed;
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
/** Number of data columns the parent renders (numeric track keys). */
|
|
890
|
+
const parentDataColumns = computed(() => {
|
|
891
|
+
const tracks = parentNode.value?.tracks;
|
|
892
|
+
return tracks
|
|
893
|
+
? Object.keys(tracks).filter((key) => /^\d+$/.test(key)).length
|
|
894
|
+
: 0;
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* The parent's rendered columns in order — `select` (if any), data columns
|
|
899
|
+
* `0…N-1`, then `actions` (if any) — form a gridline coordinate, one cell per
|
|
900
|
+
* column. Cell `c` is the range `[c, c + 1]`. So a no-select parent starts its
|
|
901
|
+
* data at cell 0, while a selectable parent starts it at cell 1.
|
|
902
|
+
*/
|
|
903
|
+
const parentColumnKeys = computed(() => {
|
|
904
|
+
const tracks = parentNode.value?.tracks ?? {};
|
|
905
|
+
const keys: string[] = [];
|
|
906
|
+
if ('select' in tracks) keys.push('select');
|
|
907
|
+
for (let k = 0; k < parentDataColumns.value; k++) keys.push(String(k));
|
|
908
|
+
if ('actions' in tracks) keys.push('actions');
|
|
909
|
+
return keys;
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
/** Gridline cells where the parent's data region begins/ends and the table ends. */
|
|
913
|
+
const firstDataCell = computed(() =>
|
|
914
|
+
'select' in (parentNode.value?.tracks ?? {}) ? 1 : 0
|
|
915
|
+
);
|
|
916
|
+
const dataEndCell = computed(
|
|
917
|
+
() => firstDataCell.value + parentDataColumns.value
|
|
918
|
+
);
|
|
919
|
+
const tableEndCell = computed(() => parentColumnKeys.value.length);
|
|
920
|
+
|
|
921
|
+
/** Parent track custom property for the integer cell `[cell, cell + 1]`. */
|
|
922
|
+
const cellTrackVar = (cell: number) => {
|
|
923
|
+
const key = parentColumnKeys.value[cell];
|
|
924
|
+
return key ? parentVar(key, '0px') : '0px';
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
/** CSS length summing the parent tracks across the gridline range `[a, b]`. */
|
|
928
|
+
const gridRangeWidth = (a: number, b: number): string | null => {
|
|
929
|
+
if (!parentId.value || b - a <= 1e-6) return null;
|
|
930
|
+
const parts: string[] = [];
|
|
931
|
+
for (let cell = Math.floor(a); cell < Math.ceil(b - 1e-6); cell++) {
|
|
932
|
+
const fraction = Math.min(b, cell + 1) - Math.max(a, cell);
|
|
933
|
+
if (fraction <= 1e-6) continue;
|
|
934
|
+
const track = cellTrackVar(cell);
|
|
935
|
+
parts.push(
|
|
936
|
+
fraction >= 1 - 1e-6 ? track : `${Number(fraction.toFixed(4))} * ${track}`
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
if (!parts.length) return null;
|
|
940
|
+
// A bare `var()` can stand alone, but a single fractional term still needs a
|
|
941
|
+
// `calc()` wrapper for the multiplication to be valid CSS.
|
|
942
|
+
if (parts.length === 1 && !parts[0].includes('*')) return parts[0];
|
|
943
|
+
return `calc(${parts.join(' + ')})`;
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Resolved parent snap interval for each data column.
|
|
948
|
+
* - A number snaps to that start point; the column then runs up to the next
|
|
949
|
+
* column's snap point (or one whole track if the next is unset). So a single
|
|
950
|
+
* snap that skips ahead widens this column to cover the gap — `snap: 4` on the
|
|
951
|
+
* second column makes the first effectively `[start, 4]`.
|
|
952
|
+
* - A `[start, end]` pair is taken verbatim (`end` of `-1` runs to the end of
|
|
953
|
+
* the data region).
|
|
954
|
+
* - Omitted, the column chains from the previous column's end.
|
|
955
|
+
*/
|
|
956
|
+
const columnIntervals = computed(() => {
|
|
957
|
+
const cols = props.columns;
|
|
958
|
+
// Explicit start points; a later column's snap sets the previous column's end.
|
|
959
|
+
const starts = cols.map((column) =>
|
|
960
|
+
typeof column.snap === 'number'
|
|
961
|
+
? column.snap
|
|
962
|
+
: Array.isArray(column.snap)
|
|
963
|
+
? column.snap[0]
|
|
964
|
+
: null
|
|
965
|
+
);
|
|
966
|
+
let cursor = firstDataCell.value;
|
|
967
|
+
return cols.map((column, i) => {
|
|
968
|
+
const start = starts[i] ?? cursor;
|
|
969
|
+
let end: number;
|
|
970
|
+
if (Array.isArray(column.snap)) {
|
|
971
|
+
end = column.snap[1] === -1 ? dataEndCell.value : column.snap[1];
|
|
972
|
+
} else {
|
|
973
|
+
const next = starts[i + 1];
|
|
974
|
+
end = next != null && next > start ? next : Math.floor(start) + 1;
|
|
975
|
+
}
|
|
976
|
+
cursor = end;
|
|
977
|
+
return { start, end };
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* A column whose interval begins at or beyond the parent's last data cell has no
|
|
983
|
+
* matching parent column to inherit from — the table has more columns than its
|
|
984
|
+
* parent. Such columns are sized to their own measured content and scroll within
|
|
985
|
+
* the expand row instead of inheriting a track.
|
|
986
|
+
*/
|
|
987
|
+
const isOverflowColumn = (interval: { start: number }) =>
|
|
988
|
+
isInheriting.value && interval.start >= dataEndCell.value;
|
|
989
|
+
|
|
990
|
+
/** True when any column overflows the parent (more columns than the parent). */
|
|
991
|
+
const overflowsParent = computed(() =>
|
|
992
|
+
columnIntervals.value.some(isOverflowColumn)
|
|
993
|
+
);
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* A "flex" column shares a root table's leftover space (min-content floor)
|
|
997
|
+
* proportionally via the probe. Only root tables flex this way; an inheriting
|
|
998
|
+
* table instead snaps its in-range columns to the parent, content-sizes its
|
|
999
|
+
* overflow columns, and lets a single fill column take up any slack.
|
|
1000
|
+
*/
|
|
1001
|
+
const isFlexColumn = (index: number) =>
|
|
1002
|
+
props.columns[index]?.width == null && !isInheriting.value;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* The last column of an inheriting table whose width is left undefined — neither
|
|
1006
|
+
* a `width` nor a `snap` (a `snap` *is* a width definition: the track range it
|
|
1007
|
+
* spans). That column absorbs the leftover space so the table fills its parent
|
|
1008
|
+
* when a frozen/snapped column narrower than the parent's would otherwise leave a
|
|
1009
|
+
* gap. `-1` for a root table, or when every column defines its own width.
|
|
1010
|
+
*/
|
|
1011
|
+
const fillColumnIndex = computed(() => {
|
|
1012
|
+
if (!isInheriting.value) return -1;
|
|
1013
|
+
for (let i = props.columns.length - 1; i >= 0; i--) {
|
|
1014
|
+
const column = props.columns[i];
|
|
1015
|
+
if (column.width == null && column.snap == null) return i;
|
|
1016
|
+
}
|
|
1017
|
+
return -1;
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
// Parent columns left of the first column (e.g. a select this table doesn't
|
|
1021
|
+
// render, or columns skipped by the first snap) and those right of the last are
|
|
1022
|
+
// folded into the edge columns as the structural offset, keeping the table
|
|
1023
|
+
// aligned to the parent. `offsetStartValue` becomes the first column's padding.
|
|
1024
|
+
const offsetStartValue = computed(() => {
|
|
1025
|
+
const first = columnIntervals.value[0];
|
|
1026
|
+
// No parent to align to (a root table) means no offset at all — without this
|
|
1027
|
+
// the structural reclaim below would still fold a negative `-ownSelect` in.
|
|
1028
|
+
if (!inheritColumnWidths.value || !parentId.value || !first) return null;
|
|
1029
|
+
// The fill runs from the parent's left edge to this table's first data
|
|
1030
|
+
// column — the parent's select cell, if any, plus any skipped data columns.
|
|
1031
|
+
const head = gridRangeWidth(0, first.start);
|
|
1032
|
+
// This table's own select column sits flush at the left edge and takes its
|
|
1033
|
+
// measured width, so reclaim it from the fill (mirror of the actions side):
|
|
1034
|
+
// the first data column then lines the *next* column up flush with the
|
|
1035
|
+
// parent. When the parent has a select cell it is part of `head`, so only the
|
|
1036
|
+
// surplus over it is reclaimed; when the parent has none the whole select
|
|
1037
|
+
// width comes out of the first column, which shrinks to make room for it.
|
|
1038
|
+
const ownSelect = props.selectable ? structuralFit.select : null;
|
|
1039
|
+
if (!ownSelect) return head;
|
|
1040
|
+
return `calc(${head ?? '0px'} - ${ownSelect})`;
|
|
1041
|
+
});
|
|
1042
|
+
const offsetEndValue = computed(() => {
|
|
1043
|
+
const intervals = columnIntervals.value;
|
|
1044
|
+
const last = intervals[intervals.length - 1];
|
|
1045
|
+
// No parent to align to (a root table) means no offset at all — without this
|
|
1046
|
+
// the structural reclaim below would still fold a negative `-ownActions` in.
|
|
1047
|
+
if (!inheritColumnWidths.value || !parentId.value || !last) return null;
|
|
1048
|
+
// With more columns than the parent, the table runs past the parent's right
|
|
1049
|
+
// edge: there is no trailing parent region to fold, and the last column is a
|
|
1050
|
+
// content-sized overflow column, so there is no end fill.
|
|
1051
|
+
if (overflowsParent.value) return null;
|
|
1052
|
+
// When the last column is the (auto) fill column it already absorbs the whole
|
|
1053
|
+
// trailing region via fixed layout, so folding the offset in too would double
|
|
1054
|
+
// it — and skew its right-aligned content inward.
|
|
1055
|
+
if (fillColumnIndex.value === props.columns.length - 1) return null;
|
|
1056
|
+
// The fill runs from the last data column's end all the way to the parent's
|
|
1057
|
+
// right edge — any unmapped data columns plus the parent's actions cell, if
|
|
1058
|
+
// it has one.
|
|
1059
|
+
const tail = gridRangeWidth(last.end, tableEndCell.value);
|
|
1060
|
+
// This table's own actions column sits flush against that right edge and
|
|
1061
|
+
// takes its measured content width, so reclaim it from the fill: the table
|
|
1062
|
+
// then ends exactly at the parent's edge instead of overflowing by the
|
|
1063
|
+
// actions width. When the parent has an actions cell it is part of `tail`, so
|
|
1064
|
+
// only the surplus over it is effectively reclaimed; when the parent has none
|
|
1065
|
+
// the whole actions width comes out of the data fill. The result may be
|
|
1066
|
+
// negative — the last data column then shrinks to make room for the actions.
|
|
1067
|
+
const ownActions = props.actions ? structuralFit.actions : null;
|
|
1068
|
+
if (!ownActions) return tail;
|
|
1069
|
+
return `calc(${tail ?? '0px'} - ${ownActions})`;
|
|
1070
|
+
});
|
|
1071
|
+
const offsetStartActive = computed(() => offsetStartValue.value !== null);
|
|
1072
|
+
const offsetEndActive = computed(() => offsetEndValue.value !== null);
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Measured intrinsic content widths of the structural columns. In a fixed table
|
|
1076
|
+
* these pin `select`/`actions` to their content so the remaining space is shared
|
|
1077
|
+
* among the data columns; `null` falls back to the regular auto behavior.
|
|
1078
|
+
*/
|
|
1079
|
+
const structuralFit = reactive<{
|
|
1080
|
+
select: string | null;
|
|
1081
|
+
actions: string | null;
|
|
1082
|
+
}>({ select: null, actions: null });
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Rendered columns in DOM order, each with the track key it publishes/inherits
|
|
1086
|
+
* and the width to apply via `<colgroup>`. A frozen column width wins; otherwise
|
|
1087
|
+
* an unfrozen column syncs to the parent's matching track (or `auto` at root).
|
|
1088
|
+
* The first/last column additionally absorbs the structural edge offset.
|
|
1089
|
+
*/
|
|
1090
|
+
const columnTracks = computed(() => {
|
|
1091
|
+
const sync = (key: string) =>
|
|
1092
|
+
inheritColumnWidths.value ? parentVar(key) : 'auto';
|
|
1093
|
+
// In fixed layout `auto` columns share width equally, so pin the structural
|
|
1094
|
+
// columns to their measured content width and let the data columns share.
|
|
1095
|
+
const structural = (key: 'select' | 'actions') =>
|
|
1096
|
+
fixedLayout.value && structuralFit[key]
|
|
1097
|
+
? (structuralFit[key] as string)
|
|
1098
|
+
: sync(key);
|
|
1099
|
+
const tracks: Array<{ key: string; width: string }> = [];
|
|
1100
|
+
|
|
1101
|
+
if (props.selectable) {
|
|
1102
|
+
tracks.push({ key: 'select', width: structural('select') });
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
const lastIndex = props.columns.length - 1;
|
|
1106
|
+
props.columns.forEach((column, index) => {
|
|
1107
|
+
const key = String(index);
|
|
1108
|
+
const frozen = column.width != null ? toLength(column.width) : null;
|
|
1109
|
+
const interval = columnIntervals.value[index];
|
|
1110
|
+
|
|
1111
|
+
// The fill column is left `auto` so fixed layout (the inheriting table has
|
|
1112
|
+
// a definite `width: 100%`) hands it the leftover space — its own inherited
|
|
1113
|
+
// track plus the folded edge region plus any deficit. Skipped when the
|
|
1114
|
+
// table overflows: there is no leftover then, and it must content-size.
|
|
1115
|
+
if (index === fillColumnIndex.value && !overflowsParent.value) {
|
|
1116
|
+
tracks.push({ key, width: 'auto' });
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
let span: string | null;
|
|
1121
|
+
if (frozen != null) {
|
|
1122
|
+
span = frozen;
|
|
1123
|
+
} else if (isFlexColumn(index)) {
|
|
1124
|
+
// Root table auto column: a precise share of the leftover space from the
|
|
1125
|
+
// proportional probe rather than fixed layout's equal split. `auto` is
|
|
1126
|
+
// the fallback before the probe runs.
|
|
1127
|
+
span = (fixedLayout.value && probeColWidths.value[index]) || null;
|
|
1128
|
+
} else if (isOverflowColumn(interval)) {
|
|
1129
|
+
// Inheriting table, past the parent's last column: no track to snap to,
|
|
1130
|
+
// so size to its own content and let the table overflow (and scroll).
|
|
1131
|
+
span = columnMinWidths.value[index] ?? null;
|
|
1132
|
+
} else {
|
|
1133
|
+
// In range: snap to the parent's matching column.
|
|
1134
|
+
span = gridRangeWidth(interval.start, interval.end);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
const offsets: string[] = [];
|
|
1138
|
+
if (index === 0 && offsetStartActive.value) {
|
|
1139
|
+
offsets.push('var(--offset-internal-start, 0px)');
|
|
1140
|
+
}
|
|
1141
|
+
if (index === lastIndex && offsetEndActive.value) {
|
|
1142
|
+
offsets.push('var(--offset-internal-end, 0px)');
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// When folding an offset, use a calc-safe length base (no `auto`) so the
|
|
1146
|
+
// column width = offset(s) + the column's own span.
|
|
1147
|
+
const width = offsets.length
|
|
1148
|
+
? `calc(${[...offsets, span ?? '0px'].join(' + ')})`
|
|
1149
|
+
: (span ?? 'auto');
|
|
1150
|
+
|
|
1151
|
+
tracks.push({ key, width });
|
|
1152
|
+
});
|
|
1153
|
+
|
|
1154
|
+
if (props.actions) {
|
|
1155
|
+
tracks.push({ key: 'actions', width: structural('actions') });
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
return tracks;
|
|
1159
|
+
});
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* Standalone edge-offset custom properties consumed by the first/last cell
|
|
1163
|
+
* padding and the first/last column width. Set only when an offset is active;
|
|
1164
|
+
* otherwise the CSS default of `0px` makes both calcs collapse to their base.
|
|
1165
|
+
*/
|
|
1166
|
+
const structuralOffset = computed<Record<string, string>>(() => {
|
|
1167
|
+
const style: Record<string, string> = {};
|
|
1168
|
+
if (offsetStartValue.value) {
|
|
1169
|
+
style['--offset-start'] = offsetStartValue.value;
|
|
1170
|
+
}
|
|
1171
|
+
if (offsetEndValue.value) {
|
|
1172
|
+
style['--offset-end'] = offsetEndValue.value;
|
|
1173
|
+
}
|
|
1174
|
+
return style;
|
|
1175
|
+
});
|
|
1176
|
+
|
|
1177
|
+
const containerStyle = computed(() => {
|
|
1178
|
+
const vars: Record<string, string> = {
|
|
1179
|
+
...cssVars.value,
|
|
1180
|
+
...structuralOffset.value,
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
if (naturalTotalWidth.value) {
|
|
1184
|
+
vars['--natural-width'] = naturalTotalWidth.value;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
if (fillValue.value > 0) {
|
|
1188
|
+
vars['--fill'] = `${fillValue.value}px`;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
return vars;
|
|
1192
|
+
});
|
|
1193
|
+
|
|
1194
|
+
/** Reads the header cells in render order: [select?, ...data, actions?]. */
|
|
1195
|
+
const headerCells = () =>
|
|
1196
|
+
Array.from(
|
|
1197
|
+
tableRef.value?.querySelectorAll<HTMLElement>(
|
|
1198
|
+
':scope > thead > tr.bb-table-header-row > th'
|
|
1199
|
+
) ?? []
|
|
1200
|
+
);
|
|
1201
|
+
|
|
1202
|
+
/** Measures the rendered columns and publishes them as this table's tracks. */
|
|
1203
|
+
const measureTracks = () => {
|
|
1204
|
+
const keys = columnTracks.value.map((track) => track.key);
|
|
1205
|
+
const tracks: Record<string, string> = {};
|
|
1206
|
+
headerCells().forEach((cell, index) => {
|
|
1207
|
+
const key = keys[index];
|
|
1208
|
+
if (key != null) tracks[key] = `${cell.getBoundingClientRect().width}px`;
|
|
1209
|
+
});
|
|
1210
|
+
setTracks(tracks);
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Measures the intrinsic content width of the structural columns across header
|
|
1215
|
+
* and body. Fixed layout sizes columns from the header row only, so the body is
|
|
1216
|
+
* required here: the actions header is `sr-only`, while the real control lives
|
|
1217
|
+
* in the body. The measured child width is independent of the column width, so
|
|
1218
|
+
* pinning the column to it converges instead of oscillating.
|
|
1219
|
+
*/
|
|
1220
|
+
const measureStructuralFit = () => {
|
|
1221
|
+
const table = tableRef.value;
|
|
1222
|
+
if (!table) return;
|
|
1223
|
+
|
|
1224
|
+
// Non-replaced block-level boxes stretch to their container's width in block
|
|
1225
|
+
// formatting; everything else (inline-*, floats, tables) shrink-wraps.
|
|
1226
|
+
const STRETCHING = ['block', 'flex', 'grid', 'flow-root', 'list-item'];
|
|
1227
|
+
// Widgets and replaced elements size to their content regardless of display,
|
|
1228
|
+
// so their rendered width is always intrinsic.
|
|
1229
|
+
const SHRINK_WRAPPING_TAGS = [
|
|
1230
|
+
'BUTTON',
|
|
1231
|
+
'INPUT',
|
|
1232
|
+
'SELECT',
|
|
1233
|
+
'TEXTAREA',
|
|
1234
|
+
'IMG',
|
|
1235
|
+
'svg',
|
|
1236
|
+
'VIDEO',
|
|
1237
|
+
'CANVAS',
|
|
1238
|
+
];
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Intrinsic occupied width of an element's in-flow contents: the sum of each
|
|
1242
|
+
* child's own intrinsic width plus horizontal margins and any flex/grid
|
|
1243
|
+
* column gaps — an actions cell holds several side-by-side controls and the
|
|
1244
|
+
* column must fit them all. Crucially this is *not* their shared extent: the
|
|
1245
|
+
* extent depends on how the container spreads them across its width, which
|
|
1246
|
+
* feeds the column width back into its own measurement and runs away into
|
|
1247
|
+
* the thousands.
|
|
1248
|
+
*
|
|
1249
|
+
* A shrink-wrapping child's rendered width does not depend on the cell, so
|
|
1250
|
+
* it is used as-is. A *stretching* child's rendered width IS its container's
|
|
1251
|
+
* width — a consumer slotting `<div class="flex">…</div>` would otherwise
|
|
1252
|
+
* ratchet the column wider on every container resize — so recurse into its
|
|
1253
|
+
* contents instead. A child stretches only in block formatting: flex/grid
|
|
1254
|
+
* items size to their content on the main axis, so inside a flex/grid
|
|
1255
|
+
* container every child's rendered width is trusted. Out-of-flow children
|
|
1256
|
+
* (e.g. an `sr-only` label parked far off-screen, a popover) are skipped so
|
|
1257
|
+
* they cannot inflate the result.
|
|
1258
|
+
*/
|
|
1259
|
+
const contentsWidth = (el: HTMLElement): number => {
|
|
1260
|
+
const style = getComputedStyle(el);
|
|
1261
|
+
const itemsShrinkWrap =
|
|
1262
|
+
style.display.includes('flex') || style.display.includes('grid');
|
|
1263
|
+
let total = 0;
|
|
1264
|
+
let count = 0;
|
|
1265
|
+
el.querySelectorAll<HTMLElement>(':scope > *').forEach((child) => {
|
|
1266
|
+
const childStyle = getComputedStyle(child);
|
|
1267
|
+
if (childStyle.position === 'absolute' || childStyle.position === 'fixed')
|
|
1268
|
+
return;
|
|
1269
|
+
const margin =
|
|
1270
|
+
parseFloat(childStyle.marginLeft) + parseFloat(childStyle.marginRight);
|
|
1271
|
+
const stretches =
|
|
1272
|
+
!itemsShrinkWrap &&
|
|
1273
|
+
!SHRINK_WRAPPING_TAGS.includes(child.tagName) &&
|
|
1274
|
+
childStyle.cssFloat === 'none' &&
|
|
1275
|
+
STRETCHING.includes(childStyle.display);
|
|
1276
|
+
const own = stretches
|
|
1277
|
+
? contentsWidth(child) +
|
|
1278
|
+
parseFloat(childStyle.paddingLeft) +
|
|
1279
|
+
parseFloat(childStyle.paddingRight) +
|
|
1280
|
+
parseFloat(childStyle.borderLeftWidth) +
|
|
1281
|
+
parseFloat(childStyle.borderRightWidth)
|
|
1282
|
+
: child.getBoundingClientRect().width;
|
|
1283
|
+
total += own + (margin || 0);
|
|
1284
|
+
count += 1;
|
|
1285
|
+
});
|
|
1286
|
+
if (count === 0) {
|
|
1287
|
+
// Text-only content: measure the laid-out text run itself.
|
|
1288
|
+
const range = document.createRange();
|
|
1289
|
+
range.selectNodeContents(el);
|
|
1290
|
+
return range.getBoundingClientRect().width;
|
|
1291
|
+
}
|
|
1292
|
+
if (count > 1) {
|
|
1293
|
+
const gap = parseFloat(style.columnGap);
|
|
1294
|
+
if (gap) total += gap * (count - 1);
|
|
1295
|
+
}
|
|
1296
|
+
return total;
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
const fit = (selector: string) => {
|
|
1300
|
+
let max = 0;
|
|
1301
|
+
table.querySelectorAll<HTMLElement>(selector).forEach((cell) => {
|
|
1302
|
+
const style = getComputedStyle(cell);
|
|
1303
|
+
const padding =
|
|
1304
|
+
parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
1305
|
+
max = Math.max(max, contentsWidth(cell) + padding);
|
|
1306
|
+
});
|
|
1307
|
+
return max > 0 ? `${Math.ceil(max)}px` : null;
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
// Scoped to this table's own header/body rows: an unscoped descendant query
|
|
1311
|
+
// would also match the structural cells of a nested table living in an expand
|
|
1312
|
+
// row, letting a child's actions/select width hijack this table's column.
|
|
1313
|
+
structuralFit.select = props.selectable
|
|
1314
|
+
? fit(
|
|
1315
|
+
':scope > thead > tr > th.bb-table-header--select, :scope > tbody > tr > td.bb-table-data__cell--select'
|
|
1316
|
+
)
|
|
1317
|
+
: null;
|
|
1318
|
+
structuralFit.actions = props.actions
|
|
1319
|
+
? fit(
|
|
1320
|
+
':scope > thead > tr > th.bb-table-header--actions, :scope > tbody > tr > td.bb-table__cell--actions'
|
|
1321
|
+
)
|
|
1322
|
+
: null;
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
const measure = () => {
|
|
1326
|
+
measureStructuralFit();
|
|
1327
|
+
measureTracks();
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Proportional `<col>` widths derived from an auto-layout probe, one entry per
|
|
1332
|
+
* data column (`null` for frozen columns — they keep their declared width).
|
|
1333
|
+
*
|
|
1334
|
+
* For each auto column the formula is:
|
|
1335
|
+
* width = max(minimum, available × (minimum / minimumTotal))
|
|
1336
|
+
*
|
|
1337
|
+
* where `minimum` is the column's `min-content` width (what it shrinks to in a
|
|
1338
|
+
* very narrow container, i.e. the floor below which content would be clipped),
|
|
1339
|
+
* `available` = containerWidth − frozenColumnWidths − structuralColumnWidths
|
|
1340
|
+
* and `minimumTotal` = sum of the auto columns' minimums.
|
|
1341
|
+
*
|
|
1342
|
+
* So when the container has room (`available ≥ minimumTotal`) the slack is shared
|
|
1343
|
+
* out proportionally to each column's minimum, scaling them up together; when it
|
|
1344
|
+
* does not, every column drops to its minimum and the table-level `min-width`
|
|
1345
|
+
* lets it overflow (the container scrolls) rather than squashing content further.
|
|
1346
|
+
*
|
|
1347
|
+
* Re-measured after any DOM mutation (debounced 200 ms) and after any container
|
|
1348
|
+
* resize (via a dedicated ResizeObserver on the container element).
|
|
1349
|
+
*/
|
|
1350
|
+
const probeColWidths = ref<Array<string | null>>([]);
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Each unfrozen column's measured `min-content` width (`null` for frozen). Used
|
|
1354
|
+
* to content-size the overflow columns of an inheriting table — those past the
|
|
1355
|
+
* parent's last column, with no track to snap to.
|
|
1356
|
+
*/
|
|
1357
|
+
const columnMinWidths = ref<Array<string | null>>([]);
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* Leftover px the inheriting fill column adds so the table reaches its parent's
|
|
1361
|
+
* width. Published as `--fill`; `0` when the table already fills or
|
|
1362
|
+
* overflows. Derived self-correctingly from the live total (see the probe).
|
|
1363
|
+
*/
|
|
1364
|
+
const fillValue = ref(0);
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Total minimum width of the table (all columns at their `min-content`, plus the
|
|
1368
|
+
* structural columns). Published as `--natural-width` and used as
|
|
1369
|
+
* `min-width` on the `<table>` so the table scrolls horizontally only once the
|
|
1370
|
+
* container is narrower than this true minimum.
|
|
1371
|
+
*/
|
|
1372
|
+
const naturalTotalWidth = ref<string | null>(null);
|
|
1373
|
+
|
|
1374
|
+
const runNaturalWidthProbe = () => {
|
|
1375
|
+
const container = containerRef.value;
|
|
1376
|
+
if (!container || !fixedLayout.value) return;
|
|
1377
|
+
// Runs for a frozen-column table (to share space), or any inheriting table
|
|
1378
|
+
// (to content-size overflow columns and drive the fill column's slack).
|
|
1379
|
+
if (
|
|
1380
|
+
!props.columns.some((col) => col.width != null) &&
|
|
1381
|
+
!overflowsParent.value &&
|
|
1382
|
+
fillColumnIndex.value < 0
|
|
1383
|
+
)
|
|
1384
|
+
return;
|
|
1385
|
+
|
|
1386
|
+
const containerWidth = container.offsetWidth;
|
|
1387
|
+
const dataOffset = props.selectable ? 1 : 0;
|
|
1388
|
+
|
|
1389
|
+
// ── Real-table measurements ────────────────────────────────────────────
|
|
1390
|
+
// Structural column widths come from measureStructuralFit (already run).
|
|
1391
|
+
const selectWidth = structuralFit.select
|
|
1392
|
+
? parseFloat(structuralFit.select)
|
|
1393
|
+
: 0;
|
|
1394
|
+
const actionsWidth = structuralFit.actions
|
|
1395
|
+
? parseFloat(structuralFit.actions)
|
|
1396
|
+
: 0;
|
|
1397
|
+
|
|
1398
|
+
// Live rendered widths from the fixed-layout table. `frozenTotal` (declared
|
|
1399
|
+
// widths) feeds the stable min-width floor; `nonFlexTotal` (frozen + inherited)
|
|
1400
|
+
// is what the flex columns share the remainder of. The inherited part is only
|
|
1401
|
+
// used for that `available` figure — never fed back into min-width, since those
|
|
1402
|
+
// widths stretch with the table and would otherwise lock min-width above
|
|
1403
|
+
// max-content and force a spurious uniform stretch on every column.
|
|
1404
|
+
const realThs = headerCells();
|
|
1405
|
+
let frozenTotal = 0;
|
|
1406
|
+
let nonFlexTotal = 0;
|
|
1407
|
+
props.columns.forEach((col, i) => {
|
|
1408
|
+
const width = realThs[dataOffset + i]?.getBoundingClientRect().width ?? 0;
|
|
1409
|
+
if (col.width != null) frozenTotal += width;
|
|
1410
|
+
if (!isFlexColumn(i)) nonFlexTotal += width;
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1413
|
+
// ── Offscreen probe for the auto columns' minimum (min-content) widths ──
|
|
1414
|
+
// The clone's inner table is forced to `width: min-content` and the auto <col>
|
|
1415
|
+
// hints are stripped so each <th> reports the narrowest width it can take
|
|
1416
|
+
// before content would be clipped, independent of the container size or
|
|
1417
|
+
// previous probe cycles.
|
|
1418
|
+
const probe = document.createElement('div');
|
|
1419
|
+
probe.style.cssText = [
|
|
1420
|
+
'position:absolute',
|
|
1421
|
+
'top:-9999px',
|
|
1422
|
+
'left:-9999px',
|
|
1423
|
+
'visibility:hidden',
|
|
1424
|
+
'pointer-events:none',
|
|
1425
|
+
`width:${containerWidth}px`,
|
|
1426
|
+
`height:${container.offsetHeight}px`,
|
|
1427
|
+
'overflow:visible',
|
|
1428
|
+
].join(';');
|
|
1429
|
+
|
|
1430
|
+
const clone = container.cloneNode(true) as HTMLElement;
|
|
1431
|
+
clone.classList.remove('bb-table--fixed');
|
|
1432
|
+
|
|
1433
|
+
// Expand rows are full-width (colspan) and hold nested tables; under the
|
|
1434
|
+
// auto-layout probe their content would back-pressure this table's own
|
|
1435
|
+
// columns, so drop them and measure this table's columns in isolation.
|
|
1436
|
+
clone
|
|
1437
|
+
.querySelectorAll('.bb-table-expand__row')
|
|
1438
|
+
.forEach((row) => row.remove());
|
|
1439
|
+
|
|
1440
|
+
// Auto <col> hints are cleared so a previous cycle's computed width cannot
|
|
1441
|
+
// act as a minimum and inflate the measurement; frozen hints are left intact
|
|
1442
|
+
// since their declared width is a genuine floor for that column.
|
|
1443
|
+
const probeColEls = Array.from(clone.querySelectorAll<HTMLElement>('col'));
|
|
1444
|
+
props.columns.forEach((col, i) => {
|
|
1445
|
+
if (col.width == null) {
|
|
1446
|
+
const probeCol = probeColEls[dataOffset + i];
|
|
1447
|
+
if (probeCol) probeCol.style.width = '';
|
|
1448
|
+
}
|
|
1449
|
+
});
|
|
1450
|
+
|
|
1451
|
+
const innerTable = clone.querySelector<HTMLElement>('table');
|
|
1452
|
+
if (innerTable) {
|
|
1453
|
+
innerTable.style.width = 'min-content';
|
|
1454
|
+
innerTable.style.minWidth = '0';
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
probe.appendChild(clone);
|
|
1458
|
+
document.body.appendChild(probe);
|
|
1459
|
+
|
|
1460
|
+
const headerRow = probe.querySelector<HTMLElement>(
|
|
1461
|
+
'table thead tr.bb-table-header-row'
|
|
1462
|
+
);
|
|
1463
|
+
const ths = headerRow
|
|
1464
|
+
? Array.from(headerRow.querySelectorAll<HTMLElement>(':scope > th'))
|
|
1465
|
+
: [];
|
|
1466
|
+
|
|
1467
|
+
// Min-content of every unfrozen column (0 for frozen). Independent of the live
|
|
1468
|
+
// table's width, so it is a stable basis for both the flex share and the
|
|
1469
|
+
// min-width floor — unlike the rendered inherited widths.
|
|
1470
|
+
const minContents = props.columns.map((col, i) => {
|
|
1471
|
+
if (col.width != null) return 0;
|
|
1472
|
+
const th = ths[dataOffset + i];
|
|
1473
|
+
return th ? th.getBoundingClientRect().width : 0;
|
|
1474
|
+
});
|
|
1475
|
+
|
|
1476
|
+
document.body.removeChild(probe);
|
|
1477
|
+
|
|
1478
|
+
// ── Proportional <col> widths ──────────────────────────────────────────
|
|
1479
|
+
// Only the flex columns share `available`; the inherited columns are already
|
|
1480
|
+
// laid out and excluded via `nonFlexTotal`.
|
|
1481
|
+
const flexMinTotal = props.columns.reduce(
|
|
1482
|
+
(s, _, i) => s + (isFlexColumn(i) ? minContents[i] : 0),
|
|
1483
|
+
0
|
|
1484
|
+
);
|
|
1485
|
+
const available = containerWidth - nonFlexTotal - selectWidth - actionsWidth;
|
|
1486
|
+
|
|
1487
|
+
// Share the available space proportionally to each flex column's minimum, but
|
|
1488
|
+
// never drop below that minimum — when space runs out the table overflows
|
|
1489
|
+
// (and the container scrolls) instead of clipping content.
|
|
1490
|
+
//
|
|
1491
|
+
// Widths are kept sub-pixel (not rounded up): the raw shares sum to exactly
|
|
1492
|
+
// `available`, whereas ceiling each column would over-allocate by up to a
|
|
1493
|
+
// pixel apiece and, under `table-layout: fixed`, push the table a few px past
|
|
1494
|
+
// the container and trip the horizontal scrollbar. `toFixed` only trims the
|
|
1495
|
+
// float tail, well below the 1px a scrollbar needs.
|
|
1496
|
+
const px = (n: number) => `${Number(n.toFixed(3))}px`;
|
|
1497
|
+
probeColWidths.value = props.columns.map((_, i) => {
|
|
1498
|
+
if (!isFlexColumn(i)) return null;
|
|
1499
|
+
const minimum = minContents[i];
|
|
1500
|
+
if (flexMinTotal <= 0) return px(minimum);
|
|
1501
|
+
const share = available > 0 ? available * (minimum / flexMinTotal) : 0;
|
|
1502
|
+
return px(Math.max(minimum, share));
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
// Min-content per unfrozen column, for content-sizing an inheriting table's
|
|
1506
|
+
// overflow columns (no parent track to snap to).
|
|
1507
|
+
columnMinWidths.value = minContents.map((w) => (w > 0 ? px(w) : null));
|
|
1508
|
+
|
|
1509
|
+
// Leftover the inheriting fill column must absorb to reach the parent's width.
|
|
1510
|
+
// `parentTotal` is the parent table's full width (the expand cell this table
|
|
1511
|
+
// sits in); the container itself shrink-wraps to the table, so it can't be the
|
|
1512
|
+
// reference. Self-correcting: the live total already includes last cycle's
|
|
1513
|
+
// fill, so adding it back recovers the intrinsic total and the result is the
|
|
1514
|
+
// same once the table fills (0 when it already fills or overflows).
|
|
1515
|
+
if (fillColumnIndex.value >= 0) {
|
|
1516
|
+
const parentTotal = Object.values(parentNode.value?.tracks ?? {}).reduce(
|
|
1517
|
+
(s, w) => s + (parseFloat(w) || 0),
|
|
1518
|
+
0
|
|
1519
|
+
);
|
|
1520
|
+
const liveTotal = realThs.reduce(
|
|
1521
|
+
(s, th) => s + th.getBoundingClientRect().width,
|
|
1522
|
+
0
|
|
1523
|
+
);
|
|
1524
|
+
fillValue.value = Math.max(0, parentTotal - liveTotal + fillValue.value);
|
|
1525
|
+
} else {
|
|
1526
|
+
fillValue.value = 0;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
// Table min-width = frozen (declared) widths + every unfrozen column's
|
|
1530
|
+
// min-content + structural. Built only from values that do not depend on the
|
|
1531
|
+
// table's own width, so it can never exceed max-content and force a stretch.
|
|
1532
|
+
const minContentTotal = minContents.reduce((s, w) => s + w, 0);
|
|
1533
|
+
const naturalTotal =
|
|
1534
|
+
frozenTotal + minContentTotal + selectWidth + actionsWidth;
|
|
1535
|
+
naturalTotalWidth.value =
|
|
1536
|
+
naturalTotal > 0 ? `${Math.ceil(naturalTotal)}px` : null;
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
let naturalWidthDebounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
1540
|
+
let mutationObserver: MutationObserver | undefined;
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* True while a container resize is waiting on the debounced probe to reflow
|
|
1544
|
+
* the columns. A shrink leaves the old (wider) column widths in place until
|
|
1545
|
+
* the probe lands, so `overflow-x: auto` would flash a horizontal scrollbar
|
|
1546
|
+
* for that window. While measuring, overflow is clipped instead — but only
|
|
1547
|
+
* when the table wasn't already overflowing when the resize hit (an existing
|
|
1548
|
+
* scrollbar stays; hiding it would jolt a table the user may be scrolling).
|
|
1549
|
+
*/
|
|
1550
|
+
const measuring = ref(false);
|
|
1551
|
+
|
|
1552
|
+
/** Whether the table genuinely overflowed its container at the last settle. */
|
|
1553
|
+
let hadOverflow = false;
|
|
1554
|
+
|
|
1555
|
+
const updateOverflowState = () => {
|
|
1556
|
+
const container = containerRef.value;
|
|
1557
|
+
const table = tableRef.value;
|
|
1558
|
+
hadOverflow =
|
|
1559
|
+
!!container &&
|
|
1560
|
+
!!table &&
|
|
1561
|
+
table.getBoundingClientRect().width > container.clientWidth + 1;
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1564
|
+
/** Invalidates the cached natural width and schedules a fresh probe. */
|
|
1565
|
+
const scheduleNaturalWidthProbe = () => {
|
|
1566
|
+
if (naturalWidthDebounceTimer !== null)
|
|
1567
|
+
clearTimeout(naturalWidthDebounceTimer);
|
|
1568
|
+
naturalWidthDebounceTimer = setTimeout(() => {
|
|
1569
|
+
naturalWidthDebounceTimer = null;
|
|
1570
|
+
runNaturalWidthProbe();
|
|
1571
|
+
// Lift the overflow clip only after the new column widths have rendered,
|
|
1572
|
+
// then re-read the settled overflow state (a scrollbar reappears here
|
|
1573
|
+
// only if the table truly cannot fit the new container width).
|
|
1574
|
+
nextTick(() => {
|
|
1575
|
+
measuring.value = false;
|
|
1576
|
+
updateOverflowState();
|
|
1577
|
+
});
|
|
1578
|
+
}, 200);
|
|
1579
|
+
};
|
|
1580
|
+
|
|
1581
|
+
let resizeObserver: ResizeObserver | undefined;
|
|
1582
|
+
/** Observes the container element specifically for size changes so the
|
|
1583
|
+
* proportional <col> widths are recomputed whenever the container grows or
|
|
1584
|
+
* shrinks — separately from the header-cell observer that drives measureTracks. */
|
|
1585
|
+
let containerResizeObserver: ResizeObserver | undefined;
|
|
1586
|
+
|
|
1587
|
+
const observeColumns = () => {
|
|
1588
|
+
if (!resizeObserver) return;
|
|
1589
|
+
resizeObserver.disconnect();
|
|
1590
|
+
headerCells().forEach((cell) => resizeObserver?.observe(cell));
|
|
1591
|
+
measure();
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
onMounted(() => {
|
|
1595
|
+
resizeObserver = new ResizeObserver(() => measure());
|
|
1596
|
+
observeColumns();
|
|
1597
|
+
|
|
1598
|
+
// Initial probe runs after the first render so all cells have content.
|
|
1599
|
+
nextTick(runNaturalWidthProbe);
|
|
1600
|
+
|
|
1601
|
+
// Invalidate the cache whenever rows or cell content change.
|
|
1602
|
+
if (tableRef.value) {
|
|
1603
|
+
mutationObserver = new MutationObserver(scheduleNaturalWidthProbe);
|
|
1604
|
+
mutationObserver.observe(tableRef.value, {
|
|
1605
|
+
childList: true,
|
|
1606
|
+
subtree: true,
|
|
1607
|
+
characterData: true,
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
// Re-probe whenever the container itself is resized so that proportional
|
|
1612
|
+
// <col> widths stay accurate as the available space changes. Runs before
|
|
1613
|
+
// paint, so clipping overflow here means the stale-width scrollbar never
|
|
1614
|
+
// shows. The hadOverflow guard also breaks the feedback loop of the clip
|
|
1615
|
+
// itself resizing the content box.
|
|
1616
|
+
if (containerRef.value) {
|
|
1617
|
+
containerResizeObserver = new ResizeObserver(() => {
|
|
1618
|
+
if (!hadOverflow) measuring.value = true;
|
|
1619
|
+
scheduleNaturalWidthProbe();
|
|
1620
|
+
});
|
|
1621
|
+
containerResizeObserver.observe(containerRef.value);
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
onBeforeUnmount(() => {
|
|
1626
|
+
resizeObserver?.disconnect();
|
|
1627
|
+
containerResizeObserver?.disconnect();
|
|
1628
|
+
mutationObserver?.disconnect();
|
|
1629
|
+
if (naturalWidthDebounceTimer !== null)
|
|
1630
|
+
clearTimeout(naturalWidthDebounceTimer);
|
|
1631
|
+
});
|
|
1632
|
+
|
|
1633
|
+
watch(columnTracks, () => nextTick(observeColumns), { flush: 'post' });
|
|
1634
|
+
|
|
1635
|
+
/** Builds accessible label for selection controls from row content. */
|
|
1636
|
+
const getAccessibleLabel = (columns: MappedCell[], item: any) =>
|
|
1637
|
+
props.accessibleLabel
|
|
1638
|
+
? props.accessibleLabel(columns, item)
|
|
1639
|
+
: [t('table.select').value, ...columns.map((col) => col.content)].join(' ');
|
|
1640
|
+
|
|
1641
|
+
const containerTag = computed(() => (props.selectable ? 'fieldset' : 'div'));
|
|
1642
|
+
|
|
1643
|
+
const loading = computed(() => props.loading || innerLoading.value);
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* The header and the data rows go `inert` while loading unless the consumer opts
|
|
1647
|
+
* out: a refetch is about to replace the rows, so editing, selecting or sorting
|
|
1648
|
+
* them races the incoming data.
|
|
1649
|
+
*
|
|
1650
|
+
* Applied to `<thead>` and to each row rather than to `<table>` or `<tbody>` on
|
|
1651
|
+
* purpose — `inert` removes descendants from the a11y tree, and the loading
|
|
1652
|
+
* announcement lives in the same body as the rows, so a broader target would
|
|
1653
|
+
* silence it and the table would go busy in complete silence.
|
|
1654
|
+
*/
|
|
1655
|
+
const contentInert = computed(
|
|
1656
|
+
() => loading.value && !props.interactiveWhileLoading
|
|
1657
|
+
);
|
|
1658
|
+
|
|
1659
|
+
const hasProvidedAccessibilityData = computed(
|
|
1660
|
+
() =>
|
|
1661
|
+
contextIsReady.value &&
|
|
1662
|
+
!isNil(contextState.page) &&
|
|
1663
|
+
!isNil(contextState.perPage) &&
|
|
1664
|
+
!isNil(contextState.total) &&
|
|
1665
|
+
contextState.page >= 1 &&
|
|
1666
|
+
contextState.perPage > 0 &&
|
|
1667
|
+
contextState.total >= 0
|
|
1668
|
+
);
|
|
1669
|
+
|
|
1670
|
+
const containerClass = computed(() => ({
|
|
1671
|
+
'bb-table': true,
|
|
1672
|
+
[`bb-table--align-${props.align}`]: true,
|
|
1673
|
+
'bb-table--compact': props.compact,
|
|
1674
|
+
'bb-table--fixed': fixedLayout.value,
|
|
1675
|
+
'bb-table--inherit-widths': sizeToColumns.value,
|
|
1676
|
+
'bb-table--fixed-header': props.fixedHeaders,
|
|
1677
|
+
'bb-table--loading': loading.value,
|
|
1678
|
+
'bb-table--empty': !options.value.length,
|
|
1679
|
+
'bb-table--selectable': !!props.selectable,
|
|
1680
|
+
'bb-table--measuring': measuring.value,
|
|
1681
|
+
'scrollbar-border': true,
|
|
1682
|
+
}));
|
|
1683
|
+
|
|
1684
|
+
const replacementContentSpan = computed(
|
|
1685
|
+
() =>
|
|
1686
|
+
props.columns.length + Number(!!props.selectable) + Number(!!props.actions)
|
|
1687
|
+
);
|
|
1688
|
+
|
|
1689
|
+
const slotNamesByKey = computed(() =>
|
|
1690
|
+
Object.fromEntries(
|
|
1691
|
+
props.columns.map((col) => [col.key, columnKeyToSlotName(col.key)])
|
|
1692
|
+
)
|
|
1693
|
+
);
|
|
1694
|
+
const {
|
|
1695
|
+
getter,
|
|
1696
|
+
items: internalItems,
|
|
1697
|
+
loading: innerLoading,
|
|
1698
|
+
} = useItemsGetter({
|
|
1699
|
+
items: toRef(props, 'items'),
|
|
1700
|
+
});
|
|
1701
|
+
|
|
1702
|
+
const { hasPrefilled } = usePrefill({
|
|
1703
|
+
trigger: true,
|
|
1704
|
+
fn: async (isPrefill) => {
|
|
1705
|
+
await getter(isPrefill, contextState.selected);
|
|
1706
|
+
pruneIncoherent();
|
|
1707
|
+
},
|
|
1708
|
+
});
|
|
1709
|
+
|
|
1710
|
+
const { data: modelValueIndexedByHash } = useIndexById({
|
|
1711
|
+
items: computed(() => contextState.selected),
|
|
1712
|
+
});
|
|
1713
|
+
|
|
1714
|
+
const { options } = useBaseOptions({
|
|
1715
|
+
disabled: toRef(props, 'disabled'),
|
|
1716
|
+
items: internalItems,
|
|
1717
|
+
itemText: undefined,
|
|
1718
|
+
itemValue: props.itemValue,
|
|
1719
|
+
max: props.max,
|
|
1720
|
+
selectable: true,
|
|
1721
|
+
selectedIndexedByHash: modelValueIndexedByHash,
|
|
1722
|
+
});
|
|
1723
|
+
|
|
1724
|
+
// Selection changes are written to the shared context; the host mirrors them
|
|
1725
|
+
// back out through `update:modelValue` synchronously, so the v-model contract
|
|
1726
|
+
// is unchanged while companion composables see the same state.
|
|
1727
|
+
const onOptionSelected = async (option: BaseOption) => {
|
|
1728
|
+
if (props.multiple) {
|
|
1729
|
+
contextState.selected = (contextState.selected ?? []).concat(option.value);
|
|
1730
|
+
} else {
|
|
1731
|
+
contextState.selected = option.value;
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
const onOptionUnselected = async (option: BaseOption) => {
|
|
1736
|
+
if (props.multiple) {
|
|
1737
|
+
const copy = { ...modelValueIndexedByHash.value };
|
|
1738
|
+
delete copy[option.valueHash];
|
|
1739
|
+
contextState.selected = Object.values(copy);
|
|
1740
|
+
} else {
|
|
1741
|
+
contextState.selected = null;
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
useHashedWatcher(
|
|
1746
|
+
() => [
|
|
1747
|
+
props.dependencies,
|
|
1748
|
+
props.items,
|
|
1749
|
+
// A provider-backed table refetches when the shared page moves: the page
|
|
1750
|
+
// only ever changes because something deliberately drove it (a paired
|
|
1751
|
+
// `BbPagination`, a `useBbTableContext` write, or a bound `page` prop),
|
|
1752
|
+
// and for a provider that can only mean "fetch that page". An array table
|
|
1753
|
+
// is paged externally by the consumer, so its rows arrive through `items`
|
|
1754
|
+
// and the page is a11y metadata only — never a refetch signal.
|
|
1755
|
+
typeof props.items === 'function'
|
|
1756
|
+
? [contextState.page, contextState.perPage]
|
|
1757
|
+
: undefined,
|
|
1758
|
+
],
|
|
1759
|
+
async () => {
|
|
1760
|
+
if (!hasPrefilled.value) {
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
// `prefill: true` — only a user-typed query passes `false`, and the table
|
|
1764
|
+
// has no search field. See the item-provider contract.
|
|
1765
|
+
await getter(true, contextState.selected);
|
|
1766
|
+
pruneIncoherent();
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
debounce: props.depsDebounceTime,
|
|
1770
|
+
}
|
|
1771
|
+
);
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* `enforce-coherence`: after every load, drop from the row-keyed models the
|
|
1775
|
+
* values whose row is not in the result set; values still present survive.
|
|
1776
|
+
* Models are only written when a prune actually removes something, so a
|
|
1777
|
+
* coherent state emits no spurious updates. Unlike the selects there is no
|
|
1778
|
+
* laziness interplay — the table always loads eagerly — but the same caveat
|
|
1779
|
+
* from the prop docs applies: state held on rows of other pages does not
|
|
1780
|
+
* survive a page-driven refetch.
|
|
1781
|
+
*/
|
|
1782
|
+
const pruneIncoherent = () => {
|
|
1783
|
+
if (!props.enforceCoherence) return;
|
|
1784
|
+
const rowHashes = new Set(options.value.map((option) => option.valueHash));
|
|
1785
|
+
const isCoherent = (value: unknown) => rowHashes.has(hash(value));
|
|
1786
|
+
|
|
1787
|
+
if (props.multiple) {
|
|
1788
|
+
const selected: any[] = contextState.selected ?? [];
|
|
1789
|
+
if (!selected.every(isCoherent)) {
|
|
1790
|
+
contextState.selected = selected.filter(isCoherent);
|
|
1791
|
+
}
|
|
1792
|
+
} else if (
|
|
1793
|
+
!isNil(contextState.selected) &&
|
|
1794
|
+
!isCoherent(contextState.selected)
|
|
1795
|
+
) {
|
|
1796
|
+
contextState.selected = null;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
const unselected = contextState.unselected ?? [];
|
|
1800
|
+
if (!unselected.every(isCoherent)) {
|
|
1801
|
+
contextState.unselected = unselected.filter(isCoherent);
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
if (props.highlightMultiple) {
|
|
1805
|
+
if (!highlightedValues.value.every(isCoherent)) {
|
|
1806
|
+
highlighted.value = highlightedValues.value.filter(isCoherent);
|
|
1807
|
+
}
|
|
1808
|
+
} else if (!isNil(highlighted.value) && !isCoherent(highlighted.value)) {
|
|
1809
|
+
highlighted.value = null;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
if (!expandedItems.value.every(isCoherent)) {
|
|
1813
|
+
expandedItems.value = expandedItems.value.filter(isCoherent);
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
|
|
1817
|
+
const mapColumnToCell = (
|
|
1818
|
+
column: BbTableColumn<Item>,
|
|
1819
|
+
item: BaseOption
|
|
1820
|
+
): MappedCell => {
|
|
1821
|
+
const slotName = slotNamesByKey.value[column.key];
|
|
1822
|
+
const align = column.align ?? 'left';
|
|
1823
|
+
let content = getItemValue(item.item, column.key);
|
|
1824
|
+
|
|
1825
|
+
if (column.formatter && (!isNil(content) || column.formatOnNull !== false)) {
|
|
1826
|
+
content = column.formatter(content, column.key, item.item);
|
|
1827
|
+
}
|
|
1828
|
+
if (column.placeholder && isNil(content)) {
|
|
1829
|
+
content = column.placeholder;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
return {
|
|
1833
|
+
align,
|
|
1834
|
+
classes: mergeCellClasses(
|
|
1835
|
+
[`bb-table-data__cell--${align}`],
|
|
1836
|
+
props.tdClass,
|
|
1837
|
+
column.tdClass,
|
|
1838
|
+
content,
|
|
1839
|
+
column.key,
|
|
1840
|
+
item.item
|
|
1841
|
+
),
|
|
1842
|
+
content,
|
|
1843
|
+
key: column.key,
|
|
1844
|
+
label: column.label,
|
|
1845
|
+
slotName,
|
|
1846
|
+
};
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
const mappedHeaders = computed(() =>
|
|
1850
|
+
props.columns.map((column: BbTableColumn<Item>): MappedHeader => {
|
|
1851
|
+
const align = column.align ?? 'left';
|
|
1852
|
+
const slotName = `header:${slotNamesByKey.value[column.key]}`;
|
|
1853
|
+
// The live sort model wins over the static `sorted` column flag.
|
|
1854
|
+
const sortOrder = sortOrderFor(column.key);
|
|
1855
|
+
const sorted = sortOrder ?? column.sorted;
|
|
1856
|
+
const sortDirection = sorted
|
|
1857
|
+
? sorted === 'asc'
|
|
1858
|
+
? 'ascending'
|
|
1859
|
+
: 'descending'
|
|
1860
|
+
: undefined;
|
|
1861
|
+
|
|
1862
|
+
return {
|
|
1863
|
+
align,
|
|
1864
|
+
key: column.key,
|
|
1865
|
+
label: column.label,
|
|
1866
|
+
slotName,
|
|
1867
|
+
classes: mergeHeaderClasses(
|
|
1868
|
+
[`bb-table-header--${align}`],
|
|
1869
|
+
props.thClass,
|
|
1870
|
+
column.thClass
|
|
1871
|
+
),
|
|
1872
|
+
sortable: !!column.sortable,
|
|
1873
|
+
sortDirection,
|
|
1874
|
+
sortOrder,
|
|
1875
|
+
};
|
|
1876
|
+
})
|
|
1877
|
+
);
|
|
1878
|
+
|
|
1879
|
+
const mappedItems = computed<MappedItem[]>(() => {
|
|
1880
|
+
let expandedRows = 0;
|
|
1881
|
+
return options.value.map((item: BaseOption, index: number): MappedItem => {
|
|
1882
|
+
const disabled =
|
|
1883
|
+
!props.selectable ||
|
|
1884
|
+
(typeof props.selectable === 'function' &&
|
|
1885
|
+
!props.selectable(item.item)) ||
|
|
1886
|
+
!!item.disabled;
|
|
1887
|
+
|
|
1888
|
+
// How many rows have passed
|
|
1889
|
+
const indexPageOffset =
|
|
1890
|
+
((contextState.page ?? 0) - 1) * (contextState.perPage ?? 0);
|
|
1891
|
+
const headRowOffset = 1;
|
|
1892
|
+
const increment = index + 1;
|
|
1893
|
+
const rowIndex = indexPageOffset + headRowOffset + increment + expandedRows;
|
|
1894
|
+
|
|
1895
|
+
// Create a projection of the columns and run all formatter logic so
|
|
1896
|
+
// we just display content in the template
|
|
1897
|
+
const cols: MappedCell[] = props.columns.map((column) =>
|
|
1898
|
+
mapColumnToCell(column, item)
|
|
1899
|
+
);
|
|
1900
|
+
const expanded = expandedItemsIndexedByHash.value[item.valueHash] ?? false;
|
|
1901
|
+
if (expanded) {
|
|
1902
|
+
expandedRows++;
|
|
1903
|
+
}
|
|
1904
|
+
const res = {
|
|
1905
|
+
accessibleLabel: getAccessibleLabel(cols, item.item),
|
|
1906
|
+
cols,
|
|
1907
|
+
expanded,
|
|
1908
|
+
highlighted: item.valueHash in highlightedIndexedByHash.value,
|
|
1909
|
+
rowClasses: mergeRowClasses(
|
|
1910
|
+
props.rowClass,
|
|
1911
|
+
props.columns,
|
|
1912
|
+
cols,
|
|
1913
|
+
item.item
|
|
1914
|
+
),
|
|
1915
|
+
onRowClick: (event: MouseEvent) => {
|
|
1916
|
+
onRowClickHighlight(event, item);
|
|
1917
|
+
emit('click:row', event, item, !!item.selected);
|
|
1918
|
+
},
|
|
1919
|
+
onRowContextMenu: (event: MouseEvent) =>
|
|
1920
|
+
emit('contextmenu:row', event, item, !!item.selected),
|
|
1921
|
+
onRowDblClick: (event: MouseEvent) =>
|
|
1922
|
+
emit('dblclick:row', event, item, !!item.selected),
|
|
1923
|
+
item: item.item,
|
|
1924
|
+
text: item.text,
|
|
1925
|
+
rowIndex,
|
|
1926
|
+
valueHash: item.valueHash,
|
|
1927
|
+
value: item.value,
|
|
1928
|
+
selected: item.selected,
|
|
1929
|
+
disabled,
|
|
1930
|
+
};
|
|
1931
|
+
return res;
|
|
1932
|
+
});
|
|
1933
|
+
});
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* Roving tabindex for the opt-in keyboard navigation: the row at this index is
|
|
1937
|
+
* the body's single tab stop (`tabindex="0"`, all others `-1`). Follows focus
|
|
1938
|
+
* (so a mouse click re-anchors arrow navigation) and is clamped when the item
|
|
1939
|
+
* list shrinks. Declared after `mappedItems`: the watch getter runs eagerly at
|
|
1940
|
+
* setup.
|
|
1941
|
+
*/
|
|
1942
|
+
const activeRowIndex = ref(0);
|
|
1943
|
+
|
|
1944
|
+
watch(
|
|
1945
|
+
() => mappedItems.value.length,
|
|
1946
|
+
(length) => {
|
|
1947
|
+
activeRowIndex.value = clamp(
|
|
1948
|
+
activeRowIndex.value,
|
|
1949
|
+
0,
|
|
1950
|
+
Math.max(0, length - 1)
|
|
1951
|
+
);
|
|
1952
|
+
}
|
|
1953
|
+
);
|
|
1954
|
+
|
|
1955
|
+
/** This table's own data rows (excludes expand rows and nested tables). */
|
|
1956
|
+
const dataRows = () =>
|
|
1957
|
+
tableRef.value?.querySelectorAll<HTMLElement>(
|
|
1958
|
+
':scope > tbody > tr.bb-table-data__row'
|
|
1959
|
+
);
|
|
1960
|
+
|
|
1961
|
+
const focusRow = (index: number) => {
|
|
1962
|
+
activeRowIndex.value = index;
|
|
1963
|
+
const row = dataRows()?.[index];
|
|
1964
|
+
row?.focus();
|
|
1965
|
+
row?.scrollIntoView({ block: 'nearest' });
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
const onRowFocus = (index: number) => {
|
|
1969
|
+
if (!props.keyboardNavigation) return;
|
|
1970
|
+
activeRowIndex.value = index;
|
|
1971
|
+
};
|
|
1972
|
+
|
|
1973
|
+
/**
|
|
1974
|
+
* PageUp/PageDown stride, clamped at the edges. A fixed count (the APG grid
|
|
1975
|
+
* pattern leaves it "author-determined") — not viewport-derived, so the jump
|
|
1976
|
+
* is predictable and testable, and not a prop, so the surface stays frozen.
|
|
1977
|
+
*/
|
|
1978
|
+
const KEYBOARD_PAGE_JUMP = 10;
|
|
1979
|
+
|
|
1980
|
+
/**
|
|
1981
|
+
* Keyboard navigation (opt-in via `keyboardNavigation`): arrows move the
|
|
1982
|
+
* focused row, PageUp/PageDown stride `KEYBOARD_PAGE_JUMP` rows, Home/End
|
|
1983
|
+
* jump, Enter/Space activate the row through the same
|
|
1984
|
+
* code path as a mouse click (highlight toggle + `click:row`) — focus and
|
|
1985
|
+
* highlight stay independent until that commit. Only keys pressed on the row
|
|
1986
|
+
* itself are handled: events bubbling from interactive descendants (or from a
|
|
1987
|
+
* nested table's rows) keep their own semantics.
|
|
1988
|
+
*/
|
|
1989
|
+
const onRowKeydown = (event: KeyboardEvent, index: number) => {
|
|
1990
|
+
if (!props.keyboardNavigation) return;
|
|
1991
|
+
if (event.target !== event.currentTarget) return;
|
|
1992
|
+
const lastIndex = mappedItems.value.length - 1;
|
|
1993
|
+
if (lastIndex < 0) return;
|
|
1994
|
+
const move = (next: number) => {
|
|
1995
|
+
event.preventDefault();
|
|
1996
|
+
focusRow(clamp(next, 0, lastIndex));
|
|
1997
|
+
};
|
|
1998
|
+
switch (event.key) {
|
|
1999
|
+
case 'ArrowDown':
|
|
2000
|
+
move(index + 1);
|
|
2001
|
+
break;
|
|
2002
|
+
case 'ArrowUp':
|
|
2003
|
+
move(index - 1);
|
|
2004
|
+
break;
|
|
2005
|
+
case 'PageDown':
|
|
2006
|
+
move(index + KEYBOARD_PAGE_JUMP);
|
|
2007
|
+
break;
|
|
2008
|
+
case 'PageUp':
|
|
2009
|
+
move(index - KEYBOARD_PAGE_JUMP);
|
|
2010
|
+
break;
|
|
2011
|
+
case 'Home':
|
|
2012
|
+
move(0);
|
|
2013
|
+
break;
|
|
2014
|
+
case 'End':
|
|
2015
|
+
move(lastIndex);
|
|
2016
|
+
break;
|
|
2017
|
+
case 'Enter':
|
|
2018
|
+
case ' ':
|
|
2019
|
+
event.preventDefault();
|
|
2020
|
+
(event.currentTarget as HTMLElement).click();
|
|
2021
|
+
break;
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
const { data: expandedItemsIndexedByHash } = useIndexById({
|
|
2026
|
+
items: expandedItems,
|
|
2027
|
+
});
|
|
2028
|
+
|
|
2029
|
+
const onExpandControllerKeydown = (event: KeyboardEvent, valueHash: string) => {
|
|
2030
|
+
if (!(event.target instanceof HTMLElement)) return;
|
|
2031
|
+
if (event.target instanceof HTMLButtonElement) return;
|
|
2032
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
2033
|
+
event.preventDefault();
|
|
2034
|
+
toggleExpandedFor(valueHash);
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
const getExpandControllerProps = (item: MappedItem) => ({
|
|
2038
|
+
'aria-controls': isNil(expandedItemsIndexedByHash.value[item.valueHash])
|
|
2039
|
+
? undefined
|
|
2040
|
+
: `expanded_${item.valueHash}`,
|
|
2041
|
+
'aria-expanded': item.expanded ? 'true' : 'false',
|
|
2042
|
+
onClick: (event: MouseEvent) => {
|
|
2043
|
+
event.stopPropagation();
|
|
2044
|
+
toggleExpandedFor(item.valueHash);
|
|
2045
|
+
},
|
|
2046
|
+
onKeydown: (event: KeyboardEvent) =>
|
|
2047
|
+
onExpandControllerKeydown(event, item.valueHash),
|
|
2048
|
+
});
|
|
2049
|
+
|
|
2050
|
+
const toggleExpandedFor = (valueHash: string) => {
|
|
2051
|
+
const linkedOption = options.value.find((o) => o.valueHash === valueHash);
|
|
2052
|
+
if (!linkedOption) return;
|
|
2053
|
+
if (valueHash in expandedItemsIndexedByHash.value) {
|
|
2054
|
+
expandedItems.value = expandedItems.value.filter(
|
|
2055
|
+
(o) => hash(o) !== valueHash
|
|
2056
|
+
);
|
|
2057
|
+
} else {
|
|
2058
|
+
expandedItems.value = [...expandedItems.value, linkedOption.value];
|
|
2059
|
+
}
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
watch(selectAll, () => {
|
|
2063
|
+
unselectedItems.clear();
|
|
2064
|
+
contextState.unselected = [];
|
|
2065
|
+
contextState.selected = [];
|
|
2066
|
+
});
|
|
2067
|
+
|
|
2068
|
+
const indeterminate = computed(() => {
|
|
2069
|
+
const selectedCount = Array.isArray(contextState.selected)
|
|
2070
|
+
? contextState.selected.length
|
|
2071
|
+
: 0;
|
|
2072
|
+
if (props.multiple && selectedCount > 0 && !selectAll.value) {
|
|
2073
|
+
return true;
|
|
2074
|
+
}
|
|
2075
|
+
if (selectAll.value && unselectedItems.size > 0) {
|
|
2076
|
+
return true;
|
|
2077
|
+
}
|
|
2078
|
+
return false;
|
|
2079
|
+
});
|
|
2080
|
+
|
|
2081
|
+
const unselectedItems = reactive(new Set<string>());
|
|
2082
|
+
watch(
|
|
2083
|
+
() => contextState.unselected,
|
|
2084
|
+
(value) => {
|
|
2085
|
+
unselectedItems.clear();
|
|
2086
|
+
(value ?? []).forEach((i) => {
|
|
2087
|
+
unselectedItems.add(hash(i));
|
|
2088
|
+
});
|
|
2089
|
+
},
|
|
2090
|
+
{ immediate: true }
|
|
2091
|
+
);
|
|
2092
|
+
|
|
2093
|
+
const onInputChange = (item: BaseOption) => {
|
|
2094
|
+
const currentUnselected = contextState.unselected ?? [];
|
|
2095
|
+
if (isSelected(item)) {
|
|
2096
|
+
onOptionUnselected(item);
|
|
2097
|
+
emit('item:unselected', item.value);
|
|
2098
|
+
unselectedItems.add(item.valueHash);
|
|
2099
|
+
contextState.unselected = [...currentUnselected, item.value];
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
if (!selectAll.value) {
|
|
2103
|
+
onOptionSelected(item);
|
|
2104
|
+
}
|
|
2105
|
+
emit('item:selected', item.value);
|
|
2106
|
+
unselectedItems.delete(item.valueHash);
|
|
2107
|
+
contextState.unselected = currentUnselected.filter(
|
|
2108
|
+
(i) => hash(i) !== hash(item.value)
|
|
2109
|
+
);
|
|
2110
|
+
};
|
|
2111
|
+
|
|
2112
|
+
const isSelected = (item: BaseOption): boolean => {
|
|
2113
|
+
if (unselectedItems.has(item.valueHash)) return false;
|
|
2114
|
+
return item.selected || selectAll.value;
|
|
2115
|
+
};
|
|
2116
|
+
|
|
2117
|
+
/**
|
|
2118
|
+
* Selection channel for user-defined controls in slots: same pathway as the
|
|
2119
|
+
* built-in checkbox/radio. Only *explicit* blocks apply — a disabled/readonly
|
|
2120
|
+
* table, a row excluded by a `selectable` function, or a disabled option. A
|
|
2121
|
+
* merely absent `selectable` prop does not block: that prop governs the
|
|
2122
|
+
* built-in selection column, while a slot-wired control is deliberate intent
|
|
2123
|
+
* and selection state (v-model, context) works independently of that column.
|
|
2124
|
+
*/
|
|
2125
|
+
/**
|
|
2126
|
+
* Whether `toggleSelectedFor` would refuse to toggle this row — the exact
|
|
2127
|
+
* predicate the callback uses, so the `#select` slot's `disabled` prop never
|
|
2128
|
+
* disagrees with what `toggleSelected` actually does. Unlike the built-in
|
|
2129
|
+
* column's per-row `disabled` (which gates rendering only), this folds in
|
|
2130
|
+
* table-wide `disabled`/`readonly`.
|
|
2131
|
+
*/
|
|
2132
|
+
const isSelectToggleBlocked = (item: MappedItem): boolean => {
|
|
2133
|
+
if (props.disabled || props.readonly) return true;
|
|
2134
|
+
if (typeof props.selectable === 'function' && !props.selectable(item.item)) {
|
|
2135
|
+
return true;
|
|
2136
|
+
}
|
|
2137
|
+
const option = options.value.find((o) => o.valueHash === item.valueHash);
|
|
2138
|
+
return !option || !!option.disabled;
|
|
2139
|
+
};
|
|
2140
|
+
|
|
2141
|
+
const toggleSelectedFor = (item: MappedItem) => {
|
|
2142
|
+
if (isSelectToggleBlocked(item)) return;
|
|
2143
|
+
onInputChange(item);
|
|
2144
|
+
};
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* When using this component for submission we add a bunch of hidden inputs
|
|
2148
|
+
* so the submitted inputs is on par with v-model
|
|
2149
|
+
*/
|
|
2150
|
+
|
|
2151
|
+
/**
|
|
2152
|
+
* This is used to keep the value compatible to common html expected values.
|
|
2153
|
+
* Convert to string everything that's not but do not double encode strings
|
|
2154
|
+
*/
|
|
2155
|
+
const makeInputValue = when(
|
|
2156
|
+
(item: unknown) => typeof item !== 'string',
|
|
2157
|
+
JSON.stringify
|
|
2158
|
+
);
|
|
2159
|
+
const hiddenInputs = computed(() =>
|
|
2160
|
+
[].concat(contextState.selected ?? []).map((current: unknown) => ({
|
|
2161
|
+
disabled: props.disabled,
|
|
2162
|
+
name: props.name,
|
|
2163
|
+
type: 'hidden' as const,
|
|
2164
|
+
value: makeInputValue(current),
|
|
2165
|
+
}))
|
|
2166
|
+
);
|
|
2167
|
+
|
|
2168
|
+
/** Varied line widths for skeleton (percent) to avoid a mechanical look */
|
|
2169
|
+
const skeletonLineWidths = [70, 45, 85, 55];
|
|
2170
|
+
|
|
2171
|
+
const skeletonLength = computed(() =>
|
|
2172
|
+
clamp(options.value.length || props.columns.length || 1, 4, 10)
|
|
2173
|
+
);
|
|
2174
|
+
|
|
2175
|
+
watch(
|
|
2176
|
+
() => [mappedItems.value, props.fixedColumns],
|
|
2177
|
+
() => {
|
|
2178
|
+
if (tableRef.value && props.fixedColumns?.length) {
|
|
2179
|
+
applyFixedTableColumns(tableRef.value, props.fixedColumns);
|
|
2180
|
+
}
|
|
2181
|
+
},
|
|
2182
|
+
{ flush: 'post' }
|
|
2183
|
+
);
|
|
2184
|
+
</script>
|
|
2185
|
+
|
|
2186
|
+
<style lang="postcss">
|
|
2187
|
+
@import './index.css';
|
|
2188
|
+
</style>
|
|
2189
|
+
```
|
|
2190
|
+
|
|
2191
|
+
## Types
|
|
2192
|
+
|
|
2193
|
+
```ts
|
|
2194
|
+
import type { Classes } from '@/types/Classes';
|
|
2195
|
+
import type { ItemAccessor } from '@/types/ItemAccessor';
|
|
2196
|
+
import type { Option } from '@/types/Option';
|
|
2197
|
+
import type { InputHTMLAttributes } from 'vue';
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* Recursively builds dot-notation paths from a type's keys.
|
|
2201
|
+
* Depth-limited to 3 levels to avoid compiler performance issues.
|
|
2202
|
+
*/
|
|
2203
|
+
type NestedPaths<T, Depth extends unknown[] = []> = Depth['length'] extends 3
|
|
2204
|
+
? never
|
|
2205
|
+
: 0 extends 1 & T
|
|
2206
|
+
? string
|
|
2207
|
+
: T extends object
|
|
2208
|
+
? // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- type-level filter must match any function shape
|
|
2209
|
+
T extends any[] | Date | Function | RegExp | Map<any, any> | Set<any>
|
|
2210
|
+
? never
|
|
2211
|
+
: {
|
|
2212
|
+
[K in Extract<keyof T, string>]:
|
|
2213
|
+
| K
|
|
2214
|
+
| `${K}.${NestedPaths<NonNullable<T[K]>, [...Depth, unknown]>}`;
|
|
2215
|
+
}[Extract<keyof T, string>]
|
|
2216
|
+
: never;
|
|
2217
|
+
|
|
2218
|
+
/**
|
|
2219
|
+
* Suggested keys for a column derived from an Item type.
|
|
2220
|
+
* Provides autocomplete for nested dot-notation paths (up to 3 levels)
|
|
2221
|
+
* while still allowing arbitrary string keys for virtual columns.
|
|
2222
|
+
*/
|
|
2223
|
+
export type ItemKey<Item = any> = NestedPaths<Item> | (string & {});
|
|
2224
|
+
|
|
2225
|
+
/**
|
|
2226
|
+
* Column keys the table owns and renders itself, from the `actions` and
|
|
2227
|
+
* `selectable` props rather than from `columns`.
|
|
2228
|
+
*
|
|
2229
|
+
* These cannot be excluded from {@link ItemKey} directly: its `(string & {})`
|
|
2230
|
+
* arm exists so virtual columns can use arbitrary keys, and `Exclude` over
|
|
2231
|
+
* `string` is a no-op. The ban is applied where the key type is generic and
|
|
2232
|
+
* inferred per column, so the conditional has literal types to distribute over.
|
|
2233
|
+
*/
|
|
2234
|
+
export type ReservedColumnKey = 'actions' | 'select';
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* Skeleton placeholder style for the loading state.
|
|
2238
|
+
* Matches the expected content type for a better loading experience.
|
|
2239
|
+
*/
|
|
2240
|
+
export type SkeletonType =
|
|
2241
|
+
| 'text'
|
|
2242
|
+
| 'avatar'
|
|
2243
|
+
| 'avatar-text'
|
|
2244
|
+
| 'image'
|
|
2245
|
+
| 'badge';
|
|
2246
|
+
|
|
2247
|
+
export type BaseColumn<Item = any> = {
|
|
2248
|
+
/**
|
|
2249
|
+
* When set to false the formatter will not run on nullish values.
|
|
2250
|
+
* By default is true so you can create virtual columns with keys that do not
|
|
2251
|
+
* reference a prop in the `item` and still extract data from the other
|
|
2252
|
+
* arguments in the formatting function.
|
|
2253
|
+
*/
|
|
2254
|
+
formatOnNull?: boolean;
|
|
2255
|
+
|
|
2256
|
+
/**
|
|
2257
|
+
* Formatting function used to generate enhanced content.
|
|
2258
|
+
* @param content The content generated by the extraction of `Item[key]`
|
|
2259
|
+
* @param key Key of the column taken from the column definition.
|
|
2260
|
+
* @param item Item of the row.
|
|
2261
|
+
*/
|
|
2262
|
+
formatter?: (content: any, key: string, item: Item) => any;
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Key identifying the column.
|
|
2266
|
+
*/
|
|
2267
|
+
key: ItemKey<Item>;
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* Text used in the header for this column.
|
|
2271
|
+
*/
|
|
2272
|
+
label: string;
|
|
2273
|
+
|
|
2274
|
+
/**
|
|
2275
|
+
* Placeholder used when the pipeline returns null content.
|
|
2276
|
+
*/
|
|
2277
|
+
placeholder?: string;
|
|
2278
|
+
};
|
|
2279
|
+
|
|
2280
|
+
/**
|
|
2281
|
+
* Column definition for BbTable. Controls data extraction, formatting, alignment, and styling.
|
|
2282
|
+
*/
|
|
2283
|
+
export type BbTableColumn<Item = any> = BaseColumn<Item> & {
|
|
2284
|
+
/**
|
|
2285
|
+
* Text alignment of the column.
|
|
2286
|
+
*/
|
|
2287
|
+
align?: 'left' | 'right' | 'center';
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Skeleton placeholder style shown during loading. Defaults to `'text'`.
|
|
2291
|
+
*/
|
|
2292
|
+
skeleton?: SkeletonType;
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* Enables sorting on this column: the header renders as a button that
|
|
2296
|
+
* cycles the column's entry in the `sort` model (asc → desc → removed).
|
|
2297
|
+
*/
|
|
2298
|
+
sortable?: boolean;
|
|
2299
|
+
|
|
2300
|
+
/**
|
|
2301
|
+
* Defines the sorting direction of the column.
|
|
2302
|
+
*/
|
|
2303
|
+
sorted?: 'asc' | 'desc';
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* Classes this column contributes to the whole row's `<tr>`. Every column's
|
|
2307
|
+
* `rowClass` is accumulated with the table-level `rowClass` prop and applied
|
|
2308
|
+
* together. Can also be a function of the cell's content for dynamic values.
|
|
2309
|
+
*/
|
|
2310
|
+
rowClass?: ColumnClasses<Item>;
|
|
2311
|
+
|
|
2312
|
+
/**
|
|
2313
|
+
* Defines the classes to be passed to the `<td>` elements. Can also be a function for dynamic values.
|
|
2314
|
+
*/
|
|
2315
|
+
tdClass?: ColumnClasses<Item>;
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* Defines the classes to be passed to the `<th>`.
|
|
2319
|
+
*/
|
|
2320
|
+
thClass?: Classes;
|
|
2321
|
+
|
|
2322
|
+
/**
|
|
2323
|
+
* Freezes the column to a fixed width (numbers are treated as px). When
|
|
2324
|
+
* omitted the column syncs its width to the parent table's matching track.
|
|
2325
|
+
*/
|
|
2326
|
+
width?: number | string;
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* For a nested table, where this column snaps onto the parent's grid. The
|
|
2330
|
+
* parent's columns form snap points where `select` occupies `[0, 1]`, data
|
|
2331
|
+
* column `k` occupies `[k + 1, k + 2]` and `actions` occupies `[N + 1, N + 2]`.
|
|
2332
|
+
*
|
|
2333
|
+
* - A single number is a start snap point that takes one parent track, e.g.
|
|
2334
|
+
* `2` → `[2, 3]`. It may skip ahead (`5` jumps straight to the sixth track),
|
|
2335
|
+
* and the next column resumes from where it ends.
|
|
2336
|
+
* - A `[start, end]` pair snaps between two points; the width is the sum of
|
|
2337
|
+
* the fractional parent tracks it covers, so `[3, 4.5]` is the full fourth
|
|
2338
|
+
* track plus half of the fifth. `end` of `-1` runs to the end of the data
|
|
2339
|
+
* region.
|
|
2340
|
+
*
|
|
2341
|
+
* When omitted the column chains from the previous column's end to the next
|
|
2342
|
+
* whole snap point (a one-to-one inheritance by index).
|
|
2343
|
+
*/
|
|
2344
|
+
snap?: number | [start: number, end: number];
|
|
2345
|
+
};
|
|
2346
|
+
|
|
2347
|
+
export type BbTableProps<Item = any> = {
|
|
2348
|
+
/**
|
|
2349
|
+
* Function that accepts the columns and the current item as
|
|
2350
|
+
* arguments and returns a label to be used for accessibility purposes.
|
|
2351
|
+
*/
|
|
2352
|
+
accessibleLabel?: (columns: MappedCell[], item: any) => string;
|
|
2353
|
+
|
|
2354
|
+
/**
|
|
2355
|
+
* Displays the actions column.
|
|
2356
|
+
*/
|
|
2357
|
+
actions?: boolean;
|
|
2358
|
+
|
|
2359
|
+
/**
|
|
2360
|
+
* Label used in the header of the actions column.
|
|
2361
|
+
*/
|
|
2362
|
+
actionsText?: string;
|
|
2363
|
+
|
|
2364
|
+
/**
|
|
2365
|
+
* Text alignment of the columns.
|
|
2366
|
+
*
|
|
2367
|
+
* @defaultValue `'left'`
|
|
2368
|
+
*/
|
|
2369
|
+
align?: 'left' | 'center' | 'right';
|
|
2370
|
+
|
|
2371
|
+
/**
|
|
2372
|
+
* Stable id for this table's width context. When omitted a unique id is
|
|
2373
|
+
* generated. Nested tables use the nearest ancestor id to inherit widths.
|
|
2374
|
+
*/
|
|
2375
|
+
id?: string;
|
|
2376
|
+
|
|
2377
|
+
/**
|
|
2378
|
+
* Opt a nested table into inheriting its column widths from an ancestor
|
|
2379
|
+
* table's matching tracks (accounting for `select`/`actions` columns). This
|
|
2380
|
+
* also forces `table-layout: fixed`, so it is **off by default** — a nested
|
|
2381
|
+
* table renders independently unless you ask for alignment.
|
|
2382
|
+
* - `false` (the default): do not inherit; size independently.
|
|
2383
|
+
* - `true`: inherit from the nearest ancestor table.
|
|
2384
|
+
* - a table id (string): inherit from the specific ancestor in the chain with
|
|
2385
|
+
* that id rather than the immediate parent. Use this when an intermediate
|
|
2386
|
+
* table has a different column count, so the extra columns would otherwise
|
|
2387
|
+
* misalign against it.
|
|
2388
|
+
*/
|
|
2389
|
+
inheritColumnWidths?: boolean | string;
|
|
2390
|
+
|
|
2391
|
+
/**
|
|
2392
|
+
* Hides the "Select all" checkbox that selectable multi-row tables
|
|
2393
|
+
* display by default.
|
|
2394
|
+
*
|
|
2395
|
+
* @defaultValue `false`
|
|
2396
|
+
*/
|
|
2397
|
+
disableSelectAll?: boolean;
|
|
2398
|
+
|
|
2399
|
+
/**
|
|
2400
|
+
* Caption that describes the content of the table. Used for accessibility purposes.
|
|
2401
|
+
*/
|
|
2402
|
+
caption?: string;
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* Array of definitions of how the columns should be rendered.
|
|
2406
|
+
*
|
|
2407
|
+
*/
|
|
2408
|
+
columns: Array<BbTableColumn<Item>>;
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* Adds a CSS class that applies a compact style to the component.
|
|
2412
|
+
*/
|
|
2413
|
+
compact?: boolean;
|
|
2414
|
+
|
|
2415
|
+
/**
|
|
2416
|
+
* Defines an array of dependencies that will trigger actions in the component upon change.
|
|
2417
|
+
*
|
|
2418
|
+
* @defaultValue `[]`
|
|
2419
|
+
*/
|
|
2420
|
+
dependencies?: unknown[];
|
|
2421
|
+
|
|
2422
|
+
/**
|
|
2423
|
+
* Timeout used to debounce response to changes to dependencies.
|
|
2424
|
+
*
|
|
2425
|
+
* @defaultValue `0`
|
|
2426
|
+
*/
|
|
2427
|
+
depsDebounceTime?: number;
|
|
2428
|
+
|
|
2429
|
+
/**
|
|
2430
|
+
* Disables the component
|
|
2431
|
+
*/
|
|
2432
|
+
disabled?: boolean;
|
|
2433
|
+
|
|
2434
|
+
/**
|
|
2435
|
+
* After every load (initial, `dependencies` refetch or a change of the
|
|
2436
|
+
* `items` array) prunes the row-keyed models of values whose row is no
|
|
2437
|
+
* longer in the result set: `modelValue`, `unselected-items`,
|
|
2438
|
+
* `highlighted` and `expanded-items`. Values whose rows are still present
|
|
2439
|
+
* survive. Single-value models (`modelValue` without `multiple`,
|
|
2440
|
+
* `highlighted` without `highlight-multiple`) reset to `null`.
|
|
2441
|
+
*
|
|
2442
|
+
* Do **not** enable it on paginated tables where the page feeds
|
|
2443
|
+
* `dependencies`: every page turn is a refetch, so state held on rows of
|
|
2444
|
+
* other pages (the `select-all` + `unselected-items` pattern, cross-page
|
|
2445
|
+
* selections) would be pruned. Reconcile in the items provider instead.
|
|
2446
|
+
*
|
|
2447
|
+
* @defaultValue `false`
|
|
2448
|
+
*/
|
|
2449
|
+
enforceCoherence?: boolean;
|
|
2450
|
+
|
|
2451
|
+
/**
|
|
2452
|
+
* Boolean that defines whether to display or hide the caption.
|
|
2453
|
+
* By default is true and the caption is hidden.
|
|
2454
|
+
*/
|
|
2455
|
+
displayCaption?: boolean;
|
|
2456
|
+
|
|
2457
|
+
/**
|
|
2458
|
+
* Defines the table layout as fixed
|
|
2459
|
+
* making each column take up the same amount of space.
|
|
2460
|
+
*/
|
|
2461
|
+
fixed?: boolean;
|
|
2462
|
+
|
|
2463
|
+
/**
|
|
2464
|
+
* Definition for which column should be fixed.
|
|
2465
|
+
* It can be an array of index of the column to fix on the left side of the table or
|
|
2466
|
+
* an array of objects indicating the index and the position `left` or `right` where to affix the columns.
|
|
2467
|
+
*
|
|
2468
|
+
* @defaultValue `[]`
|
|
2469
|
+
*/
|
|
2470
|
+
fixedColumns?: Array<number | { index: number; position: 'left' | 'right' }>;
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* Boolean that sets the headers as sticky to the top of the table.
|
|
2474
|
+
*/
|
|
2475
|
+
fixedHeaders?: boolean;
|
|
2476
|
+
|
|
2477
|
+
/**
|
|
2478
|
+
* Used by `v-model:highlighted`. A parallel, UI-intent state to selection —
|
|
2479
|
+
* typically "the row whose details are open". A single item value (or
|
|
2480
|
+
* `null`) by default; an array of values with `highlightMultiple`.
|
|
2481
|
+
* Purely mechanical: highlighted rows only get the
|
|
2482
|
+
* `bb-table-data__row--highlighted` class (and `aria-current`) — no styling
|
|
2483
|
+
* is shipped, targeting the class is up to the consumer.
|
|
2484
|
+
*/
|
|
2485
|
+
highlighted?: any;
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* Allows highlighting multiple rows: `highlighted` becomes an array of item
|
|
2489
|
+
* values instead of a single value.
|
|
2490
|
+
*/
|
|
2491
|
+
highlightMultiple?: boolean;
|
|
2492
|
+
|
|
2493
|
+
/**
|
|
2494
|
+
* Rows to render, or a fetcher that returns them.
|
|
2495
|
+
*
|
|
2496
|
+
* @defaultValue `[]`
|
|
2497
|
+
*/
|
|
2498
|
+
items:
|
|
2499
|
+
| Item[]
|
|
2500
|
+
| ((prefill: boolean, modelValue?: any) => Item[] | Promise<Item[]>);
|
|
2501
|
+
|
|
2502
|
+
/**
|
|
2503
|
+
* Opt-in keyboard navigation with a roving tabindex: the body is one tab
|
|
2504
|
+
* stop, ArrowUp/ArrowDown move the focused row (Home/End jump), and
|
|
2505
|
+
* Enter/Space activate it through the same path as a mouse click (highlight
|
|
2506
|
+
* toggle + `click:row`). Focus and highlight stay independent — moving does
|
|
2507
|
+
* not highlight until committed. Focused rows show the standard focus ring.
|
|
2508
|
+
*/
|
|
2509
|
+
keyboardNavigation?: boolean;
|
|
2510
|
+
|
|
2511
|
+
itemValue?: ItemAccessor<Item>;
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* Text content of the legend.
|
|
2515
|
+
*/
|
|
2516
|
+
legend?: string;
|
|
2517
|
+
|
|
2518
|
+
/**
|
|
2519
|
+
* Sets the component in a loading state, usually triggering some visual styles.
|
|
2520
|
+
*
|
|
2521
|
+
* With no rows yet this renders skeletons; over existing rows the rows stay
|
|
2522
|
+
* on screen (dimmed, with an indeterminate bar) rather than being replaced —
|
|
2523
|
+
* a refetch should not blank a table the user is reading.
|
|
2524
|
+
*/
|
|
2525
|
+
loading?: boolean;
|
|
2526
|
+
|
|
2527
|
+
/**
|
|
2528
|
+
* Keeps the table interactive while it is loading. The header and the rows are
|
|
2529
|
+
* `inert` while loading by default — a refetch is about to replace the rows,
|
|
2530
|
+
* so editing, selecting or sorting them races the incoming data. This escape
|
|
2531
|
+
* hatch exists for tables that must stay usable during background refreshes
|
|
2532
|
+
* (e.g. a poll that must not interrupt an open editor).
|
|
2533
|
+
*
|
|
2534
|
+
* The loading announcement is never inert, so the busy state is always
|
|
2535
|
+
* conveyed.
|
|
2536
|
+
*/
|
|
2537
|
+
interactiveWhileLoading?: boolean;
|
|
2538
|
+
|
|
2539
|
+
/**
|
|
2540
|
+
* String displayed while items are being loaded.
|
|
2541
|
+
*/
|
|
2542
|
+
loadingText?: string;
|
|
2543
|
+
|
|
2544
|
+
/**
|
|
2545
|
+
* Maximum number of items that can be selected.
|
|
2546
|
+
*
|
|
2547
|
+
* @defaultValue `Infinity`
|
|
2548
|
+
*/
|
|
2549
|
+
max?: number;
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* Used by v-model. Can be any serializable type.
|
|
2553
|
+
*
|
|
2554
|
+
* @defaultValue `[]`
|
|
2555
|
+
*/
|
|
2556
|
+
modelValue?: any;
|
|
2557
|
+
|
|
2558
|
+
/**
|
|
2559
|
+
* Allows the selection of multiple items.
|
|
2560
|
+
*
|
|
2561
|
+
* @defaultValue `true`
|
|
2562
|
+
*/
|
|
2563
|
+
multiple?: boolean;
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* Defines the name of the input.
|
|
2567
|
+
*/
|
|
2568
|
+
name?: InputHTMLAttributes['name'];
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* String displayed when there are no items to display.
|
|
2572
|
+
*/
|
|
2573
|
+
noDataText?: string;
|
|
2574
|
+
|
|
2575
|
+
/**
|
|
2576
|
+
* Current page number starting from 1, used for accessibility purposes.
|
|
2577
|
+
*/
|
|
2578
|
+
page?: number;
|
|
2579
|
+
|
|
2580
|
+
/**
|
|
2581
|
+
* Number of items per page, used for accessibility purposes.
|
|
2582
|
+
*/
|
|
2583
|
+
perPage?: number;
|
|
2584
|
+
|
|
2585
|
+
/**
|
|
2586
|
+
* Sets the input in a readonly state.
|
|
2587
|
+
*/
|
|
2588
|
+
readonly?: boolean;
|
|
2589
|
+
|
|
2590
|
+
/**
|
|
2591
|
+
* Defines the classes to be passed to each data `<tr>`. Can also be a
|
|
2592
|
+
* function of the row's item for dynamic values.
|
|
2593
|
+
*/
|
|
2594
|
+
rowClass?: RowClasses<Item>;
|
|
2595
|
+
|
|
2596
|
+
/**
|
|
2597
|
+
* Defines the classes to be passed to the header `<tr>`.
|
|
2598
|
+
*/
|
|
2599
|
+
headerRowClass?: Classes;
|
|
2600
|
+
|
|
2601
|
+
/**
|
|
2602
|
+
* Defines whether the "Select all" checkbox is checked.
|
|
2603
|
+
*
|
|
2604
|
+
* @defaultValue `false`
|
|
2605
|
+
*/
|
|
2606
|
+
selectAll?: boolean;
|
|
2607
|
+
|
|
2608
|
+
/**
|
|
2609
|
+
* Defines whether the table is selectable.
|
|
2610
|
+
* Can be a global boolean that affects all rows or a function
|
|
2611
|
+
* that accepts an item and returns a boolean that only affects that item.
|
|
2612
|
+
*/
|
|
2613
|
+
selectable?: boolean | ((item: Item) => boolean);
|
|
2614
|
+
|
|
2615
|
+
/**
|
|
2616
|
+
* Used by `v-model:sort`. Ordered array of `[columnKey, direction]`
|
|
2617
|
+
* entries, one per actively sorted column. Bidirectional: the header
|
|
2618
|
+
* buttons of `sortable` columns update it, and external writes update the
|
|
2619
|
+
* header indicators. The table does not sort its items — apply the model
|
|
2620
|
+
* to your own data source.
|
|
2621
|
+
*
|
|
2622
|
+
* @defaultValue `[]`
|
|
2623
|
+
*/
|
|
2624
|
+
sort?: BbTableSortEntry[];
|
|
2625
|
+
|
|
2626
|
+
/**
|
|
2627
|
+
* Used by `v-model:expandedItems`. Array of the currently expanded items —
|
|
2628
|
+
* toggled by the row expand control and by external writes (mirrors the
|
|
2629
|
+
* `highlighted`/`sort` v-model surfaces). Drives the `#expand` slot rows and
|
|
2630
|
+
* their `aria-expanded`/`aria-controls` wiring.
|
|
2631
|
+
*
|
|
2632
|
+
* @defaultValue `[]`
|
|
2633
|
+
*/
|
|
2634
|
+
expandedItems?: any[];
|
|
2635
|
+
|
|
2636
|
+
/**
|
|
2637
|
+
* Text of the label used by the "Select all" boolean.
|
|
2638
|
+
*/
|
|
2639
|
+
selectAllLabel?: string;
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* Text of the header used for the radio inputs when the table is not `multiple`.
|
|
2643
|
+
*/
|
|
2644
|
+
selectText?: string;
|
|
2645
|
+
|
|
2646
|
+
/**
|
|
2647
|
+
* Defines the classes to be passed to the `<td>` elements. Can also be a function for dynamic values.
|
|
2648
|
+
*/
|
|
2649
|
+
tdClass?: ColumnClasses<Item>;
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Defines the classes to be passed to the `<th>`.
|
|
2653
|
+
*/
|
|
2654
|
+
thClass?: Classes;
|
|
2655
|
+
|
|
2656
|
+
/**
|
|
2657
|
+
* Total number of items there is.
|
|
2658
|
+
*/
|
|
2659
|
+
totalItems?: number;
|
|
2660
|
+
|
|
2661
|
+
/**
|
|
2662
|
+
* Seeds the page count shown by a `BbPagination` paired through `id`. A
|
|
2663
|
+
* shortcut for when the server reports a page count rather than a row
|
|
2664
|
+
* count: the table renders nothing from it, it only flows into the shared
|
|
2665
|
+
* table context. A known total always wins — when `totalItems` (or a
|
|
2666
|
+
* context write) provides one, the page count is derived from it and this
|
|
2667
|
+
* seed is ignored.
|
|
2668
|
+
*/
|
|
2669
|
+
totalPages?: number;
|
|
2670
|
+
|
|
2671
|
+
/**
|
|
2672
|
+
* Items that are not selected.
|
|
2673
|
+
*
|
|
2674
|
+
* @defaultValue `[]`
|
|
2675
|
+
*/
|
|
2676
|
+
unselectedItems?: any[];
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* We allow table data classes to be a function so it can depend on the item.
|
|
2681
|
+
* The function may return `undefined` — the common "no class for this row"
|
|
2682
|
+
* branch of a conditional — which contributes nothing, exactly like `''`.
|
|
2683
|
+
*/
|
|
2684
|
+
export type ColumnClasses<Item = any> =
|
|
2685
|
+
| Classes
|
|
2686
|
+
| ((content: any, key: string, item: Item) => Classes | undefined);
|
|
2687
|
+
|
|
2688
|
+
/**
|
|
2689
|
+
* Row-level classes: static Classes or a function of the row's item (which may
|
|
2690
|
+
* return `undefined` to contribute nothing).
|
|
2691
|
+
*/
|
|
2692
|
+
export type RowClasses<Item = any> =
|
|
2693
|
+
| Classes
|
|
2694
|
+
| ((item: Item) => Classes | undefined);
|
|
2695
|
+
|
|
2696
|
+
/**
|
|
2697
|
+
* One entry of the sort model: `[columnKey, direction]`. The array order is
|
|
2698
|
+
* the sort priority (first entry sorts first).
|
|
2699
|
+
*/
|
|
2700
|
+
export type BbTableSortEntry = [key: string, direction: 'asc' | 'desc'];
|
|
2701
|
+
|
|
2702
|
+
/**
|
|
2703
|
+
* Projection that represents a row of cells with flags
|
|
2704
|
+
* linked to the state of the item
|
|
2705
|
+
*/
|
|
2706
|
+
export type MappedItem = Option & {
|
|
2707
|
+
accessibleLabel: string;
|
|
2708
|
+
cols: MappedCell[];
|
|
2709
|
+
expanded: boolean;
|
|
2710
|
+
highlighted: boolean;
|
|
2711
|
+
rowClasses?: Classes;
|
|
2712
|
+
onRowClick: (event: MouseEvent) => void;
|
|
2713
|
+
onRowContextMenu: (event: MouseEvent) => void;
|
|
2714
|
+
onRowDblClick: (event: MouseEvent) => void;
|
|
2715
|
+
rowIndex: number | undefined;
|
|
2716
|
+
};
|
|
2717
|
+
|
|
2718
|
+
/**
|
|
2719
|
+
* Projection that represents a header
|
|
2720
|
+
*/
|
|
2721
|
+
export type MappedHeader = {
|
|
2722
|
+
align: HTMLTableCellElement['align'];
|
|
2723
|
+
classes?: Classes;
|
|
2724
|
+
key: string;
|
|
2725
|
+
label: string;
|
|
2726
|
+
slotName: string;
|
|
2727
|
+
sortable: boolean;
|
|
2728
|
+
sortDirection?: 'ascending' | 'descending';
|
|
2729
|
+
sortOrder: 'asc' | 'desc' | null;
|
|
2730
|
+
};
|
|
2731
|
+
|
|
2732
|
+
/**
|
|
2733
|
+
* Projection that represents a cell of data for display.
|
|
2734
|
+
*/
|
|
2735
|
+
export type MappedCell = {
|
|
2736
|
+
align: string;
|
|
2737
|
+
classes: Classes;
|
|
2738
|
+
content: any;
|
|
2739
|
+
key: string;
|
|
2740
|
+
label: string;
|
|
2741
|
+
slotName: string;
|
|
2742
|
+
};
|
|
2743
|
+
|
|
2744
|
+
export type ExpandControllerProps = {
|
|
2745
|
+
'aria-controls'?: string;
|
|
2746
|
+
'aria-expanded': 'true' | 'false';
|
|
2747
|
+
onClick: () => void;
|
|
2748
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
2749
|
+
};
|
|
2750
|
+
|
|
2751
|
+
export type BbTableEvents = {
|
|
2752
|
+
(e: 'click:row', event: MouseEvent, item: any, selected: boolean): void;
|
|
2753
|
+
(e: 'contextmenu:row', event: MouseEvent, item: any, selected: boolean): void;
|
|
2754
|
+
(e: 'dblclick:row', event: MouseEvent, item: any, selected: boolean): void;
|
|
2755
|
+
(e: 'update:highlighted', value: any): void;
|
|
2756
|
+
(e: 'update:modelValue', value: any): void;
|
|
2757
|
+
(e: 'update:selectAll', value: boolean): void;
|
|
2758
|
+
(e: 'update:sort', value: BbTableSortEntry[]): void;
|
|
2759
|
+
(e: 'update:expandedItems', value: any[]): void;
|
|
2760
|
+
(e: 'update:unselectedItems', value: any[]): void;
|
|
2761
|
+
(e: 'item:selected', value: any): void;
|
|
2762
|
+
(e: 'item:unselected', value: any): void;
|
|
2763
|
+
};
|
|
2764
|
+
|
|
2765
|
+
export type BbTableSlots<Item = any> = {
|
|
2766
|
+
/**
|
|
2767
|
+
* Replaces the entire `<thead>` element. Use when you need full control over the header markup.
|
|
2768
|
+
*/
|
|
2769
|
+
thead?: (props: object) => any;
|
|
2770
|
+
/**
|
|
2771
|
+
* Replaces the entire `<tbody>` element. Use when you need full control over the body markup.
|
|
2772
|
+
*/
|
|
2773
|
+
tbody?: (props: object) => any;
|
|
2774
|
+
/**
|
|
2775
|
+
* Replaces the entire `<tfoot>` element. Use when you need full control over the footer markup.
|
|
2776
|
+
*/
|
|
2777
|
+
tfoot?: (props: {
|
|
2778
|
+
/**
|
|
2779
|
+
* Total rendered column count — the value to give a full-width footer row's
|
|
2780
|
+
* `colspan` (accounts for the selection/expand columns), so you never hand-count it.
|
|
2781
|
+
*/
|
|
2782
|
+
columnCount: number;
|
|
2783
|
+
}) => any;
|
|
2784
|
+
/**
|
|
2785
|
+
* Replaces the default selection header cell content (checkbox or radio label).
|
|
2786
|
+
* @param multiple - Whether the table allows multiple selection.
|
|
2787
|
+
* @param selectAll - Whether the "select all" checkbox is currently checked.
|
|
2788
|
+
* @param text - The accessible label text for the select-all control.
|
|
2789
|
+
*/
|
|
2790
|
+
'header:select'?: (props: {
|
|
2791
|
+
multiple: boolean;
|
|
2792
|
+
selectAll: boolean;
|
|
2793
|
+
text: string;
|
|
2794
|
+
}) => any;
|
|
2795
|
+
/**
|
|
2796
|
+
* Replaces the default actions header cell content.
|
|
2797
|
+
* @param text - The accessible label text for the actions column header.
|
|
2798
|
+
*/
|
|
2799
|
+
'header:actions'?: (props: { text: string }) => any;
|
|
2800
|
+
/**
|
|
2801
|
+
* Content shown while table rows are loading (replaces the skeleton rows).
|
|
2802
|
+
* @param items - The current (possibly stale) list of items, useful to match the previous row count.
|
|
2803
|
+
*/
|
|
2804
|
+
loading?: (props: { items: Item[] }) => any;
|
|
2805
|
+
/**
|
|
2806
|
+
* Content shown when the items list is empty and not loading. It fills the
|
|
2807
|
+
* table's own full-width empty-state cell (the colspan already accounts for
|
|
2808
|
+
* the selection/actions columns), so provide the *content* — a message, an
|
|
2809
|
+
* illustration, a "clear filters" button — never a `<tr>`/`<td>` of your own.
|
|
2810
|
+
*/
|
|
2811
|
+
'no-data'?: (props: object) => any;
|
|
2812
|
+
/**
|
|
2813
|
+
* Content rendered in the actions cell for each row.
|
|
2814
|
+
* @param expanded - Whether this row is currently expanded.
|
|
2815
|
+
* @param expandProps - Bind these onto an expand-toggle button to wire up aria attributes and keyboard handling.
|
|
2816
|
+
* @param toggleExpanded - Toggles the expanded state for this row.
|
|
2817
|
+
* @param highlighted - Whether this row is currently highlighted.
|
|
2818
|
+
* @param toggleHighlighted - Toggles the highlighted state for this row (in single mode, highlighting a row replaces the previous one).
|
|
2819
|
+
* @param selected - Whether this row is currently selected.
|
|
2820
|
+
* @param toggleSelected - Toggles the selected state for this row through the same pathway as the built-in selection controls; works even when the table is not `selectable`.
|
|
2821
|
+
* @param item - The raw item for this row.
|
|
2822
|
+
* @param value - The resolved value for this row.
|
|
2823
|
+
*/
|
|
2824
|
+
actions?: (props: {
|
|
2825
|
+
expanded?: boolean;
|
|
2826
|
+
expandProps?: ExpandControllerProps;
|
|
2827
|
+
toggleExpanded?: () => void;
|
|
2828
|
+
highlighted?: boolean;
|
|
2829
|
+
toggleHighlighted?: () => void;
|
|
2830
|
+
selected?: boolean;
|
|
2831
|
+
toggleSelected?: () => void;
|
|
2832
|
+
item: Item;
|
|
2833
|
+
value: any;
|
|
2834
|
+
}) => any;
|
|
2835
|
+
/**
|
|
2836
|
+
* Full-width expandable content row rendered below each main row when expanded.
|
|
2837
|
+
* @param expanded - Whether this row is currently expanded.
|
|
2838
|
+
* @param expandProps - Bind these onto an expand-toggle button to wire up aria attributes and keyboard handling.
|
|
2839
|
+
* @param toggleExpanded - Toggles the expanded state for this row.
|
|
2840
|
+
* @param highlighted - Whether this row is currently highlighted.
|
|
2841
|
+
* @param toggleHighlighted - Toggles the highlighted state for this row (in single mode, highlighting a row replaces the previous one).
|
|
2842
|
+
* @param selected - Whether this row is currently selected.
|
|
2843
|
+
* @param toggleSelected - Toggles the selected state for this row through the same pathway as the built-in selection controls; works even when the table is not `selectable`.
|
|
2844
|
+
* @param item - The raw item for this row.
|
|
2845
|
+
* @param value - The resolved value for this row.
|
|
2846
|
+
*/
|
|
2847
|
+
expand?: (props: {
|
|
2848
|
+
expanded: boolean;
|
|
2849
|
+
expandProps?: ExpandControllerProps;
|
|
2850
|
+
toggleExpanded: () => void;
|
|
2851
|
+
highlighted?: boolean;
|
|
2852
|
+
toggleHighlighted?: () => void;
|
|
2853
|
+
selected?: boolean;
|
|
2854
|
+
toggleSelected?: () => void;
|
|
2855
|
+
item: Item;
|
|
2856
|
+
value: any;
|
|
2857
|
+
}) => any;
|
|
2858
|
+
/**
|
|
2859
|
+
* Replaces the default checkbox/radio in the selection cell for each row.
|
|
2860
|
+
* @param item - The raw item for this row.
|
|
2861
|
+
* @param value - The resolved value for this row.
|
|
2862
|
+
* @param checked - Whether this row is currently selected.
|
|
2863
|
+
* @param disabled - Whether this row's selection control is disabled.
|
|
2864
|
+
* @param inputName - The `name` attribute for the selection input.
|
|
2865
|
+
* @param readonly - Whether the selection control is read-only.
|
|
2866
|
+
* @param toggleSelected - Toggles the selected state for this row through the same pathway as the built-in selection controls; works even when the table is not `selectable`.
|
|
2867
|
+
*/
|
|
2868
|
+
select?: (props: {
|
|
2869
|
+
item: Item;
|
|
2870
|
+
value: any;
|
|
2871
|
+
checked: boolean;
|
|
2872
|
+
disabled: boolean;
|
|
2873
|
+
inputName: string;
|
|
2874
|
+
readonly: boolean;
|
|
2875
|
+
toggleSelected?: () => void;
|
|
2876
|
+
}) => any;
|
|
2877
|
+
} & Record<
|
|
2878
|
+
string,
|
|
2879
|
+
(props: {
|
|
2880
|
+
classes?: Classes[];
|
|
2881
|
+
content?: any;
|
|
2882
|
+
expanded?: boolean;
|
|
2883
|
+
expandProps?: ExpandControllerProps;
|
|
2884
|
+
toggleExpanded?: () => void;
|
|
2885
|
+
highlighted?: boolean;
|
|
2886
|
+
toggleHighlighted?: () => void;
|
|
2887
|
+
selected?: boolean;
|
|
2888
|
+
toggleSelected?: () => void;
|
|
2889
|
+
sortable?: boolean;
|
|
2890
|
+
sortOrder?: 'asc' | 'desc' | null;
|
|
2891
|
+
toggleSort?: () => void;
|
|
2892
|
+
item: Item;
|
|
2893
|
+
value?: any;
|
|
2894
|
+
items?: Item[];
|
|
2895
|
+
label?: string;
|
|
2896
|
+
}) => any
|
|
2897
|
+
>;
|
|
2898
|
+
```
|
|
2899
|
+
|
|
2900
|
+
## Styles
|
|
2901
|
+
|
|
2902
|
+
```css
|
|
2903
|
+
.bb-table {
|
|
2904
|
+
--padding-x: 12px;
|
|
2905
|
+
--cell-h: 36px;
|
|
2906
|
+
--padding-y: 6px;
|
|
2907
|
+
--actions-spacing: 8px;
|
|
2908
|
+
/* Raw structural edge offset measured by the component (the parent's
|
|
2909
|
+
select/actions track width). Default 0 keeps every calc at its base. */
|
|
2910
|
+
--offset-start: 0px;
|
|
2911
|
+
--offset-end: 0px;
|
|
2912
|
+
/* Routing of that offset. By default it is "internal": added to the
|
|
2913
|
+
first/last cell padding and folded into the first/last column width.
|
|
2914
|
+
Swap internal↔external (set internal to 0 and external to the raw offset)
|
|
2915
|
+
to pad the whole table instead of the edge cells. */
|
|
2916
|
+
--offset-internal-start: var(--offset-start);
|
|
2917
|
+
--offset-internal-end: var(--offset-end);
|
|
2918
|
+
--offset-external-start: 0px;
|
|
2919
|
+
--offset-external-end: 0px;
|
|
2920
|
+
/* Slack the fill column adds to reach the parent's width. Reset per table so a
|
|
2921
|
+
nested table never inherits an ancestor's value through the cascade. */
|
|
2922
|
+
--fill: 0px;
|
|
2923
|
+
display: grid;
|
|
2924
|
+
/* Override the UA `min-inline-size: min-content` that a <fieldset> container
|
|
2925
|
+
(rendered for selectable tables) carries — without this the container can't
|
|
2926
|
+
shrink below the table's content width, so it overflows its parent and
|
|
2927
|
+
pushes the page instead of scrolling inside its own `overflow-x: auto`. */
|
|
2928
|
+
min-width: 0;
|
|
2929
|
+
overflow-x: auto;
|
|
2930
|
+
|
|
2931
|
+
/* While a container resize waits on the debounced column re-probe, the stale
|
|
2932
|
+
(wider) column widths would flash a horizontal scrollbar; clip instead of
|
|
2933
|
+
scroll for that window. Applied only when the table wasn't already
|
|
2934
|
+
overflowing, so no live scroll position is ever clipped away. */
|
|
2935
|
+
&--measuring {
|
|
2936
|
+
overflow-x: clip;
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
padding-inline-end: var(--offset-external-end);
|
|
2940
|
+
padding-inline-start: var(--offset-external-start);
|
|
2941
|
+
|
|
2942
|
+
position: relative;
|
|
2943
|
+
|
|
2944
|
+
&--align {
|
|
2945
|
+
&-left {
|
|
2946
|
+
text-align: left;
|
|
2947
|
+
}
|
|
2948
|
+
&-center {
|
|
2949
|
+
text-align: center;
|
|
2950
|
+
}
|
|
2951
|
+
&-right {
|
|
2952
|
+
text-align: right;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
&--compact {
|
|
2957
|
+
--padding-x: 8px;
|
|
2958
|
+
--cell-h: 32px;
|
|
2959
|
+
--padding-y: 4px;
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
&--fixed-header {
|
|
2963
|
+
table {
|
|
2964
|
+
thead {
|
|
2965
|
+
th {
|
|
2966
|
+
position: sticky;
|
|
2967
|
+
top: 0;
|
|
2968
|
+
z-index: 1;
|
|
2969
|
+
}
|
|
2970
|
+
th[style*='sticky'] {
|
|
2971
|
+
position: sticky;
|
|
2972
|
+
top: 0;
|
|
2973
|
+
z-index: 2;
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
&--selectable {
|
|
2980
|
+
tr {
|
|
2981
|
+
> .bb-table-data__cell--select {
|
|
2982
|
+
text-align: center;
|
|
2983
|
+
width: 0px;
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
table {
|
|
2989
|
+
/* On the <table> element itself, not the container: `border-spacing` is
|
|
2990
|
+
inherited, so a container-level `0` loses to the UA's element rule
|
|
2991
|
+
(`table { border-spacing: 2px }`) — without a preflight reset every
|
|
2992
|
+
cell would drift by 2px per gridline and break nested-table
|
|
2993
|
+
alignment. */
|
|
2994
|
+
border-collapse: separate;
|
|
2995
|
+
border-spacing: 0;
|
|
2996
|
+
min-width: 100%;
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
/* A nested table inheriting its parent's widths sizes to the sum of its
|
|
3000
|
+
columns instead of filling its container, so fixed layout cannot stretch
|
|
3001
|
+
them out of alignment. Declared after `--fixed` and the base table rule so
|
|
3002
|
+
it overrides their width/min-width at equal specificity. */
|
|
3003
|
+
&--inherit-widths {
|
|
3004
|
+
/* Never grow past the parent's expand cell: a child with more columns
|
|
3005
|
+
than the parent overflows the cell, so cap the container here and let its
|
|
3006
|
+
own `overflow-x: auto` scroll the surplus columns inside the expand row
|
|
3007
|
+
rather than stretching the ancestor. */
|
|
3008
|
+
max-width: 100%;
|
|
3009
|
+
min-width: 0;
|
|
3010
|
+
|
|
3011
|
+
table {
|
|
3012
|
+
min-width: 0;
|
|
3013
|
+
/* A *definite* width (not `max-content`) so `table-layout: fixed` stays
|
|
3014
|
+
content-independent: inherited columns keep their colgroup widths and
|
|
3015
|
+
align with the parent instead of growing to fit content. The fill
|
|
3016
|
+
column is `auto`, so fixed layout hands it the leftover; when columns
|
|
3017
|
+
overflow, the table grows past 100% and scrolls. */
|
|
3018
|
+
width: 100%;
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
/* Declared after the base `table { min-width: 100% }` rule so it wins the
|
|
3023
|
+
cascade at equal specificity. The probe publishes the natural content width
|
|
3024
|
+
of all columns; the table fills its container freely but never compresses
|
|
3025
|
+
below that floor — the container's `overflow-x: auto` then shows a
|
|
3026
|
+
scrollbar instead of squishing content. */
|
|
3027
|
+
&--fixed {
|
|
3028
|
+
> table {
|
|
3029
|
+
table-layout: fixed;
|
|
3030
|
+
width: 100%;
|
|
3031
|
+
|
|
3032
|
+
thead {
|
|
3033
|
+
.bb-table-header--actions {
|
|
3034
|
+
width: auto;
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
table {
|
|
3040
|
+
min-width: var(--natural-width, 0px);
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
&-header {
|
|
3045
|
+
border-bottom: var(--bb-border-w) solid var(--bb-border);
|
|
3046
|
+
color: var(--bb-text-muted);
|
|
3047
|
+
font-size: var(--bb-fs);
|
|
3048
|
+
font-weight: 500;
|
|
3049
|
+
padding: var(--padding-y) var(--padding-x);
|
|
3050
|
+
|
|
3051
|
+
&--center {
|
|
3052
|
+
text-align: center;
|
|
3053
|
+
}
|
|
3054
|
+
|
|
3055
|
+
&--right {
|
|
3056
|
+
text-align: right;
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
&--actions {
|
|
3060
|
+
width: 0;
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
/* Sortable header control: label + the two-arrow sort icon. The icon is
|
|
3065
|
+
invisible at rest and fades in muted on hover/focus; an active sort keeps
|
|
3066
|
+
it visible with the active direction's arrow at full strength while the
|
|
3067
|
+
other arrow stays muted. */
|
|
3068
|
+
&-sort {
|
|
3069
|
+
align-items: center;
|
|
3070
|
+
background: none;
|
|
3071
|
+
border: 0;
|
|
3072
|
+
border-radius: var(--bb-radius-sm);
|
|
3073
|
+
box-shadow: 0px 0px 0px 0px var(--bb-ring);
|
|
3074
|
+
color: inherit;
|
|
3075
|
+
cursor: pointer;
|
|
3076
|
+
display: inline-flex;
|
|
3077
|
+
font: inherit;
|
|
3078
|
+
gap: 4px;
|
|
3079
|
+
/* Buttons don't inherit typography from the row, so a consumer's
|
|
3080
|
+
headerRowClass (e.g. uppercase/tracking) must be pulled in explicitly
|
|
3081
|
+
or sortable headers would render differently from plain ones. */
|
|
3082
|
+
letter-spacing: inherit;
|
|
3083
|
+
padding: 0;
|
|
3084
|
+
text-align: inherit;
|
|
3085
|
+
text-transform: inherit;
|
|
3086
|
+
|
|
3087
|
+
&:focus-visible {
|
|
3088
|
+
box-shadow: 0px 0px 0px var(--bb-ring-size) var(--bb-ring);
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
.bb-table-sort__icon {
|
|
3092
|
+
color: var(--bb-muted);
|
|
3093
|
+
flex-shrink: 0;
|
|
3094
|
+
opacity: 0;
|
|
3095
|
+
transition: opacity var(--bb-transition-fast) var(--bb-ease);
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
/* The arrows are `fill: currentColor`, so transitioning `color` fades
|
|
3099
|
+
them between the muted rest tone and the active `--bb-text`. */
|
|
3100
|
+
.sort-icon__asc,
|
|
3101
|
+
.sort-icon__desc {
|
|
3102
|
+
transition: color var(--bb-transition-fast) var(--bb-ease);
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
&:hover .bb-table-sort__icon,
|
|
3106
|
+
&:focus-visible .bb-table-sort__icon,
|
|
3107
|
+
&--asc .bb-table-sort__icon,
|
|
3108
|
+
&--desc .bb-table-sort__icon {
|
|
3109
|
+
opacity: 1;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
&--asc .sort-icon__asc,
|
|
3113
|
+
&--desc .sort-icon__desc {
|
|
3114
|
+
color: var(--bb-text);
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
tbody {
|
|
3119
|
+
tr {
|
|
3120
|
+
/* On the cells, not the row: the table renders with the separate border
|
|
3121
|
+
model, where a `tr` border never paints. */
|
|
3122
|
+
&:not(:last-child) > td {
|
|
3123
|
+
border-bottom: var(--bb-border-w) solid var(--bb-border);
|
|
3124
|
+
}
|
|
3125
|
+
td {
|
|
3126
|
+
color: var(--bb-text);
|
|
3127
|
+
font-size: var(--bb-fs);
|
|
3128
|
+
font-weight: 400;
|
|
3129
|
+
height: var(--cell-h);
|
|
3130
|
+
padding: var(--padding-y) var(--padding-x);
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
td.bb-table-expand__cell {
|
|
3134
|
+
/* Collapse to the content's height instead of inheriting the data-row
|
|
3135
|
+
cell height, so an expand row with no slot content takes no space. */
|
|
3136
|
+
height: auto;
|
|
3137
|
+
padding: 0;
|
|
3138
|
+
|
|
3139
|
+
&:empty {
|
|
3140
|
+
display: none;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
/* Apply the structural edge offsets to the first/last *data* column. They
|
|
3147
|
+
must land on the data cells, not the absolute first/last child: a select
|
|
3148
|
+
or actions column would otherwise absorb the fill and leave the data
|
|
3149
|
+
columns misaligned with the parent (and bloat the actions cell).
|
|
3150
|
+
|
|
3151
|
+
The offset is clamped at 0 here: a positive fill widens the cell and is
|
|
3152
|
+
reserved as extra edge padding, but a *negative* offset (a select/actions
|
|
3153
|
+
column reclaimed from this column's width) must not eat into the normal
|
|
3154
|
+
`--padding-x` — that only shrinks the column width, not its inner padding. */
|
|
3155
|
+
thead tr > th.bb-table-header--edge-start,
|
|
3156
|
+
tbody tr > td.bb-table-data__cell--edge-start {
|
|
3157
|
+
padding-inline-start: calc(
|
|
3158
|
+
var(--padding-x) + max(0px, var(--offset-internal-start))
|
|
3159
|
+
);
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
thead tr > th.bb-table-header--edge-end,
|
|
3163
|
+
tbody tr > td.bb-table-data__cell--edge-end {
|
|
3164
|
+
padding-inline-end: calc(
|
|
3165
|
+
var(--padding-x) + max(0px, var(--offset-internal-end))
|
|
3166
|
+
);
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
&.bb-table--loading {
|
|
3170
|
+
.bb-table-loading__row {
|
|
3171
|
+
.bb-table-loading__cell {
|
|
3172
|
+
padding: 0 var(--padding-x) !important;
|
|
3173
|
+
vertical-align: top;
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
.bb-table-loading__row--sr-only {
|
|
3178
|
+
.bb-table-loading__cell {
|
|
3179
|
+
border: none;
|
|
3180
|
+
height: 0;
|
|
3181
|
+
overflow: hidden;
|
|
3182
|
+
padding: 0 !important;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
|
|
3187
|
+
&-skeleton {
|
|
3188
|
+
&__cell {
|
|
3189
|
+
height: var(--cell-h);
|
|
3190
|
+
overflow: hidden;
|
|
3191
|
+
padding: var(--padding-y) var(--padding-x);
|
|
3192
|
+
vertical-align: middle;
|
|
3193
|
+
|
|
3194
|
+
&--select,
|
|
3195
|
+
&--actions {
|
|
3196
|
+
text-align: center;
|
|
3197
|
+
width: 0;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
&__cell-content {
|
|
3202
|
+
display: flex;
|
|
3203
|
+
flex-direction: column;
|
|
3204
|
+
gap: 6px;
|
|
3205
|
+
justify-content: center;
|
|
3206
|
+
max-height: calc(var(--cell-h) - var(--padding-y) * 2);
|
|
3207
|
+
min-width: 96px;
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
&__line {
|
|
3211
|
+
animation: bb-table-skeleton-shimmer 1.8s ease-in-out infinite;
|
|
3212
|
+
background: linear-gradient(
|
|
3213
|
+
90deg,
|
|
3214
|
+
var(--bb-border) 0%,
|
|
3215
|
+
var(--bb-border) 35%,
|
|
3216
|
+
color-mix(in oklab, var(--bb-border) 60%, white) 50%,
|
|
3217
|
+
var(--bb-border) 65%,
|
|
3218
|
+
var(--bb-border) 100%
|
|
3219
|
+
);
|
|
3220
|
+
background-size: 200% 100%;
|
|
3221
|
+
border-radius: var(--bb-radius-sm);
|
|
3222
|
+
flex-shrink: 0;
|
|
3223
|
+
height: 10px;
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3227
|
+
&__line {
|
|
3228
|
+
animation: none;
|
|
3229
|
+
background: var(--bb-border);
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
&__placeholder {
|
|
3234
|
+
background-color: var(--bb-border);
|
|
3235
|
+
border-radius: var(--bb-radius-sm);
|
|
3236
|
+
flex-shrink: 0;
|
|
3237
|
+
height: 22px;
|
|
3238
|
+
margin: 0 auto;
|
|
3239
|
+
min-width: 22px;
|
|
3240
|
+
width: 22px;
|
|
3241
|
+
}
|
|
3242
|
+
|
|
3243
|
+
&__avatar {
|
|
3244
|
+
aspect-ratio: 1;
|
|
3245
|
+
background-color: var(--bb-border);
|
|
3246
|
+
border-radius: 50%;
|
|
3247
|
+
flex-shrink: 0;
|
|
3248
|
+
height: calc(var(--cell-h) - var(--padding-y) * 2);
|
|
3249
|
+
min-width: calc(var(--cell-h) - var(--padding-y) * 2);
|
|
3250
|
+
width: calc(var(--cell-h) - var(--padding-y) * 2);
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
&__avatar-text {
|
|
3254
|
+
align-items: center;
|
|
3255
|
+
display: flex;
|
|
3256
|
+
gap: 12px;
|
|
3257
|
+
max-height: calc(var(--cell-h) - var(--padding-y) * 2);
|
|
3258
|
+
min-width: 140px;
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
&__avatar-text .bb-table-skeleton__avatar {
|
|
3262
|
+
width: calc(var(--cell-h) - var(--padding-y) * 2);
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
&__avatar-text .bb-table-skeleton__cell-content {
|
|
3266
|
+
flex: 1;
|
|
3267
|
+
min-width: 0;
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
&__image {
|
|
3271
|
+
aspect-ratio: 4 / 3;
|
|
3272
|
+
background-color: var(--bb-border);
|
|
3273
|
+
border-radius: var(--bb-radius-sm);
|
|
3274
|
+
height: calc(var(--cell-h) - var(--padding-y) * 2);
|
|
3275
|
+
min-width: 64px;
|
|
3276
|
+
width: auto;
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
&__badge {
|
|
3280
|
+
background-color: var(--bb-border);
|
|
3281
|
+
border-radius: 999px;
|
|
3282
|
+
flex-shrink: 0;
|
|
3283
|
+
height: 26px;
|
|
3284
|
+
min-width: 72px;
|
|
3285
|
+
width: 88px;
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
@keyframes bb-table-skeleton-shimmer {
|
|
3290
|
+
0% {
|
|
3291
|
+
background-position: 200% 0;
|
|
3292
|
+
}
|
|
3293
|
+
100% {
|
|
3294
|
+
background-position: -200% 0;
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
|
|
3298
|
+
/* The empty state is not a data cell — it spans the whole table, so it
|
|
3299
|
+
centres itself regardless of the table's column alignment. */
|
|
3300
|
+
&-no-data {
|
|
3301
|
+
&__cell {
|
|
3302
|
+
padding: var(--padding-y) var(--padding-x);
|
|
3303
|
+
text-align: center;
|
|
3304
|
+
vertical-align: middle;
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
&__text {
|
|
3308
|
+
color: var(--bb-text-muted);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
&-data {
|
|
3313
|
+
&__row {
|
|
3314
|
+
transition: background-color var(--bb-transition-fast) var(--bb-ease);
|
|
3315
|
+
|
|
3316
|
+
&:hover {
|
|
3317
|
+
background-color: var(--bb-surface-hover);
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
/* Focusable only with `keyboardNavigation`; the ring is mandatory
|
|
3321
|
+
focus indication, not decoration. Inset outline (not box-shadow) —
|
|
3322
|
+
it paints reliably on table rows. */
|
|
3323
|
+
&:focus-visible {
|
|
3324
|
+
outline: var(--bb-ring-size) solid var(--bb-ring);
|
|
3325
|
+
outline-offset: calc(var(--bb-ring-size) * -1);
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
&__cell {
|
|
3330
|
+
&--center {
|
|
3331
|
+
text-align: center;
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3334
|
+
&--right {
|
|
3335
|
+
text-align: right;
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
&__cell {
|
|
3341
|
+
&--actions {
|
|
3342
|
+
white-space: nowrap;
|
|
3343
|
+
> *:not(:first-child) {
|
|
3344
|
+
margin-left: var(--actions-spacing);
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
&-check,
|
|
3350
|
+
&-radio {
|
|
3351
|
+
&__label {
|
|
3352
|
+
cursor: pointer;
|
|
3353
|
+
display: inline-block;
|
|
3354
|
+
transform: translateY(2px);
|
|
3355
|
+
user-select: none;
|
|
3356
|
+
|
|
3357
|
+
&.bb-table {
|
|
3358
|
+
&-check,
|
|
3359
|
+
&-radio {
|
|
3360
|
+
&__label--disabled {
|
|
3361
|
+
cursor: default;
|
|
3362
|
+
visibility: hidden;
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
&.bb-table-radio__label--disabled {
|
|
3368
|
+
cursor: default;
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3374
|
+
/* --- Refetching over existing rows ------------------------------------------
|
|
3375
|
+
A first load has nothing to show, so it gets the skeleton. A refetch does:
|
|
3376
|
+
blanking a populated table loses the user's place and flashes on every
|
|
3377
|
+
dependency change (a filter, a poll, an autosave round-trip). Keep the rows
|
|
3378
|
+
on screen, mark them stale, and run an indeterminate bar along the header/body
|
|
3379
|
+
boundary. `aria-busy` on the root already carries the semantics and the
|
|
3380
|
+
sr-only row in `<tbody>` still announces, so the bar is decorative — hence a
|
|
3381
|
+
pseudo-element rather than a node. `.bb-table--empty` is "nothing to keep". */
|
|
3382
|
+
.bb-table--loading:not(.bb-table--empty) {
|
|
3383
|
+
& tbody {
|
|
3384
|
+
opacity: 0.55;
|
|
3385
|
+
transition: opacity var(--bb-transition-fast) ease;
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
/* Anchors the bar. When `fixed-header` is on, thead is already sticky and
|
|
3389
|
+
the bar rides along with it. */
|
|
3390
|
+
& thead {
|
|
3391
|
+
position: relative;
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
/* Animating background-position repaints a 2px strip instead of laying out
|
|
3395
|
+
a moving node every frame, and needs no wrapper to clip it. */
|
|
3396
|
+
& thead::after {
|
|
3397
|
+
animation: bb-table-busy-slide 1.1s linear infinite;
|
|
3398
|
+
background: linear-gradient(
|
|
3399
|
+
90deg,
|
|
3400
|
+
transparent 0%,
|
|
3401
|
+
var(--bb-primary) 50%,
|
|
3402
|
+
transparent 100%
|
|
3403
|
+
);
|
|
3404
|
+
background-repeat: no-repeat;
|
|
3405
|
+
background-size: 40% 100%;
|
|
3406
|
+
bottom: 0;
|
|
3407
|
+
content: '';
|
|
3408
|
+
height: 2px;
|
|
3409
|
+
inset-inline: 0;
|
|
3410
|
+
pointer-events: none;
|
|
3411
|
+
position: absolute;
|
|
3412
|
+
z-index: 1;
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3416
|
+
@keyframes bb-table-busy-slide {
|
|
3417
|
+
from {
|
|
3418
|
+
background-position: -40% 0;
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
to {
|
|
3422
|
+
background-position: 140% 0;
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3427
|
+
.bb-table--loading:not(.bb-table--empty) thead::after {
|
|
3428
|
+
animation: none;
|
|
3429
|
+
background: var(--bb-primary);
|
|
3430
|
+
opacity: 0.5;
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
```
|