@bk2k/ui 0.6.7 → 0.7.0
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/BUILDING.md +88 -2
- package/CHANGELOG.md +193 -0
- package/USAGE.md +102 -33
- package/custom-elements.json +1 -1
- package/dist/charts/chart-tokens.js +1 -1
- package/dist/charts/fields.d.ts +20 -0
- package/dist/charts/fields.js +27 -0
- package/dist/charts/frame.d.ts +2 -0
- package/dist/charts/frame.js +4 -2
- package/dist/clipboard.js +1 -0
- package/dist/components/bk-alert.js +2 -1
- package/dist/components/bk-avatar-group.js +4 -6
- package/dist/components/bk-avatar.d.ts +10 -0
- package/dist/components/bk-avatar.js +17 -0
- package/dist/components/bk-bar.js +2 -0
- package/dist/components/bk-button-group.js +1 -1
- package/dist/components/bk-button-top.js +2 -1
- package/dist/components/bk-button.d.ts +55 -17
- package/dist/components/bk-button.js +71 -24
- package/dist/components/bk-card.d.ts +4 -0
- package/dist/components/bk-card.js +15 -2
- package/dist/components/bk-carousel-controls.d.ts +2 -0
- package/dist/components/bk-carousel-controls.js +4 -2
- package/dist/components/bk-chart-area.d.ts +6 -0
- package/dist/components/bk-chart-bar.d.ts +63 -9
- package/dist/components/bk-chart-bar.js +152 -41
- package/dist/components/bk-chart-line.d.ts +13 -0
- package/dist/components/bk-chart-line.js +11 -1
- package/dist/components/bk-chip-group.d.ts +2 -2
- package/dist/components/bk-chip-group.js +4 -0
- package/dist/components/bk-chip.d.ts +53 -8
- package/dist/components/bk-chip.js +43 -7
- package/dist/components/bk-code.js +6 -2
- package/dist/components/bk-columns.d.ts +11 -0
- package/dist/components/bk-columns.js +8 -1
- package/dist/components/bk-combobox.d.ts +30 -6
- package/dist/components/bk-combobox.js +63 -20
- package/dist/components/bk-delta.d.ts +10 -0
- package/dist/components/bk-delta.js +8 -6
- package/dist/components/bk-dialog.d.ts +16 -6
- package/dist/components/bk-dialog.js +20 -8
- package/dist/components/bk-disclosure.js +4 -2
- package/dist/components/bk-drop-target.d.ts +7 -1
- package/dist/components/bk-drop-target.js +20 -4
- package/dist/components/bk-error-summary.d.ts +5 -0
- package/dist/components/bk-error-summary.js +13 -4
- package/dist/components/bk-facts-item.js +8 -6
- package/dist/components/bk-facts.d.ts +6 -4
- package/dist/components/bk-facts.js +22 -10
- package/dist/components/bk-footnote.d.ts +73 -0
- package/dist/components/bk-footnote.js +97 -0
- package/dist/components/bk-footnotes-item.d.ts +92 -0
- package/dist/components/bk-footnotes-item.js +139 -0
- package/dist/components/bk-footnotes.d.ts +51 -0
- package/dist/components/bk-footnotes.js +43 -0
- package/dist/components/bk-icon.js +2 -2
- package/dist/components/bk-image-compare.d.ts +33 -5
- package/dist/components/bk-image-compare.js +72 -24
- package/dist/components/bk-image-crop.d.ts +3 -3
- package/dist/components/bk-image-editor.d.ts +1 -1
- package/dist/components/bk-image-viewer.d.ts +107 -11
- package/dist/components/bk-image-viewer.js +205 -34
- package/dist/components/bk-input-inline.d.ts +15 -6
- package/dist/components/bk-input-inline.js +22 -6
- package/dist/components/bk-input-number.js +2 -1
- package/dist/components/bk-input-search.d.ts +1 -1
- package/dist/components/bk-input-search.js +2 -1
- package/dist/components/bk-input-text.d.ts +11 -0
- package/dist/components/bk-input-text.js +17 -3
- package/dist/components/bk-input-time-zone.d.ts +3 -0
- package/dist/components/bk-input-time.js +2 -1
- package/dist/components/bk-item.js +2 -1
- package/dist/components/bk-lightbox.d.ts +12 -3
- package/dist/components/bk-lightbox.js +6 -3
- package/dist/components/bk-link.d.ts +9 -1
- package/dist/components/bk-link.js +14 -4
- package/dist/components/bk-menu-item.d.ts +40 -0
- package/dist/components/bk-menu-item.js +57 -9
- package/dist/components/bk-menu-label.js +2 -1
- package/dist/components/bk-menu-list.d.ts +1 -0
- package/dist/components/bk-menu-list.js +10 -0
- package/dist/components/bk-menu.d.ts +8 -1
- package/dist/components/bk-menu.js +16 -5
- package/dist/components/bk-message-feedback.d.ts +4 -3
- package/dist/components/bk-message-feedback.js +7 -5
- package/dist/components/bk-message-list.js +2 -1
- package/dist/components/bk-message-source.d.ts +1 -2
- package/dist/components/bk-message-source.js +3 -11
- package/dist/components/bk-message.js +2 -0
- package/dist/components/bk-model-viewer.d.ts +12 -1
- package/dist/components/bk-model-viewer.js +15 -2
- package/dist/components/bk-nav-group.js +1 -1
- package/dist/components/bk-nav-item.d.ts +18 -0
- package/dist/components/bk-nav-item.js +18 -5
- package/dist/components/bk-nav.d.ts +1 -1
- package/dist/components/bk-page-cta.js +2 -0
- package/dist/components/bk-page-section.d.ts +1 -1
- package/dist/components/bk-page-section.js +3 -9
- package/dist/components/bk-pane.d.ts +1 -0
- package/dist/components/bk-pane.js +7 -5
- package/dist/components/bk-panel.d.ts +1 -1
- package/dist/components/bk-panel.js +6 -5
- package/dist/components/bk-period-nav.d.ts +102 -0
- package/dist/components/bk-period-nav.js +69 -0
- package/dist/components/bk-picture.d.ts +17 -4
- package/dist/components/bk-picture.js +8 -1
- package/dist/components/bk-segmented-item.d.ts +24 -4
- package/dist/components/bk-segmented-item.js +37 -5
- package/dist/components/bk-segmented.js +2 -13
- package/dist/components/bk-select-cascade.d.ts +1 -1
- package/dist/components/bk-select-tree.d.ts +1 -1
- package/dist/components/bk-select.d.ts +1 -1
- package/dist/components/bk-select.js +2 -1
- package/dist/components/bk-shell-app.d.ts +13 -6
- package/dist/components/bk-shell-app.js +47 -11
- package/dist/components/bk-shell-sites.d.ts +2 -1
- package/dist/components/bk-shell-sites.js +3 -5
- package/dist/components/bk-sortable.d.ts +3 -0
- package/dist/components/bk-sortable.js +10 -17
- package/dist/components/bk-split-grid.d.ts +104 -3
- package/dist/components/bk-split-grid.js +425 -2
- package/dist/components/bk-split.d.ts +3 -0
- package/dist/components/bk-split.js +3 -0
- package/dist/components/bk-stat-group.js +2 -1
- package/dist/components/bk-stat.d.ts +17 -0
- package/dist/components/bk-stat.js +7 -3
- package/dist/components/bk-steps.js +2 -1
- package/dist/components/bk-surface.d.ts +2 -0
- package/dist/components/bk-surface.js +6 -3
- package/dist/components/bk-table.d.ts +17 -13
- package/dist/components/bk-table.js +94 -15
- package/dist/components/bk-tabs-item.d.ts +45 -7
- package/dist/components/bk-tabs-item.js +51 -20
- package/dist/components/bk-tabs-panel.d.ts +6 -3
- package/dist/components/bk-tabs-panel.js +6 -0
- package/dist/components/bk-tabs.d.ts +50 -7
- package/dist/components/bk-tabs.js +168 -96
- package/dist/components/bk-text.js +2 -1
- package/dist/components/bk-toast-group.d.ts +3 -1
- package/dist/components/bk-toast-group.js +11 -1
- package/dist/components/bk-tooltip.d.ts +3 -1
- package/dist/components/bk-tooltip.js +2 -1
- package/dist/components/bk-video.js +2 -2
- package/dist/components/bk-zoom.d.ts +3 -1
- package/dist/components/confirm.d.ts +15 -0
- package/dist/components/confirm.js +27 -4
- package/dist/i18n/de.js +19 -1
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.js +3 -0
- package/dist/i18n.d.ts +23 -2
- package/dist/i18n.js +35 -4
- package/dist/icons/brands-static.d.ts +3 -0
- package/dist/icons/brands-static.js +5 -0
- package/dist/icons/core.d.ts +1 -0
- package/dist/icons/core.js +2 -0
- package/dist/icons/load-static.d.ts +3 -0
- package/dist/icons/load-static.js +5 -0
- package/dist/icons/load.js +1 -0
- package/dist/icons/registry.js +1 -1
- package/dist/icons/set/save-as.d.ts +3 -0
- package/dist/icons/set/save-as.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/internal/announcer.d.ts +8 -1
- package/dist/internal/announcer.js +26 -10
- package/dist/internal/backdrop.d.ts +19 -0
- package/dist/internal/backdrop.js +29 -0
- package/dist/internal/busy.d.ts +3 -2
- package/dist/internal/busy.js +4 -5
- package/dist/internal/choice-field.js +1 -1
- package/dist/internal/choice-item.d.ts +17 -6
- package/dist/internal/choice-item.js +20 -9
- package/dist/internal/cloak.d.ts +3 -0
- package/dist/internal/cloak.js +7 -0
- package/dist/internal/crop-frame.d.ts +1 -1
- package/dist/internal/crop-frame.js +2 -7
- package/dist/internal/date-field.js +2 -1
- package/dist/internal/drag.d.ts +11 -0
- package/dist/internal/drag.js +23 -0
- package/dist/internal/english-static.d.ts +3 -0
- package/dist/internal/english-static.js +5 -0
- package/dist/internal/english.d.ts +8 -0
- package/dist/internal/english.js +6 -0
- package/dist/internal/footnotes.d.ts +56 -0
- package/dist/internal/footnotes.js +143 -0
- package/dist/internal/handle-menu.d.ts +2 -3
- package/dist/internal/handle-menu.js +11 -3
- package/dist/internal/late/bk-shell-app.d.ts +4 -0
- package/dist/internal/late/bk-shell-app.js +7 -0
- package/dist/internal/late/bk-table.d.ts +4 -0
- package/dist/internal/late/bk-table.js +17 -0
- package/dist/internal/late/handle-menu.d.ts +4 -0
- package/dist/internal/late/handle-menu.js +9 -0
- package/dist/internal/late/static.d.ts +7 -0
- package/dist/internal/late/static.js +5 -0
- package/dist/internal/late.d.ts +20 -0
- package/dist/internal/late.js +45 -0
- package/dist/internal/link.d.ts +2 -0
- package/dist/internal/link.js +11 -1
- package/dist/internal/own-text.d.ts +8 -0
- package/dist/internal/own-text.js +7 -0
- package/dist/internal/scope.js +1 -1
- package/dist/internal/scroll-lock.d.ts +4 -1
- package/dist/internal/scroll-lock.js +17 -4
- package/dist/internal/slider.js +2 -1
- package/dist/internal/styles.js +3 -0
- package/dist/internal/submit.d.ts +23 -0
- package/dist/internal/submit.js +57 -0
- package/dist/jsx.d.ts +176 -56
- package/dist/reset.css +10 -0
- package/dist/standalone/all.js +226 -221
- package/dist/standalone/appearance.js +1 -1
- package/dist/standalone/bk-accordion-item.js +4 -4
- package/dist/standalone/bk-accordion.js +2 -2
- package/dist/standalone/bk-action-bar.js +3 -3
- package/dist/standalone/bk-alert-offline.js +1 -2
- package/dist/standalone/bk-alert.js +13 -12
- package/dist/standalone/bk-app-state.js +1 -1
- package/dist/standalone/bk-attachment.js +4 -4
- package/dist/standalone/bk-avatar-group.js +12 -10
- package/dist/standalone/bk-avatar.js +14 -4
- package/dist/standalone/bk-badge.js +2 -2
- package/dist/standalone/bk-bar.js +3 -1
- package/dist/standalone/bk-brand.js +3 -3
- package/dist/standalone/bk-breadcrumbs.js +5 -5
- package/dist/standalone/bk-button-copy.js +5 -5
- package/dist/standalone/bk-button-group.js +5 -5
- package/dist/standalone/bk-button-share.js +5 -5
- package/dist/standalone/bk-button-top.js +9 -8
- package/dist/standalone/bk-button.js +74 -34
- package/dist/standalone/bk-calendar-event.js +1 -1
- package/dist/standalone/bk-calendar-week.js +3 -3
- package/dist/standalone/bk-calendar.js +4 -4
- package/dist/standalone/bk-card.js +20 -7
- package/dist/standalone/bk-carousel-controls.js +7 -6
- package/dist/standalone/bk-carousel-item.js +2 -2
- package/dist/standalone/bk-carousel.js +1 -1
- package/dist/standalone/bk-chart-area.js +1 -1
- package/dist/standalone/bk-chart-bar-list.js +8 -8
- package/dist/standalone/bk-chart-bar.js +253 -166
- package/dist/standalone/bk-chart-bridge.js +7 -7
- package/dist/standalone/bk-chart-bullet.js +6 -6
- package/dist/standalone/bk-chart-calendar.js +7 -7
- package/dist/standalone/bk-chart-heatmap.js +7 -7
- package/dist/standalone/bk-chart-histogram.js +5 -5
- package/dist/standalone/bk-chart-legend.js +6 -6
- package/dist/standalone/bk-chart-line.js +116 -103
- package/dist/standalone/bk-chart-mark.js +1 -1
- package/dist/standalone/bk-chart-scatter.js +6 -6
- package/dist/standalone/bk-chart-sparkline.js +6 -6
- package/dist/standalone/bk-chart-stacked-bar.js +7 -7
- package/dist/standalone/bk-chart-tracker.js +6 -6
- package/dist/standalone/bk-chart-waterfall.js +6 -6
- package/dist/standalone/bk-checkbox-group.js +4 -4
- package/dist/standalone/bk-checkbox.js +4 -4
- package/dist/standalone/bk-chip-group.js +9 -5
- package/dist/standalone/bk-chip.js +56 -17
- package/dist/standalone/bk-cluster.js +1 -1
- package/dist/standalone/bk-code-diff.js +4 -4
- package/dist/standalone/bk-code-stack.js +4 -4
- package/dist/standalone/bk-code.js +10 -6
- package/dist/standalone/bk-color-panel.js +5 -5
- package/dist/standalone/bk-columns.js +13 -5
- package/dist/standalone/bk-combobox.js +53 -33
- package/dist/standalone/bk-command-menu.js +6 -6
- package/dist/standalone/bk-command-palette.js +6 -5
- package/dist/standalone/bk-composer.js +6 -6
- package/dist/standalone/bk-delta.js +11 -10
- package/dist/standalone/bk-diagram.js +1 -1
- package/dist/standalone/bk-dialog.js +1 -1
- package/dist/standalone/bk-disclosure.js +7 -5
- package/dist/standalone/bk-divider.js +2 -2
- package/dist/standalone/bk-drawer.js +3 -3
- package/dist/standalone/bk-drop-target.js +12 -6
- package/dist/standalone/bk-empty-state.js +3 -3
- package/dist/standalone/bk-error-summary.js +9 -6
- package/dist/standalone/bk-facts-item.js +10 -8
- package/dist/standalone/bk-facts.js +28 -16
- package/dist/standalone/bk-feature.js +3 -3
- package/dist/standalone/bk-fieldset.js +3 -3
- package/dist/standalone/bk-filter-bar.js +4 -4
- package/dist/standalone/bk-folder-browser.js +4 -4
- package/dist/standalone/bk-footnote.js +82 -0
- package/dist/standalone/bk-footnotes-item.js +122 -0
- package/dist/standalone/bk-footnotes.js +37 -0
- package/dist/standalone/bk-form-guard.js +2 -2
- package/dist/standalone/bk-form-steps.js +3 -3
- package/dist/standalone/bk-grid.js +1 -1
- package/dist/standalone/bk-icon-tile.js +3 -3
- package/dist/standalone/bk-icon.js +1 -1
- package/dist/standalone/bk-image-compare.js +88 -47
- package/dist/standalone/bk-image-crop.js +6 -6
- package/dist/standalone/bk-image-editor.js +2 -1
- package/dist/standalone/bk-image-viewer.js +180 -59
- package/dist/standalone/bk-input-code.js +4 -4
- package/dist/standalone/bk-input-color.js +4 -4
- package/dist/standalone/bk-input-date-range.js +2 -2
- package/dist/standalone/bk-input-date.js +2 -2
- package/dist/standalone/bk-input-file.js +5 -5
- package/dist/standalone/bk-input-group.js +4 -4
- package/dist/standalone/bk-input-inline.js +17 -10
- package/dist/standalone/bk-input-number.js +9 -8
- package/dist/standalone/bk-input-rating.js +6 -6
- package/dist/standalone/bk-input-rich.js +1 -1
- package/dist/standalone/bk-input-search.js +23 -22
- package/dist/standalone/bk-input-slider-range.js +5 -5
- package/dist/standalone/bk-input-slider.js +5 -5
- package/dist/standalone/bk-input-text.js +1 -1
- package/dist/standalone/bk-input-time-zone.js +1 -1
- package/dist/standalone/bk-input-time.js +29 -28
- package/dist/standalone/bk-item-group.js +3 -3
- package/dist/standalone/bk-item.js +12 -11
- package/dist/standalone/bk-kbd-shortcuts.js +4 -3
- package/dist/standalone/bk-kbd.js +68 -1
- package/dist/standalone/bk-lightbox.js +11 -7
- package/dist/standalone/bk-lines.js +1 -1
- package/dist/standalone/bk-link.js +33 -19
- package/dist/standalone/bk-listbox-columns.js +6 -6
- package/dist/standalone/bk-listbox-item.js +1 -1
- package/dist/standalone/bk-listbox-search.js +7 -7
- package/dist/standalone/bk-listbox-transfer.js +6 -6
- package/dist/standalone/bk-listbox.js +7 -7
- package/dist/standalone/bk-logo-wall.js +2 -2
- package/dist/standalone/bk-logo.js +3 -3
- package/dist/standalone/bk-menu-bar.js +3 -3
- package/dist/standalone/bk-menu-context.js +1 -1
- package/dist/standalone/bk-menu-divider.js +2 -2
- package/dist/standalone/bk-menu-item.js +73 -29
- package/dist/standalone/bk-menu-label.js +7 -6
- package/dist/standalone/bk-menu-list.js +10 -4
- package/dist/standalone/bk-menu.js +19 -10
- package/dist/standalone/bk-message-approval.js +4 -4
- package/dist/standalone/bk-message-branches.js +3 -3
- package/dist/standalone/bk-message-citation.js +10 -10
- package/dist/standalone/bk-message-feedback.js +10 -6
- package/dist/standalone/bk-message-list.js +6 -5
- package/dist/standalone/bk-message-reasoning.js +5 -5
- package/dist/standalone/bk-message-source.js +13 -21
- package/dist/standalone/bk-message-tool-group.js +5 -5
- package/dist/standalone/bk-message-tool.js +5 -5
- package/dist/standalone/bk-message.js +6 -4
- package/dist/standalone/bk-meter.js +3 -3
- package/dist/standalone/bk-model-viewer.js +1 -1
- package/dist/standalone/bk-nav-divider.js +2 -2
- package/dist/standalone/bk-nav-group.js +6 -6
- package/dist/standalone/bk-nav-item.js +31 -23
- package/dist/standalone/bk-nav-toc.js +3 -3
- package/dist/standalone/bk-nav.js +3 -3
- package/dist/standalone/bk-overflow.js +3 -3
- package/dist/standalone/bk-page-cta.js +5 -3
- package/dist/standalone/bk-page-footer-column.js +2 -2
- package/dist/standalone/bk-page-footer.js +3 -3
- package/dist/standalone/bk-page-header.js +3 -3
- package/dist/standalone/bk-page-hero.js +3 -3
- package/dist/standalone/bk-page-pager.js +5 -5
- package/dist/standalone/bk-page-section.js +6 -6
- package/dist/standalone/bk-pagination.js +6 -6
- package/dist/standalone/bk-pane.js +10 -9
- package/dist/standalone/bk-panel.js +9 -10
- package/dist/standalone/bk-period-nav.js +69 -0
- package/dist/standalone/bk-picture.js +24 -15
- package/dist/standalone/bk-popover-help.js +3 -3
- package/dist/standalone/bk-popover.js +2 -2
- package/dist/standalone/bk-presence-cursor.js +2 -2
- package/dist/standalone/bk-preview.js +4 -4
- package/dist/standalone/bk-progress.js +3 -3
- package/dist/standalone/bk-prose.js +3 -3
- package/dist/standalone/bk-qr-code.js +1 -1
- package/dist/standalone/bk-radio-group.js +4 -4
- package/dist/standalone/bk-radio.js +3 -3
- package/dist/standalone/bk-rating.js +5 -5
- package/dist/standalone/bk-scroll.js +3 -3
- package/dist/standalone/bk-segmented-item.js +40 -16
- package/dist/standalone/bk-segmented.js +15 -13
- package/dist/standalone/bk-select-cascade.js +3 -3
- package/dist/standalone/bk-select-tree.js +4 -4
- package/dist/standalone/bk-select.js +7 -6
- package/dist/standalone/bk-shell-app.js +1 -1217
- package/dist/standalone/bk-shell-centered.js +2 -2
- package/dist/standalone/bk-shell-sites.js +5 -7
- package/dist/standalone/bk-skeleton.js +2 -2
- package/dist/standalone/bk-sortable.js +58 -60
- package/dist/standalone/bk-spinner.js +2 -2
- package/dist/standalone/bk-split-grid.js +318 -41
- package/dist/standalone/bk-split.js +9 -6
- package/dist/standalone/bk-stack.js +1 -1
- package/dist/standalone/bk-stat-group.js +8 -7
- package/dist/standalone/bk-stat.js +11 -8
- package/dist/standalone/bk-status-dot.js +3 -3
- package/dist/standalone/bk-steps-item.js +5 -5
- package/dist/standalone/bk-steps.js +8 -7
- package/dist/standalone/bk-surface.js +1 -1
- package/dist/standalone/bk-swatch-group.js +4 -4
- package/dist/standalone/bk-swatch-palette.js +1 -1
- package/dist/standalone/bk-swatch.js +2 -2
- package/dist/standalone/bk-switch.js +4 -4
- package/dist/standalone/bk-table.js +1 -1887
- package/dist/standalone/bk-tabs-item.js +58 -35
- package/dist/standalone/bk-tabs-panel.js +7 -3
- package/dist/standalone/bk-tabs.js +160 -98
- package/dist/standalone/bk-tasks-item.js +4 -4
- package/dist/standalone/bk-tasks.js +2 -2
- package/dist/standalone/bk-testimonial.js +3 -3
- package/dist/standalone/bk-text.js +19 -18
- package/dist/standalone/bk-time-countdown.js +4 -4
- package/dist/standalone/bk-time-relative.js +3 -3
- package/dist/standalone/bk-timeline-item.js +4 -4
- package/dist/standalone/bk-timeline.js +2 -2
- package/dist/standalone/bk-toast-group.js +1 -1
- package/dist/standalone/bk-toast.js +4 -4
- package/dist/standalone/bk-toolbar.js +2 -2
- package/dist/standalone/bk-tooltip.js +8 -7
- package/dist/standalone/bk-tree-item.js +6 -6
- package/dist/standalone/bk-tree.js +3 -3
- package/dist/standalone/bk-video.js +6 -6
- package/dist/standalone/bk-visually-hidden.js +2 -2
- package/dist/standalone/bk-zoom.js +5 -5
- package/dist/standalone/chunks/announcer-D1zrRWwO.js +36 -0
- package/dist/standalone/chunks/{appearance-waHnV0kk.js → appearance-CBOJXbmC.js} +1 -1
- package/dist/standalone/chunks/{bk-alert-offline-BoMEYxnE.js → bk-alert-offline-Clw0ZSsH.js} +3 -3
- package/dist/standalone/chunks/{bk-carousel-B7-9OanA.js → bk-carousel-Biz7t8sL.js} +4 -4
- package/dist/standalone/chunks/{bk-diagram-CpOpicmo.js → bk-diagram-D_fQf6SF.js} +5 -5
- package/dist/standalone/chunks/{bk-dialog-a2BtUBf2.js → bk-dialog-DwZyUUHh.js} +65 -27
- package/dist/standalone/chunks/{bk-icon-DssFsNuB.js → bk-icon-Bp_flKdv.js} +4 -3
- package/dist/standalone/chunks/{bk-image-editor-z_Uj83fy.js → bk-image-editor-BADsoLRL.js} +5 -5
- package/dist/standalone/chunks/{bk-input-date-range-BQkbPlSJ.js → bk-input-date-range-DHcJ8-5g.js} +2 -2
- package/dist/standalone/chunks/{bk-input-rich-Dte_b4Ev.js → bk-input-rich-CFhW6vRa.js} +6 -6
- package/dist/standalone/chunks/{bk-input-text-CUNQG1ah.js → bk-input-text-DviyLBqj.js} +63 -54
- package/dist/standalone/chunks/{bk-model-viewer-D1XJPgAG.js → bk-model-viewer-w_Ah4Tvs.js} +22 -8
- package/dist/standalone/chunks/{bk-qr-code-CbI9rdOK.js → bk-qr-code-CYMovNVl.js} +3 -3
- package/dist/standalone/chunks/bk-shell-app-B2lxHit8.js +1235 -0
- package/dist/standalone/chunks/{bk-surface-DkIhrWMt.js → bk-surface-D7e0tErs.js} +9 -7
- package/dist/standalone/chunks/{bk-swatch-palette-BNNXTP3w.js → bk-swatch-palette-x13JgJQi.js} +6 -6
- package/dist/standalone/chunks/bk-table-CP8n_jy7.js +1944 -0
- package/dist/standalone/chunks/{bk-toast-group-Cix-Urgi.js → bk-toast-group-CoL6W7uk.js} +27 -24
- package/dist/standalone/chunks/{brush-Bn3lPdHN.js → brush-DALmXSru.js} +18 -2
- package/dist/standalone/chunks/{busy-B7Mxemwm.js → busy-BUB22mGY.js} +5 -4
- package/dist/standalone/chunks/{chart-tokens-D1Exf7BW.js → chart-tokens-DQ4hVSmn.js} +2 -2
- package/dist/standalone/chunks/{choice-field-BnuK9mp_.js → choice-field-poOTerh1.js} +6 -6
- package/dist/standalone/chunks/{choice-item-B6-9ZRlf.js → choice-item-Cx-nm1js.js} +17 -8
- package/dist/standalone/chunks/clipboard-RqIeP9Uz.js +29 -0
- package/dist/standalone/chunks/clipboard-UVLSkL4C.js +34 -0
- package/dist/standalone/chunks/{crop-frame-poLCGrBG.js → crop-frame-Z9N0QML4.js} +1 -11
- package/dist/standalone/chunks/{date-field-BQ5k-DDL.js → date-field-B-fCXa2D.js} +48 -47
- package/dist/standalone/chunks/{define-CzVPD4Zi.js → define-DkVeu7e9.js} +1 -1
- package/dist/standalone/chunks/drag-DT4__0t9.js +12 -0
- package/dist/standalone/chunks/footnotes-BeisMxLk.js +94 -0
- package/dist/standalone/chunks/{form-control-D7dqSP9M.js → form-control-CHpfKAKa.js} +2 -2
- package/dist/standalone/chunks/{frame-BW1nKuoM.js → frame-xIMVEUCi.js} +7 -4
- package/dist/standalone/chunks/handle-menu-BgYUbGO2.js +56 -0
- package/dist/standalone/chunks/{heading-text-CV5gBf7k.js → heading-text-CgnCa_q2.js} +1 -1
- package/dist/standalone/chunks/{i18n-CNsBRNPu.js → i18n-DFfGgd3d.js} +56 -34
- package/dist/standalone/chunks/{i18n-CrZgrRu9.js → i18n-DQAcbHkY.js} +1 -1
- package/dist/standalone/chunks/link--YWr8exL.js +69 -0
- package/dist/standalone/chunks/{marks-CdqbbJpM.js → marks-pOUDNUf1.js} +2 -2
- package/dist/standalone/chunks/{options-DMEc8rQt.js → options-BdC8-KKM.js} +2 -2
- package/dist/standalone/chunks/own-text-mpZVnMyX.js +5 -0
- package/dist/standalone/chunks/{palettes-CKLHSIPx.js → palettes-J4bQ21ks.js} +2 -2
- package/dist/standalone/chunks/{popover-base-oDhxsYMr.js → popover-base-hxo-Vh6E.js} +2 -2
- package/dist/standalone/chunks/{prose-BG4oQH-i.js → prose-BiuJgiah.js} +1 -1
- package/dist/standalone/chunks/{ramp-EclrETaQ.js → ramp-CGDOcqBZ.js} +1 -1
- package/dist/standalone/chunks/save-as-DBGZjczB.js +6 -0
- package/dist/standalone/chunks/shortcuts-DPxCSO4M.js +210 -0
- package/dist/standalone/chunks/{slider-BWT8Fmwz.js → slider-jp3d-Ld-.js} +15 -14
- package/dist/standalone/chunks/{stars-BN9M_9Q1.js → stars-BgKEjDQx.js} +1 -1
- package/dist/standalone/chunks/{styles-DwSR-9a3.js → styles-CaeyhYDA.js} +3 -0
- package/dist/standalone/chunks/submit-BjBGB8OW.js +42 -0
- package/dist/standalone/chunks/{summary-BwL-Gp8w.js → summary-W5s0TFqV.js} +1 -1
- package/dist/standalone/chunks/{text-field-CTp2b-Ai.js → text-field-CqhJSAwZ.js} +4 -4
- package/dist/standalone/chunks/{toggle-control-DXkgmz7R.js → toggle-control-lvZbQtGW.js} +2 -2
- package/dist/standalone/chunks/{tokens-BuahF1lF.js → tokens-C_ul7pL9.js} +4 -3
- package/dist/standalone/chunks/{virtual-B-1oN14Y.js → virtual-C_h6sHnm.js} +1 -1
- package/dist/standalone/confirm.js +27 -14
- package/dist/standalone/i18n-de.js +20 -2
- package/dist/standalone/icons.js +100 -98
- package/dist/standalone/links.js +1 -1
- package/dist/standalone/reset.css +10 -0
- package/dist/standalone/toast.js +1 -1
- package/dist/standalone/tokens.css +9 -5
- package/dist/tokens.css +9 -5
- package/dist/tokens.js +4 -3
- package/package.json +25 -2
- package/dist/standalone/chunks/announcer-haFcvqbe.js +0 -25
- package/dist/standalone/chunks/bk-kbd-B7bz8hmV.js +0 -275
- package/dist/standalone/chunks/clipboard-DBGdJ-1S.js +0 -61
- package/dist/standalone/chunks/handle-menu-DsxWvv4D.js +0 -22
- package/dist/standalone/chunks/link-CWSMsx04.js +0 -60
|
@@ -1,1887 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as o } from "./chunks/style-map-BMvn17E7.js";
|
|
3
|
-
import { i as s, n as c, r as l, t as u } from "./chunks/define-CzVPD4Zi.js";
|
|
4
|
-
import { t as d } from "./chunks/announcer-haFcvqbe.js";
|
|
5
|
-
import { i as f, n as p, o as m, t as h } from "./chunks/link-CWSMsx04.js";
|
|
6
|
-
import { i as g, n as _ } from "./chunks/events-DQ4e9cPN.js";
|
|
7
|
-
import { t as v } from "./chunks/state-XYmTmnOw.js";
|
|
8
|
-
import { t as y } from "./chunks/light-styles-CFbyUU7I.js";
|
|
9
|
-
import { t as b } from "./chunks/slots-BHTtBbPo.js";
|
|
10
|
-
import { n as x, t as S } from "./chunks/busy-B7Mxemwm.js";
|
|
11
|
-
import { n as C, t as w } from "./chunks/virtual-B-1oN14Y.js";
|
|
12
|
-
import { n as T, r as E, t as D } from "./chunks/handle-menu-DsxWvv4D.js";
|
|
13
|
-
import { c as O, i as k, n as A } from "./chunks/anchor-CNX3nt2F.js";
|
|
14
|
-
import { n as j } from "./chunks/clipboard-DBGdJ-1S.js";
|
|
15
|
-
import { t as M } from "./chunks/i18n-CNsBRNPu.js";
|
|
16
|
-
import { S as N, f as P, t as F } from "./chunks/styles-DwSR-9a3.js";
|
|
17
|
-
import "./bk-button.js";
|
|
18
|
-
import "./bk-checkbox.js";
|
|
19
|
-
import "./bk-filter-bar.js";
|
|
20
|
-
import "./chunks/bk-icon-DssFsNuB.js";
|
|
21
|
-
import "./bk-input-number.js";
|
|
22
|
-
import "./chunks/bk-input-text-CUNQG1ah.js";
|
|
23
|
-
import "./bk-menu-context.js";
|
|
24
|
-
import "./bk-menu-divider.js";
|
|
25
|
-
import "./bk-menu-item.js";
|
|
26
|
-
import "./bk-menu-label.js";
|
|
27
|
-
import "./bk-popover.js";
|
|
28
|
-
import "./bk-skeleton.js";
|
|
29
|
-
import "./chunks/add-CUFUzxGc.js";
|
|
30
|
-
import "./chunks/arrow-back-DJBwVPZy.js";
|
|
31
|
-
import "./chunks/arrow-down-yAm1AGV7.js";
|
|
32
|
-
import "./chunks/arrow-forward-vijvTQ6r.js";
|
|
33
|
-
import "./chunks/arrow-up-BfHTuP3c.js";
|
|
34
|
-
import "./chunks/check-BkWcIJJJ.js";
|
|
35
|
-
import "./chunks/chevron-right-CxqvZ6TS.js";
|
|
36
|
-
import "./chunks/drag-indicator--UOafVoi.js";
|
|
37
|
-
import "./chunks/filter-CCC4hLkS.js";
|
|
38
|
-
import "./chunks/grid-BV0_DQ5v.js";
|
|
39
|
-
import "./chunks/keyboard-Cq9klEyN.js";
|
|
40
|
-
import "./chunks/more-vert-u8TDwpwH.js";
|
|
41
|
-
import "./chunks/refresh-BeOCgDeL.js";
|
|
42
|
-
import "./chunks/remove-3A4Fpn3J.js";
|
|
43
|
-
import "./chunks/unfold-more-CcOFYpUE.js";
|
|
44
|
-
import "./chunks/visibility-off-urFZQ4oB.js";
|
|
45
|
-
// dist/components/bk-table.js
|
|
46
|
-
var I = 48, L = 16, R = 64, z = 3, B = 10, V = "[data-bk-select], [data-bk-handle]", H = "button, a[href], input, select, textarea, bk-checkbox, bk-button, bk-switch, bk-link, bk-select, .bk-table-resize, [tabindex]:not(td, th, tr)", U = "button, a[href], input, select, textarea, label, summary, [contenteditable], [role='button'], [tabindex]:not(td, th, tr), [data-row-action], bk-button, bk-button-copy, bk-button-share, bk-checkbox, bk-switch, bk-link, bk-select, bk-menu, bk-input-inline, bk-input-rating", W = ":scope > table > :is(thead, tbody:not([data-bk-state]), tfoot) > tr:not([data-bk-spacer])", G = (e) => (e ?? "").replace(/\s+/g, " ").trim(), K = /* @__PURE__ */ new Set(["true", "yes"]), q = /* @__PURE__ */ new Set([
|
|
47
|
-
"false",
|
|
48
|
-
"no",
|
|
49
|
-
""
|
|
50
|
-
]), J = (e) => e == null || e === "" || e === !1 || Array.isArray(e) && e.length === 0, Y = (e, t) => e.includes(t) || /["\r\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, X = a`
|
|
51
|
-
@layer bk.components {
|
|
52
|
-
bk-table > table {
|
|
53
|
-
inline-size: 100%; border-collapse: separate; border-spacing: 0;
|
|
54
|
-
font-family: var(--bk-font); font-size: var(--bk-table-font-size, var(--bk-type-small));
|
|
55
|
-
line-height: var(--bk-line-height-body); color: var(--bk-table-fg, var(--bk-text));
|
|
56
|
-
}
|
|
57
|
-
bk-table > table > caption {
|
|
58
|
-
caption-side: top; text-align: start; padding-block-end: var(--bk-table-caption-gap, var(--bk-space-2));
|
|
59
|
-
color: var(--bk-table-caption-fg, var(--bk-text-muted)); font-size: var(--bk-table-caption-size, var(--bk-type-small));
|
|
60
|
-
}
|
|
61
|
-
bk-table > table > * > tr > :is(th, td) {
|
|
62
|
-
padding: var(--_bk-table-pad) var(--bk-table-cell-pad-inline, var(--bk-space-3));
|
|
63
|
-
text-align: start; vertical-align: middle; box-sizing: border-box;
|
|
64
|
-
border-block-end: var(--bk-border-width) solid var(--bk-table-border, var(--bk-line));
|
|
65
|
-
}
|
|
66
|
-
bk-table > table > * > tr > :is(th, td):first-child { padding-inline-start: var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))); }
|
|
67
|
-
bk-table > table > * > tr > :is(th, td):last-child { padding-inline-end: var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))); }
|
|
68
|
-
bk-table[flush] { --bk-table-edge: 0px; }
|
|
69
|
-
bk-table > table > thead > tr > th {
|
|
70
|
-
font-weight: var(--bk-table-head-weight, var(--bk-group-label-weight, var(--bk-label-weight, var(--bk-weight-medium)))); color: var(--bk-table-head-fg, var(--bk-group-label-color, var(--bk-text-muted)));
|
|
71
|
-
font-size: var(--bk-table-head-size, var(--bk-group-label-size, 1em));
|
|
72
|
-
line-height: var(--bk-table-head-leading, var(--bk-line-height-heading));
|
|
73
|
-
text-transform: var(--bk-group-label-transform, var(--bk-label-transform, none)); letter-spacing: var(--bk-group-label-tracking, var(--bk-label-tracking, normal)); font-family: var(--bk-font-label, inherit);
|
|
74
|
-
background: var(--bk-table-head-bg, transparent); white-space: nowrap;
|
|
75
|
-
}
|
|
76
|
-
bk-table > table > tbody > tr > th { font-weight: var(--bk-table-row-head-weight, var(--bk-weight-medium)); }
|
|
77
|
-
bk-table > table > tbody:last-child > tr:last-child > :is(th, td) { border-block-end: 0; }
|
|
78
|
-
bk-table > table > tfoot > tr > :is(th, td) {
|
|
79
|
-
font-weight: var(--bk-table-foot-weight, var(--bk-weight-medium)); border-block-start: var(--bk-border-width) solid var(--bk-table-border-strong, var(--bk-line-strong)); border-block-end: 0;
|
|
80
|
-
background: var(--bk-table-foot-bg, transparent);
|
|
81
|
-
}
|
|
82
|
-
bk-table > table > * > tr > [data-type="number"] { text-align: end; font-variant-numeric: tabular-nums; }
|
|
83
|
-
/* Yes/no cells: a mark in place of the value, centred in the column. A text value of the column ("Unlimited") centres too. */
|
|
84
|
-
bk-table > table > * > tr > :is([data-bk-check], [data-bk-check-column], th[data-type="check"]) { text-align: center; }
|
|
85
|
-
bk-table > table > * > tr > [data-bk-check] > .bk-table-check {
|
|
86
|
-
display: inline-flex; align-items: center; justify-content: center; vertical-align: top;
|
|
87
|
-
block-size: var(--bk-line-height-body); color: var(--bk-table-check-yes-fg, var(--bk-success-text));
|
|
88
|
-
}
|
|
89
|
-
bk-table > table > * > tr > [data-bk-check="no"] > .bk-table-check { color: var(--bk-table-check-no-fg, var(--bk-text-faint)); }
|
|
90
|
-
bk-table > table > * > tr > [data-bk-check] > .bk-table-check > bk-icon { --bk-icon-size: var(--bk-table-check-size, var(--bk-icon-sm)); }
|
|
91
|
-
/* The highlighted column: a tint and a frame from the header to the last row. Inset shadows, so the layout stays. */
|
|
92
|
-
bk-table > table > * > tr > [data-bk-highlight] {
|
|
93
|
-
--_bk-table-hl-w: var(--bk-table-highlight-border-width, var(--bk-border-width));
|
|
94
|
-
--_bk-table-hl-c: var(--bk-table-highlight-border, var(--bk-accent-solid));
|
|
95
|
-
background-color: var(--bk-table-highlight-bg, var(--bk-accent-soft));
|
|
96
|
-
box-shadow: inset var(--_bk-table-hl-w) 0 0 0 var(--_bk-table-hl-c), inset calc(-1 * var(--_bk-table-hl-w)) 0 0 0 var(--_bk-table-hl-c);
|
|
97
|
-
}
|
|
98
|
-
bk-table > table > * > tr > [data-bk-highlight="first"] {
|
|
99
|
-
box-shadow: inset var(--_bk-table-hl-w) 0 0 0 var(--_bk-table-hl-c), inset calc(-1 * var(--_bk-table-hl-w)) 0 0 0 var(--_bk-table-hl-c), inset 0 var(--_bk-table-hl-w) 0 0 var(--_bk-table-hl-c);
|
|
100
|
-
}
|
|
101
|
-
bk-table > table > * > tr > [data-bk-highlight="last"] {
|
|
102
|
-
box-shadow: inset var(--_bk-table-hl-w) 0 0 0 var(--_bk-table-hl-c), inset calc(-1 * var(--_bk-table-hl-w)) 0 0 0 var(--_bk-table-hl-c), inset 0 calc(-1 * var(--_bk-table-hl-w)) 0 0 var(--_bk-table-hl-c);
|
|
103
|
-
}
|
|
104
|
-
bk-table > table > thead > tr > th[data-bk-highlight] { color: var(--bk-table-highlight-head-fg, var(--bk-accent-text)); }
|
|
105
|
-
bk-table[variant="striped"] > table > tbody > tr:nth-child(even) > :is(th, td) { background: var(--bk-table-stripe, var(--bk-hover)); }
|
|
106
|
-
/* Stripes are the divider: no hairline runs into the edge of a tinted row. */
|
|
107
|
-
bk-table[variant="striped"] > table > tbody > tr > :is(th, td) { border-block-end-color: transparent; }
|
|
108
|
-
bk-table[variant="grid"] > table > * > tr > :is(th, td):not(:last-child) { border-inline-end: var(--bk-border-width) solid var(--bk-table-border, var(--bk-line)); }
|
|
109
|
-
bk-table > table > tbody > tr:is([data-selected], [aria-selected="true"]) > :is(th, td) { background: var(--bk-table-selected, var(--bk-selected)); }
|
|
110
|
-
/* A tinted row has a surface: no divider line runs into its edges (above, below). */
|
|
111
|
-
bk-table:not([variant="striped"]) > table > tbody > tr:is([data-selected], [aria-selected="true"], [data-group]) > :is(th, td),
|
|
112
|
-
bk-table:not([variant="striped"]) > table > tbody > tr:has(+ tr:is([data-selected], [aria-selected="true"], [data-group])) > :is(th, td) {
|
|
113
|
-
border-block-end-color: transparent;
|
|
114
|
-
}
|
|
115
|
-
/* Row links: the hit area of the link covers the row; the controls of the row stay on top of it. The row is a
|
|
116
|
-
stacking context, so its controls never paint over a sticky header. */
|
|
117
|
-
bk-table > table > tbody > tr:has(a[data-row-link][href]) { position: relative; z-index: 0; cursor: pointer; }
|
|
118
|
-
bk-table > table > tbody > tr > * a[data-row-link][href] { color: var(--bk-table-row-link-fg, inherit); font-weight: var(--bk-table-row-link-weight, inherit); text-decoration: none; }
|
|
119
|
-
bk-table > table > tbody > tr > * a[data-row-link][href]::after { content: ""; position: absolute; inset: 0; }
|
|
120
|
-
bk-table > table > tbody > tr:has(a[data-row-link][href]) :is(${t(U)}):not([data-row-link]) { position: relative; z-index: 1; }
|
|
121
|
-
bk-table > table > tbody > tr > * a[data-row-link][href]:focus { outline: none; }
|
|
122
|
-
bk-table > table > tbody > tr > * a[data-row-link][href]:focus-visible::after { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
123
|
-
@media (hover: hover) {
|
|
124
|
-
bk-table > table > tbody > tr:hover > * a[data-row-link][href] { text-decoration: underline; }
|
|
125
|
-
/* An overlay, so the hover shows on stripes and selected rows too. */
|
|
126
|
-
bk-table[hover-rows] > table > tbody > tr:hover > :is(th, td) {
|
|
127
|
-
background-image: linear-gradient(var(--bk-table-row-hover, var(--bk-hover)), var(--bk-table-row-hover, var(--bk-hover)));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/* The sort button fills the header cell beside its tools: a click anywhere in the cell sorts. */
|
|
131
|
-
bk-table > table > thead > tr > th > .bk-table-sort {
|
|
132
|
-
display: inline-flex; align-items: center; gap: var(--bk-table-sort-gap, var(--bk-space-1)); box-sizing: border-box;
|
|
133
|
-
inline-size: calc(100% + 2 * var(--bk-table-sort-pad, var(--bk-space-1)) - var(--_bk-table-sort-tools, 0px));
|
|
134
|
-
position: relative; min-block-size: var(--bk-space-6); margin: 0 calc(-1 * var(--bk-table-sort-pad, var(--bk-space-1)));
|
|
135
|
-
padding: 0 var(--bk-table-sort-pad, var(--bk-space-1)); border: 0; border-radius: var(--bk-table-sort-radius, var(--bk-radius-xs));
|
|
136
|
-
background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: inherit;
|
|
137
|
-
cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--bk-duration-fast), color var(--bk-duration-fast);
|
|
138
|
-
}
|
|
139
|
-
bk-table > table > thead > tr > th > .bk-table-sort::before { content: ""; position: absolute; inset-inline: 0; inset-block: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
|
|
140
|
-
@media (hover: hover) {
|
|
141
|
-
bk-table > table > thead > tr > th > .bk-table-sort:hover { background: var(--bk-table-sort-hover, var(--bk-hover)); color: var(--bk-table-sort-active-fg, var(--bk-text)); }
|
|
142
|
-
}
|
|
143
|
-
bk-table > table > thead > tr > th > .bk-table-sort:active { background: var(--bk-pressed); }
|
|
144
|
-
bk-table > table > thead > tr > th > .bk-table-sort:focus { outline: none; }
|
|
145
|
-
bk-table > table > thead > tr > th > .bk-table-sort:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
146
|
-
bk-table > table > thead > tr > th[aria-sort] > .bk-table-sort { color: var(--bk-table-sort-active-fg, var(--bk-text)); }
|
|
147
|
-
bk-table > table > thead > tr > th:has(> .bk-table-tool) > .bk-table-sort {
|
|
148
|
-
--_bk-table-sort-tools: calc(var(--bk-table-tool-size, var(--bk-space-6)) + var(--bk-table-tool-gap, var(--bk-space-1)));
|
|
149
|
-
}
|
|
150
|
-
bk-table > table > thead > tr > th:has(> .bk-table-tool ~ .bk-table-tool) > .bk-table-sort {
|
|
151
|
-
--_bk-table-sort-tools: calc(2 * (var(--bk-table-tool-size, var(--bk-space-6)) + var(--bk-table-tool-gap, var(--bk-space-1))));
|
|
152
|
-
}
|
|
153
|
-
/* Numbers align to the end: the icon goes first, so the labels line up with the figures. In the reversed row the
|
|
154
|
-
start of the content is the end of the cell. */
|
|
155
|
-
bk-table > table > thead > tr > th[data-type="number"] > .bk-table-sort { flex-direction: row-reverse; }
|
|
156
|
-
bk-table > table > thead > tr > th > .bk-table-sort > .bk-table-sort-icon {
|
|
157
|
-
--bk-icon-size: var(--bk-table-sort-icon-size, var(--bk-icon-sm)); color: var(--bk-table-sort-icon-fg, var(--bk-text-faint));
|
|
158
|
-
}
|
|
159
|
-
bk-table > table > thead > tr > th[aria-sort] > .bk-table-sort > .bk-table-sort-icon { color: inherit; }
|
|
160
|
-
bk-table[sticky-header] > table > thead > tr > th {
|
|
161
|
-
position: sticky; inset-block-start: 0; z-index: 1;
|
|
162
|
-
background: var(--bk-table-head-bg, var(--bk-layer-sticky-bg));
|
|
163
|
-
}
|
|
164
|
-
bk-table[sticky-footer] > table > tfoot > tr > :is(th, td) {
|
|
165
|
-
position: sticky; inset-block-end: 0; z-index: 1;
|
|
166
|
-
background: var(--bk-table-foot-bg, var(--bk-layer-sticky-bg));
|
|
167
|
-
}
|
|
168
|
-
bk-table > table > * > tr > * > .bk-table-sr, bk-table > table > * > tr > * > .bk-table-check > .bk-table-sr { ${N} }
|
|
169
|
-
/* Header tools: the filter button and the column menu button, ghost icon buttons after the label. */
|
|
170
|
-
bk-table > table > thead > tr > th > .bk-table-tool,
|
|
171
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle {
|
|
172
|
-
display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; position: relative;
|
|
173
|
-
inline-size: var(--bk-table-tool-size, var(--bk-space-6)); block-size: var(--bk-table-tool-size, var(--bk-space-6));
|
|
174
|
-
margin-block: calc(-1 * var(--bk-space-1)); padding: 0; border: 0;
|
|
175
|
-
border-radius: var(--bk-table-tool-radius, var(--bk-radius-xs)); background: none;
|
|
176
|
-
color: var(--bk-table-tool-fg, var(--bk-text-muted)); cursor: pointer; -webkit-tap-highlight-color: transparent;
|
|
177
|
-
}
|
|
178
|
-
bk-table > table > thead > tr > th > .bk-table-tool { margin-inline-start: var(--bk-table-tool-gap, var(--bk-space-1)); }
|
|
179
|
-
bk-table > table > thead > tr > th > .bk-table-tool::before,
|
|
180
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle::before { content: ""; position: absolute; inset: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
|
|
181
|
-
bk-table > table > thead > tr > th > .bk-table-tool > bk-icon,
|
|
182
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle > bk-icon { --bk-icon-size: var(--bk-table-tool-icon-size, var(--bk-icon-sm)); }
|
|
183
|
-
@media (hover: hover) {
|
|
184
|
-
bk-table > table > thead > tr > th > .bk-table-tool:hover,
|
|
185
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:hover { background: var(--bk-table-tool-hover, var(--bk-hover)); color: var(--bk-text); }
|
|
186
|
-
/* The menu button shows where the pointer or the focus is; on touch it always shows. */
|
|
187
|
-
bk-table > table > thead > tr > th > .bk-table-menu { opacity: 0; }
|
|
188
|
-
bk-table > table > thead > tr > th:is(:hover, :focus-within) > .bk-table-menu,
|
|
189
|
-
bk-table > table > thead > tr > th > .bk-table-menu[aria-expanded="true"] { opacity: 1; }
|
|
190
|
-
}
|
|
191
|
-
bk-table > table > thead > tr > th > .bk-table-tool:active,
|
|
192
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:active { background: var(--bk-pressed); }
|
|
193
|
-
bk-table > table > thead > tr > th > .bk-table-tool:focus,
|
|
194
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:focus { outline: none; }
|
|
195
|
-
bk-table > table > thead > tr > th > .bk-table-tool:focus-visible,
|
|
196
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
197
|
-
bk-table > table > thead > tr > th > .bk-table-filter[data-active] { color: var(--bk-table-filter-active-fg, var(--bk-accent-text)); }
|
|
198
|
-
/* Selection and handle columns: narrow. */
|
|
199
|
-
bk-table > table > * > tr > :is([data-bk-select], [data-bk-handle]) { inline-size: 1px; white-space: nowrap; }
|
|
200
|
-
bk-table > table > * > tr > [data-bk-handle] { padding-inline-end: 0; }
|
|
201
|
-
bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle { cursor: grab; touch-action: none; }
|
|
202
|
-
bk-table > table > tbody > tr[data-bk-lifted] > :is(th, td) { background: var(--bk-table-lifted-bg, var(--bk-layer-raised-bg)); }
|
|
203
|
-
bk-table > table > tbody > tr[data-bk-lifted] > [data-bk-handle] > .bk-table-handle { cursor: grabbing; color: var(--bk-text); }
|
|
204
|
-
bk-table > table > tbody > tr[data-bk-drop="before"] > :is(th, td) { box-shadow: inset 0 calc(var(--bk-border-width) * 2) 0 0 var(--bk-table-drop-line, var(--bk-accent-solid)); }
|
|
205
|
-
bk-table > table > tbody > tr[data-bk-drop="after"] > :is(th, td) { box-shadow: inset 0 calc(var(--bk-border-width) * -2) 0 0 var(--bk-table-drop-line, var(--bk-accent-solid)); }
|
|
206
|
-
/* Expandable rows: a disclosure button in the first cell. */
|
|
207
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure {
|
|
208
|
-
display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
|
|
209
|
-
position: relative; inline-size: var(--bk-space-6); block-size: var(--bk-space-6); margin: calc(-1 * var(--bk-space-1)) var(--bk-space-1) calc(-1 * var(--bk-space-1)) calc(-1 * var(--bk-space-1));
|
|
210
|
-
padding: 0; border: 0; border-radius: var(--bk-table-disclosure-radius, var(--bk-radius-xs));
|
|
211
|
-
background: none; color: var(--bk-table-disclosure-fg, var(--bk-text-muted)); cursor: pointer; -webkit-tap-highlight-color: transparent;
|
|
212
|
-
}
|
|
213
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure::before { content: ""; position: absolute; inset-inline: 0; inset-block: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
|
|
214
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure > bk-icon {
|
|
215
|
-
--bk-icon-size: var(--bk-table-disclosure-icon-size, var(--bk-icon-sm));
|
|
216
|
-
transition: rotate var(--bk-duration-fast);
|
|
217
|
-
}
|
|
218
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure[aria-expanded="true"] > bk-icon,
|
|
219
|
-
bk-table > table > tbody > tr[aria-expanded="true"] > * > .bk-table-disclosure > bk-icon { rotate: 90deg; }
|
|
220
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure:dir(rtl) > bk-icon { scale: -1 1; }
|
|
221
|
-
@media (hover: hover) {
|
|
222
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure:hover { background: var(--bk-table-disclosure-hover, var(--bk-hover)); color: var(--bk-text); }
|
|
223
|
-
}
|
|
224
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure:active { background: var(--bk-pressed); }
|
|
225
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure:focus { outline: none; }
|
|
226
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
227
|
-
bk-table > table > tbody > tr[data-detail] > td { background: var(--bk-table-detail-bg, transparent); }
|
|
228
|
-
/* Tree rows: the first cell moves in by the level; a leaf keeps the place of the disclosure button. */
|
|
229
|
-
bk-table > table > tbody > tr[data-bk-tree] > [data-bk-indent] {
|
|
230
|
-
padding-inline-start: calc(var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))) + var(--_bk-table-level, 0) * var(--bk-table-indent, var(--bk-space-4)));
|
|
231
|
-
}
|
|
232
|
-
bk-table > table > tbody > tr[data-bk-tree]:not([data-bk-parent]) > [data-bk-indent] {
|
|
233
|
-
padding-inline-start: calc(var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))) + var(--_bk-table-level, 0) * var(--bk-table-indent, var(--bk-space-4)) + var(--bk-space-6));
|
|
234
|
-
}
|
|
235
|
-
bk-table > table > tbody > tr[data-group] > :is(th, td) {
|
|
236
|
-
background: var(--bk-table-group-bg, var(--bk-layer-sunken-bg)); font-weight: var(--bk-table-group-weight, var(--bk-weight-medium));
|
|
237
|
-
}
|
|
238
|
-
bk-table > table > tbody > tr[data-bk-tree]:focus { outline: none; }
|
|
239
|
-
bk-table > table > tbody > tr[data-bk-tree]:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
240
|
-
/* Cell navigation: one cell (or the one control in it) has the focus. */
|
|
241
|
-
bk-table[navigation="cell"] > table > * > tr > :is(th, td):focus { outline: none; }
|
|
242
|
-
bk-table[navigation="cell"] > table > * > tr > :is(th, td):focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
243
|
-
bk-table > table > * > tr > td[data-bk-editing] { position: relative; }
|
|
244
|
-
bk-table > table > * > tr > td > .bk-table-editor {
|
|
245
|
-
position: absolute; inset: 0; z-index: 2; display: grid; align-content: center;
|
|
246
|
-
padding-inline: var(--bk-table-edit-pad, var(--bk-space-1)); background: var(--bk-table-edit-bg, var(--bk-layer-base-bg));
|
|
247
|
-
text-align: start; font-weight: var(--bk-weight-regular, normal);
|
|
248
|
-
}
|
|
249
|
-
/* Resizable columns: a separator handle on the end edge of the header cell. */
|
|
250
|
-
:where(bk-table > table > thead > tr > th[data-resizable]) { position: relative; }
|
|
251
|
-
bk-table > table > thead > tr > th > .bk-table-resize {
|
|
252
|
-
position: absolute; inset-block: 0; inset-inline-end: calc(var(--bk-target-min) / -2); z-index: 3;
|
|
253
|
-
inline-size: var(--bk-target-min); cursor: col-resize; touch-action: none; -webkit-tap-highlight-color: transparent;
|
|
254
|
-
--_bk-grip-color: var(--bk-table-resize-active-fg, var(--bk-accent-solid));
|
|
255
|
-
}
|
|
256
|
-
${P}
|
|
257
|
-
bk-table > table > thead > tr > th > .bk-table-resize::after {
|
|
258
|
-
content: ""; position: absolute; inset-block: var(--bk-space-1); inset-inline-start: calc(50% - var(--bk-border-width) / 2);
|
|
259
|
-
inline-size: var(--bk-border-width); background: var(--bk-table-resize-fg, var(--bk-line-strong));
|
|
260
|
-
}
|
|
261
|
-
@media (hover: hover) {
|
|
262
|
-
bk-table > table > thead > tr > th > .bk-table-resize:hover::after { background: var(--bk-table-resize-active-fg, var(--bk-accent-solid)); inline-size: var(--bk-table-resize-active-size, calc(var(--bk-border-width) * 2)); }
|
|
263
|
-
}
|
|
264
|
-
bk-table > table > thead > tr > th > .bk-table-resize:focus { outline: none; }
|
|
265
|
-
bk-table > table > thead > tr > th > .bk-table-resize:focus-visible::after,
|
|
266
|
-
bk-table > table > thead > tr > th > .bk-table-resize[data-dragging]::after { background: var(--bk-table-resize-active-fg, var(--bk-accent-solid)); }
|
|
267
|
-
/* Pinned columns stay at the inline start or end; opaque, so the scrolled cells pass beneath. */
|
|
268
|
-
bk-table > table > * > tr > :is(th, td)[data-pin] { white-space: nowrap; }
|
|
269
|
-
bk-table > table > * > tr > :is(th, td)[data-pin="start"] {
|
|
270
|
-
position: sticky; inset-inline-start: var(--_bk-table-pin, 0); z-index: 1;
|
|
271
|
-
background: var(--bk-table-pin-bg, var(--bk-layer-base-bg));
|
|
272
|
-
}
|
|
273
|
-
bk-table > table > * > tr > :is(th, td)[data-pin="end"] {
|
|
274
|
-
position: sticky; inset-inline-end: var(--_bk-table-pin, 0); z-index: 1;
|
|
275
|
-
background: var(--bk-table-pin-bg, var(--bk-layer-base-bg));
|
|
276
|
-
}
|
|
277
|
-
bk-table > table > thead > tr > th[data-pin] { z-index: 2; background: var(--bk-table-pin-bg, var(--bk-layer-sticky-bg)); }
|
|
278
|
-
bk-table[sticky-footer] > table > tfoot > tr > [data-pin] { z-index: 2; background: var(--bk-table-pin-bg, var(--bk-layer-sticky-bg)); }
|
|
279
|
-
bk-table > table > tbody > tr:is([data-selected], [aria-selected="true"]) > :is(th, td)[data-pin] {
|
|
280
|
-
background: linear-gradient(var(--bk-table-selected, var(--bk-selected)), var(--bk-table-selected, var(--bk-selected))), var(--bk-table-pin-bg, var(--bk-layer-base-bg));
|
|
281
|
-
}
|
|
282
|
-
bk-table > table > * > tr > :is(th, td)[data-pin="start"][data-pin-edge] { border-inline-end: var(--bk-border-width) solid var(--bk-table-pin-border, var(--bk-line-strong)); }
|
|
283
|
-
bk-table > table > * > tr > :is(th, td)[data-pin="end"][data-pin-edge] { border-inline-start: var(--bk-border-width) solid var(--bk-table-pin-border, var(--bk-line-strong)); }
|
|
284
|
-
/* Hidden columns (column menu). */
|
|
285
|
-
bk-table > table > * > tr > [data-bk-hidden] { display: none; }
|
|
286
|
-
/* Loading: the old rows fade under the veil; the first load shows skeleton rows. */
|
|
287
|
-
bk-table[busy] > table > tbody:not([data-bk-state]) > tr > :is(th, td) { opacity: var(--bk-table-busy-opacity, 1); }
|
|
288
|
-
bk-table > table > tbody[data-bk-state] > tr > td { border-block-end: var(--bk-border-width) solid var(--bk-table-border, var(--bk-line)); }
|
|
289
|
-
bk-table > table > tbody[data-bk-state] > tr > td > bk-skeleton { --bk-skeleton-width: var(--bk-table-skeleton-width, 70%); }
|
|
290
|
-
/* An error replaces the rows: they are out of date. */
|
|
291
|
-
bk-table:has(> [slot="error"]) > table > tbody { display: none; }
|
|
292
|
-
/* Virtual rows: one fixed height, so the table can compute the window. */
|
|
293
|
-
bk-table[virtual] > table > tbody > tr:not([data-bk-spacer]) { block-size: var(--bk-table-row-height, var(--bk-control-lg)); }
|
|
294
|
-
bk-table[virtual] > table > tbody > tr:not([data-bk-spacer]) > :is(th, td) { white-space: nowrap; padding-block: 0; }
|
|
295
|
-
bk-table > table > tbody > tr[data-bk-spacer] > td { padding: 0; border: 0; }
|
|
296
|
-
/* Cards on a narrow screen: every row is a card of label and value pairs; the header row keeps its controls. */
|
|
297
|
-
bk-table:state(cards) > table,
|
|
298
|
-
bk-table:state(cards) > table > :is(thead, tbody, tfoot),
|
|
299
|
-
bk-table:state(cards) > table > * > tr { display: block; }
|
|
300
|
-
bk-table:state(cards) > table > caption { display: block; }
|
|
301
|
-
bk-table:state(cards) > table > thead > tr {
|
|
302
|
-
display: flex; flex-wrap: wrap; align-items: center; gap: var(--bk-table-card-gap, var(--bk-space-2));
|
|
303
|
-
padding-block-end: var(--bk-table-card-gap, var(--bk-space-2));
|
|
304
|
-
}
|
|
305
|
-
bk-table:state(cards) > table > thead > tr > th { display: block; position: static; padding: 0; border: 0; background: none; inline-size: auto; }
|
|
306
|
-
bk-table:state(cards) > table > thead > tr > th:not(:has(> button, > bk-checkbox)) { ${N} }
|
|
307
|
-
bk-table:state(cards) > table > thead > tr > th > .bk-table-resize { display: none; }
|
|
308
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr {
|
|
309
|
-
margin-block-end: var(--bk-table-card-gap, var(--bk-space-2)); padding: var(--bk-table-card-padding, var(--bk-space-3));
|
|
310
|
-
border: var(--bk-border-width) solid var(--bk-table-card-border, var(--bk-layer-raised-border));
|
|
311
|
-
border-radius: var(--bk-table-card-radius, var(--bk-radius-container, var(--bk-radius-md)));
|
|
312
|
-
background: var(--bk-table-card-bg, var(--bk-layer-raised-bg));
|
|
313
|
-
}
|
|
314
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > :is(th, td) {
|
|
315
|
-
display: flex; justify-content: space-between; align-items: baseline; gap: var(--bk-table-card-label-gap, var(--bk-space-3));
|
|
316
|
-
position: static; padding: var(--bk-table-card-row-pad, var(--bk-space-1)) 0; border: 0; text-align: end; inline-size: auto;
|
|
317
|
-
}
|
|
318
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-label]::before {
|
|
319
|
-
content: attr(data-bk-label) / ""; text-align: start; color: var(--bk-table-head-fg, var(--bk-text-muted));
|
|
320
|
-
font-weight: var(--bk-table-head-weight, var(--bk-weight-medium));
|
|
321
|
-
}
|
|
322
|
-
/*
|
|
323
|
-
* A text value stands at the end beside its label while it fits on the line. A longer value wraps as a whole under
|
|
324
|
-
* the label: it starts at the start edge and takes the full width. A number stays at the end beside its label.
|
|
325
|
-
*/
|
|
326
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-label]:not([data-bk-number], [data-type="number"], [data-bk-check]) {
|
|
327
|
-
flex-wrap: wrap; row-gap: var(--bk-table-card-block-gap, var(--bk-space-1)); text-align: start;
|
|
328
|
-
}
|
|
329
|
-
/* th[data-card="block"]: the value always stands under its label. */
|
|
330
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="block"] { display: block; text-align: start; }
|
|
331
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="block"][data-bk-label]::before {
|
|
332
|
-
display: block; margin-block-end: var(--bk-table-card-block-gap, var(--bk-space-1));
|
|
333
|
-
}
|
|
334
|
-
/* A row header in the body is the title of the card, unless its column gives it another place (data-card). */
|
|
335
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="title"],
|
|
336
|
-
bk-table:state(cards) > table > tbody > tr > th:not([data-bk-card], ${t(V)}) {
|
|
337
|
-
justify-content: start; text-align: start; font-size: var(--bk-table-card-title-size, var(--bk-type-body, 1em));
|
|
338
|
-
font-weight: var(--bk-table-card-title-weight, var(--bk-weight-semibold, var(--bk-weight-medium)));
|
|
339
|
-
}
|
|
340
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > :is([data-bk-card="hidden"], [data-bk-handle]) { display: none; }
|
|
341
|
-
/*
|
|
342
|
-
* th[data-card="meta"]: a short value without its label (a position, a change) is in the head of the card,
|
|
343
|
-
* in the order of the row, next to the title and the checkbox. The other cells follow in full rows.
|
|
344
|
-
*/
|
|
345
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) {
|
|
346
|
-
display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--bk-table-card-meta-gap, var(--bk-space-2));
|
|
347
|
-
}
|
|
348
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) > * { flex: 1 0 100%; order: 1; }
|
|
349
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) > :is([data-bk-card="meta"], [data-bk-select]) {
|
|
350
|
-
flex: none; order: 0;
|
|
351
|
-
}
|
|
352
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) > :is([data-bk-card="title"], th:not([data-bk-card], ${t(V)})) {
|
|
353
|
-
flex: 1 1 0; min-inline-size: 0; order: 0;
|
|
354
|
-
}
|
|
355
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="meta"] {
|
|
356
|
-
justify-content: start; align-items: center; gap: var(--bk-table-card-meta-gap, var(--bk-space-2));
|
|
357
|
-
text-align: start; color: var(--bk-table-card-meta-fg, var(--bk-text-muted));
|
|
358
|
-
}
|
|
359
|
-
/* An open row and its detail form one card. The text of the detail starts at the start edge. */
|
|
360
|
-
bk-table:state(cards) > table > tbody > tr:has(+ tr[data-detail]:not([hidden])) {
|
|
361
|
-
margin-block-end: 0; border-end-start-radius: 0; border-end-end-radius: 0;
|
|
362
|
-
}
|
|
363
|
-
bk-table:state(cards) > table > tbody > tr[data-detail] {
|
|
364
|
-
border-block-start-style: dashed; border-start-start-radius: 0; border-start-end-radius: 0;
|
|
365
|
-
}
|
|
366
|
-
bk-table:state(cards) > table > tbody > tr[data-detail] > td { display: block; text-align: start; }
|
|
367
|
-
/* A closed detail row and the hidden rows of a closed tree stay hidden in card mode too. */
|
|
368
|
-
bk-table:state(cards) > table > :is(thead, tbody, tfoot) > tr[hidden] { display: none; }
|
|
369
|
-
bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-select] { justify-content: start; }
|
|
370
|
-
@media (forced-colors: active) {
|
|
371
|
-
bk-table > table > * > tr > [data-bk-highlight] { --_bk-table-hl-c: Highlight; forced-color-adjust: none; background-color: Canvas; color: CanvasText; }
|
|
372
|
-
bk-table > table > * > tr > [data-bk-check] > .bk-table-check { color: CanvasText; }
|
|
373
|
-
bk-table > table > tbody > tr[data-bk-drop] { outline: calc(var(--bk-border-width) * 2) solid Highlight; }
|
|
374
|
-
bk-table > table > thead > tr > th > .bk-table-filter[data-active] { color: Highlight; }
|
|
375
|
-
}
|
|
376
|
-
@media (prefers-reduced-motion: reduce) {
|
|
377
|
-
bk-table > table > tbody > tr > * > .bk-table-disclosure > bk-icon { transition: none; }
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
`, Z = class extends i {
|
|
381
|
-
static properties = {
|
|
382
|
-
variant: {
|
|
383
|
-
reflect: !0,
|
|
384
|
-
useDefault: !0
|
|
385
|
-
},
|
|
386
|
-
stickyHeader: {
|
|
387
|
-
type: Boolean,
|
|
388
|
-
reflect: !0,
|
|
389
|
-
useDefault: !0,
|
|
390
|
-
attribute: "sticky-header"
|
|
391
|
-
},
|
|
392
|
-
stickyFooter: {
|
|
393
|
-
type: Boolean,
|
|
394
|
-
reflect: !0,
|
|
395
|
-
useDefault: !0,
|
|
396
|
-
attribute: "sticky-footer"
|
|
397
|
-
},
|
|
398
|
-
hoverRows: {
|
|
399
|
-
type: Boolean,
|
|
400
|
-
reflect: !0,
|
|
401
|
-
useDefault: !0,
|
|
402
|
-
attribute: "hover-rows"
|
|
403
|
-
},
|
|
404
|
-
surface: {
|
|
405
|
-
type: Boolean,
|
|
406
|
-
reflect: !0,
|
|
407
|
-
useDefault: !0
|
|
408
|
-
},
|
|
409
|
-
flush: {
|
|
410
|
-
type: Boolean,
|
|
411
|
-
reflect: !0,
|
|
412
|
-
useDefault: !0
|
|
413
|
-
},
|
|
414
|
-
sortable: {
|
|
415
|
-
type: Boolean,
|
|
416
|
-
reflect: !0,
|
|
417
|
-
useDefault: !0
|
|
418
|
-
},
|
|
419
|
-
sortKey: {
|
|
420
|
-
reflect: !0,
|
|
421
|
-
attribute: "sort-key"
|
|
422
|
-
},
|
|
423
|
-
sortDir: {
|
|
424
|
-
reflect: !0,
|
|
425
|
-
useDefault: !0,
|
|
426
|
-
attribute: "sort-dir"
|
|
427
|
-
},
|
|
428
|
-
selection: { reflect: !0 },
|
|
429
|
-
navigation: { reflect: !0 },
|
|
430
|
-
columnMenu: {
|
|
431
|
-
type: Boolean,
|
|
432
|
-
reflect: !0,
|
|
433
|
-
useDefault: !0,
|
|
434
|
-
attribute: "column-menu"
|
|
435
|
-
},
|
|
436
|
-
reorderable: {
|
|
437
|
-
type: Boolean,
|
|
438
|
-
reflect: !0,
|
|
439
|
-
useDefault: !0
|
|
440
|
-
},
|
|
441
|
-
responsive: { reflect: !0 },
|
|
442
|
-
busy: {
|
|
443
|
-
type: Boolean,
|
|
444
|
-
reflect: !0,
|
|
445
|
-
useDefault: !0
|
|
446
|
-
},
|
|
447
|
-
busyLabel: { attribute: "busy-label" },
|
|
448
|
-
skeletonRows: {
|
|
449
|
-
type: Number,
|
|
450
|
-
attribute: "skeleton-rows"
|
|
451
|
-
},
|
|
452
|
-
virtual: {
|
|
453
|
-
type: Boolean,
|
|
454
|
-
reflect: !0,
|
|
455
|
-
useDefault: !0
|
|
456
|
-
},
|
|
457
|
-
rows: { attribute: !1 },
|
|
458
|
-
renderRow: { attribute: !1 },
|
|
459
|
-
rowKey: { attribute: !1 },
|
|
460
|
-
filters: { attribute: !1 },
|
|
461
|
-
hiddenColumns: { attribute: !1 },
|
|
462
|
-
persistKey: { attribute: "persist-key" },
|
|
463
|
-
label: {},
|
|
464
|
-
scrolling: { state: !0 },
|
|
465
|
-
resizable: { state: !0 },
|
|
466
|
-
empty: { state: !0 },
|
|
467
|
-
filterKey: { state: !0 }
|
|
468
|
-
};
|
|
469
|
-
menuColumn = null;
|
|
470
|
-
menuKind = "resize";
|
|
471
|
-
i18n = new M(this);
|
|
472
|
-
internals = this.attachInternals();
|
|
473
|
-
slots = new b(this);
|
|
474
|
-
busyState = new S(this, this.i18n);
|
|
475
|
-
keys = /* @__PURE__ */ new Set();
|
|
476
|
-
anchor;
|
|
477
|
-
shift = !1;
|
|
478
|
-
shiftDown = !1;
|
|
479
|
-
widths = new v(this, () => this.persistKey && `table:${this.persistKey}:widths`);
|
|
480
|
-
columnState = new v(this, () => this.persistKey && `table:${this.persistKey}:columns`);
|
|
481
|
-
openRows = new v(this, () => this.persistKey && `table:${this.persistKey}:expanded`);
|
|
482
|
-
sizes = s(() => this.measure());
|
|
483
|
-
observedTable = null;
|
|
484
|
-
heads = l(() => this.syncAll());
|
|
485
|
-
rowLinks = l(() => this.resolveRowLinks());
|
|
486
|
-
vc = new C(this, {
|
|
487
|
-
scroller: () => this.scroller,
|
|
488
|
-
track: () => this.virtual ? this.body : null,
|
|
489
|
-
rowHeight: "var(--bk-table-row-height, var(--bk-control-lg))"
|
|
490
|
-
});
|
|
491
|
-
loadMore = new w(this, {
|
|
492
|
-
sentinel: () => this.virtual ? this.renderRoot.querySelector(".sentinel") : null,
|
|
493
|
-
root: () => this.scroller,
|
|
494
|
-
loading: () => this.busy,
|
|
495
|
-
count: () => this.rows?.length ?? 0
|
|
496
|
-
});
|
|
497
|
-
tree = !1;
|
|
498
|
-
stop = null;
|
|
499
|
-
lift = null;
|
|
500
|
-
handleRow = null;
|
|
501
|
-
editing = null;
|
|
502
|
-
filterButton = null;
|
|
503
|
-
filterable = !1;
|
|
504
|
-
syncing = !1;
|
|
505
|
-
constructor() {
|
|
506
|
-
super(), new h(this), this.variant = "line", this.stickyHeader = !1, this.stickyFooter = !1, this.hoverRows = !1, this.surface = !1, this.flush = !1, this.sortable = !1, this.sortDir = "asc", this.columnMenu = !1, this.reorderable = !1, this.busy = !1, this.skeletonRows = 5, this.virtual = !1, this.filters = {}, this.hiddenColumns = [], this.scrolling = !1, this.resizable = !1, this.empty = !1, this.addEventListener("click", this.onClick), this.addEventListener("click", this.onRowLink), this.addEventListener("auxclick", this.onRowLink), this.addEventListener("click", this.onRowLinkNavigate), this.addEventListener("dblclick", this.onDoubleClick), this.addEventListener("click", (e) => {
|
|
507
|
-
this.shift = e.shiftKey || this.shiftDown, setTimeout(() => this.shift = !1);
|
|
508
|
-
}, !0), this.addEventListener("keydown", (e) => this.shiftDown = e.shiftKey, !0), this.addEventListener("keyup", (e) => this.shiftDown = e.shiftKey, !0), this.addEventListener("focusout", this.onFocusOut), this.addEventListener("focusin", this.onFocusIn), this.addEventListener("change", this.onChange), this.addEventListener("keydown", this.onKeydown), this.addEventListener("pointerdown", this.onPointerDown);
|
|
509
|
-
}
|
|
510
|
-
get selectedKeys() {
|
|
511
|
-
return [...this.keys];
|
|
512
|
-
}
|
|
513
|
-
set selectedKeys(e) {
|
|
514
|
-
this.keys = new Set(e ?? []), this.requestUpdate("selectedKeys");
|
|
515
|
-
}
|
|
516
|
-
get columnOrder() {
|
|
517
|
-
let e = this.headRow, t = e ? this.appCells(e).map((e) => this.columnKey(e)) : [], n = this.columnState.value?.order;
|
|
518
|
-
return n?.length ? [...n, ...t.filter((e) => !n.includes(e))] : t;
|
|
519
|
-
}
|
|
520
|
-
static styles = [
|
|
521
|
-
F,
|
|
522
|
-
x,
|
|
523
|
-
T,
|
|
524
|
-
a`
|
|
525
|
-
:host {
|
|
526
|
-
display: block; min-inline-size: 0;
|
|
527
|
-
--_bk-table-pad: var(--bk-table-cell-pad-block, var(--bk-row-pad));
|
|
528
|
-
}
|
|
529
|
-
.frame { position: relative; max-block-size: inherit; block-size: inherit; display: flex; flex-direction: column; }
|
|
530
|
-
:host([surface]:not(:state(cards))) .frame {
|
|
531
|
-
background: var(--bk-table-surface-bg, var(--bk-layer-raised-bg));
|
|
532
|
-
border: var(--bk-border-width) solid var(--bk-table-surface-border, var(--bk-layer-raised-border));
|
|
533
|
-
border-radius: var(--bk-table-surface-radius, var(--bk-radius-container, var(--bk-radius-md)));
|
|
534
|
-
box-shadow: var(--bk-table-surface-shadow, var(--bk-layer-raised-shadow));
|
|
535
|
-
overflow: hidden;
|
|
536
|
-
}
|
|
537
|
-
.scroller { overflow: auto; flex: 1 1 auto; min-block-size: 0; max-block-size: inherit; overscroll-behavior-inline: contain; }
|
|
538
|
-
.scroller:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
|
|
539
|
-
.filter-bar { margin-block-end: var(--bk-table-filter-bar-gap, var(--bk-space-2)); }
|
|
540
|
-
.state { padding: var(--bk-table-state-padding, var(--bk-space-4)); }
|
|
541
|
-
.sentinel { block-size: var(--bk-border-width); }
|
|
542
|
-
.probe { position: absolute; visibility: hidden; pointer-events: none; inline-size: 0; block-size: 0; margin-inline-start: var(--bk-table-cards-below, calc(var(--bk-width-panel) * 1.5)); }
|
|
543
|
-
.filter-anchor { position: absolute; left: 0; top: 0; inline-size: 0; block-size: 0; }
|
|
544
|
-
.filter-anchor > bk-popover { position: absolute; left: 0; top: 0; }
|
|
545
|
-
.filter-body { display: flex; flex-direction: column; gap: var(--bk-table-filter-gap, var(--bk-space-3)); }
|
|
546
|
-
.filter-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--bk-space-cluster); }
|
|
547
|
-
`
|
|
548
|
-
];
|
|
549
|
-
connectedCallback() {
|
|
550
|
-
super.connectedCallback(), y(this, X), this.hasUpdated && this.observe();
|
|
551
|
-
}
|
|
552
|
-
disconnectedCallback() {
|
|
553
|
-
super.disconnectedCallback(), this.sizes.disconnect(), this.heads.disconnect(), this.rowLinks.disconnect(), this.observedTable = null;
|
|
554
|
-
}
|
|
555
|
-
willUpdate(e) {
|
|
556
|
-
if (super.willUpdate(e), this.virtual && this.renderRow ? this.vc.setCount(this.rows?.length ?? 0) : this.vc.count && this.vc.setCount(0), c(this)) {
|
|
557
|
-
this.empty = this.isEmpty;
|
|
558
|
-
let e = this.headRow;
|
|
559
|
-
this.resizable = this.columnMenu || !!e && this.appCells(e).some((e) => e.hasAttribute("data-resizable"));
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
get isEmpty() {
|
|
563
|
-
return this.virtual && this.renderRow ? !this.rows?.length : this.dataRows.length === 0;
|
|
564
|
-
}
|
|
565
|
-
updated(e) {
|
|
566
|
-
super.updated(e), this.virtual && this.renderRow ? this.renderWindow() : e.has("virtual") && e.get("virtual") && this.clearWindow(), this.isConnected && !this.observedTable && this.observe(), this.resolveRowLinks(), [
|
|
567
|
-
"sortable",
|
|
568
|
-
"sortKey",
|
|
569
|
-
"sortDir",
|
|
570
|
-
"selection",
|
|
571
|
-
"selectedKeys",
|
|
572
|
-
"persistKey",
|
|
573
|
-
"navigation",
|
|
574
|
-
"columnMenu",
|
|
575
|
-
"reorderable",
|
|
576
|
-
"responsive",
|
|
577
|
-
"busy",
|
|
578
|
-
"skeletonRows",
|
|
579
|
-
"virtual",
|
|
580
|
-
"rows",
|
|
581
|
-
"renderRow",
|
|
582
|
-
"filters",
|
|
583
|
-
"hiddenColumns"
|
|
584
|
-
].some((t) => e.has(t)) ? this.syncAll() : (this.persistKey && this.syncColumns(), this.table && (this.syncMarks(), this.heads.takeRecords())), (e.has("stickyHeader") || e.has("stickyFooter") || e.has("responsive")) && this.measure();
|
|
585
|
-
}
|
|
586
|
-
resolveRowLinks() {
|
|
587
|
-
if (!this.table) return;
|
|
588
|
-
let e = [...this.table.querySelectorAll("a[data-row-link]")].filter((e) => e.closest("bk-table") === this);
|
|
589
|
-
m(e), this.rowLinks.takeRecords();
|
|
590
|
-
}
|
|
591
|
-
observe() {
|
|
592
|
-
let e = this.scroller, t = this.table;
|
|
593
|
-
e && t !== this.observedTable && (this.sizes.disconnect(), this.heads.disconnect(), this.rowLinks.disconnect(), this.sizes.observe(e), t && (this.sizes.observe(t), this.heads.observe(t, {
|
|
594
|
-
childList: !0,
|
|
595
|
-
subtree: !0
|
|
596
|
-
}), this.rowLinks.observe(t, {
|
|
597
|
-
childList: !0,
|
|
598
|
-
subtree: !0,
|
|
599
|
-
attributes: !0,
|
|
600
|
-
attributeFilter: ["href"]
|
|
601
|
-
})), this.observedTable = t, this.syncAll());
|
|
602
|
-
}
|
|
603
|
-
syncAll() {
|
|
604
|
-
if (!this.syncing && this.table) {
|
|
605
|
-
this.syncing = !0;
|
|
606
|
-
try {
|
|
607
|
-
this.syncHandles(), this.syncSelection(), this.syncExpand(), this.syncTree(), this.syncSort(), this.syncTools(), this.syncColumns(), this.syncCards(), this.syncMarks(), this.syncRoles(), this.syncFocus(), this.syncState();
|
|
608
|
-
} finally {
|
|
609
|
-
this.syncing = !1, this.heads.takeRecords();
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
get scroller() {
|
|
614
|
-
return this.renderRoot?.querySelector(".scroller") ?? null;
|
|
615
|
-
}
|
|
616
|
-
get table() {
|
|
617
|
-
return c(this)?.querySelector(":scope > table") ?? null;
|
|
618
|
-
}
|
|
619
|
-
get body() {
|
|
620
|
-
return c(this)?.querySelector(":scope > table > tbody:not([data-bk-state])") ?? null;
|
|
621
|
-
}
|
|
622
|
-
get headRow() {
|
|
623
|
-
return c(this)?.querySelector(":scope > table > thead > tr") ?? null;
|
|
624
|
-
}
|
|
625
|
-
get headRows() {
|
|
626
|
-
return [...c(this)?.querySelectorAll(":scope > table > thead > tr") ?? []];
|
|
627
|
-
}
|
|
628
|
-
get footRows() {
|
|
629
|
-
return [...c(this)?.querySelectorAll(":scope > table > tfoot > tr") ?? []];
|
|
630
|
-
}
|
|
631
|
-
get bodyRows() {
|
|
632
|
-
return [...this.querySelectorAll(":scope > table > tbody:not([data-bk-state]) > tr:not([data-bk-spacer])")];
|
|
633
|
-
}
|
|
634
|
-
get dataRows() {
|
|
635
|
-
return this.bodyRows.filter((e) => !e.hasAttribute("data-detail"));
|
|
636
|
-
}
|
|
637
|
-
get keyedRows() {
|
|
638
|
-
return this.dataRows.filter((e) => e.dataset.key !== void 0);
|
|
639
|
-
}
|
|
640
|
-
get columnRows() {
|
|
641
|
-
return [...c(this)?.querySelectorAll(W) ?? []].filter((e) => !e.hasAttribute("data-detail"));
|
|
642
|
-
}
|
|
643
|
-
appCells(e) {
|
|
644
|
-
return [...e.cells].filter((e) => !e.matches(V));
|
|
645
|
-
}
|
|
646
|
-
get number() {
|
|
647
|
-
return new Intl.NumberFormat(this.i18n.locale);
|
|
648
|
-
}
|
|
649
|
-
text(e) {
|
|
650
|
-
let t = e.querySelector(":scope > .bk-table-check");
|
|
651
|
-
if (t) return G(t.textContent);
|
|
652
|
-
let n = e.querySelector(":scope > .bk-table-sort");
|
|
653
|
-
if (n) return G(n.textContent);
|
|
654
|
-
let r = e.querySelector(":scope > [data-bk-note]")?.textContent ?? "", i = e.textContent ?? "";
|
|
655
|
-
return G(r && i.endsWith(r) ? i.slice(0, -r.length) : i);
|
|
656
|
-
}
|
|
657
|
-
rowName(e) {
|
|
658
|
-
let t = this.appCells(e).find((e) => e.textContent?.trim());
|
|
659
|
-
return t ? this.text(t) : e.dataset.key ?? "";
|
|
660
|
-
}
|
|
661
|
-
columnKey(e) {
|
|
662
|
-
return e.dataset.key ?? e.dataset.sort ?? e.dataset.filter ?? String(this.appCells(e.parentElement).indexOf(e));
|
|
663
|
-
}
|
|
664
|
-
headOf(e) {
|
|
665
|
-
return this.headRow?.cells[e.cellIndex] ?? null;
|
|
666
|
-
}
|
|
667
|
-
leadCell(e, t, n) {
|
|
668
|
-
let r = e.querySelector(`:scope > [data-bk-${t}]`);
|
|
669
|
-
if (r) return r;
|
|
670
|
-
r = document.createElement(n), r.setAttribute(`data-bk-${t}`, ""), n === "th" && e.parentElement?.localName === "thead" && r.setAttribute("scope", "col");
|
|
671
|
-
let i = t === "select" ? e.querySelector(":scope > [data-bk-handle]") : null;
|
|
672
|
-
return i ? i.after(r) : e.prepend(r), r;
|
|
673
|
-
}
|
|
674
|
-
srText(e, t) {
|
|
675
|
-
let n = e.querySelector(":scope > .bk-table-sr");
|
|
676
|
-
return n || (n = document.createElement("span"), n.className = "bk-table-sr", e.append(n)), n.textContent !== t && (n.textContent = t), n;
|
|
677
|
-
}
|
|
678
|
-
get sortHeaders() {
|
|
679
|
-
return [...c(this)?.querySelectorAll(":scope > table > thead > tr > th[data-sort]") ?? []];
|
|
680
|
-
}
|
|
681
|
-
syncSort() {
|
|
682
|
-
for (let e of this.sortHeaders) {
|
|
683
|
-
let t = e.querySelector(":scope > button:not(.bk-table-tool)");
|
|
684
|
-
if (!this.sortable) {
|
|
685
|
-
if (!t?.classList.contains("bk-table-sort")) continue;
|
|
686
|
-
e.removeAttribute("aria-sort"), t.querySelector(":scope > .bk-table-sort-icon")?.remove(), t.classList.remove("bk-table-sort"), t.hasAttribute("data-bk-sort") && t.replaceWith(...t.childNodes);
|
|
687
|
-
continue;
|
|
688
|
-
}
|
|
689
|
-
t || (t = document.createElement("button"), t.type = "button", t.setAttribute("data-bk-sort", ""), t.append(...[...e.childNodes].filter((e) => !(e instanceof Element && e.matches(".bk-table-tool, .bk-table-resize, .bk-table-sr")))), e.prepend(t)), t.classList.add("bk-table-sort");
|
|
690
|
-
let n = t.querySelector(":scope > .bk-table-sort-icon");
|
|
691
|
-
n || (n = document.createElement("bk-icon"), n.className = "bk-table-sort-icon", t.append(n));
|
|
692
|
-
let r = e.dataset.sort === this.sortKey, i = r ? this.sortDir === "desc" ? "arrow-down" : "arrow-up" : "unfold-more";
|
|
693
|
-
n.getAttribute("name") !== i && n.setAttribute("name", i);
|
|
694
|
-
let a = r ? this.sortDir === "desc" ? "descending" : "ascending" : null;
|
|
695
|
-
a === null ? e.removeAttribute("aria-sort") : e.getAttribute("aria-sort") !== a && e.setAttribute("aria-sort", a);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
requestSort(e, t) {
|
|
699
|
-
let n = e.dataset.sort, r = t ?? (n === this.sortKey ? this.sortDir === "desc" ? "asc" : "desc" : e.dataset.sortDir === "desc" ? "desc" : "asc");
|
|
700
|
-
_(this, "sort", {
|
|
701
|
-
key: n,
|
|
702
|
-
dir: r
|
|
703
|
-
}, !0) && (this.sortKey = n, this.sortDir = r, d(this.i18n.t(r === "desc" ? "tableSortedDescending" : "tableSortedAscending", { column: this.text(e) || n })));
|
|
704
|
-
}
|
|
705
|
-
onRowLink = (e) => {
|
|
706
|
-
if (e.defaultPrevented || e.type === "auxclick" && e.button !== 1) return;
|
|
707
|
-
let t = e.composedPath(), n = t.find((e) => e instanceof HTMLTableRowElement);
|
|
708
|
-
if (!n || n.parentElement?.localName !== "tbody" || n.closest("bk-table") !== this) return;
|
|
709
|
-
let r = n.querySelector("a[data-row-link][href]");
|
|
710
|
-
if (r && r.closest("tr") === n) {
|
|
711
|
-
for (let e of t) {
|
|
712
|
-
if (e === n) break;
|
|
713
|
-
if (e === r || e instanceof Element && e.matches(U)) return;
|
|
714
|
-
}
|
|
715
|
-
getSelection()?.toString() || r.dispatchEvent(new MouseEvent(e.type, {
|
|
716
|
-
bubbles: !0,
|
|
717
|
-
cancelable: !0,
|
|
718
|
-
composed: !0,
|
|
719
|
-
view: window,
|
|
720
|
-
detail: e.detail,
|
|
721
|
-
button: e.button,
|
|
722
|
-
buttons: e.buttons,
|
|
723
|
-
clientX: e.clientX,
|
|
724
|
-
clientY: e.clientY,
|
|
725
|
-
ctrlKey: e.ctrlKey,
|
|
726
|
-
metaKey: e.metaKey,
|
|
727
|
-
shiftKey: e.shiftKey,
|
|
728
|
-
altKey: e.altKey
|
|
729
|
-
}));
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
onRowLinkNavigate = (e) => {
|
|
733
|
-
let t = p(e);
|
|
734
|
-
t?.hasAttribute("data-row-link") && t.closest("bk-table") === this && f(t, e);
|
|
735
|
-
};
|
|
736
|
-
onClick = (e) => {
|
|
737
|
-
let t = e.target;
|
|
738
|
-
if (!t?.closest) return;
|
|
739
|
-
let n = (e) => !!e && e.closest("bk-table") === this, r = t.closest(".bk-table-disclosure");
|
|
740
|
-
if (r && n(r)) return this.onDisclosure(r);
|
|
741
|
-
let i = t.closest("button.bk-table-tool");
|
|
742
|
-
if (i && n(i)) {
|
|
743
|
-
let e = i.parentElement;
|
|
744
|
-
i.classList.contains("bk-table-filter") ? this.openFilter(e, i) : this.openColumnMenu(e, "column", i);
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
if (!this.sortable) return;
|
|
748
|
-
let a = t.closest("button.bk-table-sort")?.parentElement;
|
|
749
|
-
a && this.sortHeaders.includes(a) && this.requestSort(a);
|
|
750
|
-
};
|
|
751
|
-
box(e) {
|
|
752
|
-
let t = e.querySelector(":scope > bk-checkbox");
|
|
753
|
-
return t || (t = document.createElement("bk-checkbox"), t.setAttribute("data-bk-select", ""), e.append(t)), t;
|
|
754
|
-
}
|
|
755
|
-
get allKeys() {
|
|
756
|
-
return this.virtual && this.rowKey && this.rows ? this.rows.map((e, t) => this.rowKey(e, t)) : this.keyedRows.map((e) => e.dataset.key);
|
|
757
|
-
}
|
|
758
|
-
syncSelection() {
|
|
759
|
-
let e = this.selection === "single" || this.selection === "multiple", t = this.headRows, n = this.bodyRows, r = this.footRows;
|
|
760
|
-
if (!e) {
|
|
761
|
-
for (let e of [
|
|
762
|
-
...t,
|
|
763
|
-
...n,
|
|
764
|
-
...r
|
|
765
|
-
]) e.querySelector(":scope > [data-bk-select]")?.remove(), e.hasAttribute("data-bk-selectable") && (e.removeAttribute("data-selected"), e.removeAttribute("data-bk-selectable"));
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
let i = this.allKeys, a = i.filter((e) => this.keys.has(e)).length;
|
|
769
|
-
t.forEach((e, t) => {
|
|
770
|
-
let n = this.leadCell(e, "select", "th");
|
|
771
|
-
if (t > 0 || this.selection !== "multiple") {
|
|
772
|
-
n.querySelector("bk-checkbox")?.remove(), t === 0 && this.srText(n, this.i18n.t("tableSelection"));
|
|
773
|
-
return;
|
|
774
|
-
}
|
|
775
|
-
n.querySelector(".bk-table-sr")?.remove();
|
|
776
|
-
let r = this.box(n);
|
|
777
|
-
r.setAttribute("aria-label", this.i18n.t("tableSelectAll")), r.setAttribute("data-bk-all", ""), r.checked = i.length > 0 && a === i.length, r.indeterminate = a > 0 && a < i.length;
|
|
778
|
-
});
|
|
779
|
-
for (let e of r) this.leadCell(e, "select", "td");
|
|
780
|
-
for (let e of n) {
|
|
781
|
-
if (e.hasAttribute("data-detail")) continue;
|
|
782
|
-
let t = this.leadCell(e, "select", "td"), n = e.dataset.key;
|
|
783
|
-
if (n === void 0) continue;
|
|
784
|
-
let r = this.keys.has(n);
|
|
785
|
-
e.setAttribute("data-bk-selectable", ""), e.toggleAttribute("data-selected", r);
|
|
786
|
-
let i = this.box(t), a = this.i18n.t("tableSelectRow", { row: this.rowName(e) });
|
|
787
|
-
i.getAttribute("aria-label") !== a && i.setAttribute("aria-label", a), i.checked !== r && (i.checked = r);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
choose(e) {
|
|
791
|
-
let t = [...e];
|
|
792
|
-
_(this, "select", { keys: t }, !0) ? (this.keys = e, this.syncSelection(), d(this.i18n.t("selectedCount", { count: this.number.format(this.keys.size) }))) : this.syncSelection();
|
|
793
|
-
}
|
|
794
|
-
toggleRow(e, t, n) {
|
|
795
|
-
let r = new Set(this.selection === "single" ? [] : this.keys), i = this.allKeys, a = n && this.anchor !== void 0 && i.includes(this.anchor) && this.selection === "multiple" ? i.slice(Math.min(i.indexOf(this.anchor), i.indexOf(e)), Math.max(i.indexOf(this.anchor), i.indexOf(e)) + 1) : [e];
|
|
796
|
-
for (let e of a) t ? r.add(e) : r.delete(e);
|
|
797
|
-
this.anchor = e, this.choose(r);
|
|
798
|
-
}
|
|
799
|
-
onChange = (e) => {
|
|
800
|
-
let t = e.target;
|
|
801
|
-
if (!t?.hasAttribute?.("data-bk-select") || t.parentElement?.closest("bk-table") !== this) return;
|
|
802
|
-
if (e.stopPropagation(), t.hasAttribute("data-bk-all")) {
|
|
803
|
-
let e = new Set(this.keys);
|
|
804
|
-
for (let n of this.allKeys) t.checked ? e.add(n) : e.delete(n);
|
|
805
|
-
this.choose(e);
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
let n = t.closest("tr");
|
|
809
|
-
n?.dataset.key !== void 0 && this.toggleRow(n.dataset.key, t.checked, this.shift);
|
|
810
|
-
};
|
|
811
|
-
serialize(e, t, n) {
|
|
812
|
-
let r = this.headRow, i = /* @__PURE__ */ new Set(), a = r ? this.appCells(r) : [];
|
|
813
|
-
a.forEach((e, t) => e.hasAttribute("data-bk-hidden") && i.add(t));
|
|
814
|
-
let o = (e) => e.dataset.value ?? this.text(e), s = (e) => e.filter((e, t) => !i.has(t)).map((e) => Y(o(e), t)).join(t), c = e.map((e) => s(this.appCells(e)));
|
|
815
|
-
return n && a.length && c.unshift(s(a)), c.join("\r\n");
|
|
816
|
-
}
|
|
817
|
-
exportRows(t) {
|
|
818
|
-
if (this.virtual && this.renderRow && this.rows) {
|
|
819
|
-
let n = document.createElement("tbody"), i = this.rows.map((e, t) => ({
|
|
820
|
-
r: e,
|
|
821
|
-
i: t
|
|
822
|
-
})).filter(({ r: e, i: n }) => !t || (this.rowKey ? this.keys.has(this.rowKey(e, n)) : !1));
|
|
823
|
-
r(e`${i.map(({ r: e, i: t }) => this.renderRow(e, t))}`, n);
|
|
824
|
-
let a = [...n.rows];
|
|
825
|
-
return t && !this.rowKey ? a.filter((e) => e.dataset.key !== void 0 && this.keys.has(e.dataset.key)) : a;
|
|
826
|
-
}
|
|
827
|
-
let n = this.dataRows;
|
|
828
|
-
return t ? n.filter((e) => e.dataset.key !== void 0 && this.keys.has(e.dataset.key)) : n;
|
|
829
|
-
}
|
|
830
|
-
toCSV(e = {}) {
|
|
831
|
-
return this.serialize(this.exportRows(!!e.selectedOnly), e.delimiter ?? ",", e.header ?? !0);
|
|
832
|
-
}
|
|
833
|
-
async copySelection() {
|
|
834
|
-
let e = this.selection ? this.exportRows(!0) : [], t = "", n = "";
|
|
835
|
-
if (e.length) t = this.serialize(e, " ", !1), n = this.i18n.t("tableCopiedRows", { count: e.length });
|
|
836
|
-
else {
|
|
837
|
-
let e = k()?.closest?.("td, th");
|
|
838
|
-
if (!e || e.closest("bk-table") !== this || this.navigation !== "cell") return !1;
|
|
839
|
-
t = e.dataset.value ?? this.text(e), n = this.i18n.t("copied");
|
|
840
|
-
}
|
|
841
|
-
let r = await j(t);
|
|
842
|
-
return r && d(n), r;
|
|
843
|
-
}
|
|
844
|
-
restoreOpen(e) {
|
|
845
|
-
let t = this.openRows.value;
|
|
846
|
-
t && e.dataset.key !== void 0 && e.toggleAttribute("data-expanded", t.includes(e.dataset.key));
|
|
847
|
-
}
|
|
848
|
-
saveOpen(e) {
|
|
849
|
-
if (!this.persistKey || e.dataset.key === void 0) return;
|
|
850
|
-
let t = new Set(this.openRows.value ?? []);
|
|
851
|
-
e.hasAttribute("data-expanded") ? t.add(e.dataset.key) : t.delete(e.dataset.key), this.openRows.set([...t]);
|
|
852
|
-
}
|
|
853
|
-
syncExpand() {
|
|
854
|
-
let e = 0;
|
|
855
|
-
for (let t of this.querySelectorAll(":scope > table > tbody > tr[data-expandable]")) {
|
|
856
|
-
let n = t.nextElementSibling instanceof HTMLTableRowElement && t.nextElementSibling.hasAttribute("data-detail") ? t.nextElementSibling : null, r = this.appCells(t)[0];
|
|
857
|
-
if (!r || !n) continue;
|
|
858
|
-
this.restoreOpen(t);
|
|
859
|
-
let i = r.querySelector(":scope > button.bk-table-disclosure");
|
|
860
|
-
if (!i) {
|
|
861
|
-
i = document.createElement("button"), i.type = "button", i.className = "bk-table-disclosure";
|
|
862
|
-
let e = document.createElement("bk-icon");
|
|
863
|
-
e.setAttribute("name", "chevron-right"), i.append(e), r.prepend(i);
|
|
864
|
-
}
|
|
865
|
-
n.id ||= `bk-table-detail-${++e}-${Math.random().toString(36).slice(2, 7)}`;
|
|
866
|
-
let a = t.hasAttribute("data-expanded");
|
|
867
|
-
i.setAttribute("aria-controls", n.id), i.setAttribute("aria-expanded", String(a)), i.setAttribute("aria-label", this.i18n.t(a ? "tableCollapseRow" : "tableExpandRow")), n.hidden = !a;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
level(e) {
|
|
871
|
-
return Math.max(0, Number(e.dataset.level) || 0);
|
|
872
|
-
}
|
|
873
|
-
syncTree() {
|
|
874
|
-
let e = this.dataRows;
|
|
875
|
-
if (!e.some((e) => e.hasAttribute("data-level") || e.hasAttribute("data-group"))) {
|
|
876
|
-
if (this.tree) for (let e of this.querySelectorAll(":scope > table > tbody > tr[data-bk-tree]")) {
|
|
877
|
-
for (let t of [
|
|
878
|
-
"data-bk-tree",
|
|
879
|
-
"data-bk-parent",
|
|
880
|
-
"aria-level",
|
|
881
|
-
"aria-setsize",
|
|
882
|
-
"aria-posinset",
|
|
883
|
-
"aria-expanded"
|
|
884
|
-
]) e.removeAttribute(t);
|
|
885
|
-
e.hidden = !1, e.querySelector(":scope > * > span.bk-table-disclosure")?.remove(), e.querySelector(":scope > [data-bk-indent]")?.removeAttribute("data-bk-indent");
|
|
886
|
-
}
|
|
887
|
-
this.tree = !1;
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
this.tree = !0;
|
|
891
|
-
let t = e.map((e) => this.level(e)), n = [], r = /* @__PURE__ */ new Map(), i = [];
|
|
892
|
-
e.forEach((e, a) => {
|
|
893
|
-
for (; n.length && t[n.at(-1)] >= t[a];) n.pop();
|
|
894
|
-
let o = n.at(-1) ?? -1;
|
|
895
|
-
i[a] = o, r.has(o) || r.set(o, []), r.get(o).push(a), n.push(a);
|
|
896
|
-
});
|
|
897
|
-
let a = 1e400;
|
|
898
|
-
e.forEach((n, o) => {
|
|
899
|
-
let s = t[o], c = o + 1 < e.length && t[o + 1] > s;
|
|
900
|
-
s <= a && (a = 1e400), n.hidden = s > a, n.setAttribute("data-bk-tree", ""), n.toggleAttribute("data-bk-parent", c), n.setAttribute("aria-level", String(s + 1));
|
|
901
|
-
let l = r.get(i[o]);
|
|
902
|
-
n.setAttribute("aria-setsize", String(l.length)), n.setAttribute("aria-posinset", String(l.indexOf(o) + 1)), n.style.setProperty("--_bk-table-level", String(s));
|
|
903
|
-
let u = this.appCells(n)[0];
|
|
904
|
-
u && !u.hasAttribute("data-bk-indent") && u.setAttribute("data-bk-indent", "");
|
|
905
|
-
let d = u?.querySelector(":scope > span.bk-table-disclosure") ?? null;
|
|
906
|
-
if (c) {
|
|
907
|
-
this.restoreOpen(n);
|
|
908
|
-
let e = n.hasAttribute("data-expanded");
|
|
909
|
-
if (n.setAttribute("aria-expanded", String(e)), !e && a === 1e400 && (a = s), !d && u) {
|
|
910
|
-
d = document.createElement("span"), d.className = "bk-table-disclosure", d.setAttribute("aria-hidden", "true");
|
|
911
|
-
let e = document.createElement("bk-icon");
|
|
912
|
-
e.setAttribute("name", "chevron-right"), d.append(e), u.prepend(d);
|
|
913
|
-
}
|
|
914
|
-
} else n.removeAttribute("aria-expanded"), d?.remove();
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
toggleOpen(e, t = !e.hasAttribute("data-expanded")) {
|
|
918
|
-
t !== e.hasAttribute("data-expanded") && (e.toggleAttribute("data-expanded", t), this.saveOpen(e), this.syncAll(), g(e, t));
|
|
919
|
-
}
|
|
920
|
-
onDisclosure(e) {
|
|
921
|
-
let t = e.closest("tr");
|
|
922
|
-
t && this.toggleOpen(t);
|
|
923
|
-
}
|
|
924
|
-
tool(e, t, n) {
|
|
925
|
-
let r = e.querySelector(`:scope > .bk-table-${t}`);
|
|
926
|
-
if (!n) return r?.remove(), null;
|
|
927
|
-
if (!r) {
|
|
928
|
-
r = document.createElement("button"), r.type = "button", r.className = `bk-table-tool bk-table-${t}`;
|
|
929
|
-
let n = document.createElement("bk-icon");
|
|
930
|
-
n.setAttribute("name", t === "filter" ? "filter" : "more-vert"), r.append(n);
|
|
931
|
-
let i = e.querySelector(t === "filter" ? ":scope > .bk-table-menu, :scope > .bk-table-resize" : ":scope > .bk-table-resize");
|
|
932
|
-
i ? i.before(r) : e.append(r);
|
|
933
|
-
}
|
|
934
|
-
return r;
|
|
935
|
-
}
|
|
936
|
-
syncTools() {
|
|
937
|
-
let e = this.headRow, t = !!e?.querySelector(":scope > th[data-filter]");
|
|
938
|
-
if (t !== this.filterable && (this.filterable = t, this.requestUpdate()), e) for (let t of this.appCells(e)) {
|
|
939
|
-
let e = this.text(t), n = this.tool(t, "filter", t.hasAttribute("data-filter"));
|
|
940
|
-
if (n) {
|
|
941
|
-
let r = !J(this.filters?.[t.dataset.filter]);
|
|
942
|
-
n.toggleAttribute("data-active", r);
|
|
943
|
-
let i = this.i18n.t(r ? "tableFilterColumnActive" : "tableFilterColumn", { column: e });
|
|
944
|
-
n.getAttribute("aria-label") !== i && n.setAttribute("aria-label", i), O(n, {
|
|
945
|
-
haspopup: "dialog",
|
|
946
|
-
expanded: this.filterKey === t.dataset.filter && n === this.filterButton
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
let r = this.tool(t, "menu", this.columnMenu);
|
|
950
|
-
if (r) {
|
|
951
|
-
let t = this.i18n.t("tableColumnMenu", { column: e });
|
|
952
|
-
r.getAttribute("aria-label") !== t && r.setAttribute("aria-label", t), r.hasAttribute("aria-haspopup") || O(r, {
|
|
953
|
-
haspopup: "menu",
|
|
954
|
-
expanded: !1
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
filterField(e) {
|
|
960
|
-
let t = [...this.children].find((t) => t.getAttribute("slot") === `filter-${e}`);
|
|
961
|
-
if (!t) return null;
|
|
962
|
-
let n = (e) => "value" in e && ("checkValidity" in e || e instanceof HTMLInputElement || e instanceof HTMLSelectElement);
|
|
963
|
-
return n(t) ? t : [...t.querySelectorAll("*")].find(n) ?? null;
|
|
964
|
-
}
|
|
965
|
-
readField(e) {
|
|
966
|
-
return Array.isArray(e.values) && (e.multiple || e.hasAttribute("multiple") || e.getAttribute("selection") === "multiple") ? [...e.values] : e.value;
|
|
967
|
-
}
|
|
968
|
-
clearField(e) {
|
|
969
|
-
let t = this.filterField(e);
|
|
970
|
-
t && (Array.isArray(t.values) && (t.values = []), t.value = "");
|
|
971
|
-
}
|
|
972
|
-
filterText(e, t) {
|
|
973
|
-
let n = this.filterField(e), r = (e) => {
|
|
974
|
-
let t = String(e);
|
|
975
|
-
return G(n?.querySelector(`[value="${CSS.escape(t)}"]`)?.textContent) || t;
|
|
976
|
-
};
|
|
977
|
-
return Array.isArray(t) ? t.map(r).join(", ") : r(t);
|
|
978
|
-
}
|
|
979
|
-
get filterItems() {
|
|
980
|
-
let e = this.headRow;
|
|
981
|
-
return e ? this.appCells(e).filter((e) => e.dataset.filter && !J(this.filters?.[e.dataset.filter])).map((e) => ({
|
|
982
|
-
key: e.dataset.filter,
|
|
983
|
-
label: `${this.text(e)}: ${this.filterText(e.dataset.filter, this.filters[e.dataset.filter])}`
|
|
984
|
-
})) : [];
|
|
985
|
-
}
|
|
986
|
-
applyFilters(e) {
|
|
987
|
-
for (let [t, n] of Object.entries(e)) J(n) && delete e[t];
|
|
988
|
-
return _(this, "filter", { filters: e }, !0) ? (this.filters = e, d(this.i18n.t("filtersActive", { count: Object.keys(e).length })), !0) : !1;
|
|
989
|
-
}
|
|
990
|
-
get filterPopover() {
|
|
991
|
-
return this.renderRoot.querySelector(".filter-popover");
|
|
992
|
-
}
|
|
993
|
-
async openFilter(e, t) {
|
|
994
|
-
let n = e.dataset.filter, r = this.filterPopover;
|
|
995
|
-
if (r?.open && this.filterKey === n) {
|
|
996
|
-
r.hide();
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
this.filterKey = n, this.filterButton = t, await this.updateComplete;
|
|
1000
|
-
let i = this.renderRoot.querySelector(".filter-anchor"), a = this.filterPopover;
|
|
1001
|
-
if (!i || !a) return;
|
|
1002
|
-
i.style.left = i.style.top = "0px";
|
|
1003
|
-
let o = i.getBoundingClientRect(), s = e.getBoundingClientRect(), c = this.matches(":dir(rtl)");
|
|
1004
|
-
i.style.left = `${(c ? s.right : s.left) - o.left}px`, i.style.top = `${s.bottom - o.top}px`, a.show(), O(t, {
|
|
1005
|
-
haspopup: "dialog",
|
|
1006
|
-
expanded: !0
|
|
1007
|
-
});
|
|
1008
|
-
}
|
|
1009
|
-
onFilterClose = () => {
|
|
1010
|
-
let e = this.filterButton;
|
|
1011
|
-
e && O(e, {
|
|
1012
|
-
haspopup: "dialog",
|
|
1013
|
-
expanded: !1
|
|
1014
|
-
});
|
|
1015
|
-
let t = k(), n = [...this.children].find((e) => e.getAttribute("slot") === `filter-${this.filterKey}`);
|
|
1016
|
-
e?.isConnected && (!t || t === document.body || A(n, t) || A(this.renderRoot, t)) && e.focus(), this.filterKey = void 0;
|
|
1017
|
-
};
|
|
1018
|
-
onFilterApply = (e) => {
|
|
1019
|
-
let t = this.filterKey;
|
|
1020
|
-
if (!t) return;
|
|
1021
|
-
let n = this.filterField(t);
|
|
1022
|
-
e && this.clearField(t);
|
|
1023
|
-
let r = e || !n ? void 0 : this.readField(n);
|
|
1024
|
-
this.applyFilters({
|
|
1025
|
-
...this.filters,
|
|
1026
|
-
[t]: r
|
|
1027
|
-
}) && this.filterPopover?.hide();
|
|
1028
|
-
};
|
|
1029
|
-
onFilterRemove = (e) => {
|
|
1030
|
-
e.stopPropagation();
|
|
1031
|
-
let t = { ...this.filters };
|
|
1032
|
-
delete t[e.detail.key], this.applyFilters(t) ? this.clearField(e.detail.key) : e.preventDefault();
|
|
1033
|
-
};
|
|
1034
|
-
onFilterClear = (e) => {
|
|
1035
|
-
e.stopPropagation();
|
|
1036
|
-
let t = Object.keys(this.filters);
|
|
1037
|
-
this.applyFilters({}) && (t.forEach((e) => this.clearField(e)), this.updateComplete.then(() => c(this)?.querySelector(":scope > table > thead > tr > th > .bk-table-filter")?.focus()));
|
|
1038
|
-
};
|
|
1039
|
-
get hiddenSet() {
|
|
1040
|
-
return new Set(this.columnState.value?.hidden ?? this.hiddenColumns ?? []);
|
|
1041
|
-
}
|
|
1042
|
-
get pinned() {
|
|
1043
|
-
let e = this.headRow, t = {};
|
|
1044
|
-
if (e) for (let n of this.appCells(e)) {
|
|
1045
|
-
let e = n.getAttribute("data-pin");
|
|
1046
|
-
(e === "start" || e === "end") && (t[this.columnKey(n)] = e);
|
|
1047
|
-
}
|
|
1048
|
-
return t;
|
|
1049
|
-
}
|
|
1050
|
-
changeColumns(e, t, n) {
|
|
1051
|
-
let r = this.headRow;
|
|
1052
|
-
if (!r) return !1;
|
|
1053
|
-
let i = this.pinned;
|
|
1054
|
-
for (let [e, n] of Object.entries(t)) n === "none" ? delete i[e] : i[e] = n;
|
|
1055
|
-
if (!_(this, "columns", {
|
|
1056
|
-
hidden: e,
|
|
1057
|
-
pinned: i,
|
|
1058
|
-
widths: this.columnWidths()
|
|
1059
|
-
}, !0)) return !1;
|
|
1060
|
-
if (this.hiddenColumns = e, this.persistKey) {
|
|
1061
|
-
let n = this.columnState.value ?? {};
|
|
1062
|
-
this.columnState.set({
|
|
1063
|
-
...n,
|
|
1064
|
-
hidden: e,
|
|
1065
|
-
pinned: {
|
|
1066
|
-
...n.pinned,
|
|
1067
|
-
...t
|
|
1068
|
-
}
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
for (let e of this.appCells(r)) {
|
|
1072
|
-
let n = t[this.columnKey(e)];
|
|
1073
|
-
n && this.setPin(e, n);
|
|
1074
|
-
}
|
|
1075
|
-
return this.syncColumns(), d(n), !0;
|
|
1076
|
-
}
|
|
1077
|
-
setPin(e, t) {
|
|
1078
|
-
e.hasAttribute("data-bk-pin-default") || e.setAttribute("data-bk-pin-default", e.getAttribute("data-pin") ?? "none"), t === "none" ? e.removeAttribute("data-pin") : e.setAttribute("data-pin", t);
|
|
1079
|
-
}
|
|
1080
|
-
toggleColumn(e, t) {
|
|
1081
|
-
let n = this.columnKey(e), r = new Set(this.hiddenSet);
|
|
1082
|
-
return t ? r.delete(n) : r.add(n), this.changeColumns([...r], {}, this.i18n.t(t ? "tableColumnShown" : "tableColumnHidden", { column: this.text(e) }));
|
|
1083
|
-
}
|
|
1084
|
-
resetColumns() {
|
|
1085
|
-
let e = this.headRow;
|
|
1086
|
-
if (!e) return;
|
|
1087
|
-
let t = {};
|
|
1088
|
-
for (let n of this.appCells(e)) {
|
|
1089
|
-
let e = n.getAttribute("data-bk-pin-default");
|
|
1090
|
-
e && (t[this.columnKey(n)] = e);
|
|
1091
|
-
}
|
|
1092
|
-
if (this.changeColumns([], t, this.i18n.t("tableColumnsReset"))) {
|
|
1093
|
-
this.persistKey && this.columnState.set(void 0);
|
|
1094
|
-
for (let t of this.appCells(e)) t.removeAttribute("data-bk-pin-default");
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
moveColumn(e, t) {
|
|
1098
|
-
let n = this.headRow;
|
|
1099
|
-
if (!n) return;
|
|
1100
|
-
let r = this.appCells(n), i = r.indexOf(e), a = i + t;
|
|
1101
|
-
if (!this.canMove(r, i, a)) return;
|
|
1102
|
-
let o = r.map((e) => this.columnKey(e)), [s] = o.splice(i, 1);
|
|
1103
|
-
o.splice(a, 0, s), _(this, "reorder", {
|
|
1104
|
-
type: "column",
|
|
1105
|
-
key: s,
|
|
1106
|
-
from: i,
|
|
1107
|
-
to: a,
|
|
1108
|
-
order: o
|
|
1109
|
-
}, !0) && (this.persistKey && this.columnState.set({
|
|
1110
|
-
...this.columnState.value,
|
|
1111
|
-
order: o
|
|
1112
|
-
}), d(this.i18n.t("sortableMoved", {
|
|
1113
|
-
item: this.text(e),
|
|
1114
|
-
position: a + 1,
|
|
1115
|
-
total: r.length
|
|
1116
|
-
})));
|
|
1117
|
-
}
|
|
1118
|
-
canMove(e, t, n) {
|
|
1119
|
-
if (n < 0 || n >= e.length || n === t) return !1;
|
|
1120
|
-
let r = (e) => e.getAttribute("data-pin") ?? "";
|
|
1121
|
-
return r(e[n]) === r(e[t]);
|
|
1122
|
-
}
|
|
1123
|
-
maxWidth() {
|
|
1124
|
-
return Math.max(96, this.clientWidth);
|
|
1125
|
-
}
|
|
1126
|
-
clampWidth(e, t = this.maxWidth()) {
|
|
1127
|
-
return Math.round(Math.min(t, Math.max(I, e)));
|
|
1128
|
-
}
|
|
1129
|
-
setValue(e, t, n = this.maxWidth()) {
|
|
1130
|
-
let r = e.querySelector(":scope > .bk-table-resize");
|
|
1131
|
-
if (!r) return;
|
|
1132
|
-
let i = Math.round(t);
|
|
1133
|
-
r.setAttribute("aria-valuenow", String(i)), r.setAttribute("aria-valuemin", String(I)), r.setAttribute("aria-valuemax", String(Math.max(i, Math.round(n)))), r.setAttribute("aria-valuetext", this.i18n.t("tableColumnWidth", { width: this.number.format(i) }));
|
|
1134
|
-
}
|
|
1135
|
-
setWidth(e, t, n) {
|
|
1136
|
-
e.style.inlineSize = e.style.minInlineSize = `${t}px`, this.setValue(e, t, n);
|
|
1137
|
-
}
|
|
1138
|
-
columnWidths() {
|
|
1139
|
-
let e = {}, t = this.headRow;
|
|
1140
|
-
if (t) for (let n of this.appCells(t)) {
|
|
1141
|
-
let t = n.style.inlineSize.endsWith("px") ? parseFloat(n.style.inlineSize) : NaN;
|
|
1142
|
-
Number.isFinite(t) && (e[this.columnKey(n)] = Math.round(t));
|
|
1143
|
-
}
|
|
1144
|
-
return e;
|
|
1145
|
-
}
|
|
1146
|
-
emitColumns() {
|
|
1147
|
-
_(this, "columns", {
|
|
1148
|
-
hidden: [...this.hiddenSet],
|
|
1149
|
-
pinned: this.pinned,
|
|
1150
|
-
widths: this.columnWidths()
|
|
1151
|
-
});
|
|
1152
|
-
}
|
|
1153
|
-
saveWidth(e, t) {
|
|
1154
|
-
this.emitColumns(), this.persistKey && this.widths.set({
|
|
1155
|
-
...this.widths.value,
|
|
1156
|
-
[this.columnKey(e)]: Math.round(t)
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
resizeTo(e, t) {
|
|
1160
|
-
let n = this.clampWidth(t);
|
|
1161
|
-
this.setWidth(e, n), this.saveWidth(e, n), this.syncPins(e.parentElement);
|
|
1162
|
-
}
|
|
1163
|
-
resetWidth(e) {
|
|
1164
|
-
if (e.style.removeProperty("inline-size"), e.style.removeProperty("min-inline-size"), this.persistKey && this.widths.value && this.columnKey(e) in this.widths.value) {
|
|
1165
|
-
let { [this.columnKey(e)]: t, ...n } = this.widths.value;
|
|
1166
|
-
this.widths.set(n);
|
|
1167
|
-
}
|
|
1168
|
-
this.setValue(e, e.offsetWidth), this.syncPins(e.parentElement), this.emitColumns();
|
|
1169
|
-
}
|
|
1170
|
-
syncColumns() {
|
|
1171
|
-
let e = this.headRow;
|
|
1172
|
-
if (!e) return;
|
|
1173
|
-
let t = this.widths.value, n = this.columnState.value?.pinned, r = this.hiddenSet, i = this.columnMenu, a = /* @__PURE__ */ new Set();
|
|
1174
|
-
for (let o of this.appCells(e)) {
|
|
1175
|
-
let e = this.columnKey(o);
|
|
1176
|
-
n?.[e] && (o.hasAttribute("data-bk-pin-default") ? (o.getAttribute("data-pin") ?? "none") !== n[e] && this.setPin(o, n[e]) : this.setPin(o, n[e])), r.has(e) && a.add(o.cellIndex);
|
|
1177
|
-
let s = o.querySelector(":scope > .bk-table-resize");
|
|
1178
|
-
if (!o.hasAttribute("data-resizable")) {
|
|
1179
|
-
s?.remove();
|
|
1180
|
-
continue;
|
|
1181
|
-
}
|
|
1182
|
-
i = !0;
|
|
1183
|
-
let c = t?.[e];
|
|
1184
|
-
s || (s = document.createElement("span"), s.className = "bk-table-resize", s.setAttribute("role", "separator"), s.setAttribute("aria-orientation", "vertical"), s.tabIndex = 0, s.innerHTML = "<span class=\"bk-grip\" aria-hidden=\"true\"></span>", s.addEventListener("pointerdown", (e) => this.onHandleDown(e, o, s)), o.append(s), c || this.setValue(o, o.offsetWidth)), c && o.style.inlineSize !== `${c}px` && this.setWidth(o, c), o.id ||= `bk-table-col-${Math.random().toString(36).slice(2, 9)}`, s.setAttribute("aria-controls", o.id);
|
|
1185
|
-
let l = this.i18n.t("tableResizeColumn", { column: this.text(o) });
|
|
1186
|
-
s.getAttribute("aria-label") !== l && s.setAttribute("aria-label", l);
|
|
1187
|
-
}
|
|
1188
|
-
for (let e of this.columnRows) for (let t of e.cells) {
|
|
1189
|
-
let e = a.has(t.cellIndex) && !t.matches(V);
|
|
1190
|
-
t.hasAttribute("data-bk-hidden") !== e && t.toggleAttribute("data-bk-hidden", e);
|
|
1191
|
-
}
|
|
1192
|
-
i !== this.resizable && (this.resizable = i), this.syncPins(e);
|
|
1193
|
-
}
|
|
1194
|
-
syncPins(e) {
|
|
1195
|
-
let t = [...e.cells], n = (e) => !e.hasAttribute("data-bk-hidden"), r = t.filter((e) => e.getAttribute("data-pin") === "start" && n(e)), i = t.filter((e) => e.getAttribute("data-pin") === "end" && n(e)).reverse(), a = this.columnRows;
|
|
1196
|
-
for (let t of a) if (t !== e) for (let n of t.cells) {
|
|
1197
|
-
let t = e.cells[n.cellIndex]?.getAttribute("data-pin");
|
|
1198
|
-
n.hasAttribute("data-pin") && t !== n.getAttribute("data-pin") && (n.removeAttribute("data-pin"), n.removeAttribute("data-pin-edge"), n.style.removeProperty("--_bk-table-pin"));
|
|
1199
|
-
}
|
|
1200
|
-
for (let e of t) !e.hasAttribute("data-pin") && e.hasAttribute("data-pin-edge") && (e.removeAttribute("data-pin-edge"), e.style.removeProperty("--_bk-table-pin"));
|
|
1201
|
-
for (let [e, t] of [[r, "start"], [i, "end"]]) {
|
|
1202
|
-
let n = 0;
|
|
1203
|
-
e.forEach((r, i) => {
|
|
1204
|
-
let o = r.cellIndex;
|
|
1205
|
-
for (let r of a) {
|
|
1206
|
-
if (r.cells.length <= o) continue;
|
|
1207
|
-
let a = r.cells[o];
|
|
1208
|
-
a.getAttribute("data-pin") !== t && a.setAttribute("data-pin", t), a.toggleAttribute("data-pin-edge", i === e.length - 1), a.style.setProperty("--_bk-table-pin", `${n}px`);
|
|
1209
|
-
}
|
|
1210
|
-
n += r.offsetWidth;
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
onHandleDown(e, t, n) {
|
|
1215
|
-
if (e.button !== 0) return;
|
|
1216
|
-
e.preventDefault(), n.focus(), n.setPointerCapture(e.pointerId);
|
|
1217
|
-
let r = t.offsetWidth, i = e.clientX, a = this.maxWidth(), o = this.matches(":dir(rtl)") ? -1 : 1, s = !1, c = (e) => {
|
|
1218
|
-
!s && Math.abs(e.clientX - i) < z || (s || n.setAttribute("data-dragging", ""), s = !0, this.setWidth(t, this.clampWidth(r + o * (e.clientX - i), a), a), this.syncPins(t.parentElement));
|
|
1219
|
-
}, l = (e) => {
|
|
1220
|
-
n.removeEventListener("pointermove", c), n.removeEventListener("pointerup", l), n.removeEventListener("pointercancel", l), n.removeAttribute("data-dragging"), s ? this.saveWidth(t, t.offsetWidth) : e.type === "pointerup" && this.openColumnMenu(t, "resize", null, e.clientX, e.clientY);
|
|
1221
|
-
};
|
|
1222
|
-
n.addEventListener("pointermove", c), n.addEventListener("pointerup", l), n.addEventListener("pointercancel", l);
|
|
1223
|
-
}
|
|
1224
|
-
onHandleKey(e, t) {
|
|
1225
|
-
let n = t.parentElement;
|
|
1226
|
-
if (!n) return;
|
|
1227
|
-
if (e.key === "Home") {
|
|
1228
|
-
e.preventDefault(), this.resetWidth(n);
|
|
1229
|
-
return;
|
|
1230
|
-
}
|
|
1231
|
-
if (!["ArrowLeft", "ArrowRight"].includes(e.key)) return;
|
|
1232
|
-
e.preventDefault(), e.stopPropagation();
|
|
1233
|
-
let r = e.key === "ArrowRight" !== this.matches(":dir(rtl)"), i = e.shiftKey ? R : L;
|
|
1234
|
-
this.resizeTo(n, n.offsetWidth + (r ? i : -i));
|
|
1235
|
-
}
|
|
1236
|
-
get columnMenuEl() {
|
|
1237
|
-
return this.renderRoot.querySelector(".column-menu");
|
|
1238
|
-
}
|
|
1239
|
-
async openColumnMenu(e, t, n, r, i) {
|
|
1240
|
-
if (this.menuColumn = e, this.menuKind = t, this.requestUpdate(), await this.updateComplete, n) {
|
|
1241
|
-
let e = n.getBoundingClientRect();
|
|
1242
|
-
r = this.matches(":dir(rtl)") ? e.right : e.left, i = e.bottom, O(n, {
|
|
1243
|
-
haspopup: "menu",
|
|
1244
|
-
expanded: !0
|
|
1245
|
-
});
|
|
1246
|
-
}
|
|
1247
|
-
setTimeout(() => this.columnMenuEl?.showAt(r ?? 0, i ?? 0, n ?? e));
|
|
1248
|
-
}
|
|
1249
|
-
onColumnMenuClose = () => {
|
|
1250
|
-
let e = this.menuColumn?.querySelector(":scope > .bk-table-menu");
|
|
1251
|
-
e && O(e, {
|
|
1252
|
-
haspopup: "menu",
|
|
1253
|
-
expanded: !1
|
|
1254
|
-
});
|
|
1255
|
-
};
|
|
1256
|
-
onColumnMenu(e) {
|
|
1257
|
-
e.stopPropagation();
|
|
1258
|
-
let t = this.menuColumn;
|
|
1259
|
-
if (!t?.isConnected) return;
|
|
1260
|
-
let n = e.detail.value, r = this.headRow, i = this.matches(":dir(rtl)");
|
|
1261
|
-
if (n === "reset") return this.resetWidth(t);
|
|
1262
|
-
if (n === "wider" || n === "narrower") e.preventDefault(), this.resizeTo(t, t.offsetWidth + (n === "wider" ? L : -16));
|
|
1263
|
-
else {
|
|
1264
|
-
if (n === "sort-asc" || n === "sort-desc") return this.requestSort(t, n === "sort-asc" ? "asc" : "desc");
|
|
1265
|
-
if (n === "pin-start" || n === "pin-end" || n === "unpin") {
|
|
1266
|
-
let e = n === "unpin" ? "none" : n === "pin-start" ? "start" : "end";
|
|
1267
|
-
this.changeColumns([...this.hiddenSet], { [this.columnKey(t)]: e }, this.i18n.t(e === "none" ? "tableColumnUnpinned" : "tableColumnPinned", { column: this.text(t) }));
|
|
1268
|
-
} else {
|
|
1269
|
-
if (n === "move-left" || n === "move-right") return this.moveColumn(t, n === "move-right" === i ? -1 : 1);
|
|
1270
|
-
if (n === "hide") return void this.toggleColumn(t, !1);
|
|
1271
|
-
if (n === "reset-columns") return this.resetColumns();
|
|
1272
|
-
if (n.startsWith("col:")) {
|
|
1273
|
-
e.preventDefault();
|
|
1274
|
-
let t = this.appCells(r).find((e) => this.columnKey(e) === n.slice(4));
|
|
1275
|
-
t && this.toggleColumn(t, t.hasAttribute("data-bk-hidden")), this.requestUpdate();
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
columnItems(t) {
|
|
1281
|
-
let r = this.i18n.t.bind(this.i18n), i = this.headRow, a = this.appCells(i), o = a.indexOf(t), s = a.filter((e) => !e.hasAttribute("data-bk-hidden")), c = a.filter((e) => e.hasAttribute("data-hideable")), l = t.getAttribute("data-pin"), u = this.matches(":dir(rtl)"), d = [];
|
|
1282
|
-
return this.sortable && t.dataset.sort && d.push([e`<bk-menu-item value="sort-asc" icon="arrow-up">${r("tableSortAscending")}</bk-menu-item>`, e`<bk-menu-item value="sort-desc" icon="arrow-down">${r("tableSortDescending")}</bk-menu-item>`]), d.push([
|
|
1283
|
-
...l === "start" ? [] : [e`<bk-menu-item value="pin-start">${r("tablePinStart")}</bk-menu-item>`],
|
|
1284
|
-
...l === "end" ? [] : [e`<bk-menu-item value="pin-end">${r("tablePinEnd")}</bk-menu-item>`],
|
|
1285
|
-
...l ? [e`<bk-menu-item value="unpin">${r("tableUnpin")}</bk-menu-item>`] : []
|
|
1286
|
-
]), t.hasAttribute("data-reorderable") && d.push([e`<bk-menu-item value="move-left" icon="arrow-back" ?disabled=${!this.canMove(a, o, o + (u ? 1 : -1))}>${r("tableMoveLeft")}</bk-menu-item>`, e`<bk-menu-item value="move-right" icon="arrow-forward" ?disabled=${!this.canMove(a, o, o + (u ? -1 : 1))}>${r("tableMoveRight")}</bk-menu-item>`]), t.hasAttribute("data-hideable") && d.push([e`<bk-menu-item value="hide" icon="visibility-off" ?disabled=${s.length <= 1}>${r("tableHideColumn")}</bk-menu-item>`]), c.length && d.push([
|
|
1287
|
-
e`<bk-menu-label>${r("tableColumns")}</bk-menu-label>`,
|
|
1288
|
-
...c.map((t) => {
|
|
1289
|
-
let n = !t.hasAttribute("data-bk-hidden");
|
|
1290
|
-
return e`<bk-menu-item type="checkbox" value=${`col:${this.columnKey(t)}`} ?checked=${n} ?disabled=${n && s.length <= 1}>${this.text(t)}</bk-menu-item>`;
|
|
1291
|
-
}),
|
|
1292
|
-
e`<bk-menu-item value="reset-columns" icon="refresh">${r("tableResetColumns")}</bk-menu-item>`
|
|
1293
|
-
]), t.hasAttribute("data-resizable") && d.push(this.resizeItems()), d.filter((e) => e.length).map((t, r) => e`${r ? e`<bk-menu-divider></bk-menu-divider>` : n}${t}`);
|
|
1294
|
-
}
|
|
1295
|
-
resizeItems() {
|
|
1296
|
-
return [
|
|
1297
|
-
e`<bk-menu-item value="wider" icon="add">${this.i18n.t("tableColumnWider")}</bk-menu-item>`,
|
|
1298
|
-
e`<bk-menu-item value="narrower" icon="remove">${this.i18n.t("tableColumnNarrower")}</bk-menu-item>`,
|
|
1299
|
-
e`<bk-menu-item value="reset" icon="refresh">${this.i18n.t("tableColumnReset")}</bk-menu-item>`
|
|
1300
|
-
];
|
|
1301
|
-
}
|
|
1302
|
-
syncHandles() {
|
|
1303
|
-
let e = [
|
|
1304
|
-
...this.headRows,
|
|
1305
|
-
...this.bodyRows,
|
|
1306
|
-
...this.footRows
|
|
1307
|
-
];
|
|
1308
|
-
if (!this.reorderable) {
|
|
1309
|
-
for (let t of e) t.querySelector(":scope > [data-bk-handle]")?.remove();
|
|
1310
|
-
return;
|
|
1311
|
-
}
|
|
1312
|
-
this.headRows.forEach((e, t) => {
|
|
1313
|
-
let n = this.leadCell(e, "handle", "th");
|
|
1314
|
-
if (t === 0) {
|
|
1315
|
-
let e = this.srText(n, this.i18n.t("tableOrder"));
|
|
1316
|
-
e.id ||= `bk-table-order-${Math.random().toString(36).slice(2, 9)}`;
|
|
1317
|
-
}
|
|
1318
|
-
});
|
|
1319
|
-
for (let e of this.footRows) this.leadCell(e, "handle", "td");
|
|
1320
|
-
let t = this.instructions();
|
|
1321
|
-
for (let e of this.bodyRows) {
|
|
1322
|
-
if (e.hasAttribute("data-detail")) continue;
|
|
1323
|
-
let n = this.leadCell(e, "handle", "td"), r = n.querySelector(":scope > .bk-table-handle");
|
|
1324
|
-
if (!r) {
|
|
1325
|
-
r = document.createElement("button"), r.type = "button", r.className = "bk-table-handle";
|
|
1326
|
-
let e = document.createElement("bk-icon");
|
|
1327
|
-
e.setAttribute("name", "drag-indicator"), r.append(e), n.append(r);
|
|
1328
|
-
}
|
|
1329
|
-
let i = this.i18n.t("sortableHandle", { item: this.rowName(e) });
|
|
1330
|
-
r.getAttribute("aria-label") !== i && r.setAttribute("aria-label", i), t && r.getAttribute("aria-describedby") !== t.id && r.setAttribute("aria-describedby", t.id);
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
instructions() {
|
|
1334
|
-
let e = this.headRow?.querySelector(":scope > [data-bk-handle]");
|
|
1335
|
-
if (!e) return null;
|
|
1336
|
-
let t = e.querySelector(":scope > .bk-table-help");
|
|
1337
|
-
t || (t = document.createElement("span"), t.className = "bk-table-sr bk-table-help", t.hidden = !0, t.id = `bk-table-help-${Math.random().toString(36).slice(2, 9)}`, e.append(t));
|
|
1338
|
-
let n = this.i18n.t("sortableInstructions");
|
|
1339
|
-
return t.textContent !== n && (t.textContent = n), t;
|
|
1340
|
-
}
|
|
1341
|
-
get movableRows() {
|
|
1342
|
-
return this.dataRows.filter((e) => !e.hidden);
|
|
1343
|
-
}
|
|
1344
|
-
startLift(e, t) {
|
|
1345
|
-
let n = this.movableRows, r = n.indexOf(e);
|
|
1346
|
-
return r < 0 ? null : (this.lift = {
|
|
1347
|
-
row: e,
|
|
1348
|
-
rows: n,
|
|
1349
|
-
from: r,
|
|
1350
|
-
to: r,
|
|
1351
|
-
mode: t
|
|
1352
|
-
}, e.setAttribute("data-bk-lifted", ""), t === "keyboard" && d(this.i18n.t("sortablePickedUp", {
|
|
1353
|
-
item: this.rowName(e),
|
|
1354
|
-
position: r + 1,
|
|
1355
|
-
total: n.length
|
|
1356
|
-
})), this.lift);
|
|
1357
|
-
}
|
|
1358
|
-
moveLift(e) {
|
|
1359
|
-
let t = this.lift;
|
|
1360
|
-
if (t) {
|
|
1361
|
-
t.to = Math.max(0, Math.min(t.rows.length - 1, e));
|
|
1362
|
-
for (let e of t.rows) e.removeAttribute("data-bk-drop");
|
|
1363
|
-
t.to !== t.from && t.rows[t.to].setAttribute("data-bk-drop", t.to < t.from ? "before" : "after"), t.mode === "keyboard" && d(this.i18n.t("sortableMoved", {
|
|
1364
|
-
item: this.rowName(t.row),
|
|
1365
|
-
position: t.to + 1,
|
|
1366
|
-
total: t.rows.length
|
|
1367
|
-
}));
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
endLift(e) {
|
|
1371
|
-
let t = this.lift;
|
|
1372
|
-
if (!t) return;
|
|
1373
|
-
this.lift = null, t.row.removeAttribute("data-bk-lifted");
|
|
1374
|
-
for (let e of t.rows) e.removeAttribute("data-bk-drop");
|
|
1375
|
-
let n = this.rowName(t.row);
|
|
1376
|
-
!e || t.to === t.from ? t.mode === "keyboard" && d(this.i18n.t("sortableCancelled", {
|
|
1377
|
-
item: n,
|
|
1378
|
-
position: t.from + 1,
|
|
1379
|
-
total: t.rows.length
|
|
1380
|
-
})) : this.requestMove(t.row, t.from, t.to, t.rows.length);
|
|
1381
|
-
}
|
|
1382
|
-
requestMove(e, t, n, r) {
|
|
1383
|
-
let i = e.dataset.key;
|
|
1384
|
-
_(this, "reorder", {
|
|
1385
|
-
type: "row",
|
|
1386
|
-
key: i,
|
|
1387
|
-
from: t,
|
|
1388
|
-
to: n
|
|
1389
|
-
}, !0) && (d(this.i18n.t("sortableDropped", {
|
|
1390
|
-
item: this.rowName(e),
|
|
1391
|
-
position: n + 1,
|
|
1392
|
-
total: r
|
|
1393
|
-
})), i !== void 0 && requestAnimationFrame(() => {
|
|
1394
|
-
let e = this.keyedRows.find((e) => e.dataset.key === i)?.querySelector(":scope > [data-bk-handle] > .bk-table-handle");
|
|
1395
|
-
e && !e.matches(":focus") && e.focus();
|
|
1396
|
-
}));
|
|
1397
|
-
}
|
|
1398
|
-
onLiftKey(e, t) {
|
|
1399
|
-
let n = this.lift;
|
|
1400
|
-
if (!n) return e.key !== " " && e.key !== "Enter" ? !1 : (e.preventDefault(), this.startLift(t, "keyboard"), !0);
|
|
1401
|
-
let r = {
|
|
1402
|
-
ArrowUp: n.to - 1,
|
|
1403
|
-
ArrowDown: n.to + 1,
|
|
1404
|
-
Home: 0,
|
|
1405
|
-
End: n.rows.length - 1
|
|
1406
|
-
};
|
|
1407
|
-
return e.key in r ? (e.preventDefault(), this.moveLift(r[e.key])) : e.key === " " || e.key === "Enter" ? (e.preventDefault(), this.endLift(!0)) : e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), this.endLift(!1)) : e.key !== "Tab" && e.key !== "Shift" && e.preventDefault(), !0;
|
|
1408
|
-
}
|
|
1409
|
-
onPointerDown = (e) => {
|
|
1410
|
-
let t = e.target?.closest?.(".bk-table-handle");
|
|
1411
|
-
if (!t || t.closest("bk-table") !== this || e.button !== 0 || this.lift) return;
|
|
1412
|
-
let n = t.closest("tr");
|
|
1413
|
-
e.preventDefault(), t.focus(), t.setPointerCapture(e.pointerId);
|
|
1414
|
-
let r = e.clientY, i = !1, a = [], o = (e) => {
|
|
1415
|
-
if (!i) {
|
|
1416
|
-
if (Math.abs(e.clientY - r) < z) return;
|
|
1417
|
-
let t = this.startLift(n, "pointer");
|
|
1418
|
-
if (!t) return;
|
|
1419
|
-
i = !0, a = t.rows.map((e) => {
|
|
1420
|
-
let t = e.getBoundingClientRect();
|
|
1421
|
-
return t.top + t.height / 2;
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
let t = this.lift, o = a.findIndex((t) => e.clientY < t);
|
|
1425
|
-
o < 0 ? o = a.length - 1 : o > t.from && --o, this.moveLift(o);
|
|
1426
|
-
}, s = (e) => {
|
|
1427
|
-
t.removeEventListener("pointermove", o), t.removeEventListener("pointerup", s), t.removeEventListener("pointercancel", s), i ? this.endLift(e.type === "pointerup") : e.type === "pointerup" && this.openRowMenu(n, t);
|
|
1428
|
-
};
|
|
1429
|
-
t.addEventListener("pointermove", o), t.addEventListener("pointerup", s), t.addEventListener("pointercancel", s);
|
|
1430
|
-
};
|
|
1431
|
-
openRowMenu(e, t) {
|
|
1432
|
-
this.handleRow = e, this.requestUpdate(), E(this, t);
|
|
1433
|
-
}
|
|
1434
|
-
get rowActions() {
|
|
1435
|
-
let e = this.handleRow;
|
|
1436
|
-
if (!e?.isConnected) return [];
|
|
1437
|
-
let t = this.movableRows, n = t.indexOf(e), r = (r) => () => this.requestMove(e, n, r, t.length), i = this.i18n.t.bind(this.i18n);
|
|
1438
|
-
return [
|
|
1439
|
-
{
|
|
1440
|
-
key: "up",
|
|
1441
|
-
label: i("sortableMoveUp"),
|
|
1442
|
-
disabled: n <= 0,
|
|
1443
|
-
run: r(n - 1)
|
|
1444
|
-
},
|
|
1445
|
-
{
|
|
1446
|
-
key: "down",
|
|
1447
|
-
label: i("sortableMoveDown"),
|
|
1448
|
-
disabled: n >= t.length - 1,
|
|
1449
|
-
run: r(n + 1)
|
|
1450
|
-
},
|
|
1451
|
-
{
|
|
1452
|
-
key: "top",
|
|
1453
|
-
label: i("sortableMoveTop"),
|
|
1454
|
-
disabled: n <= 0,
|
|
1455
|
-
divider: !0,
|
|
1456
|
-
run: r(0)
|
|
1457
|
-
},
|
|
1458
|
-
{
|
|
1459
|
-
key: "bottom",
|
|
1460
|
-
label: i("sortableMoveBottom"),
|
|
1461
|
-
disabled: n >= t.length - 1,
|
|
1462
|
-
run: r(t.length - 1)
|
|
1463
|
-
}
|
|
1464
|
-
];
|
|
1465
|
-
}
|
|
1466
|
-
get cards() {
|
|
1467
|
-
return this.internals.states.has("cards");
|
|
1468
|
-
}
|
|
1469
|
-
setRole(e, t) {
|
|
1470
|
-
let n = e.hasAttribute("data-bk-role");
|
|
1471
|
-
t ? (n || !e.hasAttribute("role")) && (e.getAttribute("role") !== t && e.setAttribute("role", t), n || e.setAttribute("data-bk-role", "")) : n && (e.removeAttribute("role"), e.removeAttribute("data-bk-role"));
|
|
1472
|
-
}
|
|
1473
|
-
syncRoles() {
|
|
1474
|
-
let e = this.table, t = this.navigation === "cell", n = this.cards;
|
|
1475
|
-
this.setRole(e, this.tree ? "treegrid" : t ? "grid" : n ? "table" : null);
|
|
1476
|
-
for (let t of e.querySelectorAll(":scope > :is(thead, tbody, tfoot)")) this.setRole(t, n ? "rowgroup" : null);
|
|
1477
|
-
for (let e of this.querySelectorAll(W)) {
|
|
1478
|
-
this.setRole(e, n ? "row" : null);
|
|
1479
|
-
let r = e.parentElement?.localName === "thead";
|
|
1480
|
-
for (let i of e.cells) i.localName === "td" ? this.setRole(i, t || this.tree ? "gridcell" : n ? "cell" : null) : this.setRole(i, n ? r || i.getAttribute("scope") === "col" ? "columnheader" : "rowheader" : null);
|
|
1481
|
-
}
|
|
1482
|
-
if (this.virtual && this.renderRow) {
|
|
1483
|
-
let t = this.headRows.length;
|
|
1484
|
-
e.setAttribute("aria-rowcount", String(t + (this.rows?.length ?? 0) + this.footRows.length)), this.headRows.forEach((e, t) => e.setAttribute("aria-rowindex", String(t + 1))), this.footRows.forEach((e, n) => e.setAttribute("aria-rowindex", String(t + (this.rows?.length ?? 0) + n + 1)));
|
|
1485
|
-
} else e.hasAttribute("aria-rowcount") && e.removeAttribute("aria-rowcount");
|
|
1486
|
-
}
|
|
1487
|
-
setTab(e, t) {
|
|
1488
|
-
if (t === null) {
|
|
1489
|
-
if (!e.hasAttribute("data-bk-tabindex")) return;
|
|
1490
|
-
let t = e.getAttribute("data-bk-tabindex");
|
|
1491
|
-
t ? e.setAttribute("tabindex", t) : e.removeAttribute("tabindex"), e.removeAttribute("data-bk-tabindex");
|
|
1492
|
-
} else e.hasAttribute("data-bk-tabindex") || e.setAttribute("data-bk-tabindex", e.getAttribute("tabindex") ?? ""), e.getAttribute("tabindex") !== String(t) && e.setAttribute("tabindex", String(t));
|
|
1493
|
-
}
|
|
1494
|
-
widgets(e) {
|
|
1495
|
-
return [...e.querySelectorAll(H)].filter((t) => !t.closest(".bk-table-editor") && !t.closest(".bk-table-sr") && t.closest("td, th") === e);
|
|
1496
|
-
}
|
|
1497
|
-
target(e) {
|
|
1498
|
-
let t = this.widgets(e);
|
|
1499
|
-
return t.length === 1 ? t[0] : e;
|
|
1500
|
-
}
|
|
1501
|
-
get gridRows() {
|
|
1502
|
-
return [
|
|
1503
|
-
...this.headRows,
|
|
1504
|
-
...this.bodyRows.filter((e) => !e.hidden),
|
|
1505
|
-
...this.footRows
|
|
1506
|
-
];
|
|
1507
|
-
}
|
|
1508
|
-
visibleCells(e) {
|
|
1509
|
-
return [...e.cells].filter((e) => !e.hasAttribute("data-bk-hidden"));
|
|
1510
|
-
}
|
|
1511
|
-
syncFocus() {
|
|
1512
|
-
let e = this.table, t = this.navigation === "cell", n = [...e.querySelectorAll("[data-bk-tabindex]")].filter((e) => e.closest("bk-table") === this);
|
|
1513
|
-
if (!t && !this.tree) {
|
|
1514
|
-
for (let e of n) this.setTab(e, null);
|
|
1515
|
-
this.stop = null;
|
|
1516
|
-
return;
|
|
1517
|
-
}
|
|
1518
|
-
let r = this.gridRows, i = [];
|
|
1519
|
-
if (this.tree && i.push(...this.dataRows), t) for (let e of r) for (let t of e.cells) i.push(t, ...this.widgets(t));
|
|
1520
|
-
let a = new Set(i);
|
|
1521
|
-
for (let e of n) a.has(e) || this.setTab(e, null);
|
|
1522
|
-
if (!((e) => !!e && e.isConnected && a.has(e) && !e.closest("[hidden], [data-bk-hidden]"))(this.stop)) {
|
|
1523
|
-
let e = this.tree ? this.dataRows.find((e) => !e.hidden) : r[0] && this.visibleCells(r[0])[0];
|
|
1524
|
-
this.stop = e ? this.tree ? e : this.target(e) : null;
|
|
1525
|
-
}
|
|
1526
|
-
for (let e of i) this.setTab(e, e === this.stop ? 0 : -1);
|
|
1527
|
-
}
|
|
1528
|
-
focusStop(e) {
|
|
1529
|
-
e && (this.stop && this.stop !== e && this.stop.isConnected && this.setTab(this.stop, -1), this.stop = e, this.setTab(e, 0), e.focus());
|
|
1530
|
-
}
|
|
1531
|
-
onFocusIn = (e) => {
|
|
1532
|
-
let t = e.target;
|
|
1533
|
-
if (t.closest?.("bk-table") !== this || t.closest(".bk-table-editor") || this.navigation !== "cell" && !this.tree) return;
|
|
1534
|
-
let n = t.closest("td, th"), r = this.navigation === "cell" && n ? t : this.tree ? t.closest("tr") : null;
|
|
1535
|
-
r && r !== this.stop && r.hasAttribute("data-bk-tabindex") && (this.stop?.isConnected && this.setTab(this.stop, -1), this.stop = r, this.setTab(this.stop, 0));
|
|
1536
|
-
};
|
|
1537
|
-
onFocusOut = (e) => {
|
|
1538
|
-
this.shiftDown = !1;
|
|
1539
|
-
let t = e.target;
|
|
1540
|
-
this.lift?.mode === "keyboard" && t.classList?.contains("bk-table-handle") && this.endLift(!1), this.editing && t.closest?.(".bk-table-editor") && !this.editing.field.contains(e.relatedTarget) && setTimeout(() => this.editing && !this.editing.field.matches(":focus-within") && this.commitEdit(!1, !1));
|
|
1541
|
-
};
|
|
1542
|
-
async rowAt(e) {
|
|
1543
|
-
let t = this.headRows;
|
|
1544
|
-
if (e < t.length) return t[e] ?? null;
|
|
1545
|
-
if (this.virtual && this.renderRow) {
|
|
1546
|
-
let n = this.rows?.length ?? 0;
|
|
1547
|
-
if (e < t.length + n) {
|
|
1548
|
-
let n = e - t.length;
|
|
1549
|
-
return this.vc.reveal(n), this.requestUpdate(), await this.updateComplete, c(this)?.querySelector(`:scope > table > tbody > tr[data-bk-index="${n}"]`) ?? null;
|
|
1550
|
-
}
|
|
1551
|
-
return this.footRows[e - t.length - n] ?? null;
|
|
1552
|
-
}
|
|
1553
|
-
return this.gridRows[e] ?? null;
|
|
1554
|
-
}
|
|
1555
|
-
rowIndex(e) {
|
|
1556
|
-
let t = this.headRows;
|
|
1557
|
-
if (this.virtual && this.renderRow) {
|
|
1558
|
-
let n = this.rows?.length ?? 0, r = t.length + n + this.footRows.length;
|
|
1559
|
-
return t.includes(e) ? [t.indexOf(e), r] : e.dataset.bkIndex === void 0 ? [t.length + n + this.footRows.indexOf(e), r] : [t.length + Number(e.dataset.bkIndex), r];
|
|
1560
|
-
}
|
|
1561
|
-
let n = this.gridRows;
|
|
1562
|
-
return [n.indexOf(e), n.length];
|
|
1563
|
-
}
|
|
1564
|
-
pageRows() {
|
|
1565
|
-
let e = this.scroller, t = this.dataRows[0];
|
|
1566
|
-
return !e || !t || e.scrollHeight <= e.clientHeight ? B : Math.max(1, Math.floor(e.clientHeight / Math.max(1, t.offsetHeight)) - 1);
|
|
1567
|
-
}
|
|
1568
|
-
async onGridKey(e, t) {
|
|
1569
|
-
let n = t.parentElement, r = this.matches(":dir(rtl)"), i = e.ctrlKey || e.metaKey, a = this.visibleCells(n).indexOf(t), [o, s] = this.rowIndex(n), c = o, l = a;
|
|
1570
|
-
switch (e.key) {
|
|
1571
|
-
case "ArrowRight":
|
|
1572
|
-
l = a + (r ? -1 : 1);
|
|
1573
|
-
break;
|
|
1574
|
-
case "ArrowLeft":
|
|
1575
|
-
if (this.tree && a === 0 && n.hasAttribute("data-bk-tree")) {
|
|
1576
|
-
e.preventDefault(), this.focusStop(n);
|
|
1577
|
-
return;
|
|
1578
|
-
}
|
|
1579
|
-
l = a + (r ? 1 : -1);
|
|
1580
|
-
break;
|
|
1581
|
-
case "ArrowDown":
|
|
1582
|
-
c = o + 1;
|
|
1583
|
-
break;
|
|
1584
|
-
case "ArrowUp":
|
|
1585
|
-
c = o - 1;
|
|
1586
|
-
break;
|
|
1587
|
-
case "Home":
|
|
1588
|
-
l = 0, i && (c = 0);
|
|
1589
|
-
break;
|
|
1590
|
-
case "End":
|
|
1591
|
-
l = 1e400, i && (c = s - 1);
|
|
1592
|
-
break;
|
|
1593
|
-
case "PageDown":
|
|
1594
|
-
c = o + this.pageRows();
|
|
1595
|
-
break;
|
|
1596
|
-
case "PageUp":
|
|
1597
|
-
c = o - this.pageRows();
|
|
1598
|
-
break;
|
|
1599
|
-
default: return;
|
|
1600
|
-
}
|
|
1601
|
-
e.preventDefault(), c = Math.max(0, Math.min(s - 1, c));
|
|
1602
|
-
let u = c === o ? n : await this.rowAt(c);
|
|
1603
|
-
if (!u) return;
|
|
1604
|
-
let d = this.visibleCells(u), f = d[Math.max(0, Math.min(d.length - 1, l))];
|
|
1605
|
-
f && this.focusStop(this.target(f));
|
|
1606
|
-
}
|
|
1607
|
-
onTreeKey(e, t) {
|
|
1608
|
-
let n = this.dataRows.filter((e) => !e.hidden), r = n.indexOf(t), i = t.hasAttribute("data-bk-parent"), a = t.hasAttribute("data-expanded"), o = this.matches(":dir(rtl)");
|
|
1609
|
-
switch (o && e.key === "ArrowRight" ? "ArrowLeft" : o && e.key === "ArrowLeft" ? "ArrowRight" : e.key) {
|
|
1610
|
-
case "ArrowDown":
|
|
1611
|
-
this.focusStop(n[r + 1]);
|
|
1612
|
-
break;
|
|
1613
|
-
case "ArrowUp":
|
|
1614
|
-
this.focusStop(n[r - 1]);
|
|
1615
|
-
break;
|
|
1616
|
-
case "Home":
|
|
1617
|
-
this.focusStop(n[0]);
|
|
1618
|
-
break;
|
|
1619
|
-
case "End":
|
|
1620
|
-
this.focusStop(n.at(-1));
|
|
1621
|
-
break;
|
|
1622
|
-
case "ArrowRight":
|
|
1623
|
-
i && !a ? this.toggleOpen(t, !0) : this.navigation === "cell" && this.focusStop(this.target(this.visibleCells(t)[0]));
|
|
1624
|
-
break;
|
|
1625
|
-
case "ArrowLeft":
|
|
1626
|
-
if (i && a) this.toggleOpen(t, !1);
|
|
1627
|
-
else {
|
|
1628
|
-
let e = this.level(t);
|
|
1629
|
-
this.focusStop(n.slice(0, r).reverse().find((t) => this.level(t) < e));
|
|
1630
|
-
}
|
|
1631
|
-
break;
|
|
1632
|
-
case "Enter":
|
|
1633
|
-
if (!i) return;
|
|
1634
|
-
this.toggleOpen(t);
|
|
1635
|
-
break;
|
|
1636
|
-
case " ": {
|
|
1637
|
-
let e = t.querySelector(":scope > [data-bk-select] > bk-checkbox");
|
|
1638
|
-
if (!e) return;
|
|
1639
|
-
e.click();
|
|
1640
|
-
break;
|
|
1641
|
-
}
|
|
1642
|
-
default: return;
|
|
1643
|
-
}
|
|
1644
|
-
e.preventDefault();
|
|
1645
|
-
}
|
|
1646
|
-
async startEdit(e) {
|
|
1647
|
-
if (this.editing || !e.hasAttribute("data-editable") || this.navigation !== "cell") return;
|
|
1648
|
-
let t = this.headOf(e), n = e.dataset.value ?? this.text(e), r = document.createElement(e.dataset.field === "number" ? "bk-input-number" : "bk-input-text");
|
|
1649
|
-
r.className = "bk-table-editor", r.setAttribute("size", "sm"), r.setAttribute("aria-label", t ? this.text(t) : ""), r.value = n, e.setAttribute("data-bk-editing", ""), e.append(r), this.editing = {
|
|
1650
|
-
cell: e,
|
|
1651
|
-
field: r,
|
|
1652
|
-
old: n
|
|
1653
|
-
}, await r.updateComplete, r.focus(), (r.shadowRoot?.querySelector("input"))?.select?.();
|
|
1654
|
-
}
|
|
1655
|
-
commitEdit(e, t = !0) {
|
|
1656
|
-
let n = this.editing;
|
|
1657
|
-
if (!n) return;
|
|
1658
|
-
let { cell: r, field: i, old: a } = n, o = String(i.value ?? "");
|
|
1659
|
-
if (!e && i.checkValidity && !i.checkValidity()) {
|
|
1660
|
-
i.reportValidity?.();
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1663
|
-
if (this.editing = null, i.remove(), r.removeAttribute("data-bk-editing"), t && this.focusStop(r), e || o === a) return;
|
|
1664
|
-
let s = this.headOf(r), c = r.parentElement;
|
|
1665
|
-
_(this, "edit", {
|
|
1666
|
-
key: c.dataset.key,
|
|
1667
|
-
column: s ? this.columnKey(s) : String(r.cellIndex),
|
|
1668
|
-
value: o,
|
|
1669
|
-
oldValue: a
|
|
1670
|
-
}, !0) && d(this.i18n.t("tableCellChanged", {
|
|
1671
|
-
column: s ? this.text(s) : "",
|
|
1672
|
-
value: o
|
|
1673
|
-
}));
|
|
1674
|
-
}
|
|
1675
|
-
onDoubleClick = (e) => {
|
|
1676
|
-
let t = e.target?.closest?.("td[data-editable]");
|
|
1677
|
-
t && t.closest("bk-table") === this && this.startEdit(t);
|
|
1678
|
-
};
|
|
1679
|
-
onKeydown = (e) => {
|
|
1680
|
-
let t = e.target;
|
|
1681
|
-
if (e.defaultPrevented || !t?.closest || t.closest("bk-table") !== this) return;
|
|
1682
|
-
if (this.editing && t.closest(".bk-table-editor")) {
|
|
1683
|
-
e.key === "Enter" ? (e.preventDefault(), this.commitEdit(!1)) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.commitEdit(!0));
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
if (!this.table?.contains(t)) return;
|
|
1687
|
-
if ((e.ctrlKey || e.metaKey) && !e.altKey && e.key.toLowerCase() === "c") {
|
|
1688
|
-
if (t.closest("input, textarea, [contenteditable]") || !document.getSelection()?.isCollapsed) return;
|
|
1689
|
-
(this.selection && this.keys.size || this.navigation === "cell") && (e.preventDefault(), this.copySelection());
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
if (e.altKey) return;
|
|
1693
|
-
let n = t.closest(".bk-table-resize");
|
|
1694
|
-
if (n && !e.ctrlKey && !e.metaKey && [
|
|
1695
|
-
"ArrowLeft",
|
|
1696
|
-
"ArrowRight",
|
|
1697
|
-
"Home"
|
|
1698
|
-
].includes(e.key)) return this.onHandleKey(e, n);
|
|
1699
|
-
let r = t.closest(".bk-table-handle");
|
|
1700
|
-
if (r && this.onLiftKey(e, r.closest("tr"))) return;
|
|
1701
|
-
let i = t.closest("td, th");
|
|
1702
|
-
if (this.tree && t.localName === "tr" && t.hasAttribute("data-bk-tree")) return this.onTreeKey(e, t);
|
|
1703
|
-
if (this.navigation === "cell" && i) {
|
|
1704
|
-
if (t === i && (e.key === "Enter" || e.key === "F2")) {
|
|
1705
|
-
if (i.hasAttribute("data-editable")) {
|
|
1706
|
-
e.preventDefault(), this.startEdit(i);
|
|
1707
|
-
return;
|
|
1708
|
-
}
|
|
1709
|
-
let t = this.widgets(i);
|
|
1710
|
-
if (t.length > 1) {
|
|
1711
|
-
e.preventDefault(), t[0].focus();
|
|
1712
|
-
return;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
if (t !== i && e.key === "Escape" && this.widgets(i).length > 1) {
|
|
1716
|
-
e.preventDefault(), this.focusStop(i);
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
if ([
|
|
1720
|
-
"ArrowRight",
|
|
1721
|
-
"ArrowLeft",
|
|
1722
|
-
"ArrowDown",
|
|
1723
|
-
"ArrowUp",
|
|
1724
|
-
"Home",
|
|
1725
|
-
"End",
|
|
1726
|
-
"PageDown",
|
|
1727
|
-
"PageUp"
|
|
1728
|
-
].includes(e.key)) {
|
|
1729
|
-
if (t !== i && t.closest("input, textarea, select, [contenteditable]")) return;
|
|
1730
|
-
this.onGridKey(e, i);
|
|
1731
|
-
}
|
|
1732
|
-
return;
|
|
1733
|
-
}
|
|
1734
|
-
if (e.ctrlKey || e.metaKey || this.selection !== "single" && this.selection !== "multiple") return;
|
|
1735
|
-
let a = t.closest("tr[data-bk-selectable]");
|
|
1736
|
-
if (!a) return;
|
|
1737
|
-
let o = a.querySelector(":scope > [data-bk-select] > bk-checkbox");
|
|
1738
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && t === o && (e.preventDefault(), this.moveSelectionFocus(a, e.key === "ArrowDown" ? 1 : -1));
|
|
1739
|
-
};
|
|
1740
|
-
async moveSelectionFocus(e, t) {
|
|
1741
|
-
let n;
|
|
1742
|
-
if (this.virtual && this.renderRow && e.dataset.bkIndex !== void 0) {
|
|
1743
|
-
let r = Number(e.dataset.bkIndex) + t;
|
|
1744
|
-
if (r < 0 || r >= (this.rows?.length ?? 0)) return;
|
|
1745
|
-
n = await this.rowAt(this.headRows.length + r);
|
|
1746
|
-
} else {
|
|
1747
|
-
let r = this.keyedRows.filter((e) => !e.hidden);
|
|
1748
|
-
n = r[r.indexOf(e) + t];
|
|
1749
|
-
}
|
|
1750
|
-
n?.querySelector(":scope > [data-bk-select] > bk-checkbox")?.focus();
|
|
1751
|
-
}
|
|
1752
|
-
syncCards() {
|
|
1753
|
-
let e = this.headRow, t = this.cards;
|
|
1754
|
-
for (let n of this.querySelectorAll(":scope > table > :is(tbody, tfoot) > tr")) if (!(n.hasAttribute("data-bk-spacer") || n.hasAttribute("data-detail"))) for (let r of this.appCells(n)) {
|
|
1755
|
-
let i = t && e ? e.cells[r.cellIndex] : null, a = i?.dataset.card, o = a === "title" || !a && r.localName === "th" && n.parentElement?.localName === "tbody", s = i && !o && a !== "meta" ? this.text(i) : null;
|
|
1756
|
-
s ? r.getAttribute("data-bk-label") !== s && r.setAttribute("data-bk-label", s) : r.removeAttribute("data-bk-label"), a ? r.getAttribute("data-bk-card") !== a && r.setAttribute("data-bk-card", a) : r.removeAttribute("data-bk-card");
|
|
1757
|
-
let c = t && r.dataset.type !== "number" && i?.dataset.type === "number";
|
|
1758
|
-
r.hasAttribute("data-bk-number") !== c && r.toggleAttribute("data-bk-number", c);
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
syncMarks() {
|
|
1762
|
-
let e = this.headRow, t = this.columnRows.filter((e) => !e.hasAttribute("data-bk-spacer")), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
1763
|
-
if (e) for (let t of this.appCells(e)) {
|
|
1764
|
-
let e = t.hasAttribute("data-highlight");
|
|
1765
|
-
e && n.add(t.cellIndex), t.dataset.type === "check" && r.add(t.cellIndex);
|
|
1766
|
-
let i = t.querySelector(":scope > [data-bk-note]");
|
|
1767
|
-
if (!e) {
|
|
1768
|
-
i?.remove();
|
|
1769
|
-
continue;
|
|
1770
|
-
}
|
|
1771
|
-
i || (i = document.createElement("span"), i.className = "bk-table-sr", i.setAttribute("data-bk-note", ""), t.append(i));
|
|
1772
|
-
let a = ` ${t.getAttribute("data-highlight")?.trim() || this.i18n.t("tableRecommended")}`;
|
|
1773
|
-
i.textContent !== a && (i.textContent = a);
|
|
1774
|
-
}
|
|
1775
|
-
t.forEach((e, i) => {
|
|
1776
|
-
let a = e.parentElement?.localName === "thead";
|
|
1777
|
-
for (let o of this.appCells(e)) {
|
|
1778
|
-
let e = i === 0 ? "first" : i === t.length - 1 ? "last" : "";
|
|
1779
|
-
n.has(o.cellIndex) ? o.getAttribute("data-bk-highlight") !== e && o.setAttribute("data-bk-highlight", e) : o.removeAttribute("data-bk-highlight");
|
|
1780
|
-
let s = !a && (o.dataset.type ?? (r.has(o.cellIndex) ? "check" : "")) === "check";
|
|
1781
|
-
o.hasAttribute("data-bk-check-column") !== s && o.toggleAttribute("data-bk-check-column", s), this.syncCheck(o, s);
|
|
1782
|
-
}
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
syncCheck(e, t) {
|
|
1786
|
-
let n = e.querySelector(":scope > .bk-table-check"), r = e.querySelector(":scope > [data-bk-check-value]"), i = (t ? e.dataset.value ?? [...e.childNodes].filter((e) => e !== n && e.nodeType !== Node.COMMENT_NODE).map((e) => e.textContent).join("") : "").trim().toLowerCase(), a = [this.i18n.t("tableYes"), this.i18n.t("tableNo")].map((e) => e.toLowerCase()), o = K.has(i) || i === a[0];
|
|
1787
|
-
if (!(t && (o || q.has(i) || i === a[1]))) {
|
|
1788
|
-
if (!n) return;
|
|
1789
|
-
n.remove(), r?.replaceWith(...r.childNodes), e.removeAttribute("data-bk-check");
|
|
1790
|
-
return;
|
|
1791
|
-
}
|
|
1792
|
-
r || (r = document.createElement("span"), r.setAttribute("data-bk-check-value", ""), r.hidden = !0, e.append(r));
|
|
1793
|
-
let s = [...e.childNodes].filter((e) => e !== n && e !== r);
|
|
1794
|
-
s.length && r.append(...s);
|
|
1795
|
-
let c = o ? "yes" : "no";
|
|
1796
|
-
n || (n = document.createElement("span"), n.className = "bk-table-check", n.append(document.createElement("bk-icon"), Object.assign(document.createElement("span"), { className: "bk-table-sr" })), e.prepend(n));
|
|
1797
|
-
let l = n.querySelector("bk-icon"), u = o ? "check" : "remove";
|
|
1798
|
-
l.getAttribute("name") !== u && l.setAttribute("name", u);
|
|
1799
|
-
let d = this.i18n.t(o ? "tableYes" : "tableNo"), f = n.querySelector(".bk-table-sr");
|
|
1800
|
-
f.textContent !== d && (f.textContent = d), e.getAttribute("data-bk-check") !== c && e.setAttribute("data-bk-check", c);
|
|
1801
|
-
}
|
|
1802
|
-
get columnCount() {
|
|
1803
|
-
let e = this.headRow;
|
|
1804
|
-
return e ? this.visibleCells(e).length : 1;
|
|
1805
|
-
}
|
|
1806
|
-
syncState() {
|
|
1807
|
-
let e = this.table, t = this.isEmpty;
|
|
1808
|
-
t !== this.empty && (this.empty = t);
|
|
1809
|
-
let n = e.querySelector(":scope > tbody[data-bk-state]"), r = this.busy && t ? Math.max(1, this.skeletonRows || 0) : 0;
|
|
1810
|
-
if (!r) {
|
|
1811
|
-
n?.remove();
|
|
1812
|
-
return;
|
|
1813
|
-
}
|
|
1814
|
-
n || (n = document.createElement("tbody"), n.setAttribute("data-bk-state", ""), n.setAttribute("aria-hidden", "true"), e.append(n));
|
|
1815
|
-
let i = this.columnCount;
|
|
1816
|
-
(n.rows.length !== r || n.rows[0]?.cells.length !== i) && n.replaceChildren(...Array.from({ length: r }, () => {
|
|
1817
|
-
let e = document.createElement("tr");
|
|
1818
|
-
e.setAttribute("data-bk-skeleton", "");
|
|
1819
|
-
for (let t = 0; t < i; t++) e.append(Object.assign(document.createElement("td"), { innerHTML: "<bk-skeleton></bk-skeleton>" }));
|
|
1820
|
-
return e;
|
|
1821
|
-
}));
|
|
1822
|
-
}
|
|
1823
|
-
renderWindow() {
|
|
1824
|
-
let t = this.body;
|
|
1825
|
-
if (!t || !this.renderRow) return;
|
|
1826
|
-
let i = this.rows ?? [], a = this.vc, s = a.count ? a.total / a.count : 0, c = a.offset, l = Math.max(0, a.total - a.offset - (a.end - a.start) * s), u = this.columnCount, d = (t) => e`<tr data-bk-spacer aria-hidden="true"><td colspan=${u} style=${o({ blockSize: `${t}px` })}></td></tr>`;
|
|
1827
|
-
r(e`${c > 0 ? d(c) : n}${i.slice(a.start, a.end).map((e, t) => this.renderRow(e, a.start + t))}${l > 0 ? d(l) : n}`, t);
|
|
1828
|
-
let f = this.headRows.length, p = a.start;
|
|
1829
|
-
for (let e of t.rows) e.hasAttribute("data-bk-spacer") || (e.setAttribute("data-bk-index", String(p)), e.setAttribute("aria-rowindex", String(f + p + 1)), p++);
|
|
1830
|
-
this.syncAll();
|
|
1831
|
-
}
|
|
1832
|
-
clearWindow() {
|
|
1833
|
-
let e = this.body;
|
|
1834
|
-
e && r(n, e);
|
|
1835
|
-
}
|
|
1836
|
-
measure() {
|
|
1837
|
-
let e = this.scroller, t = !!e && (e.scrollWidth > e.clientWidth + 1 || e.scrollHeight > e.clientHeight + 1);
|
|
1838
|
-
t !== this.scrolling && (this.scrolling = t);
|
|
1839
|
-
let n = c(this)?.querySelector(":scope > table > thead"), r = c(this)?.querySelector(":scope > table > tfoot"), i = this.stickyHeader && n ? `${n.offsetHeight}px` : "", a = this.stickyFooter && r ? `${r.offsetHeight}px` : "";
|
|
1840
|
-
e && e.style.scrollPaddingBlockStart !== i && (e.style.scrollPaddingBlockStart = i), e && e.style.scrollPaddingBlockEnd !== a && (e.style.scrollPaddingBlockEnd = a);
|
|
1841
|
-
let o = this.renderRoot.querySelector(".probe"), s = this.responsive === "cards" && !!o && this.clientWidth > 0 && this.clientWidth < parseFloat(getComputedStyle(o).marginInlineStart);
|
|
1842
|
-
s !== this.cards && (s ? this.internals.states.add("cards") : this.internals.states.delete("cards"), this.syncAll());
|
|
1843
|
-
let l = this.headRow;
|
|
1844
|
-
l && l.querySelector("[data-pin]") && this.syncPins(l);
|
|
1845
|
-
}
|
|
1846
|
-
get regionName() {
|
|
1847
|
-
let e = c(this)?.querySelector(":scope > table > caption")?.textContent?.replace(/\s+/g, " ").trim();
|
|
1848
|
-
return this.label || e || this.i18n.t("table");
|
|
1849
|
-
}
|
|
1850
|
-
render() {
|
|
1851
|
-
let t = this.menuColumn ? this.text(this.menuColumn) : "", r = this.filterItems, i = this.slots.has("error"), a = this.empty && !this.busy && !i && this.slots.has("empty"), o = this.filterKey ? this.headRow && this.appCells(this.headRow).find((e) => e.dataset.filter === this.filterKey) : null, s = this.i18n.t("tableFilterColumn", { column: o ? this.text(o) : "" });
|
|
1852
|
-
return e`${r.length ? e`<bk-filter-bar class="filter-bar" part="filter-bar" .items=${r}
|
|
1853
|
-
@remove=${this.onFilterRemove} @clear=${this.onFilterClear}></bk-filter-bar>` : n}
|
|
1854
|
-
<div class="frame">
|
|
1855
|
-
<div class="scroller" part="scroller" tabindex=${this.scrolling ? "0" : n} ?inert=${this.busyState.inert && !this.empty}
|
|
1856
|
-
role=${this.scrolling ? "region" : n} aria-label=${this.scrolling ? this.regionName : n}>
|
|
1857
|
-
<slot @slotchange=${() => {
|
|
1858
|
-
this.observedTable = null, this.observe();
|
|
1859
|
-
}}></slot>
|
|
1860
|
-
<div class="state" part="state" ?hidden=${!i && !a}>
|
|
1861
|
-
<div role="alert" ?hidden=${!i}><slot name="error"></slot></div>
|
|
1862
|
-
<div ?hidden=${!a}><slot name="empty"></slot></div>
|
|
1863
|
-
</div>
|
|
1864
|
-
${this.virtual ? e`<div class="sentinel"></div>` : n}
|
|
1865
|
-
</div>
|
|
1866
|
-
${this.empty ? n : this.busyState.veil()}
|
|
1867
|
-
</div>
|
|
1868
|
-
${this.responsive === "cards" ? e`<div class="probe" aria-hidden="true"></div>` : n}
|
|
1869
|
-
${this.resizable ? e`<bk-menu-context class="column-menu" exportparts="menu: column-menu"
|
|
1870
|
-
label=${this.i18n.t(this.menuKind === "resize" ? "tableResizeColumn" : "tableColumnMenu", { column: t })}
|
|
1871
|
-
@select=${this.onColumnMenu} @close=${this.onColumnMenuClose}>
|
|
1872
|
-
${this.menuColumn ? this.menuKind === "resize" ? this.resizeItems() : this.columnItems(this.menuColumn) : this.resizeItems()}
|
|
1873
|
-
</bk-menu-context>` : n}
|
|
1874
|
-
${this.filterable ? e`<div class="filter-anchor"><bk-popover class="filter-popover" part="filter-popover" label=${s} @close=${this.onFilterClose}>
|
|
1875
|
-
<div class="filter-body">
|
|
1876
|
-
${this.filterKey ? e`<slot name=${`filter-${this.filterKey}`}></slot>` : n}
|
|
1877
|
-
<div class="filter-actions">
|
|
1878
|
-
<bk-button variant="ghost" size="sm" @click=${() => this.onFilterApply(!0)}>${this.i18n.t("tableFilterClear")}</bk-button>
|
|
1879
|
-
<bk-button variant="solid" size="sm" @click=${() => this.onFilterApply(!1)}>${this.i18n.t("tableFilterApply")}</bk-button>
|
|
1880
|
-
</div>
|
|
1881
|
-
</div>
|
|
1882
|
-
</bk-popover></div>` : n}
|
|
1883
|
-
${this.reorderable ? D(this.handleRow ? this.i18n.t("sortableHandle", { item: this.rowName(this.handleRow) }) : "", this.rowActions) : n}`;
|
|
1884
|
-
}
|
|
1885
|
-
};
|
|
1886
|
-
u("bk-table", Z);
|
|
1887
|
-
export { Z as BkTable };
|
|
1
|
+
export { t as BkTable } from "./chunks/bk-table-CP8n_jy7.js";
|