sveltacular 0.0.76 → 1.0.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/README.md +142 -15
- package/dist/forms/base-input-wrapper.svelte +99 -0
- package/dist/forms/base-input-wrapper.svelte.d.ts +15 -0
- package/dist/forms/bool-box/bool-box.svelte +30 -17
- package/dist/forms/bool-box/bool-box.svelte.d.ts +9 -21
- package/dist/forms/button/button.svelte +153 -89
- package/dist/forms/button/button.svelte.d.ts +25 -29
- package/dist/forms/check-box/check-box-group.svelte +63 -29
- package/dist/forms/check-box/check-box-group.svelte.d.ts +11 -27
- package/dist/forms/check-box/check-box.svelte +57 -33
- package/dist/forms/check-box/check-box.svelte.d.ts +15 -25
- package/dist/forms/check-box/index.d.ts +2 -0
- package/dist/forms/check-box/index.js +2 -0
- package/dist/forms/combo/new-or-existing-combo.svelte +37 -18
- package/dist/forms/combo/new-or-existing-combo.svelte.d.ts +15 -25
- package/dist/forms/combo-box/combo-box.svelte +655 -0
- package/dist/forms/combo-box/combo-box.svelte.d.ts +62 -0
- package/dist/forms/combo-box/index.d.ts +1 -0
- package/dist/forms/combo-box/index.js +1 -0
- package/dist/forms/date-box/date-box.svelte +80 -54
- package/dist/forms/date-box/date-box.svelte.d.ts +21 -32
- package/dist/forms/file-area/file-area.svelte +109 -68
- package/dist/forms/file-area/file-area.svelte.d.ts +12 -22
- package/dist/forms/file-box/file-box.svelte +40 -21
- package/dist/forms/file-box/file-box.svelte.d.ts +14 -25
- package/dist/forms/form-field.svelte +18 -15
- package/dist/forms/form-field.svelte.d.ts +8 -18
- package/dist/forms/form-footer.svelte +6 -3
- package/dist/forms/form-footer.svelte.d.ts +6 -26
- package/dist/forms/form-header.svelte +15 -4
- package/dist/forms/form-header.svelte.d.ts +8 -18
- package/dist/forms/form-label.svelte +15 -6
- package/dist/forms/form-label.svelte.d.ts +8 -19
- package/dist/forms/form-section.svelte +15 -4
- package/dist/forms/form-section.svelte.d.ts +8 -18
- package/dist/forms/form.svelte +30 -13
- package/dist/forms/form.svelte.d.ts +11 -22
- package/dist/forms/index.d.ts +26 -0
- package/dist/forms/index.js +31 -0
- package/dist/forms/info-box/info-box.svelte +19 -8
- package/dist/forms/info-box/info-box.svelte.d.ts +8 -19
- package/dist/forms/list-box/index.d.ts +2 -0
- package/dist/forms/list-box/index.js +1 -0
- package/dist/forms/list-box/list-box.svelte +190 -118
- package/dist/forms/list-box/list-box.svelte.d.ts +16 -26
- package/dist/forms/money-box/money-box.svelte +223 -190
- package/dist/forms/money-box/money-box.svelte.d.ts +16 -28
- package/dist/forms/number-box/number-box.svelte +84 -67
- package/dist/forms/number-box/number-box.svelte.d.ts +17 -28
- package/dist/forms/phone-box/index.d.ts +1 -0
- package/dist/forms/phone-box/index.js +1 -0
- package/dist/forms/phone-box/phone-box.svelte +152 -122
- package/dist/forms/phone-box/phone-box.svelte.d.ts +8 -20
- package/dist/forms/radio-group/index.d.ts +2 -0
- package/dist/forms/radio-group/index.js +2 -0
- package/dist/forms/radio-group/radio-box.svelte +23 -8
- package/dist/forms/radio-group/radio-box.svelte.d.ts +10 -19
- package/dist/forms/radio-group/radio-group.svelte +27 -13
- package/dist/forms/radio-group/radio-group.svelte.d.ts +10 -21
- package/dist/forms/slider/slider.svelte +210 -0
- package/dist/forms/slider/slider.svelte.d.ts +17 -0
- package/dist/forms/switch-box/switch-box.svelte +35 -21
- package/dist/forms/switch-box/switch-box.svelte.d.ts +9 -20
- package/dist/forms/text-area/text-area.svelte +89 -15
- package/dist/forms/text-area/text-area.svelte.d.ts +15 -23
- package/dist/forms/text-box/text-box.svelte +253 -75
- package/dist/forms/text-box/text-box.svelte.d.ts +28 -36
- package/dist/forms/time-box/time-box.svelte +67 -0
- package/dist/forms/time-box/time-box.svelte.d.ts +12 -0
- package/dist/forms/url-box/url-box.svelte +32 -18
- package/dist/forms/url-box/url-box.svelte.d.ts +9 -20
- package/dist/forms/validation.d.ts +60 -0
- package/dist/forms/validation.js +123 -0
- package/dist/generic/address/address.svelte +22 -13
- package/dist/generic/address/address.svelte.d.ts +9 -19
- package/dist/generic/avatar/avatar.svelte +86 -0
- package/dist/generic/avatar/avatar.svelte.d.ts +10 -0
- package/dist/generic/badge/badge.svelte +82 -0
- package/dist/generic/badge/badge.svelte.d.ts +11 -0
- package/dist/generic/card/card-container.svelte +41 -13
- package/dist/generic/card/card-container.svelte.d.ts +8 -18
- package/dist/generic/card/card.svelte +47 -29
- package/dist/generic/card/card.svelte.d.ts +9 -19
- package/dist/generic/card/index.d.ts +3 -0
- package/dist/generic/card/index.js +2 -0
- package/dist/generic/chip/chip.svelte +90 -0
- package/dist/generic/chip/chip.svelte.d.ts +11 -0
- package/dist/generic/date/date-time.svelte +86 -64
- package/dist/generic/date/date-time.svelte.d.ts +10 -20
- package/dist/generic/divider/divider.svelte.d.ts +22 -19
- package/dist/generic/dot/dot.svelte +13 -4
- package/dist/generic/dot/dot.svelte.d.ts +7 -17
- package/dist/generic/dropdown-item/dropdown-item.svelte +24 -12
- package/dist/generic/dropdown-item/dropdown-item.svelte.d.ts +10 -21
- package/dist/generic/email/email.svelte +6 -4
- package/dist/generic/email/email.svelte.d.ts +5 -15
- package/dist/generic/empty/empty.svelte +57 -26
- package/dist/generic/empty/empty.svelte.d.ts +11 -21
- package/dist/generic/header/header.svelte +26 -10
- package/dist/generic/header/header.svelte.d.ts +10 -20
- package/dist/generic/index.d.ts +28 -0
- package/dist/generic/index.js +31 -0
- package/dist/generic/link/link.svelte +20 -7
- package/dist/generic/link/link.svelte.d.ts +11 -21
- package/dist/generic/list/index.d.ts +4 -0
- package/dist/generic/list/index.js +3 -0
- package/dist/generic/list/list-item.svelte +17 -13
- package/dist/generic/list/list-item.svelte.d.ts +6 -15
- package/dist/generic/list/list.d.ts +2 -2
- package/dist/generic/list/list.svelte +28 -15
- package/dist/generic/list/list.svelte.d.ts +9 -19
- package/dist/generic/menu/menu.svelte +163 -57
- package/dist/generic/menu/menu.svelte.d.ts +16 -24
- package/dist/generic/notice/notice.svelte +119 -81
- package/dist/generic/notice/notice.svelte.d.ts +17 -26
- package/dist/generic/overlay.svelte +40 -14
- package/dist/generic/overlay.svelte.d.ts +9 -19
- package/dist/generic/panel/panel.svelte +16 -6
- package/dist/generic/panel/panel.svelte.d.ts +8 -18
- package/dist/generic/phone/phone.svelte +30 -24
- package/dist/generic/phone/phone.svelte.d.ts +6 -16
- package/dist/generic/pill/pill.svelte +47 -33
- package/dist/generic/pill/pill.svelte.d.ts +10 -21
- package/dist/generic/popover/popover.svelte +226 -0
- package/dist/generic/popover/popover.svelte.d.ts +15 -0
- package/dist/generic/rating/rating.svelte +85 -0
- package/dist/generic/rating/rating.svelte.d.ts +11 -0
- package/dist/generic/scorecard/scorecard.svelte +34 -21
- package/dist/generic/scorecard/scorecard.svelte.d.ts +9 -19
- package/dist/generic/section/section.svelte +28 -9
- package/dist/generic/section/section.svelte.d.ts +11 -21
- package/dist/generic/spinner/spinner.svelte +64 -0
- package/dist/generic/spinner/spinner.svelte.d.ts +8 -0
- package/dist/generic/theme-provider/index.d.ts +1 -0
- package/dist/generic/theme-provider/index.js +1 -0
- package/dist/generic/theme-provider/theme-provider-demo.svelte +182 -0
- package/dist/generic/theme-provider/theme-provider-demo.svelte.d.ts +3 -0
- package/dist/generic/theme-provider/theme-provider.svelte +83 -0
- package/dist/generic/theme-provider/theme-provider.svelte.d.ts +44 -0
- package/dist/generic/toaster/toaster.svelte +31 -6
- package/dist/generic/toaster/toaster.svelte.d.ts +7 -15
- package/dist/generic/tooltip/tooltip.svelte +389 -0
- package/dist/generic/tooltip/tooltip.svelte.d.ts +21 -0
- package/dist/helpers/ago.d.ts +7 -1
- package/dist/helpers/ago.js +6 -0
- package/dist/helpers/animation-actions.d.ts +124 -0
- package/dist/helpers/animation-actions.js +299 -0
- package/dist/helpers/animations.d.ts +198 -0
- package/dist/helpers/animations.js +280 -0
- package/dist/helpers/announcer.d.ts +118 -0
- package/dist/helpers/announcer.js +250 -0
- package/dist/helpers/copy-to-clipboard.svelte.d.ts +5 -0
- package/dist/helpers/copy-to-clipboard.svelte.js +28 -0
- package/dist/helpers/debounce.d.ts +7 -0
- package/dist/helpers/debounce.js +7 -0
- package/dist/helpers/focus.d.ts +123 -0
- package/dist/helpers/focus.js +335 -0
- package/dist/helpers/fuzzy-search.d.ts +41 -0
- package/dist/helpers/fuzzy-search.js +114 -0
- package/dist/helpers/index.d.ts +24 -0
- package/dist/helpers/index.js +24 -0
- package/dist/helpers/navigate-to.d.ts +4 -0
- package/dist/helpers/navigate-to.js +4 -0
- package/dist/helpers/positioning.d.ts +97 -0
- package/dist/helpers/positioning.js +230 -0
- package/dist/helpers/round-to-decimals.d.ts +7 -5
- package/dist/helpers/round-to-decimals.js +7 -5
- package/dist/helpers/spring.svelte.d.ts +97 -0
- package/dist/helpers/spring.svelte.js +216 -0
- package/dist/helpers/subscribable.d.ts +1 -2
- package/dist/helpers/theme.svelte.d.ts +63 -0
- package/dist/helpers/theme.svelte.js +123 -0
- package/dist/helpers/unique-id.d.ts +4 -0
- package/dist/helpers/unique-id.js +4 -0
- package/dist/helpers/use-position.svelte.d.ts +96 -0
- package/dist/helpers/use-position.svelte.js +189 -0
- package/dist/helpers/use-virtual-list.svelte.d.ts +121 -0
- package/dist/helpers/use-virtual-list.svelte.js +239 -0
- package/dist/icons/angle-right-icon.svelte +2 -1
- package/dist/icons/angle-right-icon.svelte.d.ts +16 -12
- package/dist/icons/angle-up-icon.svelte.d.ts +22 -19
- package/dist/icons/check-icon.svelte.d.ts +22 -19
- package/dist/icons/copy-icon.svelte +46 -0
- package/dist/icons/copy-icon.svelte.d.ts +6 -0
- package/dist/icons/envelope-icon.svelte.d.ts +22 -19
- package/dist/icons/folder-open-icon.svelte.d.ts +22 -19
- package/dist/icons/hamburger-icon.svelte.d.ts +22 -19
- package/dist/icons/home-icon.svelte +2 -1
- package/dist/icons/home-icon.svelte.d.ts +16 -12
- package/dist/icons/index.d.ts +13 -0
- package/dist/icons/index.js +13 -0
- package/dist/icons/link-icon.svelte.d.ts +22 -19
- package/dist/icons/mobile-phone-icon.svelte.d.ts +22 -19
- package/dist/icons/phone-icon.svelte.d.ts +22 -19
- package/dist/icons/svg-icon.svelte +46 -12
- package/dist/icons/svg-icon.svelte.d.ts +13 -23
- package/dist/icons/upload-icon.svelte.d.ts +22 -19
- package/dist/images/icon.svelte +9 -3
- package/dist/images/icon.svelte.d.ts +6 -16
- package/dist/images/image.svelte +28 -10
- package/dist/images/image.svelte.d.ts +14 -26
- package/dist/images/index.d.ts +2 -0
- package/dist/images/index.js +2 -0
- package/dist/index.d.ts +13 -122
- package/dist/index.js +27 -135
- package/dist/layout/flex-col.svelte +65 -22
- package/dist/layout/flex-col.svelte.d.ts +12 -22
- package/dist/layout/flex-item.svelte +13 -3
- package/dist/layout/flex-item.svelte.d.ts +8 -18
- package/dist/layout/flex-row.svelte +70 -21
- package/dist/layout/flex-row.svelte.d.ts +14 -24
- package/dist/layout/grid.svelte +7 -1
- package/dist/layout/grid.svelte.d.ts +6 -26
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +4 -0
- package/dist/modals/alert.svelte +42 -28
- package/dist/modals/alert.svelte.d.ts +13 -24
- package/dist/modals/confirm.svelte +54 -37
- package/dist/modals/confirm.svelte.d.ts +16 -27
- package/dist/modals/dialog-body.svelte +10 -4
- package/dist/modals/dialog-body.svelte.d.ts +6 -26
- package/dist/modals/dialog-close-button.svelte +15 -9
- package/dist/modals/dialog-close-button.svelte.d.ts +6 -17
- package/dist/modals/dialog-footer.svelte +6 -3
- package/dist/modals/dialog-footer.svelte.d.ts +6 -26
- package/dist/modals/dialog-header.svelte +13 -1
- package/dist/modals/dialog-header.svelte.d.ts +7 -26
- package/dist/modals/dialog-window.svelte +42 -14
- package/dist/modals/dialog-window.svelte.d.ts +9 -17
- package/dist/modals/index.d.ts +9 -0
- package/dist/modals/index.js +9 -0
- package/dist/modals/modal.svelte +88 -25
- package/dist/modals/modal.svelte.d.ts +14 -22
- package/dist/modals/prompt.svelte +71 -50
- package/dist/modals/prompt.svelte.d.ts +19 -30
- package/dist/navigation/accordion/accordion.svelte +104 -0
- package/dist/navigation/accordion/accordion.svelte.d.ts +9 -0
- package/dist/navigation/app-bar/app-bar.svelte +26 -20
- package/dist/navigation/app-bar/app-bar.svelte.d.ts +10 -20
- package/dist/navigation/app-bar/app-branding.svelte +10 -5
- package/dist/navigation/app-bar/app-branding.svelte.d.ts +6 -15
- package/dist/navigation/app-bar/app-logo.svelte +20 -5
- package/dist/navigation/app-bar/app-logo.svelte.d.ts +9 -19
- package/dist/navigation/app-bar/app-nav-item.svelte +26 -14
- package/dist/navigation/app-bar/app-nav-item.svelte.d.ts +9 -20
- package/dist/navigation/app-bar/app-nav.svelte +39 -12
- package/dist/navigation/app-bar/app-nav.svelte.d.ts +8 -18
- package/dist/navigation/app-bar/index.d.ts +5 -0
- package/dist/navigation/app-bar/index.js +5 -0
- package/dist/navigation/breadcrumbs/breadcrumbs.svelte +54 -28
- package/dist/navigation/breadcrumbs/breadcrumbs.svelte.d.ts +12 -21
- package/dist/navigation/command-palette/command-palette.svelte +758 -0
- package/dist/navigation/command-palette/command-palette.svelte.d.ts +65 -0
- package/dist/navigation/command-palette/index.d.ts +2 -0
- package/dist/navigation/command-palette/index.js +1 -0
- package/dist/navigation/context-menu/README.md +146 -0
- package/dist/navigation/context-menu/context-menu-divider.svelte +21 -0
- package/dist/navigation/context-menu/context-menu-divider.svelte.d.ts +18 -0
- package/dist/navigation/context-menu/context-menu-item.svelte +268 -0
- package/dist/navigation/context-menu/context-menu-item.svelte.d.ts +19 -0
- package/dist/navigation/context-menu/context-menu.svelte +226 -0
- package/dist/navigation/context-menu/context-menu.svelte.d.ts +38 -0
- package/dist/navigation/context-menu/index.d.ts +3 -0
- package/dist/navigation/context-menu/index.js +3 -0
- package/dist/navigation/drawer/drawer.svelte +137 -0
- package/dist/navigation/drawer/drawer.svelte.d.ts +11 -0
- package/dist/navigation/dropdown-button/dropdown-button.svelte +58 -20
- package/dist/navigation/dropdown-button/dropdown-button.svelte.d.ts +10 -20
- package/dist/navigation/index.d.ts +11 -0
- package/dist/navigation/index.js +14 -0
- package/dist/navigation/pagination/pagination.svelte +55 -42
- package/dist/navigation/pagination/pagination.svelte.d.ts +10 -21
- package/dist/navigation/side-bar/side-bar.svelte +18 -9
- package/dist/navigation/side-bar/side-bar.svelte.d.ts +7 -17
- package/dist/navigation/tabs/index.d.ts +4 -0
- package/dist/navigation/tabs/index.js +3 -0
- package/dist/navigation/tabs/tab-context.d.ts +12 -6
- package/dist/navigation/tabs/tab-group.svelte +268 -55
- package/dist/navigation/tabs/tab-group.svelte.d.ts +9 -20
- package/dist/navigation/tabs/tab.svelte +64 -34
- package/dist/navigation/tabs/tab.svelte.d.ts +11 -22
- package/dist/navigation/wizard/index.d.ts +3 -0
- package/dist/navigation/wizard/index.js +2 -0
- package/dist/navigation/wizard/wizard-context.d.ts +13 -8
- package/dist/navigation/wizard/wizard-step.svelte +38 -15
- package/dist/navigation/wizard/wizard-step.svelte.d.ts +8 -18
- package/dist/navigation/wizard/wizard.svelte +123 -89
- package/dist/navigation/wizard/wizard.svelte.d.ts +15 -26
- package/dist/placeholders/index.d.ts +6 -0
- package/dist/placeholders/index.js +6 -0
- package/dist/placeholders/loading.svelte +39 -23
- package/dist/placeholders/loading.svelte.d.ts +10 -17
- package/dist/placeholders/progress.svelte +7 -6
- package/dist/placeholders/progress.svelte.d.ts +5 -15
- package/dist/placeholders/skeleton-input.svelte +66 -38
- package/dist/placeholders/skeleton-input.svelte.d.ts +5 -15
- package/dist/placeholders/skeleton-paragraph.svelte +25 -0
- package/dist/placeholders/skeleton-paragraph.svelte.d.ts +8 -0
- package/dist/placeholders/skeleton-table.svelte +75 -0
- package/dist/placeholders/skeleton-table.svelte.d.ts +8 -0
- package/dist/placeholders/skeleton-text.svelte +46 -16
- package/dist/placeholders/skeleton-text.svelte.d.ts +7 -17
- package/dist/tables/cell-renderers.d.ts +24 -0
- package/dist/tables/cell-renderers.js +228 -0
- package/dist/tables/data-grid.svelte +332 -135
- package/dist/tables/data-grid.svelte.d.ts +34 -33
- package/dist/tables/index.d.ts +10 -0
- package/dist/tables/index.js +12 -0
- package/dist/tables/table-caption.svelte +13 -4
- package/dist/tables/table-caption.svelte.d.ts +8 -18
- package/dist/tables/table-cell.svelte +45 -15
- package/dist/tables/table-cell.svelte.d.ts +10 -19
- package/dist/tables/table-context.svelte.d.ts +32 -0
- package/dist/tables/table-context.svelte.js +160 -0
- package/dist/tables/table-header-cell.svelte +158 -19
- package/dist/tables/table-header-cell.svelte.d.ts +15 -19
- package/dist/tables/table-header.svelte +31 -6
- package/dist/tables/table-header.svelte.d.ts +7 -26
- package/dist/tables/table-row.svelte +87 -7
- package/dist/tables/table-row.svelte.d.ts +10 -26
- package/dist/tables/table.svelte +61 -2
- package/dist/tables/table.svelte.d.ts +13 -26
- package/dist/test-utils/accessibility-helpers.d.ts +80 -0
- package/dist/test-utils/accessibility-helpers.js +220 -0
- package/dist/test-utils/index.d.ts +8 -0
- package/dist/test-utils/index.js +8 -0
- package/dist/test-utils/mock-helpers.d.ts +68 -0
- package/dist/test-utils/mock-helpers.js +165 -0
- package/dist/test-utils/render-helpers.d.ts +55 -0
- package/dist/test-utils/render-helpers.js +114 -0
- package/dist/test-utils/setup.d.ts +5 -0
- package/dist/test-utils/setup.js +91 -0
- package/dist/test-utils/test-data.d.ts +102 -0
- package/dist/test-utils/test-data.js +99 -0
- package/dist/timeline/index.d.ts +2 -0
- package/dist/timeline/index.js +2 -0
- package/dist/timeline/timeline-item.svelte +26 -9
- package/dist/timeline/timeline-item.svelte.d.ts +13 -23
- package/dist/timeline/timeline.svelte +12 -6
- package/dist/timeline/timeline.svelte.d.ts +6 -26
- package/dist/types/data.d.ts +61 -0
- package/dist/types/date.d.ts +1 -1
- package/dist/types/form.d.ts +20 -2
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/size.d.ts +22 -0
- package/dist/types/size.js +22 -0
- package/dist/typography/code-block.svelte +89 -10
- package/dist/typography/code-block.svelte.d.ts +7 -17
- package/dist/typography/code.svelte +89 -0
- package/dist/typography/code.svelte.d.ts +7 -0
- package/dist/typography/headline.svelte +29 -9
- package/dist/typography/headline.svelte.d.ts +8 -18
- package/dist/typography/index.d.ts +6 -0
- package/dist/typography/index.js +6 -0
- package/dist/typography/paragraph.svelte +18 -10
- package/dist/typography/paragraph.svelte.d.ts +6 -26
- package/dist/typography/subtitle.svelte +18 -4
- package/dist/typography/subtitle.svelte.d.ts +8 -18
- package/dist/typography/text.svelte +20 -5
- package/dist/typography/text.svelte.d.ts +9 -19
- package/package.json +46 -36
- package/dist/navigation/accordian/accordian.svelte +0 -62
- package/dist/navigation/accordian/accordian.svelte.d.ts +0 -19
- package/dist/tables/table-body.svelte +0 -3
- package/dist/tables/table-body.svelte.d.ts +0 -27
- package/dist/tables/table-footer-cell.svelte +0 -22
- package/dist/tables/table-footer-cell.svelte.d.ts +0 -18
- package/dist/tables/table-footer-row.svelte +0 -3
- package/dist/tables/table-footer-row.svelte.d.ts +0 -27
- package/dist/tables/table-footer.svelte +0 -13
- package/dist/tables/table-footer.svelte.d.ts +0 -27
- package/dist/tables/table-header-row.svelte +0 -4
- package/dist/tables/table-header-row.svelte.d.ts +0 -27
|
@@ -1,111 +1,230 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import TableCell from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import TableCell from './table-cell.svelte';
|
|
3
|
+
import TableHeaderCell from './table-header-cell.svelte';
|
|
4
|
+
import TableHeader from './table-header.svelte';
|
|
5
|
+
import TableRow from './table-row.svelte';
|
|
6
|
+
import Table from './table.svelte';
|
|
7
|
+
import type { ColumnDef, JsonObject, PaginationProperties } from '../types/data.js';
|
|
8
|
+
import Button from '../forms/button/button.svelte';
|
|
9
|
+
import DropdownItem from '../generic/dropdown-item/dropdown-item.svelte';
|
|
10
|
+
import Empty from '../generic/empty/empty.svelte';
|
|
11
|
+
import Pill from '../generic/pill/pill.svelte';
|
|
12
|
+
import FolderOpenIcon from '../icons/folder-open-icon.svelte';
|
|
13
|
+
import DropdownButton from '../navigation/dropdown-button/dropdown-button.svelte';
|
|
14
|
+
import Pagination from '../navigation/pagination/pagination.svelte';
|
|
15
|
+
import Loading from '../placeholders/loading.svelte';
|
|
16
|
+
import TableCaption from './table-caption.svelte';
|
|
17
|
+
import {
|
|
18
|
+
formatCell,
|
|
19
|
+
getCellLink,
|
|
20
|
+
getCellAlignment,
|
|
21
|
+
getCellTypeClass,
|
|
22
|
+
sortRows
|
|
23
|
+
} from './cell-renderers.js';
|
|
24
|
+
import { getTableContext } from './table-context.svelte.js';
|
|
25
|
+
import type { Snippet } from 'svelte';
|
|
26
|
+
import { useVirtualList } from '../helpers/use-virtual-list.svelte.js';
|
|
27
|
+
import { onMount } from 'svelte';
|
|
28
|
+
|
|
29
|
+
type PaginationEvent = (pagination: PaginationProperties) => void;
|
|
30
|
+
|
|
31
|
+
interface Action {
|
|
32
|
+
text: string;
|
|
33
|
+
onClick: (row: JsonObject) => unknown;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface Actions {
|
|
37
|
+
text?: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
items: Action[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let {
|
|
43
|
+
captionSide = 'top' as 'top' | 'bottom',
|
|
44
|
+
captionAlign = 'center' as 'left' | 'center' | 'right',
|
|
45
|
+
rows = undefined,
|
|
46
|
+
cols,
|
|
47
|
+
pagination = undefined,
|
|
48
|
+
actions = undefined,
|
|
49
|
+
stickyHeader = false,
|
|
50
|
+
enableSorting = true,
|
|
51
|
+
enableSelection = false,
|
|
52
|
+
selectionMode = 'multi',
|
|
53
|
+
rowIdKey = 'id',
|
|
54
|
+
onPageChange = null,
|
|
55
|
+
onSort = undefined,
|
|
56
|
+
onSelectionChange = undefined,
|
|
57
|
+
children = undefined,
|
|
58
|
+
virtualScroll = false,
|
|
59
|
+
rowHeight = 48,
|
|
60
|
+
maxHeight = '600px'
|
|
61
|
+
}: {
|
|
62
|
+
captionSide?: 'top' | 'bottom';
|
|
63
|
+
captionAlign?: 'left' | 'center' | 'right';
|
|
64
|
+
rows?: JsonObject[];
|
|
65
|
+
cols: ColumnDef[];
|
|
66
|
+
pagination?: PaginationProperties;
|
|
67
|
+
actions?: Actions;
|
|
68
|
+
stickyHeader?: boolean;
|
|
69
|
+
enableSorting?: boolean;
|
|
70
|
+
enableSelection?: boolean;
|
|
71
|
+
selectionMode?: 'single' | 'multi';
|
|
72
|
+
rowIdKey?: string;
|
|
73
|
+
onPageChange?: PaginationEvent | null;
|
|
74
|
+
onSort?: (column: string, direction: 'asc' | 'desc') => void;
|
|
75
|
+
onSelectionChange?: (selectedIds: Set<string | number>) => void;
|
|
76
|
+
children?: Snippet;
|
|
77
|
+
virtualScroll?: boolean;
|
|
78
|
+
rowHeight?: number;
|
|
79
|
+
maxHeight?: string;
|
|
80
|
+
} = $props();
|
|
81
|
+
|
|
82
|
+
// Track current page internally
|
|
83
|
+
let currentPage = $state(1);
|
|
84
|
+
|
|
85
|
+
// Update currentPage when pagination prop changes
|
|
86
|
+
$effect(() => {
|
|
87
|
+
const page = pagination?.page;
|
|
88
|
+
if (page) {
|
|
89
|
+
currentPage = page;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
let totalPages = $derived.by(() => {
|
|
94
|
+
if (!pagination || !rows) return 1;
|
|
95
|
+
const totalRows = Math.max(pagination.total || rows.length);
|
|
96
|
+
return Math.ceil(totalRows / pagination.perPage);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const changePage = (page: number) => {
|
|
100
|
+
if (!pagination) return;
|
|
101
|
+
currentPage = page;
|
|
102
|
+
// Notify parent if callback provided
|
|
103
|
+
if (onPageChange) {
|
|
104
|
+
const newPagination = { ...pagination, page };
|
|
105
|
+
onPageChange(newPagination);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Computed values
|
|
110
|
+
let hasActionCol = $derived(actions?.items && actions.items.length > 0);
|
|
111
|
+
let visibleCols = $derived(cols.filter((col) => !col.hidden));
|
|
112
|
+
let colCount = $derived(Math.max(1, visibleCols.length) + (hasActionCol ? 1 : 0));
|
|
113
|
+
|
|
114
|
+
// Manage sort state directly in DataGrid (not via context)
|
|
115
|
+
let currentSortColumn = $state<string | null>(null);
|
|
116
|
+
let currentSortDirection = $state<'asc' | 'desc'>('asc');
|
|
117
|
+
|
|
118
|
+
// Handle sort changes
|
|
119
|
+
function handleSortChange(column: string, direction: 'asc' | 'desc') {
|
|
120
|
+
// Empty column means clear sort
|
|
121
|
+
if (column === '') {
|
|
122
|
+
currentSortColumn = null;
|
|
123
|
+
} else {
|
|
124
|
+
currentSortColumn = column;
|
|
125
|
+
currentSortDirection = direction;
|
|
126
|
+
onSort?.(column, direction);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Apply sorting
|
|
131
|
+
let sortedRows = $derived.by(() => {
|
|
132
|
+
if (!rows?.length || !enableSorting) return rows;
|
|
133
|
+
if (!currentSortColumn) return rows;
|
|
134
|
+
|
|
135
|
+
const sortColumn = cols.find((col) => col.key === currentSortColumn);
|
|
136
|
+
if (!sortColumn) return rows;
|
|
137
|
+
|
|
138
|
+
return sortRows(rows, sortColumn, currentSortDirection);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Apply pagination
|
|
142
|
+
let filteredRows = $derived.by(() => {
|
|
143
|
+
const dataRows = sortedRows;
|
|
144
|
+
if (!dataRows?.length || !pagination) return dataRows;
|
|
145
|
+
|
|
146
|
+
// Always do client-side pagination
|
|
147
|
+
// onPageChange callback is just for notification
|
|
148
|
+
const perPage = pagination.perPage || 5;
|
|
149
|
+
const startIndex = currentPage * perPage - perPage;
|
|
150
|
+
const endIndex = startIndex + perPage;
|
|
151
|
+
return dataRows.filter((_row, index) => index >= startIndex && index < endIndex);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Virtual scrolling setup (only when pagination is disabled)
|
|
155
|
+
let tbodyRef: HTMLElement | null = null;
|
|
156
|
+
let virtual = $state<ReturnType<typeof useVirtualList<JsonObject>> | null>(null);
|
|
157
|
+
|
|
158
|
+
// Initialize virtual list
|
|
159
|
+
$effect(() => {
|
|
160
|
+
if (virtualScroll && !pagination) {
|
|
161
|
+
if (!virtual) {
|
|
162
|
+
virtual = useVirtualList(filteredRows || [], { itemHeight: rowHeight });
|
|
163
|
+
if (tbodyRef) {
|
|
164
|
+
virtual.setContainer(tbodyRef);
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
virtual.setItems(filteredRows || []);
|
|
168
|
+
}
|
|
169
|
+
} else if (virtual) {
|
|
170
|
+
virtual.destroy();
|
|
171
|
+
virtual = null;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// Set container when tbody ref is available
|
|
176
|
+
$effect(() => {
|
|
177
|
+
if (virtual && tbodyRef) {
|
|
178
|
+
virtual.setContainer(tbodyRef);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
86
181
|
</script>
|
|
87
182
|
|
|
88
|
-
<Table
|
|
89
|
-
{
|
|
90
|
-
|
|
183
|
+
<Table
|
|
184
|
+
{stickyHeader}
|
|
185
|
+
enableSorting={false}
|
|
186
|
+
{enableSelection}
|
|
187
|
+
{selectionMode}
|
|
188
|
+
{rowIdKey}
|
|
189
|
+
onSort={handleSortChange}
|
|
190
|
+
{onSelectionChange}
|
|
191
|
+
>
|
|
192
|
+
{#if children}
|
|
193
|
+
<TableCaption side={captionSide} align={captionAlign}>{@render children?.()}</TableCaption>
|
|
91
194
|
{/if}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
195
|
+
|
|
196
|
+
<TableHeader sticky={stickyHeader}>
|
|
197
|
+
<tr>
|
|
198
|
+
{#each visibleCols as col}
|
|
199
|
+
<TableHeaderCell
|
|
200
|
+
type={col.type}
|
|
201
|
+
width={col.width}
|
|
202
|
+
sortable={col.sortable ?? enableSorting}
|
|
203
|
+
sortKey={col.key}
|
|
204
|
+
align={getCellAlignment(col)}
|
|
205
|
+
isSorted={currentSortColumn === col.key}
|
|
206
|
+
sortDirection={currentSortColumn === col.key ? currentSortDirection : undefined}
|
|
207
|
+
onSort={handleSortChange}
|
|
208
|
+
>
|
|
209
|
+
{col.label}
|
|
210
|
+
</TableHeaderCell>
|
|
98
211
|
{/each}
|
|
99
212
|
{#if hasActionCol}
|
|
100
|
-
<TableHeaderCell type="
|
|
213
|
+
<TableHeaderCell type="actions">Actions</TableHeaderCell>
|
|
101
214
|
{/if}
|
|
102
|
-
</
|
|
215
|
+
</tr>
|
|
103
216
|
</TableHeader>
|
|
104
|
-
|
|
217
|
+
|
|
218
|
+
<tbody
|
|
219
|
+
bind:this={tbodyRef}
|
|
220
|
+
style={virtualScroll && !pagination
|
|
221
|
+
? `display: block; max-height: ${maxHeight}; overflow-y: auto;`
|
|
222
|
+
: ''}
|
|
223
|
+
>
|
|
105
224
|
{#if !filteredRows?.length}
|
|
106
225
|
<TableRow>
|
|
107
226
|
<TableCell colspan={colCount}>
|
|
108
|
-
<div class="empty">
|
|
227
|
+
<div class="empty" role="status" aria-live="polite">
|
|
109
228
|
{#if rows === undefined}
|
|
110
229
|
<Loading />
|
|
111
230
|
{:else}
|
|
@@ -116,32 +235,88 @@ $:
|
|
|
116
235
|
</div>
|
|
117
236
|
</TableCell>
|
|
118
237
|
</TableRow>
|
|
238
|
+
{:else if virtualScroll && !pagination && virtual}
|
|
239
|
+
<!-- Virtual scrolling mode -->
|
|
240
|
+
<tr style="height: {virtual.totalHeight}px; position: relative;">
|
|
241
|
+
<td colspan={colCount} style="padding: 0; border: 0;">
|
|
242
|
+
{#each virtual.visibleItems as vItem (vItem.index)}
|
|
243
|
+
{@const row = vItem.data}
|
|
244
|
+
{@const index = vItem.index}
|
|
245
|
+
<div
|
|
246
|
+
style="position: absolute; top: {vItem.offsetTop}px; height: {vItem.height}px; width: 100%; display: table; table-layout: fixed;"
|
|
247
|
+
>
|
|
248
|
+
<TableRow {row} rowIndex={index} selectable={enableSelection}>
|
|
249
|
+
{#each visibleCols as col}
|
|
250
|
+
{@const cellValue = formatCell(row, col)}
|
|
251
|
+
{@const cellLink = getCellLink(row, col)}
|
|
252
|
+
{@const cellAlign = getCellAlignment(col)}
|
|
253
|
+
<TableCell type={getCellTypeClass(col)} width={col.width} align={cellAlign}>
|
|
254
|
+
{#if cellLink}
|
|
255
|
+
<a href={cellLink}>{cellValue}</a>
|
|
256
|
+
{:else if col.type === 'check' || col.type === 'boolean'}
|
|
257
|
+
{#if row[col.key]}
|
|
258
|
+
<Pill shape="circle" variant="positive" compact label="✔" />
|
|
259
|
+
{/if}
|
|
260
|
+
{:else}
|
|
261
|
+
{cellValue}
|
|
262
|
+
{/if}
|
|
263
|
+
</TableCell>
|
|
264
|
+
{/each}
|
|
265
|
+
{#if hasActionCol && actions}
|
|
266
|
+
<TableCell type="actions">
|
|
267
|
+
{#if actions.type === 'dropdown'}
|
|
268
|
+
<DropdownButton text={actions.text ?? ''} variant="ghost">
|
|
269
|
+
{#each actions.items as action}
|
|
270
|
+
<DropdownItem onClick={() => action.onClick(row)}
|
|
271
|
+
>{action.text}</DropdownItem
|
|
272
|
+
>
|
|
273
|
+
{/each}
|
|
274
|
+
</DropdownButton>
|
|
275
|
+
{:else}
|
|
276
|
+
{#each actions.items as action}
|
|
277
|
+
<Button
|
|
278
|
+
collapse={true}
|
|
279
|
+
size="sm"
|
|
280
|
+
type="button"
|
|
281
|
+
variant={actions.type === 'outline' ? 'outline' : 'secondary'}
|
|
282
|
+
onClick={() => action.onClick(row)}
|
|
283
|
+
label={action.text}
|
|
284
|
+
/>
|
|
285
|
+
{/each}
|
|
286
|
+
{/if}
|
|
287
|
+
</TableCell>
|
|
288
|
+
{/if}
|
|
289
|
+
</TableRow>
|
|
290
|
+
</div>
|
|
291
|
+
{/each}
|
|
292
|
+
</td>
|
|
293
|
+
</tr>
|
|
119
294
|
{:else}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{:else}
|
|
134
|
-
{format(row, col.key)}
|
|
295
|
+
<!-- Regular rendering mode -->
|
|
296
|
+
{#each filteredRows as row, index}
|
|
297
|
+
<TableRow {row} rowIndex={index} selectable={enableSelection}>
|
|
298
|
+
{#each visibleCols as col}
|
|
299
|
+
{@const cellValue = formatCell(row, col)}
|
|
300
|
+
{@const cellLink = getCellLink(row, col)}
|
|
301
|
+
{@const cellAlign = getCellAlignment(col)}
|
|
302
|
+
<TableCell type={getCellTypeClass(col)} width={col.width} align={cellAlign}>
|
|
303
|
+
{#if cellLink}
|
|
304
|
+
<a href={cellLink}>{cellValue}</a>
|
|
305
|
+
{:else if col.type === 'check' || col.type === 'boolean'}
|
|
306
|
+
{#if row[col.key]}
|
|
307
|
+
<Pill shape="circle" variant="positive" compact label="✔" />
|
|
135
308
|
{/if}
|
|
136
|
-
|
|
137
|
-
|
|
309
|
+
{:else}
|
|
310
|
+
{cellValue}
|
|
311
|
+
{/if}
|
|
312
|
+
</TableCell>
|
|
138
313
|
{/each}
|
|
139
314
|
{#if hasActionCol && actions}
|
|
140
315
|
<TableCell type="actions">
|
|
141
316
|
{#if actions.type === 'dropdown'}
|
|
142
|
-
<DropdownButton text={actions.text ?? ''}
|
|
317
|
+
<DropdownButton text={actions.text ?? ''} variant="ghost">
|
|
143
318
|
{#each actions.items as action}
|
|
144
|
-
<DropdownItem
|
|
319
|
+
<DropdownItem onClick={() => action.onClick(row)}>{action.text}</DropdownItem>
|
|
145
320
|
{/each}
|
|
146
321
|
</DropdownButton>
|
|
147
322
|
{:else}
|
|
@@ -150,9 +325,10 @@ $:
|
|
|
150
325
|
collapse={true}
|
|
151
326
|
size="sm"
|
|
152
327
|
type="button"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
328
|
+
variant={actions.type === 'outline' ? 'outline' : 'secondary'}
|
|
329
|
+
onClick={() => action.onClick(row)}
|
|
330
|
+
label={action.text}
|
|
331
|
+
/>
|
|
156
332
|
{/each}
|
|
157
333
|
{/if}
|
|
158
334
|
</TableCell>
|
|
@@ -160,22 +336,25 @@ $:
|
|
|
160
336
|
</TableRow>
|
|
161
337
|
{/each}
|
|
162
338
|
{/if}
|
|
163
|
-
</
|
|
339
|
+
</tbody>
|
|
340
|
+
|
|
164
341
|
{#if pagination}
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
342
|
+
<tfoot>
|
|
343
|
+
<tr>
|
|
344
|
+
<td colspan={colCount} class="footer-cell">
|
|
345
|
+
<nav aria-label="Table pagination">
|
|
346
|
+
<Pagination
|
|
347
|
+
bind:currentPage
|
|
348
|
+
{totalPages}
|
|
349
|
+
variant="flat"
|
|
350
|
+
size="sm"
|
|
351
|
+
align="center"
|
|
352
|
+
onPage={changePage}
|
|
353
|
+
/>
|
|
354
|
+
</nav>
|
|
355
|
+
</td>
|
|
356
|
+
</tr>
|
|
357
|
+
</tfoot>
|
|
179
358
|
{/if}
|
|
180
359
|
</Table>
|
|
181
360
|
|
|
@@ -191,4 +370,22 @@ a {
|
|
|
191
370
|
}
|
|
192
371
|
a:hover {
|
|
193
372
|
text-decoration: underline;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
tfoot {
|
|
376
|
+
background: var(--table-footer-bg);
|
|
377
|
+
color: var(--table-footer-fg);
|
|
378
|
+
border-top: solid var(--border-thin) var(--table-footer-border);
|
|
379
|
+
border-bottom: solid var(--border-thin) var(--table-footer-border);
|
|
380
|
+
font-size: var(--font-sm);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.footer-cell {
|
|
384
|
+
padding: 0.5rem;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
td.footer-cell :global(.pagination) {
|
|
388
|
+
display: flex;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
align-items: center;
|
|
194
391
|
}</style>
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type?: string | undefined;
|
|
13
|
-
items: {
|
|
14
|
-
text: string;
|
|
15
|
-
onClick: (row: JsonObject) => unknown;
|
|
16
|
-
}[];
|
|
17
|
-
} | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Handle page change, which should return the new filtered/fetched rows.
|
|
20
|
-
*/ onPageChange?: ((pagination: PaginationProperties) => Promise<JsonObject[]>) | null | undefined;
|
|
21
|
-
};
|
|
22
|
-
events: {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {
|
|
26
|
-
default: {};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export type DataGridProps = typeof __propDef.props;
|
|
30
|
-
export type DataGridEvents = typeof __propDef.events;
|
|
31
|
-
export type DataGridSlots = typeof __propDef.slots;
|
|
32
|
-
export default class DataGrid extends SvelteComponent<DataGridProps, DataGridEvents, DataGridSlots> {
|
|
1
|
+
import type { ColumnDef, JsonObject, PaginationProperties } from '../types/data.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type PaginationEvent = (pagination: PaginationProperties) => void;
|
|
4
|
+
interface Action {
|
|
5
|
+
text: string;
|
|
6
|
+
onClick: (row: JsonObject) => unknown;
|
|
7
|
+
}
|
|
8
|
+
interface Actions {
|
|
9
|
+
text?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
items: Action[];
|
|
33
12
|
}
|
|
34
|
-
|
|
13
|
+
type $$ComponentProps = {
|
|
14
|
+
captionSide?: 'top' | 'bottom';
|
|
15
|
+
captionAlign?: 'left' | 'center' | 'right';
|
|
16
|
+
rows?: JsonObject[];
|
|
17
|
+
cols: ColumnDef[];
|
|
18
|
+
pagination?: PaginationProperties;
|
|
19
|
+
actions?: Actions;
|
|
20
|
+
stickyHeader?: boolean;
|
|
21
|
+
enableSorting?: boolean;
|
|
22
|
+
enableSelection?: boolean;
|
|
23
|
+
selectionMode?: 'single' | 'multi';
|
|
24
|
+
rowIdKey?: string;
|
|
25
|
+
onPageChange?: PaginationEvent | null;
|
|
26
|
+
onSort?: (column: string, direction: 'asc' | 'desc') => void;
|
|
27
|
+
onSelectionChange?: (selectedIds: Set<string | number>) => void;
|
|
28
|
+
children?: Snippet;
|
|
29
|
+
virtualScroll?: boolean;
|
|
30
|
+
rowHeight?: number;
|
|
31
|
+
maxHeight?: string;
|
|
32
|
+
};
|
|
33
|
+
declare const DataGrid: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
34
|
+
type DataGrid = ReturnType<typeof DataGrid>;
|
|
35
|
+
export default DataGrid;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as DataGrid } from './data-grid.svelte';
|
|
2
|
+
export { default as Table } from './table.svelte';
|
|
3
|
+
export { default as TableCell } from './table-cell.svelte';
|
|
4
|
+
export { default as TableHeader } from './table-header.svelte';
|
|
5
|
+
export { default as TableHeaderCell } from './table-header-cell.svelte';
|
|
6
|
+
export { default as TableRow } from './table-row.svelte';
|
|
7
|
+
export { default as TableCaption } from './table-caption.svelte';
|
|
8
|
+
export { createTableContext, getTableContext, TableContext } from './table-context.svelte.js';
|
|
9
|
+
export type { TableContextConfig } from './table-context.svelte.js';
|
|
10
|
+
export { formatCell, formatTextCell, formatNumberCell, formatCurrencyCell, formatDateCell, formatDateTimeCell, formatBooleanCell, formatEmailCell, formatCustomCell, getCellValue, getCellLink, getCellAlignment, getCellTypeClass, sortRows, compareValues } from './cell-renderers.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Main components
|
|
2
|
+
export { default as DataGrid } from './data-grid.svelte';
|
|
3
|
+
export { default as Table } from './table.svelte';
|
|
4
|
+
export { default as TableCell } from './table-cell.svelte';
|
|
5
|
+
export { default as TableHeader } from './table-header.svelte';
|
|
6
|
+
export { default as TableHeaderCell } from './table-header-cell.svelte';
|
|
7
|
+
export { default as TableRow } from './table-row.svelte';
|
|
8
|
+
export { default as TableCaption } from './table-caption.svelte';
|
|
9
|
+
// Context and utilities
|
|
10
|
+
export { createTableContext, getTableContext, TableContext } from './table-context.svelte.js';
|
|
11
|
+
// Cell renderers and utilities
|
|
12
|
+
export { formatCell, formatTextCell, formatNumberCell, formatCurrencyCell, formatDateCell, formatDateTimeCell, formatBooleanCell, formatEmailCell, formatCustomCell, getCellValue, getCellLink, getCellAlignment, getCellTypeClass, sortRows, compareValues } from './cell-renderers.js';
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
side = 'top' as 'top' | 'bottom',
|
|
6
|
+
align = 'center' as 'left' | 'center' | 'right',
|
|
7
|
+
children
|
|
8
|
+
}: {
|
|
9
|
+
side?: 'top' | 'bottom';
|
|
10
|
+
align?: 'left' | 'center' | 'right';
|
|
11
|
+
children: Snippet;
|
|
12
|
+
} = $props();
|
|
3
13
|
</script>
|
|
4
14
|
|
|
5
15
|
<caption class="{side} {align}">
|
|
6
|
-
|
|
16
|
+
{@render children?.()}
|
|
7
17
|
</caption>
|
|
8
18
|
|
|
9
19
|
<style>caption {
|
|
@@ -14,7 +24,6 @@ export let align = "center";
|
|
|
14
24
|
letter-spacing: 0.1em;
|
|
15
25
|
text-transform: uppercase;
|
|
16
26
|
font-family: sans-serif;
|
|
17
|
-
text-shadow: 1px 1px 1px black;
|
|
18
27
|
text-align: center;
|
|
19
28
|
caption-side: top;
|
|
20
29
|
}
|