Skip to content

Commit

Permalink
Pass id to PaginatedTable
Browse files Browse the repository at this point in the history
  • Loading branch information
laurakwhit committed Jan 7, 2025
1 parent efcb4a7 commit 3a044a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/holocene/table/paginated-table/api-paginated.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
type T = $$Generic;
type $$Props = HTMLAttributes<HTMLDivElement> & {
id?: string;
onError?: (error: Error | unknown) => void | undefined;
onFetch: () => Promise<PaginatedRequest<T>>;
onShiftUp?: (event: KeyboardEvent) => void | undefined;
Expand All @@ -43,6 +44,7 @@
pageSizeOptions?: string[];
};
export let id: string = null;
export let onError: (error: Error) => void | undefined = undefined;
export let onFetch: () => Promise<PaginatedRequest<T>>;
export let onShiftUp: (event: KeyboardEvent) => void | undefined = undefined;
Expand Down Expand Up @@ -169,7 +171,11 @@

<slot name="header" visibleItems={$store.visibleItems} />

<PaginatedTable updating={$store.updating} visibleItems={$store.visibleItems}>
<PaginatedTable
updating={$store.updating}
visibleItems={$store.visibleItems}
{id}
>
<slot name="caption" slot="caption" />
<slot name="headers" slot="headers" visibleItems={$store.visibleItems} />

Expand Down
1 change: 1 addition & 0 deletions src/lib/holocene/table/paginated-table/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
class="paginated-table"
class:table-fixed={fixed}
class:table-auto={!fixed}
{...$$restProps}
>
<slot name="caption" />
<thead class="paginated-table-header">
Expand Down
2 changes: 2 additions & 0 deletions src/lib/holocene/table/paginated-table/paginated.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
type Item = $$Generic;
export let id: string = null;
export let items: Item[];
export let variant: 'primary' | 'split' = 'primary';
export let updating = false;
Expand Down Expand Up @@ -94,6 +95,7 @@
{maxHeight}
visibleItems={$store.items}
{fixed}
{id}
>
<slot name="caption" slot="caption" />
<slot name="headers" slot="headers" visibleItems={$store.items} />
Expand Down

0 comments on commit 3a044a4

Please sign in to comment.