@kayord/ui 3.0.11 → 4.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 +70 -156
- package/dist/components/custom/action/Actions.svelte +1 -1
- package/dist/components/custom/animations/NumberTicker.svelte +2 -3
- package/dist/components/custom/copy-button/CopyButton.svelte +0 -1
- package/dist/components/custom/data-table/DataTable.svelte +42 -69
- package/dist/components/custom/data-table/DataTable.svelte.d.ts +14 -9
- package/dist/components/custom/data-table/DataTableFooter.svelte +9 -8
- package/dist/components/custom/data-table/DataTableFooter.svelte.d.ts +9 -8
- package/dist/components/custom/data-table/DataTableHeader.svelte +27 -13
- package/dist/components/custom/data-table/DataTableHeader.svelte.d.ts +9 -9
- package/dist/components/custom/data-table/DataTableView.svelte +7 -6
- package/dist/components/custom/data-table/DataTableView.svelte.d.ts +8 -7
- package/dist/components/custom/data-table/FullscreenModeToggle.svelte +11 -6
- package/dist/components/custom/data-table/Pagination.svelte +57 -41
- package/dist/components/custom/data-table/Pagination.svelte.d.ts +9 -8
- package/dist/components/custom/data-table/data-table-utils.d.ts +2 -2
- package/dist/components/custom/data-table/data-table-utils.js +20 -21
- package/dist/components/custom/data-table/features.d.ts +157 -0
- package/dist/components/custom/data-table/features.js +36 -0
- package/dist/components/custom/data-table/index.d.ts +5 -2
- package/dist/components/custom/data-table/index.js +3 -2
- package/dist/components/custom/data-table/shad-table.svelte.d.ts +9 -8
- package/dist/components/custom/data-table/shad-table.svelte.js +51 -230
- package/dist/components/custom/data-table/table-search-params.d.ts +9 -7
- package/dist/components/custom/data-table/table-search-params.js +29 -20
- package/dist/components/custom/data-table/table-url-sync.svelte.d.ts +42 -0
- package/dist/components/custom/data-table/table-url-sync.svelte.js +81 -0
- package/dist/components/custom/data-table/types.d.ts +9 -5
- package/dist/components/custom/light-switch.svelte/LightSwitch.svelte +1 -1
- package/dist/components/custom/loader/Loader.svelte +0 -2
- package/dist/components/custom/loader/Loader.svelte.d.ts +1 -3
- package/dist/components/custom/progress-loading/ProgressLoading.svelte +5 -2
- package/dist/components/custom/progress-loading/ProgressLoading.svelte.d.ts +2 -2
- package/dist/components/custom/theme-selector/ThemeSelector.svelte +1 -1
- package/dist/components/ui/accordion/accordion-content.svelte +2 -2
- package/dist/components/ui/accordion/accordion-item.svelte +5 -1
- package/dist/components/ui/accordion/accordion-trigger.svelte +5 -11
- package/dist/components/ui/accordion/index.d.ts +1 -1
- package/dist/components/ui/accordion/index.js +1 -1
- package/dist/components/ui/alert/alert-action.svelte +7 -2
- package/dist/components/ui/alert/alert-action.svelte.d.ts +1 -1
- package/dist/components/ui/alert/alert-description.svelte +2 -2
- package/dist/components/ui/alert/alert-description.svelte.d.ts +1 -1
- package/dist/components/ui/alert/alert-title.svelte +2 -2
- package/dist/components/ui/alert/alert-title.svelte.d.ts +1 -1
- package/dist/components/ui/alert/alert.svelte +9 -4
- package/dist/components/ui/alert/alert.svelte.d.ts +9 -9
- package/dist/components/ui/alert/index.d.ts +2 -2
- package/dist/components/ui/alert/index.js +2 -2
- package/dist/components/ui/alert-dialog/alert-dialog-action.svelte +5 -1
- package/dist/components/ui/alert-dialog/alert-dialog-cancel.svelte +5 -1
- package/dist/components/ui/alert-dialog/alert-dialog-content.svelte +3 -3
- package/dist/components/ui/alert-dialog/alert-dialog-content.svelte.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog-description.svelte +6 -5
- package/dist/components/ui/alert-dialog/alert-dialog-footer.svelte +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog-header.svelte +2 -5
- package/dist/components/ui/alert-dialog/alert-dialog-header.svelte.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog-media.svelte +2 -5
- package/dist/components/ui/alert-dialog/alert-dialog-media.svelte.d.ts +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog-overlay.svelte +6 -5
- package/dist/components/ui/alert-dialog/alert-dialog-title.svelte +6 -5
- package/dist/components/ui/alert-dialog/index.d.ts +7 -7
- package/dist/components/ui/alert-dialog/index.js +7 -7
- package/dist/components/ui/avatar/avatar-badge.svelte +1 -1
- package/dist/components/ui/avatar/avatar-badge.svelte.d.ts +1 -1
- package/dist/components/ui/avatar/avatar-fallback.svelte +6 -2
- package/dist/components/ui/avatar/avatar-group-count.svelte +2 -2
- package/dist/components/ui/avatar/avatar-group-count.svelte.d.ts +1 -1
- package/dist/components/ui/avatar/avatar-group.svelte +2 -2
- package/dist/components/ui/avatar/avatar-group.svelte.d.ts +1 -1
- package/dist/components/ui/avatar/avatar-image.svelte +6 -2
- package/dist/components/ui/avatar/avatar.svelte +1 -1
- package/dist/components/ui/avatar/index.d.ts +4 -4
- package/dist/components/ui/avatar/index.js +4 -4
- package/dist/components/ui/badge/badge.svelte +3 -4
- package/dist/components/ui/badge/badge.svelte.d.ts +22 -22
- package/dist/components/ui/breadcrumb/breadcrumb-ellipsis.svelte +4 -4
- package/dist/components/ui/breadcrumb/breadcrumb-ellipsis.svelte.d.ts +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-item.svelte +13 -3
- package/dist/components/ui/breadcrumb/breadcrumb-item.svelte.d.ts +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-link.svelte +3 -3
- package/dist/components/ui/breadcrumb/breadcrumb-link.svelte.d.ts +2 -2
- package/dist/components/ui/breadcrumb/breadcrumb-list.svelte +8 -3
- package/dist/components/ui/breadcrumb/breadcrumb-list.svelte.d.ts +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-page.svelte +2 -2
- package/dist/components/ui/breadcrumb/breadcrumb-page.svelte.d.ts +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte +8 -3
- package/dist/components/ui/breadcrumb/breadcrumb.svelte +1 -1
- package/dist/components/ui/breadcrumb/index.d.ts +2 -2
- package/dist/components/ui/breadcrumb/index.js +2 -2
- package/dist/components/ui/button/button.svelte +7 -12
- package/dist/components/ui/button/button.svelte.d.ts +46 -46
- package/dist/components/ui/button/index.js +1 -1
- package/dist/components/ui/button-group/button-group-separator.svelte +1 -1
- package/dist/components/ui/button-group/button-group-text.svelte +2 -5
- package/dist/components/ui/button-group/button-group-text.svelte.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.svelte.d.ts +8 -8
- package/dist/components/ui/button-group/index.d.ts +2 -2
- package/dist/components/ui/button-group/index.js +2 -2
- package/dist/components/ui/calendar/calendar-caption.svelte +3 -3
- package/dist/components/ui/calendar/calendar-caption.svelte.d.ts +3 -3
- package/dist/components/ui/calendar/calendar-cell.svelte +5 -1
- package/dist/components/ui/calendar/calendar-day.svelte +8 -4
- package/dist/components/ui/calendar/calendar-grid-body.svelte +5 -1
- package/dist/components/ui/calendar/calendar-grid-head.svelte +5 -1
- package/dist/components/ui/calendar/calendar-grid-row.svelte +5 -1
- package/dist/components/ui/calendar/calendar-grid.svelte +10 -2
- package/dist/components/ui/calendar/calendar-head-cell.svelte +9 -2
- package/dist/components/ui/calendar/calendar-header.svelte +9 -2
- package/dist/components/ui/calendar/calendar-heading.svelte +10 -2
- package/dist/components/ui/calendar/calendar-month-select.svelte +7 -5
- package/dist/components/ui/calendar/calendar-months.svelte +6 -2
- package/dist/components/ui/calendar/calendar-months.svelte.d.ts +1 -1
- package/dist/components/ui/calendar/calendar-next-button.svelte +1 -1
- package/dist/components/ui/calendar/calendar-prev-button.svelte +1 -1
- package/dist/components/ui/calendar/calendar-year-select.svelte +7 -5
- package/dist/components/ui/calendar/calendar.svelte +3 -3
- package/dist/components/ui/calendar/calendar.svelte.d.ts +3 -3
- package/dist/components/ui/calendar/index.d.ts +10 -10
- package/dist/components/ui/calendar/index.js +10 -10
- package/dist/components/ui/card/card-action.svelte +4 -1
- package/dist/components/ui/card/card-content.svelte +7 -2
- package/dist/components/ui/card/card-content.svelte.d.ts +1 -1
- package/dist/components/ui/card/card-description.svelte +7 -2
- package/dist/components/ui/card/card-description.svelte.d.ts +1 -1
- package/dist/components/ui/card/card-footer.svelte +1 -1
- package/dist/components/ui/card/card-header.svelte +1 -1
- package/dist/components/ui/card/card-title.svelte +1 -1
- package/dist/components/ui/card/card-title.svelte.d.ts +1 -1
- package/dist/components/ui/card/card.svelte +2 -5
- package/dist/components/ui/card/card.svelte.d.ts +1 -1
- package/dist/components/ui/card/index.d.ts +2 -2
- package/dist/components/ui/card/index.js +2 -2
- package/dist/components/ui/carousel/carousel-content.svelte +7 -3
- package/dist/components/ui/carousel/carousel-content.svelte.d.ts +1 -1
- package/dist/components/ui/carousel/carousel-item.svelte +7 -3
- package/dist/components/ui/carousel/carousel-item.svelte.d.ts +1 -1
- package/dist/components/ui/carousel/carousel-next.svelte +6 -6
- package/dist/components/ui/carousel/carousel-previous.svelte +6 -6
- package/dist/components/ui/carousel/carousel.svelte +6 -1
- package/dist/components/ui/carousel/carousel.svelte.d.ts +1 -1
- package/dist/components/ui/carousel/index.d.ts +2 -2
- package/dist/components/ui/carousel/index.js +2 -2
- package/dist/components/ui/chart/chart-container.svelte +3 -3
- package/dist/components/ui/chart/chart-container.svelte.d.ts +1 -1
- package/dist/components/ui/chart/chart-tooltip.svelte +19 -10
- package/dist/components/ui/chart/chart-tooltip.svelte.d.ts +3 -2
- package/dist/components/ui/chart/chart-utils.d.ts +1 -1
- package/dist/components/ui/chart/chart-utils.js +3 -1
- package/dist/components/ui/checkbox/checkbox.svelte +9 -6
- package/dist/components/ui/collapsible/collapsible.svelte +5 -1
- package/dist/components/ui/collapsible/index.d.ts +2 -2
- package/dist/components/ui/collapsible/index.js +2 -2
- package/dist/components/ui/command/command-dialog.svelte +4 -4
- package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-empty.svelte +5 -1
- package/dist/components/ui/command/command-group.svelte +2 -5
- package/dist/components/ui/command/command-input.svelte +7 -6
- package/dist/components/ui/command/command-item.svelte +9 -6
- package/dist/components/ui/command/command-link-item.svelte +6 -2
- package/dist/components/ui/command/command-list.svelte +6 -2
- package/dist/components/ui/command/command-separator.svelte +6 -2
- package/dist/components/ui/command/command-shortcut.svelte +1 -4
- package/dist/components/ui/command/command.svelte +2 -2
- package/dist/components/ui/command/index.d.ts +4 -4
- package/dist/components/ui/command/index.js +4 -4
- package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte +4 -4
- package/dist/components/ui/context-menu/context-menu-content.svelte +2 -2
- package/dist/components/ui/context-menu/context-menu-content.svelte.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu-group-heading.svelte +1 -1
- package/dist/components/ui/context-menu/context-menu-item.svelte +1 -1
- package/dist/components/ui/context-menu/context-menu-label.svelte +1 -1
- package/dist/components/ui/context-menu/context-menu-radio-group.svelte +11 -2
- package/dist/components/ui/context-menu/context-menu-radio-item.svelte +4 -4
- package/dist/components/ui/context-menu/context-menu-separator.svelte +6 -2
- package/dist/components/ui/context-menu/context-menu-shortcut.svelte +1 -4
- package/dist/components/ui/context-menu/context-menu-sub-content.svelte +6 -5
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +2 -2
- package/dist/components/ui/context-menu/context-menu-trigger.svelte +5 -1
- package/dist/components/ui/context-menu/index.d.ts +10 -10
- package/dist/components/ui/context-menu/index.js +10 -10
- package/dist/components/ui/data-table/index.d.ts +2 -3
- package/dist/components/ui/data-table/index.js +1 -3
- package/dist/components/ui/dialog/dialog-close.svelte +5 -1
- package/dist/components/ui/dialog/dialog-content.svelte +6 -6
- package/dist/components/ui/dialog/dialog-content.svelte.d.ts +1 -1
- package/dist/components/ui/dialog/dialog-description.svelte +6 -5
- package/dist/components/ui/dialog/dialog-footer.svelte +3 -6
- package/dist/components/ui/dialog/dialog-header.svelte +7 -2
- package/dist/components/ui/dialog/dialog-header.svelte.d.ts +1 -1
- package/dist/components/ui/dialog/dialog-overlay.svelte +6 -5
- package/dist/components/ui/dialog/dialog-title.svelte +5 -1
- package/dist/components/ui/dialog/dialog-trigger.svelte +5 -1
- package/dist/components/ui/dialog/index.d.ts +6 -6
- package/dist/components/ui/dialog/index.js +6 -6
- package/dist/components/ui/drawer/drawer-content.svelte +5 -8
- package/dist/components/ui/drawer/drawer-content.svelte.d.ts +1 -1
- package/dist/components/ui/drawer/drawer-description.svelte +6 -2
- package/dist/components/ui/drawer/drawer-footer.svelte +6 -1
- package/dist/components/ui/drawer/drawer-header.svelte +2 -5
- package/dist/components/ui/drawer/drawer-header.svelte.d.ts +1 -1
- package/dist/components/ui/drawer/drawer-overlay.svelte +6 -5
- package/dist/components/ui/drawer/drawer-title.svelte +6 -2
- package/dist/components/ui/drawer/index.d.ts +5 -5
- package/dist/components/ui/drawer/index.js +5 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +6 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +6 -6
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +2 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +2 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +11 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +4 -4
- package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte +6 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +2 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +6 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +2 -2
- package/dist/components/ui/dropdown-menu/index.d.ts +5 -5
- package/dist/components/ui/dropdown-menu/index.js +5 -5
- package/dist/components/ui/empty/empty-content.svelte +4 -1
- package/dist/components/ui/empty/empty-description.svelte +1 -1
- package/dist/components/ui/empty/empty-header.svelte +1 -1
- package/dist/components/ui/empty/empty-media.svelte +1 -1
- package/dist/components/ui/empty/empty-media.svelte.d.ts +8 -8
- package/dist/components/ui/empty/empty-title.svelte +6 -1
- package/dist/components/ui/empty/empty.svelte +1 -1
- package/dist/components/ui/empty/index.d.ts +3 -3
- package/dist/components/ui/empty/index.js +3 -3
- package/dist/components/ui/field/field-content.svelte +1 -1
- package/dist/components/ui/field/field-description.svelte +2 -2
- package/dist/components/ui/field/field-error.svelte +2 -2
- package/dist/components/ui/field/field-error.svelte.d.ts +1 -1
- package/dist/components/ui/field/field-group.svelte +1 -1
- package/dist/components/ui/field/field-label.svelte +7 -2
- package/dist/components/ui/field/field-separator.svelte +3 -3
- package/dist/components/ui/field/field-separator.svelte.d.ts +1 -1
- package/dist/components/ui/field/field-set.svelte +1 -4
- package/dist/components/ui/field/field-title.svelte +1 -4
- package/dist/components/ui/field/field.svelte +1 -1
- package/dist/components/ui/field/field.svelte.d.ts +12 -12
- package/dist/components/ui/field/index.d.ts +7 -7
- package/dist/components/ui/field/index.js +7 -7
- package/dist/components/ui/form/form-description.svelte +1 -1
- package/dist/components/ui/form/form-element-field.svelte +4 -3
- package/dist/components/ui/form/form-element-field.svelte.d.ts +2 -2
- package/dist/components/ui/form/form-field-errors.svelte +5 -1
- package/dist/components/ui/form/form-field.svelte +3 -2
- package/dist/components/ui/form/form-field.svelte.d.ts +1 -1
- package/dist/components/ui/form/form-fieldset.svelte +1 -1
- package/dist/components/ui/form/form-fieldset.svelte.d.ts +1 -1
- package/dist/components/ui/form/form-label.svelte +5 -1
- package/dist/components/ui/form/form-legend.svelte +6 -2
- package/dist/components/ui/form/index.d.ts +3 -3
- package/dist/components/ui/form/index.js +3 -3
- package/dist/components/ui/hover-card/hover-card-content.svelte +1 -4
- package/dist/components/ui/hover-card/index.d.ts +2 -2
- package/dist/components/ui/hover-card/index.js +2 -2
- package/dist/components/ui/input/input.svelte +5 -4
- package/dist/components/ui/input/input.svelte.d.ts +1 -1
- package/dist/components/ui/input-group/index.d.ts +1 -1
- package/dist/components/ui/input-group/index.js +1 -1
- package/dist/components/ui/input-group/input-group-addon.svelte +2 -3
- package/dist/components/ui/input-group/input-group-addon.svelte.d.ts +15 -15
- package/dist/components/ui/input-group/input-group-button.svelte +1 -1
- package/dist/components/ui/input-group/input-group-button.svelte.d.ts +15 -15
- package/dist/components/ui/input-group/input-group-input.svelte +2 -5
- package/dist/components/ui/input-group/input-group-input.svelte.d.ts +1 -1
- package/dist/components/ui/input-group/input-group-text.svelte +1 -4
- package/dist/components/ui/input-group/input-group-textarea.svelte +2 -5
- package/dist/components/ui/input-group/input-group.svelte +1 -1
- package/dist/components/ui/input-otp/index.d.ts +2 -2
- package/dist/components/ui/input-otp/index.js +2 -2
- package/dist/components/ui/input-otp/input-otp-group.svelte +2 -5
- package/dist/components/ui/input-otp/input-otp-group.svelte.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp-separator.svelte +4 -4
- package/dist/components/ui/input-otp/input-otp-separator.svelte.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp-slot.svelte +11 -4
- package/dist/components/ui/input-otp/input-otp.svelte +1 -1
- package/dist/components/ui/item/index.d.ts +7 -7
- package/dist/components/ui/item/index.js +7 -7
- package/dist/components/ui/item/item-actions.svelte +6 -1
- package/dist/components/ui/item/item-content.svelte +1 -1
- package/dist/components/ui/item/item-description.svelte +1 -1
- package/dist/components/ui/item/item-footer.svelte +1 -1
- package/dist/components/ui/item/item-group.svelte +1 -4
- package/dist/components/ui/item/item-header.svelte +1 -1
- package/dist/components/ui/item/item-media.svelte +1 -2
- package/dist/components/ui/item/item-media.svelte.d.ts +11 -11
- package/dist/components/ui/item/item-separator.svelte +12 -2
- package/dist/components/ui/item/item-title.svelte +1 -4
- package/dist/components/ui/item/item.svelte +3 -3
- package/dist/components/ui/item/item.svelte.d.ts +22 -22
- package/dist/components/ui/kbd/index.d.ts +1 -1
- package/dist/components/ui/kbd/index.js +1 -1
- package/dist/components/ui/kbd/kbd-group.svelte +6 -1
- package/dist/components/ui/kbd/kbd.svelte +1 -1
- package/dist/components/ui/label/label.svelte +6 -2
- package/dist/components/ui/menubar/index.d.ts +8 -8
- package/dist/components/ui/menubar/index.js +8 -8
- package/dist/components/ui/menubar/menubar-checkbox-item.svelte +6 -6
- package/dist/components/ui/menubar/menubar-content.svelte +2 -2
- package/dist/components/ui/menubar/menubar-content.svelte.d.ts +1 -1
- package/dist/components/ui/menubar/menubar-group-heading.svelte +1 -1
- package/dist/components/ui/menubar/menubar-item.svelte +1 -4
- package/dist/components/ui/menubar/menubar-label.svelte +1 -1
- package/dist/components/ui/menubar/menubar-radio-group.svelte +5 -1
- package/dist/components/ui/menubar/menubar-radio-item.svelte +4 -4
- package/dist/components/ui/menubar/menubar-separator.svelte +5 -1
- package/dist/components/ui/menubar/menubar-shortcut.svelte +2 -5
- package/dist/components/ui/menubar/menubar-shortcut.svelte.d.ts +1 -1
- package/dist/components/ui/menubar/menubar-sub-content.svelte +6 -5
- package/dist/components/ui/menubar/menubar-sub-trigger.svelte +2 -2
- package/dist/components/ui/menubar/menubar-trigger.svelte +6 -5
- package/dist/components/ui/menubar/menubar.svelte +6 -2
- package/dist/components/ui/native-select/index.d.ts +3 -3
- package/dist/components/ui/native-select/index.js +3 -3
- package/dist/components/ui/native-select/native-select-opt-group.svelte +6 -2
- package/dist/components/ui/native-select/native-select-opt-group.svelte.d.ts +1 -1
- package/dist/components/ui/native-select/native-select-option.svelte +1 -1
- package/dist/components/ui/native-select/native-select-option.svelte.d.ts +1 -1
- package/dist/components/ui/native-select/native-select.svelte +7 -8
- package/dist/components/ui/navigation-menu/index.d.ts +1 -1
- package/dist/components/ui/navigation-menu/index.js +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu-content.svelte +6 -2
- package/dist/components/ui/navigation-menu/navigation-menu-indicator.svelte +7 -3
- package/dist/components/ui/navigation-menu/navigation-menu-item.svelte +5 -1
- package/dist/components/ui/navigation-menu/navigation-menu-link.svelte +6 -5
- package/dist/components/ui/navigation-menu/navigation-menu-list.svelte +9 -2
- package/dist/components/ui/navigation-menu/navigation-menu-trigger.svelte +4 -7
- package/dist/components/ui/navigation-menu/navigation-menu-trigger.svelte.d.ts +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu-viewport.svelte +6 -2
- package/dist/components/ui/navigation-menu/navigation-menu.svelte +4 -1
- package/dist/components/ui/pagination/index.d.ts +4 -4
- package/dist/components/ui/pagination/index.js +4 -4
- package/dist/components/ui/pagination/pagination-content.svelte +7 -2
- package/dist/components/ui/pagination/pagination-content.svelte.d.ts +1 -1
- package/dist/components/ui/pagination/pagination-ellipsis.svelte +4 -7
- package/dist/components/ui/pagination/pagination-ellipsis.svelte.d.ts +1 -1
- package/dist/components/ui/pagination/pagination-item.svelte +6 -2
- package/dist/components/ui/pagination/pagination-item.svelte.d.ts +1 -1
- package/dist/components/ui/pagination/pagination-link.svelte +6 -2
- package/dist/components/ui/pagination/pagination-next-button.svelte +1 -1
- package/dist/components/ui/pagination/pagination-next.svelte +7 -3
- package/dist/components/ui/pagination/pagination-prev-button.svelte +1 -1
- package/dist/components/ui/pagination/pagination-previous.svelte +12 -4
- package/dist/components/ui/pagination/pagination.svelte +0 -1
- package/dist/components/ui/popover/index.d.ts +2 -2
- package/dist/components/ui/popover/index.js +2 -2
- package/dist/components/ui/popover/popover-content.svelte +2 -2
- package/dist/components/ui/popover/popover-content.svelte.d.ts +1 -1
- package/dist/components/ui/popover/popover-description.svelte +7 -2
- package/dist/components/ui/popover/popover-description.svelte.d.ts +1 -1
- package/dist/components/ui/popover/popover-header.svelte +7 -2
- package/dist/components/ui/popover/popover-header.svelte.d.ts +1 -1
- package/dist/components/ui/popover/popover-title.svelte +7 -2
- package/dist/components/ui/popover/popover-title.svelte.d.ts +1 -1
- package/dist/components/ui/popover/popover-trigger.svelte +12 -3
- package/dist/components/ui/progress/progress.svelte +1 -1
- package/dist/components/ui/radio-group/index.d.ts +1 -1
- package/dist/components/ui/radio-group/index.js +1 -1
- package/dist/components/ui/radio-group/radio-group-item.svelte +3 -5
- package/dist/components/ui/radio-group/radio-group.svelte +1 -1
- package/dist/components/ui/range-calendar/index.d.ts +10 -10
- package/dist/components/ui/range-calendar/index.js +10 -10
- package/dist/components/ui/range-calendar/range-calendar-caption.svelte +3 -3
- package/dist/components/ui/range-calendar/range-calendar-caption.svelte.d.ts +3 -3
- package/dist/components/ui/range-calendar/range-calendar-cell.svelte +6 -2
- package/dist/components/ui/range-calendar/range-calendar-day.svelte +8 -4
- package/dist/components/ui/range-calendar/range-calendar-grid-row.svelte +5 -1
- package/dist/components/ui/range-calendar/range-calendar-grid.svelte +5 -1
- package/dist/components/ui/range-calendar/range-calendar-head-cell.svelte +9 -2
- package/dist/components/ui/range-calendar/range-calendar-header.svelte +9 -2
- package/dist/components/ui/range-calendar/range-calendar-heading.svelte +10 -2
- package/dist/components/ui/range-calendar/range-calendar-month-select.svelte +6 -4
- package/dist/components/ui/range-calendar/range-calendar-months.svelte +6 -2
- package/dist/components/ui/range-calendar/range-calendar-months.svelte.d.ts +1 -1
- package/dist/components/ui/range-calendar/range-calendar-next-button.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar-year-select.svelte +6 -4
- package/dist/components/ui/range-calendar/range-calendar.svelte +4 -4
- package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +4 -4
- package/dist/components/ui/resizable/resizable-handle.svelte +2 -2
- package/dist/components/ui/resizable/resizable-pane-group.svelte +4 -1
- package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +5 -2
- package/dist/components/ui/scroll-area/scroll-area.svelte +8 -3
- package/dist/components/ui/select/index.d.ts +7 -7
- package/dist/components/ui/select/index.js +7 -7
- package/dist/components/ui/select/select-content.svelte +7 -5
- package/dist/components/ui/select/select-content.svelte.d.ts +2 -2
- package/dist/components/ui/select/select-group-heading.svelte +1 -1
- package/dist/components/ui/select/select-group.svelte +11 -2
- package/dist/components/ui/select/select-item.svelte +3 -3
- package/dist/components/ui/select/select-label.svelte +1 -1
- package/dist/components/ui/select/select-scroll-down-button.svelte +3 -6
- package/dist/components/ui/select/select-scroll-up-button.svelte +3 -6
- package/dist/components/ui/select/select-separator.svelte +7 -3
- package/dist/components/ui/select/select-trigger.svelte +3 -3
- package/dist/components/ui/select/select.svelte +5 -1
- package/dist/components/ui/separator/separator.svelte +1 -1
- package/dist/components/ui/sheet/index.d.ts +6 -6
- package/dist/components/ui/sheet/index.js +6 -6
- package/dist/components/ui/sheet/sheet-content.svelte +6 -6
- package/dist/components/ui/sheet/sheet-content.svelte.d.ts +2 -2
- package/dist/components/ui/sheet/sheet-description.svelte +6 -2
- package/dist/components/ui/sheet/sheet-footer.svelte +6 -1
- package/dist/components/ui/sheet/sheet-header.svelte +7 -2
- package/dist/components/ui/sheet/sheet-header.svelte.d.ts +1 -1
- package/dist/components/ui/sheet/sheet-overlay.svelte +6 -2
- package/dist/components/ui/sheet/sheet-title.svelte +6 -2
- package/dist/components/ui/sidebar/context.svelte.js +1 -1
- package/dist/components/ui/sidebar/index.d.ts +1 -1
- package/dist/components/ui/sidebar/index.js +1 -1
- package/dist/components/ui/sidebar/sidebar-content.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-content.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-footer.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-footer.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-group-action.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-group-content.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-group-label.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-group.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-group.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-header.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-header.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-input.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-inset.svelte +1 -4
- package/dist/components/ui/sidebar/sidebar-menu-action.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-menu-badge.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-menu-button.svelte +4 -5
- package/dist/components/ui/sidebar/sidebar-menu-button.svelte.d.ts +18 -18
- package/dist/components/ui/sidebar/sidebar-menu-skeleton.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-menu-sub-button.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-menu-sub.svelte +1 -4
- package/dist/components/ui/sidebar/sidebar-menu.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-provider.svelte +11 -3
- package/dist/components/ui/sidebar/sidebar-rail.svelte +2 -2
- package/dist/components/ui/sidebar/sidebar-separator.svelte +6 -2
- package/dist/components/ui/sidebar/sidebar-trigger.svelte +3 -3
- package/dist/components/ui/sidebar/sidebar.svelte +12 -6
- package/dist/components/ui/skeleton/skeleton.svelte +1 -1
- package/dist/components/ui/slider/slider.svelte +6 -4
- package/dist/components/ui/sonner/sonner.svelte +6 -6
- package/dist/components/ui/spinner/spinner.svelte +2 -10
- package/dist/components/ui/switch/switch.svelte +2 -2
- package/dist/components/ui/table/index.d.ts +1 -1
- package/dist/components/ui/table/index.js +1 -1
- package/dist/components/ui/table/table-caption.svelte +1 -1
- package/dist/components/ui/table/table-cell.svelte +7 -7
- package/dist/components/ui/table/table-footer.svelte +1 -1
- package/dist/components/ui/table/table-head.svelte +7 -10
- package/dist/components/ui/table/table-header.svelte +6 -1
- package/dist/components/ui/table/table-row.svelte +1 -6
- package/dist/components/ui/table/table.svelte +1 -1
- package/dist/components/ui/table/table.svelte.d.ts +1 -1
- package/dist/components/ui/tabs/index.d.ts +2 -2
- package/dist/components/ui/tabs/index.js +2 -2
- package/dist/components/ui/tabs/tabs-content.svelte +6 -2
- package/dist/components/ui/tabs/tabs-list.svelte +1 -1
- package/dist/components/ui/tabs/tabs-list.svelte.d.ts +9 -9
- package/dist/components/ui/tabs/tabs-trigger.svelte +8 -4
- package/dist/components/ui/tabs/tabs.svelte +1 -1
- package/dist/components/ui/textarea/textarea.svelte +1 -1
- package/dist/components/ui/toggle/index.d.ts +1 -1
- package/dist/components/ui/toggle/index.js +1 -1
- package/dist/components/ui/toggle/toggle.svelte +2 -2
- package/dist/components/ui/toggle/toggle.svelte.d.ts +18 -18
- package/dist/components/ui/toggle-group/index.d.ts +1 -1
- package/dist/components/ui/toggle-group/index.js +1 -1
- package/dist/components/ui/toggle-group/toggle-group-item.svelte +3 -3
- package/dist/components/ui/toggle-group/toggle-group.svelte +2 -2
- package/dist/components/ui/toggle-group/toggle-group.svelte.d.ts +1 -1
- package/dist/components/ui/tooltip/index.d.ts +3 -3
- package/dist/components/ui/tooltip/index.js +3 -3
- package/dist/components/ui/tooltip/tooltip-content.svelte +3 -3
- package/dist/components/ui/tooltip/tooltip-content.svelte.d.ts +1 -1
- package/dist/data-table/index.d.ts +4 -1
- package/dist/data-table/index.js +11 -1
- package/package.json +35 -29
- package/dist/components/custom/data-table/shad-table-old.svelte.d.ts +0 -9
- package/dist/components/custom/data-table/shad-table-old.svelte.js +0 -202
- package/dist/components/ui/data-table/data-table.svelte.d.ts +0 -40
- package/dist/components/ui/data-table/data-table.svelte.js +0 -110
- package/dist/components/ui/data-table/flex-render.svelte +0 -37
- package/dist/components/ui/data-table/flex-render.svelte.d.ts +0 -33
- package/dist/components/ui/data-table/render-helpers.d.ts +0 -90
- package/dist/components/ui/data-table/render-helpers.js +0 -99
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { tableFeatures, stockFeatures, metaHelper, filterFns, sortFns, aggregationFns, createColumnHelper, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, } from "@tanstack/svelte-table";
|
|
2
|
+
/**
|
|
3
|
+
* The static feature set shared by every {@link createShadTable} table.
|
|
4
|
+
*
|
|
5
|
+
* Includes:
|
|
6
|
+
* - all stock **feature modules** (so the `Table` / `ColumnDef` API surface and
|
|
7
|
+
* every `table.atoms.<slice>` is always available and consistently typed)
|
|
8
|
+
* - the **row models** (sorted / filtered / paginated) — runtime-only, but
|
|
9
|
+
* cheap to wire unconditionally: an unused pipeline simply falls through to
|
|
10
|
+
* the previous stage (matching the TanStack examples)
|
|
11
|
+
* - the built-in **`filterFns` / `sortFns` / `aggregationFns` registries**, so
|
|
12
|
+
* any string fn (including the default `"auto"`) resolves instead of silently
|
|
13
|
+
* no-op'ing, and those strings typecheck in column defs
|
|
14
|
+
* - the per-table **`columnMeta` / `tableMeta`** slots (`meta.className`)
|
|
15
|
+
*/
|
|
16
|
+
export const features = tableFeatures({
|
|
17
|
+
...stockFeatures,
|
|
18
|
+
sortedRowModel: createSortedRowModel(),
|
|
19
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
20
|
+
filteredRowModel: createFilteredRowModel(),
|
|
21
|
+
filterFns,
|
|
22
|
+
sortFns,
|
|
23
|
+
aggregationFns,
|
|
24
|
+
columnMeta: metaHelper(),
|
|
25
|
+
tableMeta: metaHelper(),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Creates a `ColumnHelper` bound to the library's feature set, so consumers
|
|
29
|
+
* get the same typed API as the TanStack examples:
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* const helper = createColumnHelper<Person>();
|
|
33
|
+
* const columns = helper.columns([helper.accessor("name", { header: "Name" })]);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export const createColumnHelperFor = () => createColumnHelper();
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default as DataTable } from "./DataTable.svelte";
|
|
2
|
-
export { createShadTable } from "./shad-table.svelte";
|
|
3
|
-
export {
|
|
2
|
+
export { createShadTable, features } from "./shad-table.svelte";
|
|
3
|
+
export type { ShadTableOptions } from "./shad-table.svelte";
|
|
4
|
+
export { createColumnHelperFor, type DataTableFeatures } from "./features";
|
|
5
|
+
export { useTableUrlSync } from "./table-url-sync.svelte";
|
|
6
|
+
export type { TableUrlSyncOptions } from "./table-url-sync.svelte";
|
|
4
7
|
export { aggregationFns } from "./data-table-utils";
|
|
5
8
|
export { decodeColumnFilters, decodeGlobalFilter, decodePageIndex, decodeSorting, decodeTableState, encodeColumnFilters, encodeGlobalFilter, encodePageIndex, encodeSorting, encodeTableState, } from "./table-search-params";
|
|
6
9
|
export type { CustomColumnMeta, CustomOptions } from "./types";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as DataTable } from "./DataTable.svelte";
|
|
2
|
-
export { createShadTable } from "./shad-table.svelte";
|
|
3
|
-
export {
|
|
2
|
+
export { createShadTable, features } from "./shad-table.svelte";
|
|
3
|
+
export { createColumnHelperFor } from "./features";
|
|
4
|
+
export { useTableUrlSync } from "./table-url-sync.svelte";
|
|
4
5
|
export { aggregationFns } from "./data-table-utils";
|
|
5
6
|
export { decodeColumnFilters, decodeGlobalFilter, decodePageIndex, decodeSorting, decodeTableState, encodeColumnFilters, encodeGlobalFilter, encodePageIndex, encodeSorting, encodeTableState, } from "./table-search-params";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type RowData, type
|
|
1
|
+
import { type RowData, type Table, type TableState } from "@tanstack/svelte-table";
|
|
2
|
+
import { features, type DataTableFeatures } from "./features";
|
|
2
3
|
import type { BaseOptions } from "./types";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
enablePaging?: boolean;
|
|
6
|
-
enableVisibility?: boolean;
|
|
4
|
+
export type ControlledState = Partial<TableState<DataTableFeatures>>;
|
|
5
|
+
export type ShadTableOptions<TData extends RowData> = BaseOptions<TData> & {
|
|
7
6
|
enableRowSelectionUI?: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
controlledState?: ControlledState;
|
|
8
|
+
resetPageIndexOn?: Array<keyof ControlledState>;
|
|
9
|
+
};
|
|
10
|
+
export declare function createShadTable<TData extends RowData>(shadOptions: ShadTableOptions<TData>): Table<DataTableFeatures, TData>;
|
|
11
|
+
export { features };
|
|
@@ -1,239 +1,60 @@
|
|
|
1
|
-
import { createTable,
|
|
1
|
+
import { createTable, functionalUpdate, } from "@tanstack/svelte-table";
|
|
2
2
|
import DataTableCheckbox from "./DataTableCheckbox.svelte";
|
|
3
|
-
import { renderComponent } from "
|
|
4
|
-
import {
|
|
5
|
-
import { createSubscriber } from "svelte/reactivity";
|
|
3
|
+
import { renderComponent } from "../../ui/data-table";
|
|
4
|
+
import { features } from "./features";
|
|
6
5
|
export function createShadTable(shadOptions) {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
21
|
-
globalFilterFn: "auto",
|
|
22
|
-
columnResizeMode: "onChange",
|
|
23
|
-
// enableColumnResizing: true
|
|
24
|
-
enableRowSelection: false,
|
|
25
|
-
// enableFilters: true,
|
|
26
|
-
enableGlobalFilter: true,
|
|
27
|
-
onSortingChange: (updater) => {
|
|
28
|
-
if (state.sorting) {
|
|
29
|
-
state.sorting = typeof updater === "function" ? updater(state.sorting) : updater;
|
|
30
|
-
}
|
|
31
|
-
notifyTableUpdate?.();
|
|
32
|
-
},
|
|
33
|
-
// onColumnSizingChange: (updater) => {
|
|
34
|
-
// columnSizing = typeof updater === "function" ? updater(columnSizing) : updater;
|
|
35
|
-
// },
|
|
36
|
-
// onColumnSizingInfoChange: (updater) => {
|
|
37
|
-
// columnSizingInfo = typeof updater === "function" ? updater(columnSizingInfo) : updater;
|
|
38
|
-
// },
|
|
39
|
-
// onColumnPinningChange: (updater) => {
|
|
40
|
-
// columnPinning = typeof updater === "function" ? updater(columnPinning) : updater;
|
|
41
|
-
// },
|
|
42
|
-
onColumnVisibilityChange: (updater) => {
|
|
43
|
-
if (state.columnVisibility) {
|
|
44
|
-
state.columnVisibility = typeof updater === "function" ? updater(state.columnVisibility) : updater;
|
|
45
|
-
}
|
|
46
|
-
notifyTableUpdate?.();
|
|
47
|
-
},
|
|
48
|
-
onPaginationChange: (updater) => {
|
|
49
|
-
if (state.pagination) {
|
|
50
|
-
state.pagination = typeof updater === "function" ? updater(state.pagination) : updater;
|
|
51
|
-
}
|
|
52
|
-
notifyTableUpdate?.();
|
|
53
|
-
},
|
|
54
|
-
onColumnFiltersChange: (updater) => {
|
|
55
|
-
if (state.columnFilters) {
|
|
56
|
-
state.columnFilters = typeof updater === "function" ? updater(state.columnFilters) : updater;
|
|
57
|
-
}
|
|
58
|
-
notifyTableUpdate?.();
|
|
59
|
-
},
|
|
60
|
-
onRowSelectionChange: (updater) => {
|
|
61
|
-
if (state.rowSelection) {
|
|
62
|
-
state.rowSelection = typeof updater === "function" ? updater(state.rowSelection) : updater;
|
|
63
|
-
}
|
|
64
|
-
notifyTableUpdate?.();
|
|
65
|
-
},
|
|
66
|
-
onGlobalFilterChange: (updater) => {
|
|
67
|
-
state.globalFilter = typeof updater === "function" ? updater(state.globalFilter) : updater;
|
|
68
|
-
notifyTableUpdate?.();
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
if (shadOptions.useURLSearchParams) {
|
|
72
|
-
shadOptions.autoResetPageIndex = false;
|
|
73
|
-
}
|
|
74
|
-
if ((shadOptions.enablePaging ?? true) == false) {
|
|
75
|
-
defaultOptions.getPaginationRowModel = undefined;
|
|
76
|
-
defaultOptions.manualPagination = true;
|
|
6
|
+
const { enableRowSelectionUI = true, controlledState, resetPageIndexOn = [], ...rest } = shadOptions;
|
|
7
|
+
const externalHandlers = {};
|
|
8
|
+
if (controlledState) {
|
|
9
|
+
for (const key of Object.keys(controlledState)) {
|
|
10
|
+
const resetPage = resetPageIndexOn.includes(key);
|
|
11
|
+
externalHandlers[`on${key.charAt(0).toUpperCase()}${key.slice(1)}Change`] = (updater) => {
|
|
12
|
+
const record = controlledState;
|
|
13
|
+
record[key] = functionalUpdate(updater, record[key]);
|
|
14
|
+
if (resetPage && controlledState.pagination) {
|
|
15
|
+
controlledState.pagination = { ...controlledState.pagination, pageIndex: 0 };
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
77
19
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return mergeObjects(defaultOptions, options);
|
|
85
|
-
},
|
|
86
|
-
}, options);
|
|
87
|
-
const table = createTable(resolvedOptions);
|
|
88
|
-
const state = $state(table.initialState);
|
|
89
|
-
// Row Selection
|
|
90
|
-
if (options.enableRowSelection && (shadOptions.enableRowSelectionUI ?? true)) {
|
|
91
|
-
const rowSelectionColumn = {
|
|
92
|
-
id: "select",
|
|
93
|
-
header: () => {
|
|
94
|
-
subscribeToTable();
|
|
95
|
-
return renderComponent(DataTableCheckbox, {
|
|
96
|
-
checked: table.getIsAllPageRowsSelected(),
|
|
97
|
-
indeterminate: table.getIsSomePageRowsSelected(),
|
|
98
|
-
onCheckedChange: () => table.toggleAllPageRowsSelected(),
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
cell: (r) => {
|
|
102
|
-
subscribeToTable();
|
|
103
|
-
return renderComponent(DataTableCheckbox, {
|
|
104
|
-
checked: r.row.getIsSelected(),
|
|
105
|
-
onCheckedChange: () => r.row.toggleSelected(),
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
enableResizing: false,
|
|
109
|
-
enableSorting: false,
|
|
110
|
-
};
|
|
111
|
-
options.columns.unshift(rowSelectionColumn);
|
|
112
|
-
}
|
|
113
|
-
const updateOptions = (table, state) => {
|
|
114
|
-
table.setOptions((prev) => {
|
|
115
|
-
return mergeObjects(prev, options, {
|
|
116
|
-
state: mergeObjects(state, options.state || {}),
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
-
onStateChange: (updater) => {
|
|
119
|
-
if (updater instanceof Function)
|
|
120
|
-
state = updater(state);
|
|
121
|
-
else
|
|
122
|
-
state = mergeObjects(state, updater);
|
|
123
|
-
options.onStateChange?.(updater);
|
|
124
|
-
},
|
|
20
|
+
const state = { ...(rest.state ?? {}) };
|
|
21
|
+
if (controlledState) {
|
|
22
|
+
for (const key of Object.keys(controlledState)) {
|
|
23
|
+
Object.defineProperty(state, key, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: () => controlledState[key],
|
|
125
26
|
});
|
|
126
|
-
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const selectColumn = {
|
|
30
|
+
id: "select",
|
|
31
|
+
header: () => renderComponent(DataTableCheckbox, {
|
|
32
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
33
|
+
indeterminate: table.getIsSomePageRowsSelected() && !table.getIsAllRowsSelected(),
|
|
34
|
+
onCheckedChange: () => table.toggleAllPageRowsSelected(),
|
|
35
|
+
}),
|
|
36
|
+
cell: (r) => renderComponent(DataTableCheckbox, {
|
|
37
|
+
checked: r.row.getIsSelected(),
|
|
38
|
+
onCheckedChange: () => r.row.toggleSelected(),
|
|
39
|
+
}),
|
|
40
|
+
enableResizing: false,
|
|
41
|
+
enableSorting: false,
|
|
127
42
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const reactiveTable = {
|
|
133
|
-
// Expose all original table methods and properties
|
|
134
|
-
...table,
|
|
135
|
-
// Override methods that depend on state to create reactive dependencies
|
|
136
|
-
getRowModel: () => {
|
|
137
|
-
subscribeToTable();
|
|
138
|
-
return table.getRowModel();
|
|
139
|
-
},
|
|
140
|
-
getHeaderGroups: () => {
|
|
141
|
-
subscribeToTable();
|
|
142
|
-
return table.getHeaderGroups();
|
|
143
|
-
},
|
|
144
|
-
getAllColumns: () => {
|
|
145
|
-
subscribeToTable();
|
|
146
|
-
return table.getAllColumns();
|
|
147
|
-
},
|
|
148
|
-
getVisibleLeafColumns: () => {
|
|
149
|
-
subscribeToTable();
|
|
150
|
-
return table.getVisibleLeafColumns();
|
|
151
|
-
},
|
|
152
|
-
getState: () => {
|
|
153
|
-
subscribeToTable();
|
|
154
|
-
return table.getState();
|
|
155
|
-
},
|
|
156
|
-
getPageCount: () => {
|
|
157
|
-
subscribeToTable();
|
|
158
|
-
return table.getPageCount();
|
|
159
|
-
},
|
|
160
|
-
getColumn: (columnId) => {
|
|
161
|
-
subscribeToTable();
|
|
162
|
-
return table.getColumn(columnId);
|
|
163
|
-
},
|
|
164
|
-
// Forward all other methods to the original table
|
|
165
|
-
setColumnFilters: table.setColumnFilters.bind(table),
|
|
166
|
-
setSorting: table.setSorting.bind(table),
|
|
167
|
-
setPagination: table.setPagination.bind(table),
|
|
168
|
-
setPageIndex: table.setPageIndex.bind(table),
|
|
169
|
-
setPageSize: table.setPageSize.bind(table),
|
|
170
|
-
setColumnPinning: table.setColumnPinning.bind(table),
|
|
171
|
-
setColumnVisibility: table.setColumnVisibility.bind(table),
|
|
172
|
-
setRowSelection: table.setRowSelection.bind(table),
|
|
173
|
-
setColumnSizing: table.setColumnSizing.bind(table),
|
|
174
|
-
setOptions: table.setOptions.bind(table),
|
|
175
|
-
setGlobalFilter: table.setGlobalFilter.bind(table),
|
|
176
|
-
getFlatHeaders: () => {
|
|
177
|
-
subscribeToTable();
|
|
178
|
-
return table.getFlatHeaders();
|
|
179
|
-
},
|
|
180
|
-
getTotalSize: () => {
|
|
181
|
-
subscribeToTable();
|
|
182
|
-
return table.getTotalSize();
|
|
183
|
-
},
|
|
184
|
-
getLeftLeafColumns: () => {
|
|
185
|
-
subscribeToTable();
|
|
186
|
-
return table.getLeftLeafColumns();
|
|
187
|
-
},
|
|
188
|
-
getRowCount: () => {
|
|
189
|
-
subscribeToTable();
|
|
190
|
-
return table.getRowCount();
|
|
191
|
-
},
|
|
192
|
-
getRightLeafColumns: () => {
|
|
193
|
-
subscribeToTable();
|
|
194
|
-
return table.getRightLeafColumns();
|
|
195
|
-
},
|
|
196
|
-
getCenterLeafColumns: () => {
|
|
197
|
-
subscribeToTable();
|
|
198
|
-
return table.getCenterLeafColumns();
|
|
199
|
-
},
|
|
200
|
-
getIsAllRowsSelected: () => {
|
|
201
|
-
subscribeToTable();
|
|
202
|
-
return table.getIsAllRowsSelected();
|
|
203
|
-
},
|
|
204
|
-
getIsSomeRowsSelected: () => {
|
|
205
|
-
subscribeToTable();
|
|
206
|
-
return table.getIsSomeRowsSelected();
|
|
207
|
-
},
|
|
208
|
-
getIsAllPageRowsSelected: () => {
|
|
209
|
-
subscribeToTable();
|
|
210
|
-
return table.getIsAllPageRowsSelected();
|
|
211
|
-
},
|
|
212
|
-
getIsSomePageRowsSelected: () => {
|
|
213
|
-
subscribeToTable();
|
|
214
|
-
return table.getIsSomePageRowsSelected();
|
|
215
|
-
},
|
|
216
|
-
getCanPreviousPage: () => {
|
|
217
|
-
subscribeToTable();
|
|
218
|
-
return table.getCanPreviousPage();
|
|
219
|
-
},
|
|
220
|
-
getCanNextPage: () => {
|
|
221
|
-
subscribeToTable();
|
|
222
|
-
return table.getCanNextPage();
|
|
43
|
+
const table = createTable({
|
|
44
|
+
...rest,
|
|
45
|
+
get data() {
|
|
46
|
+
return shadOptions.data;
|
|
223
47
|
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return
|
|
48
|
+
get columns() {
|
|
49
|
+
const cols = shadOptions.columns ?? [];
|
|
50
|
+
return rest.enableRowSelection && enableRowSelectionUI ? [selectColumn, ...cols] : cols;
|
|
227
51
|
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Keep table reference for any other property access
|
|
231
|
-
_getDefaultColumnDef: table._getDefaultColumnDef.bind(table),
|
|
232
|
-
get options() {
|
|
233
|
-
subscribeToTable();
|
|
234
|
-
return table.options;
|
|
52
|
+
get rowCount() {
|
|
53
|
+
return shadOptions.rowCount;
|
|
235
54
|
},
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
55
|
+
...(controlledState ? { state, ...externalHandlers } : {}),
|
|
56
|
+
features,
|
|
57
|
+
});
|
|
58
|
+
return table;
|
|
239
59
|
}
|
|
60
|
+
export { features };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import type { TableState } from "@tanstack/table
|
|
2
|
-
|
|
1
|
+
import type { TableState } from "@tanstack/svelte-table";
|
|
2
|
+
import type { DataTableFeatures } from "./features";
|
|
3
|
+
type State = Partial<TableState<DataTableFeatures>>;
|
|
4
|
+
export declare const encodeSorting: (state: State) => string;
|
|
3
5
|
export declare const decodeSorting: () => {
|
|
4
6
|
id: string;
|
|
5
7
|
desc: boolean;
|
|
6
8
|
}[] | undefined;
|
|
7
|
-
export declare const encodeGlobalFilter: (state:
|
|
9
|
+
export declare const encodeGlobalFilter: (state: State) => any;
|
|
8
10
|
export declare const decodeGlobalFilter: () => string | undefined;
|
|
9
|
-
export declare const encodePageIndex: (state:
|
|
11
|
+
export declare const encodePageIndex: (state: State) => string;
|
|
10
12
|
export declare const decodePageIndex: () => number;
|
|
11
|
-
export declare const encodeColumnFilters: (state:
|
|
13
|
+
export declare const encodeColumnFilters: (state: State) => string;
|
|
12
14
|
export declare const decodeColumnFilters: () => {
|
|
13
15
|
id: string;
|
|
14
16
|
value: any;
|
|
@@ -19,6 +21,6 @@ interface Options {
|
|
|
19
21
|
pagination?: boolean;
|
|
20
22
|
columnFilter?: boolean;
|
|
21
23
|
}
|
|
22
|
-
export declare const decodeTableState: () =>
|
|
23
|
-
export declare const encodeTableState: (state:
|
|
24
|
+
export declare const decodeTableState: () => State;
|
|
25
|
+
export declare const encodeTableState: (state: State, options?: Options, searchParams?: URLSearchParams) => string;
|
|
24
26
|
export {};
|
|
@@ -9,10 +9,13 @@ export const encodeSorting = (state) => {
|
|
|
9
9
|
return state.sorting?.map((s) => `${s.desc ? "-" : ""}${s.id}`).join(",") ?? "";
|
|
10
10
|
};
|
|
11
11
|
export const decodeSorting = () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const sort = page.url.searchParams.get("sort");
|
|
13
|
+
if (!sort)
|
|
14
|
+
return undefined;
|
|
15
|
+
return sort
|
|
16
|
+
.split(",")
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.map((s) => ({ id: s[0] === "-" ? s.slice(1) : s, desc: s[0] === "-" }));
|
|
16
19
|
};
|
|
17
20
|
export const encodeGlobalFilter = (state) => {
|
|
18
21
|
return state.globalFilter;
|
|
@@ -25,7 +28,8 @@ export const encodePageIndex = (state) => {
|
|
|
25
28
|
return state.pagination?.pageIndex?.toString() ?? "";
|
|
26
29
|
};
|
|
27
30
|
export const decodePageIndex = () => {
|
|
28
|
-
|
|
31
|
+
const pageIndex = Number(page.url.searchParams.get("page") ?? "0");
|
|
32
|
+
return Number.isFinite(pageIndex) ? pageIndex : 0;
|
|
29
33
|
};
|
|
30
34
|
export const encodeColumnFilters = (state) => {
|
|
31
35
|
return (state.columnFilters
|
|
@@ -33,21 +37,26 @@ export const encodeColumnFilters = (state) => {
|
|
|
33
37
|
.join(",") ?? "");
|
|
34
38
|
};
|
|
35
39
|
export const decodeColumnFilters = () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
const filter = page.url.searchParams.get("filter");
|
|
41
|
+
if (!filter)
|
|
42
|
+
return undefined;
|
|
43
|
+
return filter.split(",").flatMap((v) => {
|
|
44
|
+
if (!v)
|
|
45
|
+
return [];
|
|
46
|
+
const separatorIndex = v.indexOf(".");
|
|
47
|
+
if (separatorIndex === -1)
|
|
48
|
+
return [];
|
|
49
|
+
const id = v.slice(0, separatorIndex);
|
|
50
|
+
const stringValue = v.slice(separatorIndex + 1);
|
|
51
|
+
if (!id || !stringValue)
|
|
52
|
+
return [];
|
|
53
|
+
try {
|
|
54
|
+
return [{ id, value: stringValue === "undefined" ? undefined : JSON.parse(decodeURIComponent(stringValue)) }];
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
51
60
|
};
|
|
52
61
|
export const decodeTableState = () => {
|
|
53
62
|
return {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RowData, Table } from "@tanstack/svelte-table";
|
|
2
|
+
import type { DataTableFeatures } from "./features";
|
|
3
|
+
/**
|
|
4
|
+
* Which URL params to sync with the table. Omitted keys default to `true`, so
|
|
5
|
+
* calling `useTableUrlSync(table)` syncs everything. Pass `false` to opt out
|
|
6
|
+
* of individual params, or pass only the keys you want:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* // sync only paging (`?page=2`)
|
|
10
|
+
* useTableUrlSync(table, { pagination: true });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export interface TableUrlSyncOptions {
|
|
14
|
+
/** Syncs the global filter to `?search=` (default `true`). */
|
|
15
|
+
globalFilter?: boolean;
|
|
16
|
+
/** Syncs sorting to `?sort=` (default `true`). */
|
|
17
|
+
sorting?: boolean;
|
|
18
|
+
/** Syncs column filters to `?filter=` (default `true`). */
|
|
19
|
+
columnFilters?: boolean;
|
|
20
|
+
/** Syncs the page index to `?page=` (default `true`). */
|
|
21
|
+
pagination?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Keeps a table's global filter, sorting, column filters and page index in sync
|
|
25
|
+
* with the URL search params (`search`, `sort`, `filter`, `page`).
|
|
26
|
+
*
|
|
27
|
+
* This is app-routing glue, not UI — call it explicitly from the component that
|
|
28
|
+
* owns the table, next to `createShadTable`:
|
|
29
|
+
*
|
|
30
|
+
* ```svelte
|
|
31
|
+
* const table = createShadTable({ ... });
|
|
32
|
+
* useTableUrlSync(table);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* The table is hydrated from the URL immediately, before the first render, so
|
|
36
|
+
* row-model auto-resets (which are skipped on their first run) can't clobber
|
|
37
|
+
* the URL-backed state.
|
|
38
|
+
*
|
|
39
|
+
* By default all four params are synced; pass {@link TableUrlSyncOptions} to
|
|
40
|
+
* enable only a subset, e.g. `useTableUrlSync(table, { pagination: true })`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useTableUrlSync<TData extends RowData>(table: Table<DataTableFeatures, TData>, options?: TableUrlSyncOptions): void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { untrack } from "svelte";
|
|
2
|
+
import { beforeNavigate } from "$app/navigation";
|
|
3
|
+
import { useSearchParams } from "runed/kit";
|
|
4
|
+
import { defaultSearchParamSchema } from "./types";
|
|
5
|
+
import { decodeColumnFilters, decodeGlobalFilter, decodePageIndex, decodeSorting, encodeColumnFilters, encodeSorting, } from "./table-search-params";
|
|
6
|
+
/**
|
|
7
|
+
* Keeps a table's global filter, sorting, column filters and page index in sync
|
|
8
|
+
* with the URL search params (`search`, `sort`, `filter`, `page`).
|
|
9
|
+
*
|
|
10
|
+
* This is app-routing glue, not UI — call it explicitly from the component that
|
|
11
|
+
* owns the table, next to `createShadTable`:
|
|
12
|
+
*
|
|
13
|
+
* ```svelte
|
|
14
|
+
* const table = createShadTable({ ... });
|
|
15
|
+
* useTableUrlSync(table);
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* The table is hydrated from the URL immediately, before the first render, so
|
|
19
|
+
* row-model auto-resets (which are skipped on their first run) can't clobber
|
|
20
|
+
* the URL-backed state.
|
|
21
|
+
*
|
|
22
|
+
* By default all four params are synced; pass {@link TableUrlSyncOptions} to
|
|
23
|
+
* enable only a subset, e.g. `useTableUrlSync(table, { pagination: true })`.
|
|
24
|
+
*/
|
|
25
|
+
export function useTableUrlSync(table, options) {
|
|
26
|
+
const enabled = {
|
|
27
|
+
globalFilter: true,
|
|
28
|
+
sorting: true,
|
|
29
|
+
columnFilters: true,
|
|
30
|
+
pagination: true,
|
|
31
|
+
...options,
|
|
32
|
+
};
|
|
33
|
+
const params = useSearchParams(defaultSearchParamSchema, { pushHistory: false });
|
|
34
|
+
// Hydrate from the URL before the first render. Sorting/filter/data changes
|
|
35
|
+
// defer an autoResetPageIndex microtask via the adapter's schedule; row
|
|
36
|
+
// models skip auto-resets on their first run, so applying the URL state
|
|
37
|
+
// up-front can't be undone by them (a post-mount hydration would be).
|
|
38
|
+
if (enabled.globalFilter)
|
|
39
|
+
table.setGlobalFilter(decodeGlobalFilter() ?? "");
|
|
40
|
+
if (enabled.sorting)
|
|
41
|
+
table.setSorting(decodeSorting() ?? []);
|
|
42
|
+
if (enabled.pagination)
|
|
43
|
+
table.setPageIndex(decodePageIndex());
|
|
44
|
+
if (enabled.columnFilters)
|
|
45
|
+
table.setColumnFilters(decodeColumnFilters() ?? []);
|
|
46
|
+
// When navigating with new sort/search/filter params, snap back to the first page
|
|
47
|
+
// unless the target URL explicitly points at a later page.
|
|
48
|
+
beforeNavigate((navigation) => {
|
|
49
|
+
if (!enabled.pagination)
|
|
50
|
+
return;
|
|
51
|
+
const targetPage = Number(navigation.to?.url.searchParams.get("page") ?? "0");
|
|
52
|
+
const queryChanged = (enabled.sorting &&
|
|
53
|
+
navigation.from?.url.searchParams.get("sort") != navigation.to?.url.searchParams.get("sort")) ||
|
|
54
|
+
(enabled.globalFilter &&
|
|
55
|
+
navigation.from?.url.searchParams.get("search") != navigation.to?.url.searchParams.get("search")) ||
|
|
56
|
+
(enabled.columnFilters &&
|
|
57
|
+
navigation.from?.url.searchParams.get("filter") != navigation.to?.url.searchParams.get("filter"));
|
|
58
|
+
if (queryChanged && (!Number.isFinite(targetPage) || targetPage <= 0)) {
|
|
59
|
+
table.resetPageIndex();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
// Write atoms back to the URL. Only the enabled atoms are read (and thus
|
|
63
|
+
// tracked) so the effect doesn't re-run on unrelated state (e.g. row
|
|
64
|
+
// selection), and disabled params are left untouched in the URL.
|
|
65
|
+
$effect(() => {
|
|
66
|
+
const search = enabled.globalFilter ? table.atoms.globalFilter.get() : undefined;
|
|
67
|
+
const page = enabled.pagination ? table.atoms.pagination.get().pageIndex : undefined;
|
|
68
|
+
const sorting = enabled.sorting ? table.atoms.sorting.get() : undefined;
|
|
69
|
+
const columnFilters = enabled.columnFilters ? table.atoms.columnFilters.get() : undefined;
|
|
70
|
+
untrack(() => {
|
|
71
|
+
if (enabled.globalFilter)
|
|
72
|
+
params.search = search;
|
|
73
|
+
if (enabled.pagination && page !== undefined)
|
|
74
|
+
params.page = page;
|
|
75
|
+
if (enabled.sorting)
|
|
76
|
+
params.sort = encodeSorting({ sorting });
|
|
77
|
+
if (enabled.columnFilters)
|
|
78
|
+
params.filter = encodeColumnFilters({ columnFilters });
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import type { TableOptions } from "@tanstack/table
|
|
1
|
+
import type { RowData, TableOptions } from "@tanstack/svelte-table";
|
|
2
|
+
import type { DataTableFeatures } from "./features";
|
|
2
3
|
import z from "zod";
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
/** Table options bound to the library's feature set. `features` is set internally. */
|
|
5
|
+
export type BaseOptions<TData extends RowData> = Omit<TableOptions<DataTableFeatures, TData>, "features">;
|
|
6
|
+
/** Per-column metadata exposed via `columnDef.meta` (typed through the feature set). */
|
|
7
7
|
export interface CustomColumnMeta {
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
|
+
/** Table-level metadata exposed via `table.options.meta` (typed through the feature set). */
|
|
11
|
+
export interface CustomOptions {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
10
14
|
export declare const defaultSearchParamSchema: z.ZodObject<{
|
|
11
15
|
search: z.ZodDefault<z.ZodAny>;
|
|
12
16
|
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
let { variant = "outline" }: Props = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<Button onclick={toggleMode} {variant} size="icon">
|
|
13
|
+
<Button onclick={toggleMode} {variant} size="icon" class="relative">
|
|
14
14
|
<SunIcon class="scale-100 rotate-0 !transition-all dark:scale-0 dark:-rotate-90" />
|
|
15
15
|
<MoonIcon class="absolute scale-0 rotate-90 !transition-all dark:scale-100 dark:rotate-0" />
|
|
16
16
|
<span class="sr-only">Toggle theme</span>
|
|
@@ -8,8 +8,6 @@ interface Props {
|
|
|
8
8
|
isLoading?: boolean;
|
|
9
9
|
iconProps?: LoaderIconProps;
|
|
10
10
|
}
|
|
11
|
-
declare const Loader: import("svelte").Component<Props, {
|
|
12
|
-
class: string | null | undefined;
|
|
13
|
-
}, "">;
|
|
11
|
+
declare const Loader: import("svelte").Component<Props, {}, "">;
|
|
14
12
|
type Loader = ReturnType<typeof Loader>;
|
|
15
13
|
export default Loader;
|