@ghostvue/vue 0.0.0-stage → 0.1.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/LICENSE +22 -0
- package/README.md +40 -2
- package/dist/.registries/component-names.generated.d.ts +3 -0
- package/dist/GhostAccordion.vue.d.ts +38 -0
- package/dist/GhostAccordionContent.vue.d.ts +26 -0
- package/dist/GhostAccordionItem.vue.d.ts +20 -0
- package/dist/GhostAccordionTrigger.vue.d.ts +23 -0
- package/dist/GhostAvatar.vue.d.ts +27 -0
- package/dist/GhostBadge.vue.d.ts +16 -0
- package/dist/GhostBreadcrumb.vue.d.ts +28 -0
- package/dist/GhostBreadcrumbEllipsis.vue.d.ts +20 -0
- package/dist/GhostBreadcrumbItem.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbLink.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbList.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbPage.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbSeparator.vue.d.ts +25 -0
- package/dist/GhostButton.vue.d.ts +25 -0
- package/dist/GhostCalendar.vue.d.ts +57 -0
- package/dist/GhostCalendarCell.vue.d.ts +35 -0
- package/dist/GhostCalendarGrid.vue.d.ts +19 -0
- package/dist/GhostCalendarHeader.vue.d.ts +24 -0
- package/dist/GhostCalendarHeading.vue.d.ts +22 -0
- package/dist/GhostCalendarNextButton.vue.d.ts +24 -0
- package/dist/GhostCalendarPrevButton.vue.d.ts +24 -0
- package/dist/GhostCard.vue.d.ts +18 -0
- package/dist/GhostCheckbox.vue.d.ts +48 -0
- package/dist/GhostCollapsible.vue.d.ts +31 -0
- package/dist/GhostCollapsibleContent.vue.d.ts +30 -0
- package/dist/GhostCollapsibleTrigger.vue.d.ts +28 -0
- package/dist/GhostCombobox.vue.d.ts +69 -0
- package/dist/GhostComboboxContent.vue.d.ts +41 -0
- package/dist/GhostComboboxEmpty.vue.d.ts +21 -0
- package/dist/GhostComboboxGroup.vue.d.ts +21 -0
- package/dist/GhostComboboxInput.vue.d.ts +11 -0
- package/dist/GhostComboboxLabel.vue.d.ts +21 -0
- package/dist/GhostComboboxOption.vue.d.ts +29 -0
- package/dist/GhostComboboxTrigger.vue.d.ts +26 -0
- package/dist/GhostCommandPalette.vue.d.ts +57 -0
- package/dist/GhostCommandPaletteContent.vue.d.ts +47 -0
- package/dist/GhostCommandPaletteEmpty.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteGroup.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteInput.vue.d.ts +13 -0
- package/dist/GhostCommandPaletteItem.vue.d.ts +33 -0
- package/dist/GhostCommandPaletteLabel.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteList.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteOverlay.vue.d.ts +32 -0
- package/dist/GhostCommandPaletteSeparator.vue.d.ts +10 -0
- package/dist/GhostCommandPaletteTitle.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteTrigger.vue.d.ts +28 -0
- package/dist/GhostContextMenu.vue.d.ts +26 -0
- package/dist/GhostContextMenuCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostContextMenuContent.vue.d.ts +39 -0
- package/dist/GhostContextMenuGroup.vue.d.ts +21 -0
- package/dist/GhostContextMenuItem.vue.d.ts +30 -0
- package/dist/GhostContextMenuLabel.vue.d.ts +21 -0
- package/dist/GhostContextMenuRadioGroup.vue.d.ts +31 -0
- package/dist/GhostContextMenuRadioItem.vue.d.ts +31 -0
- package/dist/GhostContextMenuSeparator.vue.d.ts +11 -0
- package/dist/GhostContextMenuTrigger.vue.d.ts +28 -0
- package/dist/GhostDataTable.vue.d.ts +29 -0
- package/dist/GhostDataTablePreset.vue.d.ts +21 -0
- package/dist/GhostDataTableTable.vue.d.ts +20 -0
- package/dist/GhostDatePicker.vue.d.ts +106 -0
- package/dist/GhostDatePickerCalendar.vue.d.ts +16 -0
- package/dist/GhostDatePickerContent.vue.d.ts +46 -0
- package/dist/GhostDatePickerInput.vue.d.ts +19 -0
- package/dist/GhostDatePickerTrigger.vue.d.ts +14 -0
- package/dist/GhostDialog.vue.d.ts +31 -0
- package/dist/GhostDialogClose.vue.d.ts +28 -0
- package/dist/GhostDialogContent.vue.d.ts +50 -0
- package/dist/GhostDialogDescription.vue.d.ts +25 -0
- package/dist/GhostDialogOverlay.vue.d.ts +32 -0
- package/dist/GhostDialogTitle.vue.d.ts +25 -0
- package/dist/GhostDialogTrigger.vue.d.ts +28 -0
- package/dist/GhostDrawer.vue.d.ts +39 -0
- package/dist/GhostDrawerClose.vue.d.ts +28 -0
- package/dist/GhostDrawerContent.vue.d.ts +47 -0
- package/dist/GhostDrawerDescription.vue.d.ts +25 -0
- package/dist/GhostDrawerOverlay.vue.d.ts +32 -0
- package/dist/GhostDrawerTitle.vue.d.ts +25 -0
- package/dist/GhostDrawerTrigger.vue.d.ts +28 -0
- package/dist/GhostDropdownMenu.vue.d.ts +26 -0
- package/dist/GhostDropdownMenuCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostDropdownMenuContent.vue.d.ts +39 -0
- package/dist/GhostDropdownMenuGroup.vue.d.ts +21 -0
- package/dist/GhostDropdownMenuItem.vue.d.ts +30 -0
- package/dist/GhostDropdownMenuLabel.vue.d.ts +21 -0
- package/dist/GhostDropdownMenuRadioGroup.vue.d.ts +31 -0
- package/dist/GhostDropdownMenuRadioItem.vue.d.ts +31 -0
- package/dist/GhostDropdownMenuSeparator.vue.d.ts +11 -0
- package/dist/GhostDropdownMenuTrigger.vue.d.ts +26 -0
- package/dist/GhostEmptyState.vue.d.ts +19 -0
- package/dist/GhostField.vue.d.ts +28 -0
- package/dist/GhostFieldControl.vue.d.ts +13 -0
- package/dist/GhostFieldDescription.vue.d.ts +21 -0
- package/dist/GhostFieldError.vue.d.ts +21 -0
- package/dist/GhostFieldLabel.vue.d.ts +30 -0
- package/dist/GhostFileUpload.vue.d.ts +64 -0
- package/dist/GhostFileUploadDropzone.vue.d.ts +13 -0
- package/dist/GhostFileUploadItem.vue.d.ts +17 -0
- package/dist/GhostFileUploadItemRemove.vue.d.ts +13 -0
- package/dist/GhostFileUploadList.vue.d.ts +13 -0
- package/dist/GhostFileUploadTrigger.vue.d.ts +19 -0
- package/dist/GhostHoverCard.vue.d.ts +37 -0
- package/dist/GhostHoverCardContent.vue.d.ts +47 -0
- package/dist/GhostHoverCardTrigger.vue.d.ts +28 -0
- package/dist/GhostInlineAlert.vue.d.ts +19 -0
- package/dist/GhostInput.vue.d.ts +26 -0
- package/dist/GhostInteractiveSurface.vue.d.ts +25 -0
- package/dist/GhostKbd.vue.d.ts +25 -0
- package/dist/GhostLink.vue.d.ts +25 -0
- package/dist/GhostMenubar.vue.d.ts +27 -0
- package/dist/GhostMenubarCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostMenubarContent.vue.d.ts +39 -0
- package/dist/GhostMenubarGroup.vue.d.ts +21 -0
- package/dist/GhostMenubarItem.vue.d.ts +30 -0
- package/dist/GhostMenubarLabel.vue.d.ts +21 -0
- package/dist/GhostMenubarMenu.vue.d.ts +26 -0
- package/dist/GhostMenubarRadioGroup.vue.d.ts +31 -0
- package/dist/GhostMenubarRadioItem.vue.d.ts +31 -0
- package/dist/GhostMenubarSeparator.vue.d.ts +11 -0
- package/dist/GhostMenubarTrigger.vue.d.ts +26 -0
- package/dist/GhostNumberInput.vue.d.ts +37 -0
- package/dist/GhostPagination.vue.d.ts +53 -0
- package/dist/GhostPopover.vue.d.ts +28 -0
- package/dist/GhostPopoverClose.vue.d.ts +28 -0
- package/dist/GhostPopoverContent.vue.d.ts +47 -0
- package/dist/GhostPopoverTrigger.vue.d.ts +28 -0
- package/dist/GhostPortal.vue.d.ts +28 -0
- package/dist/GhostProgress.vue.d.ts +14 -0
- package/dist/GhostRadioGroup.vue.d.ts +36 -0
- package/dist/GhostRadioGroupItem.vue.d.ts +10 -0
- package/dist/GhostScrollArea.vue.d.ts +17 -0
- package/dist/GhostScrollSpy.vue.d.ts +57 -0
- package/dist/GhostScrollSpyItem.vue.d.ts +26 -0
- package/dist/GhostScrollSpyLink.vue.d.ts +27 -0
- package/dist/GhostScrollSpyList.vue.d.ts +24 -0
- package/dist/GhostSegmentedControl.vue.d.ts +44 -0
- package/dist/GhostSegmentedControlIndicator.vue.d.ts +3 -0
- package/dist/GhostSegmentedControlItem.vue.d.ts +30 -0
- package/dist/GhostSelect.vue.d.ts +51 -0
- package/dist/GhostSelectContent.vue.d.ts +41 -0
- package/dist/GhostSelectGroup.vue.d.ts +21 -0
- package/dist/GhostSelectLabel.vue.d.ts +21 -0
- package/dist/GhostSelectOption.vue.d.ts +29 -0
- package/dist/GhostSelectTrigger.vue.d.ts +26 -0
- package/dist/GhostSelectValue.vue.d.ts +17 -0
- package/dist/GhostSeparator.vue.d.ts +7 -0
- package/dist/GhostSkeleton.vue.d.ts +18 -0
- package/dist/GhostSlider.vue.d.ts +141 -0
- package/dist/GhostSpinner.vue.d.ts +8 -0
- package/dist/GhostSwitch.vue.d.ts +37 -0
- package/dist/GhostTable.vue.d.ts +15 -0
- package/dist/GhostTableBody.vue.d.ts +13 -0
- package/dist/GhostTableCaption.vue.d.ts +13 -0
- package/dist/GhostTableCell.vue.d.ts +13 -0
- package/dist/GhostTableFoot.vue.d.ts +13 -0
- package/dist/GhostTableHead.vue.d.ts +13 -0
- package/dist/GhostTableHeaderCell.vue.d.ts +13 -0
- package/dist/GhostTableRow.vue.d.ts +13 -0
- package/dist/GhostTabs.vue.d.ts +37 -0
- package/dist/GhostTabsContent.vue.d.ts +27 -0
- package/dist/GhostTabsList.vue.d.ts +25 -0
- package/dist/GhostTabsTrigger.vue.d.ts +30 -0
- package/dist/GhostTextarea.vue.d.ts +29 -0
- package/dist/GhostToast.vue.d.ts +17 -0
- package/dist/GhostToastAction.vue.d.ts +17 -0
- package/dist/GhostToastClose.vue.d.ts +16 -0
- package/dist/GhostToastDescription.vue.d.ts +12 -0
- package/dist/GhostToastProvider.vue.d.ts +24 -0
- package/dist/GhostToastTitle.vue.d.ts +12 -0
- package/dist/GhostToastViewport.vue.d.ts +25 -0
- package/dist/GhostToggleGroup.vue.d.ts +41 -0
- package/dist/GhostToggleGroupItem.vue.d.ts +30 -0
- package/dist/GhostToolbar.vue.d.ts +29 -0
- package/dist/GhostTooltip.vue.d.ts +36 -0
- package/dist/GhostTooltipContent.vue.d.ts +47 -0
- package/dist/GhostTooltipProvider.vue.d.ts +16 -0
- package/dist/GhostTooltipTrigger.vue.d.ts +28 -0
- package/dist/GhostTree.vue.d.ts +59 -0
- package/dist/GhostTreeGroup.vue.d.ts +22 -0
- package/dist/GhostTreeItem.vue.d.ts +27 -0
- package/dist/GhostTreeTrigger.vue.d.ts +25 -0
- package/dist/GhostVisuallyHidden.vue.d.ts +19 -0
- package/dist/accordion-header-keyboard.d.ts +11 -0
- package/dist/calendar-date-math.d.ts +16 -0
- package/dist/calendar-intl.d.ts +7 -0
- package/dist/calendar-public-date.d.ts +1 -0
- package/dist/command-palette-context.d.ts +6 -0
- package/dist/data-table-interaction.d.ts +57 -0
- package/dist/data-table-processing.d.ts +32 -0
- package/dist/data-table-render.d.ts +40 -0
- package/dist/data-table-slot-bindings.d.ts +21 -0
- package/dist/date-picker-calendar-bridge.d.ts +25 -0
- package/dist/date-picker-value.d.ts +33 -0
- package/dist/define-data-table-columns.d.ts +89 -0
- package/dist/dev-codes.d.ts +143 -0
- package/dist/dialog-shared.d.ts +169 -0
- package/dist/dismissable-layer-stack.d.ts +27 -0
- package/dist/form-reset.d.ts +21 -0
- package/dist/get-pagination-range.d.ts +24 -0
- package/dist/get-tabbable-elements.d.ts +22 -0
- package/dist/ghost-accordion.d.ts +120 -0
- package/dist/ghost-avatar.d.ts +41 -0
- package/dist/ghost-badge.d.ts +11 -0
- package/dist/ghost-breadcrumb.d.ts +114 -0
- package/dist/ghost-button.d.ts +39 -0
- package/dist/ghost-calendar.d.ts +148 -0
- package/dist/ghost-card.d.ts +29 -0
- package/dist/ghost-checkbox.d.ts +51 -0
- package/dist/ghost-collapsible.d.ts +104 -0
- package/dist/ghost-combobox.d.ts +217 -0
- package/dist/ghost-command-palette.d.ts +377 -0
- package/dist/ghost-context-menu.d.ts +226 -0
- package/dist/ghost-data-table-preset.d.ts +107 -0
- package/dist/ghost-data-table-table.d.ts +76 -0
- package/dist/ghost-data-table.d.ts +508 -0
- package/dist/ghost-date-picker.d.ts +301 -0
- package/dist/ghost-dialog.d.ts +254 -0
- package/dist/ghost-drawer.d.ts +268 -0
- package/dist/ghost-dropdown-menu.d.ts +226 -0
- package/dist/ghost-empty-state.d.ts +26 -0
- package/dist/ghost-field.d.ts +151 -0
- package/dist/ghost-file-upload-accept.d.ts +32 -0
- package/dist/ghost-file-upload-messages.d.ts +14 -0
- package/dist/ghost-file-upload.d.ts +325 -0
- package/dist/ghost-hover-card.d.ts +192 -0
- package/dist/ghost-inline-alert.d.ts +34 -0
- package/dist/ghost-input.d.ts +71 -0
- package/dist/ghost-interactive-surface.d.ts +41 -0
- package/dist/ghost-kbd.d.ts +39 -0
- package/dist/ghost-link.d.ts +58 -0
- package/dist/ghost-menubar.d.ts +260 -0
- package/dist/ghost-number-input.d.ts +88 -0
- package/dist/ghost-pagination.d.ts +92 -0
- package/dist/ghost-popover.d.ts +188 -0
- package/dist/ghost-portal.d.ts +21 -0
- package/dist/ghost-progress.d.ts +40 -0
- package/dist/ghost-radio-group.d.ts +100 -0
- package/dist/ghost-scroll-area.d.ts +46 -0
- package/dist/ghost-scroll-spy.d.ts +150 -0
- package/dist/ghost-segmented-control.d.ts +124 -0
- package/dist/ghost-select.d.ts +131 -0
- package/dist/ghost-separator.d.ts +33 -0
- package/dist/ghost-skeleton.d.ts +14 -0
- package/dist/ghost-slider.d.ts +99 -0
- package/dist/ghost-spinner.d.ts +22 -0
- package/dist/ghost-switch.d.ts +77 -0
- package/dist/ghost-table.d.ts +62 -0
- package/dist/ghost-tabs.d.ts +154 -0
- package/dist/ghost-textarea.d.ts +78 -0
- package/dist/ghost-toast.d.ts +219 -0
- package/dist/ghost-toggle-group.d.ts +123 -0
- package/dist/ghost-toolbar.d.ts +23 -0
- package/dist/ghost-tooltip-provider.d.ts +37 -0
- package/dist/ghost-tooltip.d.ts +190 -0
- package/dist/ghost-tree.d.ts +355 -0
- package/dist/ghost-visually-hidden.d.ts +27 -0
- package/dist/ghostvue.js +17534 -0
- package/dist/has-tabbable-descendants.d.ts +2 -0
- package/dist/index.d.ts +307 -0
- package/dist/invoke-attr-handler.d.ts +15 -0
- package/dist/is-ime-composing.d.ts +28 -0
- package/dist/manifest.json +17098 -0
- package/dist/measure-scroll-overflow.d.ts +6 -0
- package/dist/menu-item-activation.d.ts +39 -0
- package/dist/resolver.d.ts +49 -0
- package/dist/resolver.js +14 -0
- package/dist/scroll-spy-motion.d.ts +26 -0
- package/dist/sort-by-document-order.d.ts +23 -0
- package/dist/sync-calendar-focus-tab-stops.d.ts +2 -0
- package/dist/sync-segmented-control-item-order.d.ts +5 -0
- package/dist/sync-tabs-selection-tab-stops.d.ts +7 -0
- package/dist/sync-toggle-group-selection-tab-stops.d.ts +14 -0
- package/dist/typeahead-match.d.ts +15 -0
- package/dist/use-collapsible-content-hidden.d.ts +28 -0
- package/dist/use-controllable-state.d.ts +20 -0
- package/dist/use-dismissable-layer.d.ts +40 -0
- package/dist/use-floating.d.ts +38 -0
- package/dist/use-focus-scope.d.ts +34 -0
- package/dist/use-ghost-accordion.d.ts +5 -0
- package/dist/use-ghost-avatar.d.ts +28 -0
- package/dist/use-ghost-badge.d.ts +13 -0
- package/dist/use-ghost-breadcrumb.d.ts +19 -0
- package/dist/use-ghost-button.d.ts +18 -0
- package/dist/use-ghost-calendar.d.ts +3 -0
- package/dist/use-ghost-card.d.ts +15 -0
- package/dist/use-ghost-checkbox.d.ts +24 -0
- package/dist/use-ghost-collapsible.d.ts +8 -0
- package/dist/use-ghost-combobox.d.ts +65 -0
- package/dist/use-ghost-command-palette.d.ts +24 -0
- package/dist/use-ghost-context-menu.d.ts +14 -0
- package/dist/use-ghost-data-table.d.ts +55 -0
- package/dist/use-ghost-date-picker.d.ts +11 -0
- package/dist/use-ghost-dialog.d.ts +10 -0
- package/dist/use-ghost-drawer.d.ts +11 -0
- package/dist/use-ghost-dropdown-menu.d.ts +5 -0
- package/dist/use-ghost-empty-state.d.ts +18 -0
- package/dist/use-ghost-field-part-content.d.ts +15 -0
- package/dist/use-ghost-field.d.ts +10 -0
- package/dist/use-ghost-file-upload.d.ts +16 -0
- package/dist/use-ghost-hover-card.d.ts +8 -0
- package/dist/use-ghost-id.d.ts +6 -0
- package/dist/use-ghost-inline-alert.d.ts +20 -0
- package/dist/use-ghost-input.d.ts +29 -0
- package/dist/use-ghost-interactive-surface.d.ts +21 -0
- package/dist/use-ghost-kbd.d.ts +35 -0
- package/dist/use-ghost-link.d.ts +20 -0
- package/dist/use-ghost-menu-collection.d.ts +19 -0
- package/dist/use-ghost-menubar-menu.d.ts +3 -0
- package/dist/use-ghost-menubar.d.ts +10 -0
- package/dist/use-ghost-number-input.d.ts +63 -0
- package/dist/use-ghost-pagination.d.ts +22 -0
- package/dist/use-ghost-popover.d.ts +8 -0
- package/dist/use-ghost-progress.d.ts +33 -0
- package/dist/use-ghost-radio-group.d.ts +5 -0
- package/dist/use-ghost-scroll-area.d.ts +23 -0
- package/dist/use-ghost-scroll-spy.d.ts +25 -0
- package/dist/use-ghost-segmented-control.d.ts +6 -0
- package/dist/use-ghost-select.d.ts +52 -0
- package/dist/use-ghost-separator.d.ts +19 -0
- package/dist/use-ghost-skeleton.d.ts +19 -0
- package/dist/use-ghost-slider.d.ts +65 -0
- package/dist/use-ghost-spinner.d.ts +18 -0
- package/dist/use-ghost-switch.d.ts +39 -0
- package/dist/use-ghost-table.d.ts +70 -0
- package/dist/use-ghost-tabs.d.ts +5 -0
- package/dist/use-ghost-textarea.d.ts +44 -0
- package/dist/use-ghost-toast.d.ts +56 -0
- package/dist/use-ghost-toggle-group.d.ts +6 -0
- package/dist/use-ghost-toolbar.d.ts +23 -0
- package/dist/use-ghost-tooltip.d.ts +8 -0
- package/dist/use-ghost-tree.d.ts +14 -0
- package/dist/use-ghost-visually-hidden.d.ts +35 -0
- package/dist/use-inert-others.d.ts +20 -0
- package/dist/use-roving-focus.d.ts +20 -0
- package/dist/use-scroll-lock.d.ts +13 -0
- package/package.json +59 -4
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import type { ComputedRef, MaybeRefOrGetter, VNodeChild } from 'vue';
|
|
2
|
+
/** Stable primary key for selection, expansion, and reactivity-safe maps */
|
|
3
|
+
export type DataTableRowId = string | number;
|
|
4
|
+
/** Direction of a column in the single-column phase-one sort; `false` is unsorted. */
|
|
5
|
+
export type DataTableSortDirection = 'asc' | 'desc' | false;
|
|
6
|
+
/** One sorting entry. Phase one honors at most one entry (the first). */
|
|
7
|
+
export interface DataTableColumnSort {
|
|
8
|
+
id: string;
|
|
9
|
+
desc: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One column filter. Inactive when `value` is `undefined`, `null`, or `''`
|
|
13
|
+
* (see the default filtering contract in the DataTable spec).
|
|
14
|
+
*/
|
|
15
|
+
export interface DataTableColumnFilter {
|
|
16
|
+
id: string;
|
|
17
|
+
value: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface DataTablePaginationState {
|
|
20
|
+
/** 1-based page index (matches GhostPagination) */
|
|
21
|
+
pageIndex: number;
|
|
22
|
+
pageSize: number;
|
|
23
|
+
}
|
|
24
|
+
/** Snapshot of every dimension that can trigger a server refetch */
|
|
25
|
+
export interface DataTableQueryState {
|
|
26
|
+
sorting: DataTableColumnSort[];
|
|
27
|
+
columnFilters: DataTableColumnFilter[];
|
|
28
|
+
globalFilter: unknown;
|
|
29
|
+
pagination: DataTablePaginationState;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Consumer-owned column definition. The composable reads it but never mutates
|
|
33
|
+
* it. `enableSorting` and `enableColumnFilter` default to enabled when the
|
|
34
|
+
* column has an accessor; set either to `false` to opt the column out.
|
|
35
|
+
*/
|
|
36
|
+
export interface DataTableColumnDef<TData> {
|
|
37
|
+
id: string;
|
|
38
|
+
header?: string;
|
|
39
|
+
accessorKey?: keyof TData & string;
|
|
40
|
+
accessorFn?: (row: TData, index: number) => unknown;
|
|
41
|
+
/** Headless render hook; Vue accepts VNodeChild from setup render functions */
|
|
42
|
+
/** Render hook: invoke as `cell(context)` — not a Vue component (`<component :is>`) */
|
|
43
|
+
cell?: (context: DataTableCellContext<TData>) => VNodeChild;
|
|
44
|
+
enableSorting?: boolean;
|
|
45
|
+
enableColumnFilter?: boolean;
|
|
46
|
+
/** Placement of `null` / `undefined` values while sorting. @default 'last' */
|
|
47
|
+
sortUndefined?: 'first' | 'last' | false;
|
|
48
|
+
/** Local comparator; replaces the default value comparator for this column. */
|
|
49
|
+
sortFn?: (rowA: TData, rowB: TData, columnId: string) => number;
|
|
50
|
+
/** Local predicate; replaces the default column-filter matcher for this column. */
|
|
51
|
+
filterFn?: (row: TData, columnId: string, filterValue: unknown) => boolean;
|
|
52
|
+
/** Opaque consumer metadata; the composable never reads it. */
|
|
53
|
+
meta?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export interface DataTableCellContext<TData> {
|
|
56
|
+
row: TData;
|
|
57
|
+
rowId: DataTableRowId;
|
|
58
|
+
rowIndex: number;
|
|
59
|
+
column: DataTableColumnDef<TData>;
|
|
60
|
+
/** Runtime value is unknown; use accessorKey for typed access in templates */
|
|
61
|
+
getValue: () => unknown;
|
|
62
|
+
}
|
|
63
|
+
/** Required row identity callback; there is no index fallback in any build. */
|
|
64
|
+
export type DataTableGetRowId<TData> = (row: TData, index: number) => DataTableRowId;
|
|
65
|
+
export interface DataTableStateChangePayload {
|
|
66
|
+
/**
|
|
67
|
+
* Monotonic id minted by the table for this emit (including `retry()`).
|
|
68
|
+
* Pass it to {@link UseGhostDataTableServerRequestReturn.begin} and gate
|
|
69
|
+
* every response write with `isLatest(requestId)`. Consumers never mint ids.
|
|
70
|
+
*/
|
|
71
|
+
requestId: number;
|
|
72
|
+
/** What the user last changed */
|
|
73
|
+
trigger: keyof DataTableQueryState;
|
|
74
|
+
/** Full query after reset/coalescence rules; sole source for server fetches */
|
|
75
|
+
query: DataTableQueryState;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One entry of a DataTable row model. Field names match
|
|
79
|
+
* {@link DataTableCellContext} so renderers can spread them into cell contexts.
|
|
80
|
+
*/
|
|
81
|
+
export interface DataTableRow<TData> {
|
|
82
|
+
/** The consumer row object (never cloned or mutated). */
|
|
83
|
+
row: TData;
|
|
84
|
+
/** `getRowId(row, rowIndex)`. */
|
|
85
|
+
rowId: DataTableRowId;
|
|
86
|
+
/** Index of `row` in the `data` array that was passed in. */
|
|
87
|
+
rowIndex: number;
|
|
88
|
+
}
|
|
89
|
+
/** Header select-all state over the select-all target (see the DataTable spec). */
|
|
90
|
+
export interface DataTableHeaderSelectionState {
|
|
91
|
+
/** Every row in the target set is selected (and the set is not empty). */
|
|
92
|
+
allSelected: boolean;
|
|
93
|
+
/** Some, but not all, rows in the target set are selected (`indeterminate`). */
|
|
94
|
+
someSelected: boolean;
|
|
95
|
+
}
|
|
96
|
+
/** Options shared by every {@link useGhostDataTable} configuration. */
|
|
97
|
+
export interface UseGhostDataTableBaseOptions<TData> {
|
|
98
|
+
/**
|
|
99
|
+
* Consumer-owned rows. Read by reference only: never cloned, deep-watched, or
|
|
100
|
+
* mutated. A new array reference re-runs processing and the pruning and
|
|
101
|
+
* clamping rules.
|
|
102
|
+
*/
|
|
103
|
+
data: MaybeRefOrGetter<readonly TData[]>;
|
|
104
|
+
/** Consumer-owned column definitions. Not mutated. */
|
|
105
|
+
columns: MaybeRefOrGetter<readonly DataTableColumnDef<TData>[]>;
|
|
106
|
+
/** Required in every build; there is no index fallback. */
|
|
107
|
+
getRowId: DataTableGetRowId<TData>;
|
|
108
|
+
/** When `true`, `data` arrives globally sorted; local sorting is skipped. @default false */
|
|
109
|
+
manualSorting?: MaybeRefOrGetter<boolean | undefined>;
|
|
110
|
+
/** When `true`, `data` arrives globally filtered; local filtering is skipped. @default false */
|
|
111
|
+
manualFiltering?: MaybeRefOrGetter<boolean | undefined>;
|
|
112
|
+
/** Optional page-count override; otherwise `max(1, ceil(rowCount / pageSize))`. */
|
|
113
|
+
pageCount?: MaybeRefOrGetter<number | undefined>;
|
|
114
|
+
/** When `false`, selection APIs are inert. @default false */
|
|
115
|
+
enableRowSelection?: MaybeRefOrGetter<boolean | undefined>;
|
|
116
|
+
/** When `false`, expansion APIs are inert. @default false */
|
|
117
|
+
enableRowExpansion?: MaybeRefOrGetter<boolean | undefined>;
|
|
118
|
+
/** When `false`, expanding one row collapses the others. @default true */
|
|
119
|
+
allowMultipleExpanded?: MaybeRefOrGetter<boolean | undefined>;
|
|
120
|
+
/** Busy flag for renderers (`aria-busy`). Does not affect processing. @default false */
|
|
121
|
+
loading?: MaybeRefOrGetter<boolean | undefined>;
|
|
122
|
+
/** Makes sort, selection, and expansion toggles inert. @default false */
|
|
123
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
124
|
+
/** Controlled sorting (at most one entry is honored). Omit for uncontrolled. */
|
|
125
|
+
sorting?: MaybeRefOrGetter<DataTableColumnSort[] | undefined>;
|
|
126
|
+
/** Initial uncontrolled sorting. @default [] */
|
|
127
|
+
defaultSorting?: MaybeRefOrGetter<DataTableColumnSort[] | undefined>;
|
|
128
|
+
/** Controlled column filters. Omit for uncontrolled. */
|
|
129
|
+
columnFilters?: MaybeRefOrGetter<DataTableColumnFilter[] | undefined>;
|
|
130
|
+
/** Initial uncontrolled column filters. @default [] */
|
|
131
|
+
defaultColumnFilters?: MaybeRefOrGetter<DataTableColumnFilter[] | undefined>;
|
|
132
|
+
/** Controlled global filter. Omit for uncontrolled. */
|
|
133
|
+
globalFilter?: MaybeRefOrGetter<unknown>;
|
|
134
|
+
/** Initial uncontrolled global filter. @default undefined */
|
|
135
|
+
defaultGlobalFilter?: MaybeRefOrGetter<unknown>;
|
|
136
|
+
/** Controlled pagination (1-based `pageIndex`). Omit for uncontrolled. */
|
|
137
|
+
pagination?: MaybeRefOrGetter<DataTablePaginationState | undefined>;
|
|
138
|
+
/** Initial uncontrolled pagination. @default { pageIndex: 1, pageSize: 10 } */
|
|
139
|
+
defaultPagination?: MaybeRefOrGetter<DataTablePaginationState | undefined>;
|
|
140
|
+
/** Controlled selected row ids. Omit for uncontrolled. */
|
|
141
|
+
selectedRowIds?: MaybeRefOrGetter<DataTableRowId[] | undefined>;
|
|
142
|
+
/** Initial uncontrolled selected row ids. @default [] */
|
|
143
|
+
defaultSelectedRowIds?: MaybeRefOrGetter<DataTableRowId[] | undefined>;
|
|
144
|
+
/** Controlled expanded row ids. Omit for uncontrolled. */
|
|
145
|
+
expandedRowIds?: MaybeRefOrGetter<DataTableRowId[] | undefined>;
|
|
146
|
+
/** Initial uncontrolled expanded row ids. @default [] */
|
|
147
|
+
defaultExpandedRowIds?: MaybeRefOrGetter<DataTableRowId[] | undefined>;
|
|
148
|
+
/** `update:sorting` writer. */
|
|
149
|
+
onSortingChange?: (sorting: DataTableColumnSort[]) => void;
|
|
150
|
+
/** `update:columnFilters` writer. */
|
|
151
|
+
onColumnFiltersChange?: (columnFilters: DataTableColumnFilter[]) => void;
|
|
152
|
+
/** `update:globalFilter` writer. */
|
|
153
|
+
onGlobalFilterChange?: (globalFilter: unknown) => void;
|
|
154
|
+
/** `update:pagination` writer. */
|
|
155
|
+
onPaginationChange?: (pagination: DataTablePaginationState) => void;
|
|
156
|
+
/** `update:selectedRowIds` writer. */
|
|
157
|
+
onSelectedRowIdsChange?: (selectedRowIds: DataTableRowId[]) => void;
|
|
158
|
+
/** `update:expandedRowIds` writer. */
|
|
159
|
+
onExpandedRowIdsChange?: (expandedRowIds: DataTableRowId[]) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Fired once per action that changes the server query (a dimension whose
|
|
162
|
+
* `manual*` flag is `true`), after every `on*Change` writer and reset rule
|
|
163
|
+
* for that action. Fetch from `payload.query` only.
|
|
164
|
+
*/
|
|
165
|
+
onStateChange?: (payload: DataTableStateChangePayload) => void;
|
|
166
|
+
}
|
|
167
|
+
/** Local pagination: the composable slices the processed rows itself. */
|
|
168
|
+
export interface UseGhostDataTableLocalPaginationOptions<TData> extends UseGhostDataTableBaseOptions<TData> {
|
|
169
|
+
/** `data` holds the full set; the composable slices pages. @default false */
|
|
170
|
+
manualPagination?: MaybeRefOrGetter<false | undefined>;
|
|
171
|
+
/** Ignored for local pagination; derived from the filtered row count. */
|
|
172
|
+
rowCount?: MaybeRefOrGetter<number | undefined>;
|
|
173
|
+
}
|
|
174
|
+
/** Server pagination: `data` holds one page and `rowCount` is required. */
|
|
175
|
+
export interface UseGhostDataTableManualPaginationOptions<TData> extends UseGhostDataTableBaseOptions<TData> {
|
|
176
|
+
/** When `true`, `data` is one page of rows. */
|
|
177
|
+
manualPagination: MaybeRefOrGetter<boolean | undefined>;
|
|
178
|
+
/** Total rows matching the query on the server. Required with `manualPagination`. */
|
|
179
|
+
rowCount: MaybeRefOrGetter<number>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Options for {@link useGhostDataTable}. `rowCount` is required whenever
|
|
183
|
+
* `manualPagination` may be `true` (`pageCount` alone is insufficient).
|
|
184
|
+
*/
|
|
185
|
+
export type UseGhostDataTableOptions<TData> = UseGhostDataTableLocalPaginationOptions<TData> | UseGhostDataTableManualPaginationOptions<TData>;
|
|
186
|
+
/** State, row models, and actions returned by {@link useGhostDataTable}. */
|
|
187
|
+
export interface UseGhostDataTableReturn<TData> {
|
|
188
|
+
/** Authoritative sorting (controlled prop or internal state). */
|
|
189
|
+
sorting: ComputedRef<DataTableColumnSort[]>;
|
|
190
|
+
columnFilters: ComputedRef<DataTableColumnFilter[]>;
|
|
191
|
+
globalFilter: ComputedRef<unknown>;
|
|
192
|
+
/** Effective pagination; `pageIndex` is clamped to `[1, pageCount]`. */
|
|
193
|
+
pagination: ComputedRef<DataTablePaginationState>;
|
|
194
|
+
selectedRowIds: ComputedRef<DataTableRowId[]>;
|
|
195
|
+
expandedRowIds: ComputedRef<DataTableRowId[]>;
|
|
196
|
+
/** Server `rowCount` with `manualPagination`; otherwise the filtered row count. */
|
|
197
|
+
rowCount: ComputedRef<number>;
|
|
198
|
+
/** `pageCount` override, or `max(1, ceil(rowCount / pageSize))`. */
|
|
199
|
+
pageCount: ComputedRef<number>;
|
|
200
|
+
/** Full current query using the effective (clamped) pagination. */
|
|
201
|
+
query: ComputedRef<DataTableQueryState>;
|
|
202
|
+
loading: ComputedRef<boolean>;
|
|
203
|
+
disabled: ComputedRef<boolean>;
|
|
204
|
+
/**
|
|
205
|
+
* Resolved `enableRowSelection`. Selection is still inert while
|
|
206
|
+
* {@link disabled} is `true`.
|
|
207
|
+
*/
|
|
208
|
+
rowSelectionEnabled: ComputedRef<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* Resolved `enableRowExpansion`. Expansion is still inert while
|
|
211
|
+
* {@link disabled} is `true`.
|
|
212
|
+
*/
|
|
213
|
+
rowExpansionEnabled: ComputedRef<boolean>;
|
|
214
|
+
/** Select-all state over the same id set as {@link toggleAllRowsSelected}. */
|
|
215
|
+
headerSelectionState: ComputedRef<DataTableHeaderSelectionState>;
|
|
216
|
+
/** Every `data` row with its id, in source order. */
|
|
217
|
+
getCoreRowModel: () => readonly DataTableRow<TData>[];
|
|
218
|
+
/** Core rows after local sorting (identity when sorting is manual). */
|
|
219
|
+
getSortedRowModel: () => readonly DataTableRow<TData>[];
|
|
220
|
+
/** Sorted rows after local filtering (identity when filtering is manual). */
|
|
221
|
+
getFilteredRowModel: () => readonly DataTableRow<TData>[];
|
|
222
|
+
/** Sort + filter on the processing input, before the pagination slice. */
|
|
223
|
+
getPrePaginationRowModel: () => readonly DataTableRow<TData>[];
|
|
224
|
+
/** Rows to render: the local page slice, or the processed server page. */
|
|
225
|
+
getRowModel: () => readonly DataTableRow<TData>[];
|
|
226
|
+
/** Alias of {@link getRowModel} in phase one (same reference). */
|
|
227
|
+
getPaginationRowModel: () => readonly DataTableRow<TData>[];
|
|
228
|
+
/** Rows of {@link getRowModel} whose ids are selected. */
|
|
229
|
+
getSelectedRowModel: () => readonly DataTableRow<TData>[];
|
|
230
|
+
/** Current direction of `columnId` in the single-column sort. */
|
|
231
|
+
getSortDirection: (columnId: string) => DataTableSortDirection;
|
|
232
|
+
/** Whether `columnId` can be sorted (accessor or `sortFn`, `enableSorting !== false`). */
|
|
233
|
+
canSort: (columnId: string) => boolean;
|
|
234
|
+
setSorting: (sorting: DataTableColumnSort[]) => void;
|
|
235
|
+
/** Tri-state cycle for one column: none → asc → desc → none. Inert when disabled. */
|
|
236
|
+
toggleSorting: (columnId: string) => void;
|
|
237
|
+
setColumnFilters: (columnFilters: DataTableColumnFilter[]) => void;
|
|
238
|
+
/** Sets (or clears with `undefined` / `null` / `''`) one column filter. */
|
|
239
|
+
setColumnFilter: (columnId: string, value: unknown) => void;
|
|
240
|
+
setGlobalFilter: (globalFilter: unknown) => void;
|
|
241
|
+
/** Commits pagination; a `pageSize` change resets `pageIndex` to 1. */
|
|
242
|
+
setPagination: (pagination: DataTablePaginationState) => void;
|
|
243
|
+
setPageIndex: (pageIndex: number) => void;
|
|
244
|
+
setPageSize: (pageSize: number) => void;
|
|
245
|
+
isRowSelected: (rowId: DataTableRowId) => boolean;
|
|
246
|
+
/** Toggles (or sets with `value`) one row. Inert when selection is off or disabled. */
|
|
247
|
+
toggleRowSelected: (rowId: DataTableRowId, value?: boolean) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Selects or clears every id in the select-all target (local:
|
|
250
|
+
* pre-pagination rows; server: {@link getRowModel}) without touching ids
|
|
251
|
+
* outside that set. Without `value`, selects unless all are selected.
|
|
252
|
+
*/
|
|
253
|
+
toggleAllRowsSelected: (value?: boolean) => void;
|
|
254
|
+
/** Clears every selected id. */
|
|
255
|
+
resetRowSelection: () => void;
|
|
256
|
+
isRowExpanded: (rowId: DataTableRowId) => boolean;
|
|
257
|
+
/** Toggles (or sets with `value`) one row. Inert when expansion is off or disabled. */
|
|
258
|
+
toggleRowExpanded: (rowId: DataTableRowId, value?: boolean) => void;
|
|
259
|
+
/** Re-emits `stateChange` with the current query and a fresh `requestId`. */
|
|
260
|
+
retry: () => void;
|
|
261
|
+
}
|
|
262
|
+
/** Return type of {@link useGhostDataTableServerRequest}. */
|
|
263
|
+
export interface UseGhostDataTableServerRequestReturn {
|
|
264
|
+
/**
|
|
265
|
+
* Records `requestId` from a `stateChange` payload as the newest request.
|
|
266
|
+
* Call it synchronously at the start of the `stateChange` handler, before
|
|
267
|
+
* awaiting anything, so the newest emit always wins.
|
|
268
|
+
*/
|
|
269
|
+
begin: (requestId: number) => void;
|
|
270
|
+
/**
|
|
271
|
+
* True while `requestId` is still the newest id passed to `begin`. Gate
|
|
272
|
+
* every response write (`data`, `rowCount`, error) and the `finally` that
|
|
273
|
+
* clears `loading` with it, so a stale request cannot touch newer UI state.
|
|
274
|
+
*/
|
|
275
|
+
isLatest: (requestId: number) => boolean;
|
|
276
|
+
}
|
|
277
|
+
/** Accessible-name options for the control prop getters. */
|
|
278
|
+
export interface DataTableControlLabelOptions {
|
|
279
|
+
/**
|
|
280
|
+
* Localized accessible name, applied as `aria-label` on the focusable
|
|
281
|
+
* control itself (never a wrapper). Omit when visible text names it.
|
|
282
|
+
*/
|
|
283
|
+
label?: string;
|
|
284
|
+
}
|
|
285
|
+
/** Attributes for the `GhostTable` root (`<table>`). */
|
|
286
|
+
export interface DataTableTableRootProps {
|
|
287
|
+
'data-ghost-data-table': '';
|
|
288
|
+
/** `'true'` while `loading`; omitted otherwise. */
|
|
289
|
+
'aria-busy'?: 'true';
|
|
290
|
+
'aria-label'?: string;
|
|
291
|
+
'aria-labelledby'?: string;
|
|
292
|
+
}
|
|
293
|
+
/** Attributes for a column `GhostTableHeaderCell`. */
|
|
294
|
+
export interface DataTableHeaderCellProps {
|
|
295
|
+
scope: 'col';
|
|
296
|
+
/** Only on the sorted column (single-column sort in phase one). */
|
|
297
|
+
'aria-sort'?: 'ascending' | 'descending';
|
|
298
|
+
/** Styling hook mirroring `aria-sort`. */
|
|
299
|
+
'data-sort'?: 'asc' | 'desc';
|
|
300
|
+
}
|
|
301
|
+
/** Attributes for a data `GhostTableRow`. Both flags are independent. */
|
|
302
|
+
export interface DataTableRowProps {
|
|
303
|
+
'data-selected'?: 'true';
|
|
304
|
+
'data-expanded'?: 'true';
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Attributes for the expansion detail `GhostTableRow`. `GhostTableRow` keeps
|
|
308
|
+
* its own `data-part="row"`; this only adds `data-detail-row`.
|
|
309
|
+
*/
|
|
310
|
+
export interface DataTableDetailRowProps {
|
|
311
|
+
/** Target of the expand button's `aria-controls`. */
|
|
312
|
+
id: string;
|
|
313
|
+
'data-detail-row': 'true';
|
|
314
|
+
}
|
|
315
|
+
/** Attributes for a sort `<button>` inside a header cell. */
|
|
316
|
+
export interface DataTableSortButtonProps {
|
|
317
|
+
type: 'button';
|
|
318
|
+
'aria-label'?: string;
|
|
319
|
+
/** Set while the table is disabled or the column cannot sort. */
|
|
320
|
+
disabled?: true;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Props for a row or header `GhostCheckbox`. `aria-label` falls through to the
|
|
324
|
+
* native checkbox input (the focusable control).
|
|
325
|
+
*/
|
|
326
|
+
export interface DataTableSelectionCheckboxProps {
|
|
327
|
+
'aria-label'?: string;
|
|
328
|
+
/** `true` while selection is not enabled or the table is disabled. */
|
|
329
|
+
disabled: boolean;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Options for the expand button helper. The root `GhostDataTable` fills `id`
|
|
333
|
+
* and `detailRowId` itself; standalone {@link useGhostDataTable} consumers
|
|
334
|
+
* pass the ids of the elements they render.
|
|
335
|
+
*/
|
|
336
|
+
export interface DataTableExpandButtonOptions extends DataTableControlLabelOptions {
|
|
337
|
+
/**
|
|
338
|
+
* DOM id for the button. `GhostDataTable` looks the button up by this id to
|
|
339
|
+
* restore focus when the row's detail row collapses, so keep it when
|
|
340
|
+
* spreading the props.
|
|
341
|
+
*/
|
|
342
|
+
id?: string;
|
|
343
|
+
/** Id of the detail row, used for `aria-controls` while the row is expanded. */
|
|
344
|
+
detailRowId?: string;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The slice of {@link UseGhostDataTableReturn} the interaction prop helpers
|
|
348
|
+
* read. Any `useGhostDataTable` return satisfies it, whatever its row type.
|
|
349
|
+
*/
|
|
350
|
+
export type DataTableInteractionState = Pick<UseGhostDataTableReturn<unknown>, 'disabled' | 'canSort' | 'getSortDirection' | 'rowSelectionEnabled' | 'rowExpansionEnabled' | 'isRowExpanded'>;
|
|
351
|
+
/** Attributes for a row expand `<button>`. */
|
|
352
|
+
export interface DataTableExpandButtonProps {
|
|
353
|
+
type: 'button';
|
|
354
|
+
/** Focus-restore target when the detail row collapses (see the options). */
|
|
355
|
+
id?: string;
|
|
356
|
+
'aria-label'?: string;
|
|
357
|
+
'aria-expanded': 'true' | 'false';
|
|
358
|
+
/** Detail row id; only while expanded, so it never points at a missing node. */
|
|
359
|
+
'aria-controls'?: string;
|
|
360
|
+
/** Set while expansion is not enabled or the table is disabled. */
|
|
361
|
+
disabled?: true;
|
|
362
|
+
}
|
|
363
|
+
/** Column header model. Independent of body rows, so the head survives an empty body. */
|
|
364
|
+
export interface DataTableHeader<TData> {
|
|
365
|
+
/** Column id (same as `column.id`). */
|
|
366
|
+
id: string;
|
|
367
|
+
/** Consumer column definition (not cloned). */
|
|
368
|
+
column: DataTableColumnDef<TData>;
|
|
369
|
+
/** Whether the column can sort (accessor or `sortFn`, `enableSorting !== false`). */
|
|
370
|
+
canSort: boolean;
|
|
371
|
+
/** Current direction in the single-column sort. */
|
|
372
|
+
sortDirection: DataTableSortDirection;
|
|
373
|
+
/** Tri-state sort cycle. Ignores arguments, so it can be an `@click` handler. */
|
|
374
|
+
toggleSort: () => void;
|
|
375
|
+
}
|
|
376
|
+
/** Body row model passed to the default slot as `rows`. */
|
|
377
|
+
export interface DataTableSlotRow<TData> extends DataTableRow<TData> {
|
|
378
|
+
/** One cell context per column, in column order. */
|
|
379
|
+
cells: DataTableCellContext<TData>[];
|
|
380
|
+
isSelected: boolean;
|
|
381
|
+
isExpanded: boolean;
|
|
382
|
+
/** Toggles, or sets with a boolean (`GhostCheckbox` `update:modelValue`). */
|
|
383
|
+
toggleSelected: (value?: boolean) => void;
|
|
384
|
+
/** Toggles expansion. Ignores arguments, so it can be an `@click` handler. */
|
|
385
|
+
toggleExpanded: () => void;
|
|
386
|
+
/** Bindings for this row's expansion detail `<tr>`. */
|
|
387
|
+
detailRowProps: DataTableDetailRowProps;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Props for {@link GhostDataTable}. The options mirror
|
|
391
|
+
* {@link UseGhostDataTableBaseOptions}; v-model props are controlled when
|
|
392
|
+
* bound and fall back to their `default*` value otherwise.
|
|
393
|
+
*/
|
|
394
|
+
export interface GhostDataTableProps<TData> {
|
|
395
|
+
/** Consumer-owned rows, read by reference only (never cloned or mutated). */
|
|
396
|
+
data: readonly TData[];
|
|
397
|
+
/** Consumer-owned column definitions. Not mutated. */
|
|
398
|
+
columns: readonly DataTableColumnDef<TData>[];
|
|
399
|
+
/** Required in every build; there is no index fallback. */
|
|
400
|
+
getRowId: DataTableGetRowId<TData>;
|
|
401
|
+
/** @default false */
|
|
402
|
+
manualSorting?: boolean;
|
|
403
|
+
/** @default false */
|
|
404
|
+
manualFiltering?: boolean;
|
|
405
|
+
/** When `true`, `data` is one server page and `rowCount` is required. @default false */
|
|
406
|
+
manualPagination?: boolean;
|
|
407
|
+
/** Total rows matching the query on the server. Required with `manualPagination`. */
|
|
408
|
+
rowCount?: number;
|
|
409
|
+
/** Optional page-count override. */
|
|
410
|
+
pageCount?: number;
|
|
411
|
+
/** @default false */
|
|
412
|
+
enableRowSelection?: boolean;
|
|
413
|
+
/** @default false */
|
|
414
|
+
enableRowExpansion?: boolean;
|
|
415
|
+
/** When `false`, expanding one row collapses the others. @default true */
|
|
416
|
+
allowMultipleExpanded?: boolean;
|
|
417
|
+
/** Sets `aria-busy="true"` through `tableRootProps`. @default false */
|
|
418
|
+
loading?: boolean;
|
|
419
|
+
/** Makes sort, selection, and expansion inert and disables their controls. @default false */
|
|
420
|
+
disabled?: boolean;
|
|
421
|
+
/** Accessible name for the table, applied through `tableRootProps`. */
|
|
422
|
+
ariaLabel?: string;
|
|
423
|
+
/** Id of a visible label for the table, applied through `tableRootProps`. */
|
|
424
|
+
ariaLabelledby?: string;
|
|
425
|
+
sorting?: DataTableColumnSort[];
|
|
426
|
+
defaultSorting?: DataTableColumnSort[];
|
|
427
|
+
columnFilters?: DataTableColumnFilter[];
|
|
428
|
+
defaultColumnFilters?: DataTableColumnFilter[];
|
|
429
|
+
globalFilter?: unknown;
|
|
430
|
+
defaultGlobalFilter?: unknown;
|
|
431
|
+
pagination?: DataTablePaginationState;
|
|
432
|
+
defaultPagination?: DataTablePaginationState;
|
|
433
|
+
selectedRowIds?: DataTableRowId[];
|
|
434
|
+
defaultSelectedRowIds?: DataTableRowId[];
|
|
435
|
+
expandedRowIds?: DataTableRowId[];
|
|
436
|
+
defaultExpandedRowIds?: DataTableRowId[];
|
|
437
|
+
}
|
|
438
|
+
/** Model updates and query events from a DataTable root. */
|
|
439
|
+
export interface GhostDataTableEmits {
|
|
440
|
+
'update:sorting': [sorting: DataTableColumnSort[]];
|
|
441
|
+
'update:columnFilters': [columnFilters: DataTableColumnFilter[]];
|
|
442
|
+
'update:globalFilter': [globalFilter: unknown];
|
|
443
|
+
'update:pagination': [pagination: DataTablePaginationState];
|
|
444
|
+
'update:selectedRowIds': [selectedRowIds: DataTableRowId[]];
|
|
445
|
+
'update:expandedRowIds': [expandedRowIds: DataTableRowId[]];
|
|
446
|
+
stateChange: [payload: DataTableStateChangePayload];
|
|
447
|
+
}
|
|
448
|
+
/** Default slot props of {@link GhostDataTable} (spec: Renderless root slot bindings). */
|
|
449
|
+
export interface GhostDataTableSlotProps<TData> {
|
|
450
|
+
tableRootProps: DataTableTableRootProps;
|
|
451
|
+
headers: DataTableHeader<TData>[];
|
|
452
|
+
rows: DataTableSlotRow<TData>[];
|
|
453
|
+
headerSelectionState: DataTableHeaderSelectionState;
|
|
454
|
+
getHeaderCellProps: (columnId: string) => DataTableHeaderCellProps;
|
|
455
|
+
getRowProps: (rowId: DataTableRowId) => DataTableRowProps;
|
|
456
|
+
/**
|
|
457
|
+
* Cell context for a row in `rows` and a column id. Throws for an id that is
|
|
458
|
+
* not rendered, which is a template bug rather than a runtime state.
|
|
459
|
+
*/
|
|
460
|
+
getBodyCellContext: (rowId: DataTableRowId, columnId: string) => DataTableCellContext<TData>;
|
|
461
|
+
getSortButtonProps: (columnId: string, options?: DataTableControlLabelOptions) => DataTableSortButtonProps;
|
|
462
|
+
getRowSelectionCheckboxProps: (rowId: DataTableRowId, options?: DataTableControlLabelOptions) => DataTableSelectionCheckboxProps;
|
|
463
|
+
getHeaderSelectionCheckboxProps: (options?: DataTableControlLabelOptions) => DataTableSelectionCheckboxProps;
|
|
464
|
+
getRowExpandButtonProps: (rowId: DataTableRowId, options?: DataTableControlLabelOptions) => DataTableExpandButtonProps;
|
|
465
|
+
/** Same id set as `headerSelectionState`; accepts the checkbox's next value. */
|
|
466
|
+
toggleAllRowsSelected: (value?: boolean) => void;
|
|
467
|
+
/**
|
|
468
|
+
* Effective pagination: `pageIndex` is already clamped to `[1, pageCount]`.
|
|
469
|
+
* Bind `pagination.pageIndex` to `GhostPagination`'s `modelValue`.
|
|
470
|
+
*/
|
|
471
|
+
pagination: DataTablePaginationState;
|
|
472
|
+
/**
|
|
473
|
+
* Server `rowCount` with `manualPagination`; otherwise the filtered row
|
|
474
|
+
* count. Use it for "N results" text next to the pager.
|
|
475
|
+
*/
|
|
476
|
+
rowCount: number;
|
|
477
|
+
/**
|
|
478
|
+
* Pages for `GhostPagination`'s `pageCount`: the override, or
|
|
479
|
+
* `max(1, ceil(rowCount / pageSize))`; always `1` when `rowCount` is `0`.
|
|
480
|
+
*/
|
|
481
|
+
pageCount: number;
|
|
482
|
+
/**
|
|
483
|
+
* Commits a page from `GhostPagination`'s `update:modelValue`. Clamps to
|
|
484
|
+
* `pageCount`, updates the `pagination` v-model, and emits one
|
|
485
|
+
* `stateChange` with `manualPagination`.
|
|
486
|
+
*/
|
|
487
|
+
setPageIndex: (pageIndex: number) => void;
|
|
488
|
+
}
|
|
489
|
+
/** Methods exposed on a `GhostDataTable` template ref. */
|
|
490
|
+
export interface GhostDataTableExposed<TData> {
|
|
491
|
+
toggleAllRowsSelected: (value?: boolean) => void;
|
|
492
|
+
toggleRowSelected: (rowId: DataTableRowId, value?: boolean) => void;
|
|
493
|
+
toggleRowExpanded: (rowId: DataTableRowId, value?: boolean) => void;
|
|
494
|
+
resetRowSelection: () => void;
|
|
495
|
+
/** Re-emits `stateChange` with the current query and a fresh `requestId`. */
|
|
496
|
+
retry: () => void;
|
|
497
|
+
setSorting: (sorting: DataTableColumnSort[]) => void;
|
|
498
|
+
toggleSorting: (columnId: string) => void;
|
|
499
|
+
setGlobalFilter: (globalFilter: unknown) => void;
|
|
500
|
+
setColumnFilter: (columnId: string, value: unknown) => void;
|
|
501
|
+
setColumnFilters: (columnFilters: DataTableColumnFilter[]) => void;
|
|
502
|
+
setPagination: (pagination: DataTablePaginationState) => void;
|
|
503
|
+
setPageIndex: (pageIndex: number) => void;
|
|
504
|
+
setPageSize: (pageSize: number) => void;
|
|
505
|
+
getRowModel: () => readonly DataTableRow<TData>[];
|
|
506
|
+
getPrePaginationRowModel: () => readonly DataTableRow<TData>[];
|
|
507
|
+
getSelectedRowModel: () => readonly DataTableRow<TData>[];
|
|
508
|
+
}
|