scb-wc 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -164
- package/all.js +91 -5
- package/blazor/CustomEvents.cs +83 -0
- package/blazor/ScbBlazorInteropBase.cs +4460 -1663
- package/blazor/scb-blazor-bridge.js +6827 -2517
- package/blazor/wrappers/ScbAccordion.razor +50 -0
- package/blazor/wrappers/ScbAppBar.razor +95 -0
- package/blazor/wrappers/ScbBreadcrumb.razor +59 -0
- package/blazor/wrappers/ScbCalendar.razor +100 -0
- package/blazor/wrappers/ScbCalendarCard.razor +189 -0
- package/blazor/wrappers/ScbCheckbox.razor +92 -0
- package/blazor/wrappers/ScbCollapse.razor +76 -0
- package/blazor/wrappers/ScbCookiesConsent.razor +106 -0
- package/blazor/wrappers/ScbDatepicker.razor +77 -0
- package/blazor/wrappers/ScbDialog.razor +72 -0
- package/blazor/wrappers/ScbDrawer.razor +64 -0
- package/blazor/wrappers/ScbDropZone.razor +168 -0
- package/blazor/wrappers/ScbDropdown.razor +76 -0
- package/blazor/wrappers/ScbHorizontalScroller.razor +137 -0
- package/blazor/wrappers/ScbList.razor +77 -0
- package/blazor/wrappers/ScbMenu.razor +71 -0
- package/blazor/wrappers/ScbNav.razor +92 -0
- package/blazor/wrappers/ScbNotificationCard.razor +122 -0
- package/blazor/wrappers/ScbOptionsMenu.razor +88 -0
- package/blazor/wrappers/ScbPagination.razor +80 -0
- package/blazor/wrappers/ScbRadioGroup.razor +94 -0
- package/blazor/wrappers/ScbSearch.razor +83 -0
- package/blazor/wrappers/ScbSegmentedButton.razor +85 -0
- package/blazor/wrappers/ScbSelect.razor +79 -0
- package/blazor/wrappers/ScbSlider.razor +96 -0
- package/blazor/wrappers/ScbSnackbar.razor +93 -0
- package/blazor/wrappers/ScbSwitch.razor +92 -0
- package/blazor/wrappers/ScbTable.razor +67 -0
- package/blazor/wrappers/ScbTableAdvanced.razor +78 -0
- package/blazor/wrappers/ScbTabs.razor +55 -0
- package/blazor/wrappers/ScbTextfield.razor +104 -0
- package/blazor/wrappers/ScbTooltip.razor +88 -0
- package/blazor/wrappers/ScbViz.razor +142 -0
- package/demo-data-preview.svg +12 -0
- package/dummy.png +0 -0
- package/fonts/inter/files/inter-latin-wght-italic.woff2 +0 -0
- package/fonts/inter/files/inter-latin-wght-normal.woff2 +0 -0
- package/fonts/material-symbols-outlined/files/material-symbols-outlined-latin-wght-normal.woff2 +0 -0
- package/index.js +91 -1
- package/mvc/components/all.js +90 -1
- package/mvc/components/scb-accordion/scb-accordion-item.js +211 -0
- package/mvc/components/scb-accordion/scb-accordion.js +44 -0
- package/mvc/components/scb-app-bar/scb-app-bar.js +166 -0
- package/mvc/components/scb-avatar/scb-avatar.js +111 -0
- package/mvc/components/scb-badge/scb-badge.js +80 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +14 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +96 -0
- package/mvc/components/scb-button/scb-button.js +268 -0
- package/mvc/components/scb-calendar/scb-calendar-event.js +6 -0
- package/mvc/components/scb-calendar/scb-calendar.js +168 -0
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +346 -0
- package/mvc/components/scb-card/scb-card.js +761 -0
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +33 -0
- package/mvc/components/scb-checkbox/scb-checkbox.js +140 -0
- package/mvc/components/scb-chevron/scb-chevron.js +121 -0
- package/mvc/components/scb-chip/scb-chip.js +66 -0
- package/mvc/components/scb-collapse/scb-collapse.js +89 -0
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +78 -0
- package/mvc/components/scb-datepicker/scb-datepicker.js +296 -0
- package/mvc/components/scb-dialog/scb-dialog.js +265 -0
- package/mvc/components/scb-divider/scb-divider.js +69 -0
- package/mvc/components/scb-drawer/scb-drawer.js +128 -0
- package/mvc/components/scb-drop-zone/scb-drop-zone.js +555 -0
- package/mvc/components/scb-dropdown/scb-dropdown.js +306 -0
- package/mvc/components/scb-fab/scb-fab.js +108 -0
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +46 -0
- package/mvc/components/scb-fact-card/scb-fact-card.js +226 -0
- package/mvc/components/scb-footer/scb-footer-section.js +3 -0
- package/mvc/components/scb-footer/scb-footer.js +210 -0
- package/mvc/components/scb-gallery-grid/scb-gallery-grid.js +131 -0
- package/mvc/components/scb-grid/scb-grid-item.js +11 -0
- package/mvc/components/scb-grid/scb-grid.js +98 -0
- package/mvc/components/scb-grid/scb-stack.js +33 -0
- package/mvc/components/scb-header/scb-header-menu-group.js +1 -0
- package/mvc/components/scb-header/scb-header-menu-item.js +5 -0
- package/mvc/components/scb-header/scb-header-tab.js +5 -0
- package/mvc/components/scb-header/scb-header-utility.js +1 -0
- package/mvc/components/scb-header/scb-header.js +681 -0
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +196 -0
- package/mvc/components/scb-icon-button/scb-icon-button.js +171 -0
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +212 -0
- package/mvc/components/scb-link/scb-link.js +61 -0
- package/mvc/components/scb-list/scb-list-item.js +153 -0
- package/mvc/components/scb-list/scb-list.js +26 -0
- package/mvc/components/scb-menu/scb-menu-item.js +205 -0
- package/mvc/components/scb-menu/scb-menu-section.js +42 -0
- package/mvc/components/scb-menu/scb-menu.js +81 -0
- package/mvc/components/scb-menu/scb-sub-menu.js +10 -0
- package/mvc/components/scb-nav/scb-nav-item.js +28 -0
- package/mvc/components/scb-nav/scb-nav.js +104 -0
- package/mvc/components/scb-notification-card/scb-notification-card.js +358 -0
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +66 -0
- package/mvc/components/scb-options-menu/scb-options-menu.js +88 -0
- package/mvc/components/scb-options-menu/scb-options-sub-menu.js +34 -0
- package/mvc/components/scb-overlay/scb-overlay.js +49 -0
- package/mvc/components/scb-pagination/scb-pagination.js +312 -0
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +87 -0
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +147 -0
- package/mvc/components/scb-progress-stepper/scb-progress-stepper.js +62 -0
- package/mvc/components/scb-radio-button/scb-radio-button.js +132 -0
- package/mvc/components/scb-radio-button/scb-radio-group.js +43 -0
- package/mvc/components/scb-scrollspy/scb-scrollspy.js +79 -0
- package/mvc/components/scb-search/scb-search.js +292 -0
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +32 -0
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +74 -0
- package/mvc/components/scb-select/scb-select-option.js +61 -0
- package/mvc/components/scb-select/scb-select.js +284 -0
- package/mvc/components/scb-skeleton/scb-skeleton.js +38 -0
- package/mvc/components/scb-slider/scb-slider.js +27 -0
- package/mvc/components/scb-snackbar/scb-snackbar.js +128 -0
- package/mvc/components/scb-status-pill/scb-status-pill.js +45 -0
- package/mvc/components/scb-stepper/scb-step.js +239 -0
- package/mvc/components/scb-stepper/scb-stepper.js +139 -0
- package/mvc/components/scb-switch/scb-switch.js +59 -0
- package/mvc/components/scb-table/scb-table.js +51 -0
- package/mvc/components/scb-table-advanced/scb-table-advanced.js +76 -0
- package/mvc/components/scb-tabs/scb-primary-tab.js +6 -0
- package/mvc/components/scb-tabs/scb-secondary-tab.js +6 -0
- package/mvc/components/scb-tabs/scb-tabs.js +28 -0
- package/mvc/components/scb-textfield/scb-textfield.js +595 -0
- package/mvc/components/scb-toc/scb-toc-item.js +303 -0
- package/mvc/components/scb-toc/scb-toc.js +19 -0
- package/mvc/components/scb-tooltip/scb-tooltip.js +196 -0
- package/mvc/components/scb-vignette/scb-vignette.js +37 -0
- package/mvc/components/scb-viz/scb-viz-actions-runtime.js +2 -0
- package/mvc/components/scb-viz/scb-viz-print-runtime.js +98 -0
- package/mvc/components/scb-viz/scb-viz-series-differentiation-registry.js +1 -0
- package/mvc/components/scb-viz/scb-viz-series-differentiation-runtime.js +1 -0
- package/mvc/components/scb-viz/scb-viz-table-runtime.js +1 -0
- package/mvc/components/scb-viz/scb-viz.js +1140 -0
- package/mvc/fonts/inter/files/inter-latin-wght-italic.woff2 +0 -0
- package/mvc/fonts/inter/files/inter-latin-wght-normal.woff2 +0 -0
- package/mvc/fonts/material-symbols-outlined/files/material-symbols-outlined-latin-wght-normal.woff2 +0 -0
- package/mvc/scb-blazor-bridge.js +6827 -2517
- package/mvc/scb-logo.svg +20 -20
- package/mvc/scb-typography.css +1 -1
- package/mvc/scb-wc.css +3 -2
- package/mvc/scb.svg +13 -13
- package/mvc/vendor/assertClassBrand.js +1 -0
- package/mvc/vendor/classPrivateFieldGet2.js +1 -0
- package/mvc/vendor/decorate.js +1 -0
- package/mvc/vendor/preload-helper.js +1 -0
- package/mvc/vendor/vendor-lit.js +1 -0
- package/mvc/vendor/vendor-material.js +364 -0
- package/mvc/vendor/vendor.js +4 -0
- package/package.json +420 -77
- package/scb-accordion/scb-accordion-item.js +340 -0
- package/scb-accordion/scb-accordion.js +151 -0
- package/scb-app-bar/scb-app-bar.js +317 -0
- package/scb-avatar/scb-avatar.js +197 -0
- package/scb-badge/scb-badge.js +165 -0
- package/scb-breadcrumb/scb-breadcrumb-item.js +62 -0
- package/scb-breadcrumb/scb-breadcrumb.js +255 -0
- package/scb-button/scb-button.js +398 -0
- package/scb-calendar/scb-calendar-event.js +48 -0
- package/scb-calendar/scb-calendar.js +700 -0
- package/scb-calendar-card/scb-calendar-card.js +505 -0
- package/scb-card/scb-card.js +1231 -0
- package/scb-checkbox/scb-checkbox-group.js +104 -0
- package/scb-checkbox/scb-checkbox.js +316 -0
- package/scb-chevron/scb-chevron.js +144 -0
- package/scb-chip/scb-chip.js +234 -0
- package/scb-collapse/scb-collapse.js +231 -0
- package/scb-cookies-consent/scb-cookies-consent.js +164 -0
- package/scb-datepicker/scb-datepicker.js +470 -0
- package/scb-dialog/scb-dialog.js +574 -0
- package/scb-divider/scb-divider.js +119 -0
- package/scb-drawer/scb-drawer.js +297 -0
- package/scb-drop-zone/scb-drop-zone.js +965 -0
- package/scb-dropdown/scb-dropdown.js +598 -0
- package/scb-fab/scb-fab.js +190 -0
- package/scb-fact-card/scb-fact-card-content.js +82 -0
- package/scb-fact-card/scb-fact-card.js +376 -0
- package/scb-footer/scb-footer-section.js +23 -0
- package/scb-footer/scb-footer.js +343 -0
- package/scb-gallery-grid/scb-gallery-grid.js +242 -0
- package/scb-grid/scb-grid-item.js +81 -0
- package/scb-grid/scb-grid.js +200 -0
- package/scb-grid/scb-stack.js +120 -0
- package/scb-header/scb-header-menu-group.js +21 -0
- package/scb-header/scb-header-menu-item.js +22 -0
- package/scb-header/scb-header-tab.js +25 -0
- package/scb-header/scb-header-utility.js +27 -0
- package/scb-header/scb-header.js +1358 -0
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +353 -0
- package/scb-icon-button/scb-icon-button.js +335 -0
- package/scb-keyfigure-card/scb-keyfigure-card.js +340 -0
- package/scb-link/scb-link.js +136 -0
- package/scb-list/scb-list-item.js +297 -0
- package/scb-list/scb-list.js +119 -0
- package/scb-menu/scb-menu-item.js +330 -0
- package/scb-menu/scb-menu-section.js +60 -0
- package/scb-menu/scb-menu.js +154 -0
- package/scb-menu/scb-sub-menu.js +36 -0
- package/scb-nav/scb-nav-item.js +96 -0
- package/scb-nav/scb-nav.js +263 -0
- package/scb-notification-card/scb-notification-card.js +479 -0
- package/scb-options-menu/scb-options-menu-item.js +218 -0
- package/scb-options-menu/scb-options-menu.js +237 -0
- package/scb-options-menu/scb-options-sub-menu.js +69 -0
- package/scb-overlay/scb-overlay.js +144 -0
- package/scb-pagination/scb-pagination.js +438 -0
- package/scb-progress-indicator/scb-progress-indicator.js +199 -0
- package/scb-progress-stepper/scb-progress-step.js +213 -0
- package/scb-progress-stepper/scb-progress-stepper.js +132 -0
- package/scb-radio-button/scb-radio-button.js +249 -0
- package/scb-radio-button/scb-radio-group.js +216 -0
- package/scb-scrollspy/scb-scrollspy.js +670 -0
- package/scb-search/scb-search.js +643 -0
- package/scb-segmented-button/scb-segmented-button.js +215 -0
- package/scb-segmented-button/scb-segmented-item.js +133 -0
- package/scb-select/scb-select-option.js +88 -0
- package/scb-select/scb-select.js +517 -0
- package/scb-skeleton/scb-skeleton.js +92 -0
- package/scb-slider/scb-slider.js +98 -0
- package/scb-snackbar/scb-snackbar.js +223 -0
- package/scb-status-pill/scb-status-pill.js +100 -0
- package/scb-stepper/scb-step.js +311 -0
- package/scb-stepper/scb-stepper.js +325 -0
- package/scb-switch/scb-switch.js +182 -0
- package/scb-table/scb-table.js +202 -0
- package/scb-table-advanced/scb-table-advanced.js +327 -0
- package/scb-tabs/scb-primary-tab.js +68 -0
- package/scb-tabs/scb-secondary-tab.js +68 -0
- package/scb-tabs/scb-tabs.js +100 -0
- package/scb-test-components/index.d.ts +90 -0
- package/scb-test-components/scb-accordion/scb-accordion-item.d.ts +39 -0
- package/scb-test-components/scb-accordion/scb-accordion.d.ts +27 -0
- package/scb-test-components/scb-app-bar/scb-app-bar.d.ts +25 -0
- package/scb-test-components/scb-avatar/scb-avatar.d.ts +37 -0
- package/scb-test-components/scb-badge/scb-badge.d.ts +28 -0
- package/scb-test-components/scb-breadcrumb/scb-breadcrumb-item.d.ts +15 -0
- package/scb-test-components/scb-breadcrumb/scb-breadcrumb.d.ts +27 -0
- package/scb-test-components/scb-button/scb-button.d.ts +40 -0
- package/scb-test-components/scb-calendar/scb-calendar-event.d.ts +15 -0
- package/scb-test-components/scb-calendar/scb-calendar.d.ts +77 -0
- package/scb-test-components/scb-calendar-card/scb-calendar-card.d.ts +45 -0
- package/scb-test-components/scb-card/scb-card.d.ts +101 -0
- package/scb-test-components/scb-checkbox/scb-checkbox-group.d.ts +23 -0
- package/scb-test-components/scb-checkbox/scb-checkbox.d.ts +52 -0
- package/scb-test-components/scb-chevron/scb-chevron.d.ts +13 -0
- package/scb-test-components/scb-chip/scb-chip.d.ts +61 -0
- package/scb-test-components/scb-collapse/scb-collapse.d.ts +29 -0
- package/scb-test-components/scb-cookies-consent/scb-cookies-consent.d.ts +23 -0
- package/scb-test-components/scb-datepicker/scb-datepicker.d.ts +39 -0
- package/scb-test-components/scb-dialog/scb-dialog.d.ts +72 -0
- package/scb-test-components/scb-divider/scb-divider.d.ts +34 -0
- package/scb-test-components/scb-drawer/scb-drawer.d.ts +72 -0
- package/scb-test-components/scb-drop-zone/scb-drop-zone.d.ts +143 -0
- package/scb-test-components/scb-dropdown/scb-dropdown.d.ts +70 -0
- package/scb-test-components/scb-fab/scb-fab.d.ts +42 -0
- package/scb-test-components/scb-fact-card/scb-fact-card-content.d.ts +15 -0
- package/scb-test-components/scb-fact-card/scb-fact-card.d.ts +49 -0
- package/scb-test-components/scb-footer/scb-footer-section.d.ts +20 -0
- package/scb-test-components/scb-footer/scb-footer.d.ts +31 -0
- package/scb-test-components/scb-gallery-grid/scb-gallery-grid.d.ts +20 -0
- package/scb-test-components/scb-grid/scb-grid-item.d.ts +32 -0
- package/scb-test-components/scb-grid/scb-grid.d.ts +36 -0
- package/scb-test-components/scb-grid/scb-stack.d.ts +32 -0
- package/scb-test-components/scb-header/scb-header-menu-group.d.ts +12 -0
- package/scb-test-components/scb-header/scb-header-menu-item.d.ts +13 -0
- package/scb-test-components/scb-header/scb-header-tab.d.ts +13 -0
- package/scb-test-components/scb-header/scb-header-utility.d.ts +14 -0
- package/scb-test-components/scb-header/scb-header.d.ts +132 -0
- package/scb-test-components/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +47 -0
- package/scb-test-components/scb-icon-button/scb-icon-button.d.ts +76 -0
- package/scb-test-components/scb-keyfigure-card/scb-keyfigure-card.d.ts +46 -0
- package/scb-test-components/scb-link/scb-link.d.ts +25 -0
- package/scb-test-components/scb-list/scb-list-item.d.ts +38 -0
- package/scb-test-components/scb-list/scb-list.d.ts +26 -0
- package/scb-test-components/scb-menu/scb-menu-item.d.ts +52 -0
- package/scb-test-components/scb-menu/scb-menu-section.d.ts +11 -0
- package/scb-test-components/scb-menu/scb-menu.d.ts +25 -0
- package/scb-test-components/scb-menu/scb-sub-menu.d.ts +14 -0
- package/scb-test-components/scb-nav/scb-nav-item.d.ts +20 -0
- package/scb-test-components/scb-nav/scb-nav.d.ts +50 -0
- package/scb-test-components/scb-notification-card/scb-notification-card.d.ts +46 -0
- package/scb-test-components/scb-options-menu/scb-options-menu-item.d.ts +29 -0
- package/scb-test-components/scb-options-menu/scb-options-menu.d.ts +35 -0
- package/scb-test-components/scb-options-menu/scb-options-sub-menu.d.ts +11 -0
- package/scb-test-components/scb-overlay/scb-overlay.d.ts +24 -0
- package/scb-test-components/scb-pagination/scb-pagination.d.ts +36 -0
- package/scb-test-components/scb-progress-indicator/scb-progress-indicator.d.ts +28 -0
- package/scb-test-components/scb-progress-stepper/scb-progress-step.d.ts +21 -0
- package/scb-test-components/scb-progress-stepper/scb-progress-stepper.d.ts +22 -0
- package/scb-test-components/scb-radio-button/scb-radio-button.d.ts +26 -0
- package/scb-test-components/scb-radio-button/scb-radio-group.d.ts +49 -0
- package/scb-test-components/scb-scrollspy/scb-scrollspy.d.ts +217 -0
- package/scb-test-components/scb-search/scb-search.d.ts +96 -0
- package/scb-test-components/scb-segmented-button/scb-segmented-button.d.ts +80 -0
- package/scb-test-components/scb-segmented-button/scb-segmented-item.d.ts +21 -0
- package/scb-test-components/scb-select/scb-select-option.d.ts +16 -0
- package/scb-test-components/scb-select/scb-select.d.ts +62 -0
- package/scb-test-components/scb-skeleton/scb-skeleton.d.ts +25 -0
- package/scb-test-components/scb-slider/scb-slider.d.ts +28 -0
- package/scb-test-components/scb-snackbar/scb-snackbar.d.ts +24 -0
- package/scb-test-components/scb-status-pill/scb-status-pill.d.ts +22 -0
- package/scb-test-components/scb-stepper/scb-step.d.ts +22 -0
- package/scb-test-components/scb-stepper/scb-stepper.d.ts +47 -0
- package/scb-test-components/scb-switch/scb-switch.d.ts +52 -0
- package/scb-test-components/scb-table/scb-table.d.ts +24 -0
- package/scb-test-components/scb-table-advanced/scb-table-advanced.d.ts +39 -0
- package/scb-test-components/scb-tabs/scb-primary-tab.d.ts +15 -0
- package/scb-test-components/scb-tabs/scb-secondary-tab.d.ts +15 -0
- package/scb-test-components/scb-tabs/scb-tabs.d.ts +21 -0
- package/scb-test-components/scb-textfield/scb-textfield.d.ts +75 -0
- package/scb-test-components/scb-toc/scb-toc-item.d.ts +38 -0
- package/scb-test-components/scb-toc/scb-toc.d.ts +27 -0
- package/scb-test-components/scb-tooltip/scb-tooltip.d.ts +51 -0
- package/scb-test-components/scb-vignette/scb-vignette.d.ts +20 -0
- package/scb-test-components/scb-viz/scb-viz-actions-runtime.d.ts +26 -0
- package/scb-test-components/scb-viz/scb-viz-print-runtime.d.ts +27 -0
- package/scb-test-components/scb-viz/scb-viz-series-differentiation-registry.d.ts +21 -0
- package/scb-test-components/scb-viz/scb-viz-series-differentiation-runtime.d.ts +42 -0
- package/scb-test-components/scb-viz/scb-viz-table-runtime.d.ts +28 -0
- package/scb-test-components/scb-viz/scb-viz.d.ts +207 -0
- package/scb-textfield/scb-textfield.js +827 -0
- package/scb-toc/scb-toc-item.js +477 -0
- package/scb-toc/scb-toc.js +101 -0
- package/scb-tooltip/scb-tooltip.js +402 -0
- package/scb-typography.css +1 -1
- package/scb-vignette/scb-vignette.js +88 -0
- package/scb-viz/scb-viz-actions-runtime.js +143 -0
- package/scb-viz/scb-viz-print-runtime.js +121 -0
- package/scb-viz/scb-viz-series-differentiation-registry.js +117 -0
- package/scb-viz/scb-viz-series-differentiation-runtime.js +126 -0
- package/scb-viz/scb-viz-table-runtime.js +86 -0
- package/scb-viz/scb-viz.js +2195 -0
- package/scb-wc-selfhost.css +29 -0
- package/scb-wc.bundle.js +12893 -1099
- package/scb-wc.css +3 -2
- package/scb-wc.d.ts +180 -0
- package/index.d.ts +0 -0
- package/mvc/components/index.js +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { __decorate as e } from "../_virtual/_@oxc-project_runtime@0.126.0/helpers/decorate.js";
|
|
2
|
+
import { LitElement as t, css as n, html as r, nothing as i } from "lit";
|
|
3
|
+
import { customElement as a, property as o } from "lit/decorators.js";
|
|
4
|
+
import "@material/web/switch/switch.js";
|
|
5
|
+
//#region src/scb-test-components/scb-switch/scb-switch.ts
|
|
6
|
+
var s = class extends t {
|
|
7
|
+
static {
|
|
8
|
+
this.formAssociated = !0;
|
|
9
|
+
}
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this._internals = null, this.label = "", this.ariaLabel = "", this.icons = !1, this.selected = !1, this.required = !1, this.disabled = !1, this.fullWidth = !1, this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this.name = "", this.value = "on", this._form = null, this._formResetHandler = null, this._initialSelected = !1, this._customValidationMessage = "", "attachInternals" in this && (this._internals = this.attachInternals());
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
super.connectedCallback(), this._initialSelected = this.selected, this._form = this.closest("form"), this._form && (this._formResetHandler = () => {
|
|
15
|
+
this.selected = this._initialSelected, this.__syncFormValue();
|
|
16
|
+
}, this._form.addEventListener("reset", this._formResetHandler, !0)), this.__syncFormValue();
|
|
17
|
+
}
|
|
18
|
+
disconnectedCallback() {
|
|
19
|
+
this._form && this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0), super.disconnectedCallback();
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.styles = n`
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
/* Vertikalt avstånd styrs av spacing-attributen via CSS-variabler */
|
|
26
|
+
margin-block-start: var(--scb-switch-spacing-block-start, 0);
|
|
27
|
+
margin-block-end: var(--scb-switch-spacing-block-end, 0);
|
|
28
|
+
margin-inline-start: var(--scb-switch-spacing-inline-start, 0);
|
|
29
|
+
margin-inline-end: var(--scb-switch-spacing-inline-end, 0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.switch-container {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
width: auto;
|
|
37
|
+
|
|
38
|
+
/* Gap hämtas från spacing-tokens och följer density-lägen */
|
|
39
|
+
gap: var(--scb-switch-gap, var(--spacing-3, 8px));
|
|
40
|
+
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
|
|
43
|
+
/* Basfärg för innehållet. Labeln ärver om inget annat anges. */
|
|
44
|
+
color: var(--md-sys-color-on-surface);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* När full-width är true, kör space-between + 100% bredd */
|
|
48
|
+
:host([full-width]) .switch-container {
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
width: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.switch-label {
|
|
54
|
+
/* liten vertikal justering kopplad till spacing-tokens */
|
|
55
|
+
transform: translateY(var(--scb-switch-label-offset-y, var(--spacing-1, 2px)));
|
|
56
|
+
|
|
57
|
+
/* Typografiska tokens*/
|
|
58
|
+
font-family: var(--brand-font, 'Inter', sans-serif);
|
|
59
|
+
font-size: var(--md-sys-typescale-title-medium-size, 18px);
|
|
60
|
+
line-height: var(--md-sys-typescale-title-medium-line-height, 26px);
|
|
61
|
+
font-weight: var(--md-sys-typescale-title-large-weight, 600);
|
|
62
|
+
letter-spacing: var(--md-sys-typescale-title-medium-tracking, -0.3px);
|
|
63
|
+
|
|
64
|
+
/* Ärver färg från container */
|
|
65
|
+
color: var(--scb-switch-label-color, inherit);
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
firstUpdated() {
|
|
70
|
+
(this.shadowRoot?.querySelector("md-switch"))?.addEventListener("change", (e) => {
|
|
71
|
+
this.selected = e.target.selected, this.dispatchEvent(new CustomEvent("change", {
|
|
72
|
+
detail: { selected: this.selected },
|
|
73
|
+
bubbles: !0,
|
|
74
|
+
composed: !0
|
|
75
|
+
}));
|
|
76
|
+
}), this.#e();
|
|
77
|
+
}
|
|
78
|
+
updated(e) {
|
|
79
|
+
super.updated(e), e.has("disabled") && this.toggleAttribute("aria-disabled", this.disabled), (e.has("selected") || e.has("disabled") || e.has("value")) && this.__syncFormValue(), (e.has("selected") || e.has("disabled") || e.has("required")) && this.__syncValidity(), (e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom") || e.has("spacingLeft") || e.has("spacingRight")) && this.#e();
|
|
80
|
+
}
|
|
81
|
+
formDisabledCallback(e) {
|
|
82
|
+
this.disabled = e;
|
|
83
|
+
}
|
|
84
|
+
__getValidationMessage() {
|
|
85
|
+
return this._customValidationMessage ? this._customValidationMessage : this.required && !this.selected ? "Aktivera det här valet." : "";
|
|
86
|
+
}
|
|
87
|
+
__syncValidity() {
|
|
88
|
+
let e = this.shadowRoot?.querySelector("md-switch"), t = this.disabled ? "" : this.__getValidationMessage();
|
|
89
|
+
this._internals && (t ? this._internals.setValidity({ valueMissing: !0 }, t, e ?? void 0) : this._internals.setValidity({})), this.toggleAttribute("aria-invalid", !!t);
|
|
90
|
+
}
|
|
91
|
+
checkValidity() {
|
|
92
|
+
return !this.__getValidationMessage();
|
|
93
|
+
}
|
|
94
|
+
reportValidity() {
|
|
95
|
+
return this.__syncValidity(), this._internals ? this._internals.reportValidity() : this.checkValidity();
|
|
96
|
+
}
|
|
97
|
+
setCustomValidity(e) {
|
|
98
|
+
this._customValidationMessage = e, this.__syncValidity();
|
|
99
|
+
}
|
|
100
|
+
get validity() {
|
|
101
|
+
return this._internals?.validity;
|
|
102
|
+
}
|
|
103
|
+
get validationMessage() {
|
|
104
|
+
return this._internals?.validationMessage ?? this.__getValidationMessage();
|
|
105
|
+
}
|
|
106
|
+
get willValidate() {
|
|
107
|
+
return this._internals?.willValidate ?? !0;
|
|
108
|
+
}
|
|
109
|
+
__syncFormValue() {
|
|
110
|
+
if (!this._internals) return;
|
|
111
|
+
let e = this.disabled || !this.selected ? null : this.value;
|
|
112
|
+
this._internals.setFormValue(e);
|
|
113
|
+
}
|
|
114
|
+
#e() {
|
|
115
|
+
let e = this.#t(this.spacing), t = this.#t(this.spacingTop) ?? e, n = this.#t(this.spacingBottom) ?? e, r = this.#t(this.spacingLeft), i = this.#t(this.spacingRight);
|
|
116
|
+
t ? this.style.setProperty("--scb-switch-spacing-block-start", t) : this.style.removeProperty("--scb-switch-spacing-block-start"), n ? this.style.setProperty("--scb-switch-spacing-block-end", n) : this.style.removeProperty("--scb-switch-spacing-block-end"), r ? this.style.setProperty("--scb-switch-spacing-inline-start", r) : this.style.removeProperty("--scb-switch-spacing-inline-start"), i ? this.style.setProperty("--scb-switch-spacing-inline-end", i) : this.style.removeProperty("--scb-switch-spacing-inline-end");
|
|
117
|
+
}
|
|
118
|
+
#t(e) {
|
|
119
|
+
if (!e) return;
|
|
120
|
+
let t = String(e).trim();
|
|
121
|
+
if (t) return /^\d+$/.test(t) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(t, 10)))})` : t;
|
|
122
|
+
}
|
|
123
|
+
render() {
|
|
124
|
+
let e = this.label.trim().length > 0, t = e ? i : this.ariaLabel || i, n = r`
|
|
125
|
+
<md-switch
|
|
126
|
+
?icons=${this.icons}
|
|
127
|
+
?selected=${this.selected}
|
|
128
|
+
?disabled=${this.disabled}
|
|
129
|
+
aria-required=${this.required ? "true" : "false"}
|
|
130
|
+
aria-label=${t}
|
|
131
|
+
></md-switch>
|
|
132
|
+
`;
|
|
133
|
+
return e ? r`
|
|
134
|
+
<label class="switch-container" ?disabled=${this.disabled}>
|
|
135
|
+
<span class="switch-label">${this.label}</span>
|
|
136
|
+
${n}
|
|
137
|
+
</label>
|
|
138
|
+
` : n;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
e([o({ type: String })], s.prototype, "label", void 0), e([o({
|
|
142
|
+
type: String,
|
|
143
|
+
reflect: !0,
|
|
144
|
+
attribute: "aria-label"
|
|
145
|
+
})], s.prototype, "ariaLabel", void 0), e([o({
|
|
146
|
+
type: Boolean,
|
|
147
|
+
reflect: !0
|
|
148
|
+
})], s.prototype, "icons", void 0), e([o({
|
|
149
|
+
type: Boolean,
|
|
150
|
+
reflect: !0
|
|
151
|
+
})], s.prototype, "selected", void 0), e([o({
|
|
152
|
+
type: Boolean,
|
|
153
|
+
reflect: !0
|
|
154
|
+
})], s.prototype, "required", void 0), e([o({
|
|
155
|
+
type: Boolean,
|
|
156
|
+
reflect: !0
|
|
157
|
+
})], s.prototype, "disabled", void 0), e([o({
|
|
158
|
+
type: Boolean,
|
|
159
|
+
reflect: !0,
|
|
160
|
+
attribute: "full-width"
|
|
161
|
+
})], s.prototype, "fullWidth", void 0), e([o({
|
|
162
|
+
type: String,
|
|
163
|
+
reflect: !0
|
|
164
|
+
})], s.prototype, "spacing", void 0), e([o({
|
|
165
|
+
type: String,
|
|
166
|
+
attribute: "spacing-top",
|
|
167
|
+
reflect: !0
|
|
168
|
+
})], s.prototype, "spacingTop", void 0), e([o({
|
|
169
|
+
type: String,
|
|
170
|
+
attribute: "spacing-bottom",
|
|
171
|
+
reflect: !0
|
|
172
|
+
})], s.prototype, "spacingBottom", void 0), e([o({
|
|
173
|
+
type: String,
|
|
174
|
+
attribute: "spacing-left",
|
|
175
|
+
reflect: !0
|
|
176
|
+
})], s.prototype, "spacingLeft", void 0), e([o({
|
|
177
|
+
type: String,
|
|
178
|
+
attribute: "spacing-right",
|
|
179
|
+
reflect: !0
|
|
180
|
+
})], s.prototype, "spacingRight", void 0), e([o({ type: String })], s.prototype, "name", void 0), e([o({ type: String })], s.prototype, "value", void 0), s = e([a("scb-switch")], s);
|
|
181
|
+
//#endregion
|
|
182
|
+
export { s as ScbSwitch };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { __decorate as e } from "../_virtual/_@oxc-project_runtime@0.126.0/helpers/decorate.js";
|
|
2
|
+
import "../scb-icon-button/scb-icon-button.js";
|
|
3
|
+
import { LitElement as t, css as n, html as r } from "lit";
|
|
4
|
+
import { customElement as i, property as a } from "lit/decorators.js";
|
|
5
|
+
//#region src/scb-test-components/scb-table/scb-table.ts
|
|
6
|
+
var o = class extends t {
|
|
7
|
+
constructor(...e) {
|
|
8
|
+
super(...e), this.dataSorting = !1, this.columnWidthMode = "auto", this._sortedColumn = null, this._sortDirection = "asc", this._columnWidthFrame = null, this._onSlotChange = () => {
|
|
9
|
+
this._attachThListeners();
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
static {
|
|
13
|
+
this.styles = n`
|
|
14
|
+
:host {
|
|
15
|
+
display: block;
|
|
16
|
+
color: var(--md-sys-color-on-surface);
|
|
17
|
+
font-family: var(--brand, Inter);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.scb-table-scroll-wrapper {
|
|
21
|
+
width: 100%;
|
|
22
|
+
overflow-x: auto;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
padding-bottom: 24px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.scb-table-scroll-wrapper::-webkit-scrollbar {
|
|
29
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
30
|
+
height: 8px;
|
|
31
|
+
width: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.scb-table-scroll-wrapper::-webkit-scrollbar-thumb {
|
|
35
|
+
background: var(--md-sys-color-on-surface);
|
|
36
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.scb-table-scroll-wrapper::-webkit-scrollbar-track {
|
|
41
|
+
background: var(--md-sys-color-secondary-container);
|
|
42
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
::slotted(table) {
|
|
46
|
+
border-collapse: collapse;
|
|
47
|
+
border-spacing: 0;
|
|
48
|
+
min-width: 100%;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
::slotted(th) .scb-sort-icon {
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
::slotted(th:hover) .scb-sort-icon {
|
|
57
|
+
pointer-events: auto;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
return r`
|
|
63
|
+
<div class="scb-table-scroll-wrapper">
|
|
64
|
+
<slot @slotchange=${this._onSlotChange}></slot>
|
|
65
|
+
</div>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
firstUpdated() {
|
|
69
|
+
let e = this.shadowRoot?.querySelector("slot");
|
|
70
|
+
e && (e.addEventListener("slotchange", () => this._attachThListeners()), this._attachThListeners());
|
|
71
|
+
}
|
|
72
|
+
updated(e) {
|
|
73
|
+
e.has("dataSorting") && (this.dataSorting || (this._sortedColumn = null, this._sortDirection = "asc"), this._attachThListeners()), e.has("columnWidthMode") && this._queueColumnWidthUpdate();
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
super.disconnectedCallback(), this._columnWidthFrame !== null && (cancelAnimationFrame(this._columnWidthFrame), this._columnWidthFrame = null);
|
|
77
|
+
}
|
|
78
|
+
_getTbody() {
|
|
79
|
+
let e = this.shadowRoot?.querySelector("slot");
|
|
80
|
+
if (!e) return null;
|
|
81
|
+
let t = e.assignedNodes({ flatten: !0 });
|
|
82
|
+
for (let e of t) if (e.nodeType === Node.ELEMENT_NODE) {
|
|
83
|
+
let t = e, n = t.tagName.toLowerCase() === "tbody" ? t : t.querySelector("tbody");
|
|
84
|
+
if (n) return n;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
_getTables() {
|
|
89
|
+
let e = this.shadowRoot?.querySelector("slot");
|
|
90
|
+
if (!e) return [];
|
|
91
|
+
let t = e.assignedNodes({ flatten: !0 }), n = [];
|
|
92
|
+
return t.forEach((e) => {
|
|
93
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
94
|
+
let t = e;
|
|
95
|
+
t.tagName.toLowerCase() === "table" && n.push(t), n.push(...Array.from(t.querySelectorAll("table")));
|
|
96
|
+
}
|
|
97
|
+
}), n;
|
|
98
|
+
}
|
|
99
|
+
_attachThListeners() {
|
|
100
|
+
let e = this.shadowRoot?.querySelector("slot");
|
|
101
|
+
if (!e) return;
|
|
102
|
+
let t = e.assignedNodes({ flatten: !0 }), n = [], r = [], i = [], a = [];
|
|
103
|
+
t.forEach((e) => {
|
|
104
|
+
e.nodeType === Node.ELEMENT_NODE && (n.push(...e.querySelectorAll("thead")), r.push(...e.querySelectorAll("th")), i.push(...e.querySelectorAll("td")), a.push(...e.querySelectorAll("tr")));
|
|
105
|
+
}), n.forEach((e) => {
|
|
106
|
+
e.style.borderTop = "1px solid var(--md-sys-color-on-surface)";
|
|
107
|
+
}), r.forEach((e, t) => {
|
|
108
|
+
e.style.textAlign = "left", e.style.padding = "12px", e.style.position = "relative", e.style.backgroundColor = "var(--md-sys-color-surface)", e.style.fontFamily = "var(--md-sys-typescale-label-medium-font)", e.style.fontSize = "var(--md-sys-typescale-label-medium-size)", e.style.lineHeight = "var(--md-sys-typescale-label-medium-line-height)", e.style.fontWeight = " var(--weight-bold)", e.style.letterSpacing = "var(--md-sys-typescale-label-medium-tracking)", e.style.verticalAlign = "bottom", e.style.borderRight = "1px solid var(--md-sys-color-on-surface)", e.style.borderBottom = "1px solid var(--md-sys-color-on-surface)";
|
|
109
|
+
let n = (e.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
110
|
+
for (; e.firstChild;) e.removeChild(e.firstChild);
|
|
111
|
+
let r = document.createElement("p");
|
|
112
|
+
if (r.textContent = n, r.style.margin = "0", this.dataSorting) {
|
|
113
|
+
let n = document.createElement("scb-icon-button");
|
|
114
|
+
n.className = "scb-sort-icon", n.onclick = () => this._onThClick(t), n.setAttribute("variant", "standard"), n.setAttribute("size", "small"), n.style.alignSelf = "end", this._sortedColumn === t ? (n.setAttribute("variant", "filled-tonal"), n.setAttribute("icon", this._sortDirection === "asc" ? "arrow_downward" : "arrow_upward")) : (n.setAttribute("icon", "swap_horiz"), n.style.transform += " rotate(90deg)");
|
|
115
|
+
let i = document.createElement("div");
|
|
116
|
+
i.style.display = "flex", i.style.gap = "8px", i.style.flexWrap = "nowrap", i.style.alignItems = "center", i.appendChild(r), i.appendChild(n), e.appendChild(i);
|
|
117
|
+
} else e.appendChild(r);
|
|
118
|
+
}), i.forEach((e) => {
|
|
119
|
+
e.style.padding = "12px", e.style.textAlign = "left", e.style.borderTop = "1px solid var(--md-sys-color-outline-variant)", e.style.verticalAlign = "text-top", e.style.backgroundColor = "var(--md-sys-color-surface)", e.style.fontFamily = "var(--md-sys-typescale-body-medium-font)", e.style.fontSize = "var(--md-sys-typescale-body-medium-size)", e.style.lineHeight = "var(--md-sys-typescale-body-medium-line-height)", e.style.fontWeight = "var(--md-sys-typescale-body-medium-weight)", e.style.letterSpacing = "var(--md-sys-typescale-body-medium-tracking)", e.style.borderRight = "1px solid var(--md-sys-color-on-surface)", e.style.borderBottom = "1px solid var(--md-sys-color-on-surface)";
|
|
120
|
+
}), a.forEach((e) => {
|
|
121
|
+
let t = e.querySelectorAll("th");
|
|
122
|
+
t.length > 0 && t.forEach((e, n) => {
|
|
123
|
+
n === t.length - 1 && (e.style.borderRight = "none");
|
|
124
|
+
});
|
|
125
|
+
let n = e.querySelectorAll("td");
|
|
126
|
+
n.length > 0 && n.forEach((e, t) => {
|
|
127
|
+
t === n.length - 1 && (e.style.borderRight = "none");
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
let o = this._getTbody();
|
|
131
|
+
o && Array.from(o.querySelectorAll("tr")).forEach((e, t) => {
|
|
132
|
+
let n = t % 2 == 0 ? "var(--md-sys-color-surface-container)" : "var(--md-sys-color-surface)";
|
|
133
|
+
e.querySelectorAll("td").forEach((e) => {
|
|
134
|
+
e.style.backgroundColor = n;
|
|
135
|
+
});
|
|
136
|
+
}), this._queueColumnWidthUpdate();
|
|
137
|
+
}
|
|
138
|
+
_queueColumnWidthUpdate() {
|
|
139
|
+
this._columnWidthFrame !== null && cancelAnimationFrame(this._columnWidthFrame), this._columnWidthFrame = requestAnimationFrame(() => {
|
|
140
|
+
this._columnWidthFrame = null, this._applyColumnWidthMode();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
_applyColumnWidthMode() {
|
|
144
|
+
this._getTables().forEach((e) => {
|
|
145
|
+
if (this._removeGeneratedColGroup(e), e.style.tableLayout = "", e.style.width = "", e.style.minWidth = "", e.style.maxWidth = "", this.columnWidthMode !== "header") return;
|
|
146
|
+
let t = Array.from(e.querySelectorAll("thead tr")), n = t[t.length - 1];
|
|
147
|
+
if (!n) return;
|
|
148
|
+
let r = Array.from(n.cells).map((e) => `${Math.ceil(this._measureCellContentWidth(e))}px`), i = r.reduce((e, t) => e + parseFloat(t), 0);
|
|
149
|
+
this._applyGeneratedColGroup(e, r), e.style.tableLayout = "fixed", e.style.width = `${Math.ceil(i)}px`, e.style.minWidth = `${Math.ceil(i)}px`, e.style.maxWidth = "none";
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
_applyGeneratedColGroup(e, t) {
|
|
153
|
+
let n = document.createElement("colgroup");
|
|
154
|
+
n.setAttribute("data-scb-generated-column-widths", "true"), t.forEach((e) => {
|
|
155
|
+
let t = document.createElement("col");
|
|
156
|
+
t.style.width = e, t.style.minWidth = e, n.appendChild(t);
|
|
157
|
+
}), e.insertBefore(n, e.firstChild);
|
|
158
|
+
}
|
|
159
|
+
_removeGeneratedColGroup(e) {
|
|
160
|
+
e.querySelector("colgroup[data-scb-generated-column-widths=\"true\"]")?.remove();
|
|
161
|
+
}
|
|
162
|
+
_measureCellContentWidth(e) {
|
|
163
|
+
let t = e.firstElementChild?.cloneNode(!0) ?? document.createElement("span");
|
|
164
|
+
e.firstElementChild || (t.textContent = e.textContent ?? "");
|
|
165
|
+
let n = window.getComputedStyle(e), r = document.createElement("div");
|
|
166
|
+
r.style.position = "absolute", r.style.left = "-99999px", r.style.top = "0", r.style.visibility = "hidden", r.style.pointerEvents = "none", r.style.width = "max-content", r.style.maxWidth = "none", r.style.whiteSpace = "nowrap", r.style.fontFamily = n.fontFamily, r.style.fontSize = n.fontSize, r.style.fontWeight = n.fontWeight, r.style.lineHeight = n.lineHeight, r.style.letterSpacing = n.letterSpacing, t instanceof HTMLElement && (t.style.width = "max-content", t.style.maxWidth = "none", t.style.whiteSpace = "nowrap"), r.appendChild(t), document.body.appendChild(r);
|
|
167
|
+
let i = parseFloat(n.paddingLeft || "0"), a = parseFloat(n.paddingRight || "0"), o = r.getBoundingClientRect().width + i + a;
|
|
168
|
+
return document.body.removeChild(r), o;
|
|
169
|
+
}
|
|
170
|
+
_onThClick(e) {
|
|
171
|
+
this.dataSorting && (this._sortedColumn === e ? this._sortDirection = this._sortDirection === "asc" ? "desc" : "asc" : (this._sortedColumn = e, this._sortDirection = "asc"), this._sortTable(e, this._sortDirection), this._attachThListeners(), this.dispatchEvent(new CustomEvent("tablesortchange", {
|
|
172
|
+
detail: {
|
|
173
|
+
sortedColumn: this._sortedColumn,
|
|
174
|
+
sortDirection: this._sortDirection
|
|
175
|
+
},
|
|
176
|
+
bubbles: !0,
|
|
177
|
+
composed: !0
|
|
178
|
+
})));
|
|
179
|
+
}
|
|
180
|
+
_sortTable(e, t) {
|
|
181
|
+
let n = this._getTbody();
|
|
182
|
+
if (!n) return;
|
|
183
|
+
let r = Array.from(n.querySelectorAll("tr"));
|
|
184
|
+
r.sort((n, r) => {
|
|
185
|
+
let i = n.children[e]?.textContent?.trim() ?? "", a = r.children[e]?.textContent?.trim() ?? "", o = Date.parse(i.replace(/\s+/g, " ")), s = Date.parse(a.replace(/\s+/g, " "));
|
|
186
|
+
if (!isNaN(o) && !isNaN(s)) return t === "asc" ? o - s : s - o;
|
|
187
|
+
let c = parseFloat(i.replace(",", ".")), l = parseFloat(a.replace(",", "."));
|
|
188
|
+
if (!isNaN(c) && !isNaN(l)) return t === "asc" ? c - l : l - c;
|
|
189
|
+
let u = i.localeCompare(a, "sv");
|
|
190
|
+
return t === "asc" ? u : -u;
|
|
191
|
+
}), r.forEach((e) => n.appendChild(e));
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
e([a({
|
|
195
|
+
type: Boolean,
|
|
196
|
+
attribute: "data-sorting"
|
|
197
|
+
})], o.prototype, "dataSorting", void 0), e([a({
|
|
198
|
+
type: String,
|
|
199
|
+
attribute: "column-width-mode"
|
|
200
|
+
})], o.prototype, "columnWidthMode", void 0), o = e([i("scb-table")], o);
|
|
201
|
+
//#endregion
|
|
202
|
+
export { o as ScbTable };
|