@kayord/ui 0.9.22 → 0.10.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/dist/components/custom/data-table/DataTable.svelte +129 -117
- package/dist/components/custom/data-table/DataTable.svelte.d.ts +18 -23
- package/dist/components/custom/data-table/DataTableCheckbox.svelte +5 -8
- package/dist/components/custom/data-table/DataTableCheckbox.svelte.d.ts +3 -3
- package/dist/components/custom/data-table/index.d.ts +0 -1
- package/dist/components/custom/data-table/index.js +0 -1
- package/dist/components/custom/index.d.ts +0 -1
- package/dist/components/custom/index.js +0 -1
- package/package.json +3 -4
- package/dist/components/custom/data-table/DataTablePagination.svelte +0 -77
- package/dist/components/custom/data-table/DataTablePagination.svelte.d.ts +0 -25
- package/dist/components/custom/data-table/data.d.ts +0 -7
- package/dist/components/custom/data-table/data.js +0 -410
- package/dist/components/custom/data-table-new/DataTable.svelte +0 -176
- package/dist/components/custom/data-table-new/DataTable.svelte.d.ts +0 -36
- package/dist/components/custom/data-table-new/DataTableCheckbox.svelte +0 -14
- package/dist/components/custom/data-table-new/DataTableCheckbox.svelte.d.ts +0 -21
- package/dist/components/custom/data-table-new/index.d.ts +0 -1
- package/dist/components/custom/data-table-new/index.js +0 -1
- /package/dist/components/custom/{data-table-new → data-table}/FullscreenModeToggle.svelte +0 -0
- /package/dist/components/custom/{data-table-new → data-table}/FullscreenModeToggle.svelte.d.ts +0 -0
- /package/dist/components/custom/{data-table-new → data-table}/Pagination.svelte +0 -0
- /package/dist/components/custom/{data-table-new → data-table}/Pagination.svelte.d.ts +0 -0
- /package/dist/components/custom/{data-table-new → data-table}/VisibilitySelect.svelte +0 -0
- /package/dist/components/custom/{data-table-new → data-table}/VisibilitySelect.svelte.d.ts +0 -0
- /package/dist/components/custom/{data-table-new → data-table}/table.svelte.d.ts +0 -0
- /package/dist/components/custom/{data-table-new → data-table}/table.svelte.js +0 -0
|
@@ -1,109 +1,137 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import { FlexRender, type ColumnDef, type Table as TypeType, renderComponent } from "@tanstack/svelte-table";
|
|
3
|
+
import { Skeleton, Table } from "../../ui";
|
|
4
|
+
import Pagination from "./Pagination.svelte";
|
|
5
|
+
import type { Snippet } from "svelte";
|
|
4
6
|
import { fade } from "svelte/transition";
|
|
7
|
+
import { ProgressLoading } from "../progress-loading";
|
|
8
|
+
import DataTableCheckbox from "./DataTableCheckbox.svelte";
|
|
9
|
+
import VisibilitySelect from "./VisibilitySelect.svelte";
|
|
10
|
+
import FullscreenModeToggle from "./FullscreenModeToggle.svelte";
|
|
11
|
+
import { cn } from "../../../utils";
|
|
12
|
+
import { tableStore } from "./table.svelte";
|
|
5
13
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
interface Props<T> {
|
|
15
|
+
table: TypeType<T>;
|
|
16
|
+
columns: ColumnDef<T>[];
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
header?: Snippet;
|
|
19
|
+
subHeader?: Snippet;
|
|
20
|
+
footer?: Snippet;
|
|
21
|
+
leftToolbar?: Snippet;
|
|
22
|
+
rightToolbar?: Snippet;
|
|
23
|
+
noDataMessage?: string;
|
|
24
|
+
hideHeader?: boolean;
|
|
25
|
+
enableVisibility?: boolean;
|
|
26
|
+
enableFullscreen?: boolean;
|
|
27
|
+
}
|
|
10
28
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
29
|
+
let {
|
|
30
|
+
table,
|
|
31
|
+
columns,
|
|
32
|
+
isLoading = false,
|
|
33
|
+
header,
|
|
34
|
+
subHeader,
|
|
35
|
+
footer,
|
|
36
|
+
leftToolbar,
|
|
37
|
+
rightToolbar,
|
|
38
|
+
noDataMessage = "No data",
|
|
39
|
+
hideHeader = false,
|
|
40
|
+
enableVisibility = false,
|
|
41
|
+
enableFullscreen = false,
|
|
42
|
+
}: Props<T> = $props();
|
|
14
43
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export let hideHeader: boolean = false;
|
|
44
|
+
const isPaginationEnabled = table.options.getPaginationRowModel !== undefined;
|
|
45
|
+
const enableRowSelection = table.options.enableRowSelection;
|
|
18
46
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Select
|
|
39
|
-
const isSelectEnabled = pluginStates.select != undefined;
|
|
40
|
-
const selectedDataIds = isSelectEnabled ? pluginStates.select.selectedDataIds : undefined;
|
|
41
|
-
|
|
42
|
-
const getOriginalData = (id: any) => {
|
|
43
|
-
const data = $pageRows[id] as unknown as { original: T };
|
|
44
|
-
return data.original;
|
|
45
|
-
};
|
|
47
|
+
if (enableRowSelection) {
|
|
48
|
+
const rowSelectionColumn: ColumnDef<T> = {
|
|
49
|
+
id: "select",
|
|
50
|
+
// cell: (info) => "[]",
|
|
51
|
+
header: () =>
|
|
52
|
+
renderComponent(DataTableCheckbox, {
|
|
53
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
54
|
+
onCheckedChange: () => table.toggleAllPageRowsSelected(),
|
|
55
|
+
}),
|
|
56
|
+
cell: (r) =>
|
|
57
|
+
renderComponent(DataTableCheckbox, {
|
|
58
|
+
checked: r.row.getIsSelected(),
|
|
59
|
+
onCheckedChange: () => r.row.toggleSelected(),
|
|
60
|
+
}),
|
|
61
|
+
enableResizing: false,
|
|
62
|
+
};
|
|
63
|
+
columns.unshift(rowSelectionColumn);
|
|
64
|
+
}
|
|
46
65
|
</script>
|
|
47
66
|
|
|
48
|
-
<div
|
|
49
|
-
|
|
67
|
+
<div
|
|
68
|
+
class={cn(
|
|
69
|
+
"w-full",
|
|
70
|
+
tableStore.isFullscreen ? "absolute left-0 top-0 z-10 h-screen bg-background transition-all" : "w-full"
|
|
71
|
+
)}
|
|
72
|
+
>
|
|
73
|
+
<div class="py-2">
|
|
74
|
+
{#if header}
|
|
75
|
+
{@render header()}
|
|
76
|
+
{:else}
|
|
77
|
+
<div class="flex items-center justify-between gap-2">
|
|
78
|
+
<div>
|
|
79
|
+
{#if leftToolbar}
|
|
80
|
+
{@render leftToolbar()}
|
|
81
|
+
{/if}
|
|
82
|
+
</div>
|
|
83
|
+
<div></div>
|
|
84
|
+
<div class="flex items-center justify-between gap-2">
|
|
85
|
+
{#if rightToolbar}
|
|
86
|
+
{@render rightToolbar()}
|
|
87
|
+
{/if}
|
|
88
|
+
{#if enableVisibility}
|
|
89
|
+
<div>
|
|
90
|
+
<VisibilitySelect {table} />
|
|
91
|
+
</div>
|
|
92
|
+
{/if}
|
|
93
|
+
{#if enableFullscreen}
|
|
94
|
+
<div>
|
|
95
|
+
<FullscreenModeToggle />
|
|
96
|
+
</div>
|
|
97
|
+
{/if}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
{/if}
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<div class="rounded-md border">
|
|
50
104
|
{#if isLoading}
|
|
51
105
|
<span in:fade={{ duration: 300 }}>
|
|
52
106
|
<ProgressLoading class="h-1" />
|
|
53
107
|
</span>
|
|
54
|
-
{:else}
|
|
55
|
-
<div class="h-1"></div>
|
|
56
108
|
{/if}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<slot name="header" />
|
|
61
|
-
{:else}
|
|
62
|
-
<h1 class="p-2 text-center text-lg">
|
|
63
|
-
{title}
|
|
64
|
-
</h1>
|
|
65
|
-
{/if}
|
|
66
|
-
</div>
|
|
67
|
-
{/if}
|
|
68
|
-
{#if $$slots.subHeader}
|
|
69
|
-
<slot name="subHeader" />
|
|
109
|
+
|
|
110
|
+
{#if subHeader}
|
|
111
|
+
{@render subHeader()}
|
|
70
112
|
{/if}
|
|
71
|
-
|
|
113
|
+
|
|
114
|
+
<Table.Root class="table-auto">
|
|
72
115
|
{#if !hideHeader}
|
|
73
116
|
<Table.Header>
|
|
74
|
-
{#each
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
{#if sortKey?.id === cell.id && sortKey?.order == "desc"}
|
|
85
|
-
<ArrowDown class="ml-2 h-4 w-4" />
|
|
86
|
-
{:else if sortKey?.id === cell.id && sortKey?.order === "asc"}
|
|
87
|
-
<ArrowUp class="ml-2 h-4 w-4" />
|
|
88
|
-
{/if}
|
|
89
|
-
{/each}
|
|
90
|
-
</Button>
|
|
91
|
-
{:else}
|
|
92
|
-
<Render of={cell.render()} />
|
|
93
|
-
{/if}
|
|
94
|
-
</Table.Head>
|
|
95
|
-
</Subscribe>
|
|
96
|
-
{/each}
|
|
97
|
-
</Table.Row>
|
|
98
|
-
</Subscribe>
|
|
117
|
+
{#each table.getHeaderGroups() as headerGroup}
|
|
118
|
+
<Table.Row>
|
|
119
|
+
{#each headerGroup.headers as header}
|
|
120
|
+
<Table.Head colspan={header.colSpan}>
|
|
121
|
+
{#if !header.isPlaceholder}
|
|
122
|
+
<FlexRender content={header.column.columnDef.header} context={header.getContext()} />
|
|
123
|
+
{/if}
|
|
124
|
+
</Table.Head>
|
|
125
|
+
{/each}
|
|
126
|
+
</Table.Row>
|
|
99
127
|
{/each}
|
|
100
128
|
</Table.Header>
|
|
101
129
|
{/if}
|
|
102
|
-
<Table.Body
|
|
103
|
-
{#if isLoading &&
|
|
130
|
+
<Table.Body>
|
|
131
|
+
{#if isLoading && table.getRowModel().rows.length == 0}
|
|
104
132
|
{#each { length: 5 } as _, i}
|
|
105
133
|
<Table.Row>
|
|
106
|
-
{#each
|
|
134
|
+
{#each columns as _cell}
|
|
107
135
|
<Table.Cell>
|
|
108
136
|
<Skeleton class="h-4" />
|
|
109
137
|
</Table.Cell>
|
|
@@ -111,30 +139,21 @@
|
|
|
111
139
|
</Table.Row>
|
|
112
140
|
{/each}
|
|
113
141
|
{:else}
|
|
114
|
-
{#if
|
|
142
|
+
{#if table.getRowModel().rows.length == 0}
|
|
115
143
|
<Table.Row>
|
|
116
|
-
<Table.Cell colspan={
|
|
144
|
+
<Table.Cell colspan={table.getAllColumns().length}>
|
|
117
145
|
<div class="text-center">{noDataMessage}</div>
|
|
118
146
|
</Table.Cell>
|
|
119
147
|
</Table.Row>
|
|
120
148
|
{/if}
|
|
121
|
-
{#each
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{#each row.cells as cell (cell.id)}
|
|
130
|
-
<Subscribe attrs={cell.attrs()} let:attrs>
|
|
131
|
-
<Table.Cell {...attrs}>
|
|
132
|
-
<Render of={cell.render()} />
|
|
133
|
-
</Table.Cell>
|
|
134
|
-
</Subscribe>
|
|
135
|
-
{/each}
|
|
136
|
-
</Table.Row>
|
|
137
|
-
</Subscribe>
|
|
149
|
+
{#each table.getRowModel().rows as row}
|
|
150
|
+
<Table.Row data-state={row.getIsSelected() && "selected"}>
|
|
151
|
+
{#each row.getVisibleCells() as cell}
|
|
152
|
+
<Table.Cell style={`width: ${cell.getContext().column.getSize()}px;`}>
|
|
153
|
+
<FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />
|
|
154
|
+
</Table.Cell>
|
|
155
|
+
{/each}
|
|
156
|
+
</Table.Row>
|
|
138
157
|
{/each}
|
|
139
158
|
{/if}
|
|
140
159
|
</Table.Body>
|
|
@@ -145,20 +164,13 @@
|
|
|
145
164
|
</span>
|
|
146
165
|
{/if}
|
|
147
166
|
</div>
|
|
148
|
-
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
{Object.keys($selectedDataIds).length} of {serverItemCount ?? $rows.length} row(s) selected.
|
|
152
|
-
{/if}
|
|
153
|
-
</div>
|
|
154
|
-
{#if isPagingEnabled}
|
|
155
|
-
<DataTablePagination tableModel={tableViewModel} {showRowsPerPage} />
|
|
156
|
-
{/if}
|
|
157
|
-
</div>
|
|
167
|
+
{#if isPaginationEnabled}
|
|
168
|
+
<Pagination {table} />
|
|
169
|
+
{/if}
|
|
158
170
|
|
|
159
|
-
{#if
|
|
171
|
+
{#if footer}
|
|
160
172
|
<div class="overflow-hidden rounded-b-md">
|
|
161
|
-
|
|
173
|
+
{@render footer()}
|
|
162
174
|
</div>
|
|
163
175
|
{/if}
|
|
164
176
|
</div>
|
|
@@ -1,41 +1,36 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
type
|
|
3
|
-
declare class __sveltets_Render<T
|
|
1
|
+
import { type ColumnDef, type Table as TypeType } from "@tanstack/svelte-table";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
declare class __sveltets_Render<T> {
|
|
4
4
|
props(): {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
table: TypeType<T>;
|
|
6
|
+
columns: ColumnDef<T>[];
|
|
7
7
|
isLoading?: boolean;
|
|
8
|
+
header?: Snippet;
|
|
9
|
+
subHeader?: Snippet;
|
|
10
|
+
footer?: Snippet;
|
|
11
|
+
leftToolbar?: Snippet;
|
|
12
|
+
rightToolbar?: Snippet;
|
|
13
|
+
noDataMessage?: string;
|
|
8
14
|
hideHeader?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
rowAction?: ((row: T | undefined) => void) | undefined;
|
|
12
|
-
showSelected?: boolean;
|
|
13
|
-
showRowsPerPage?: boolean;
|
|
15
|
+
enableVisibility?: boolean;
|
|
16
|
+
enableFullscreen?: boolean;
|
|
14
17
|
};
|
|
15
18
|
events(): {} & {
|
|
16
19
|
[evt: string]: CustomEvent<any>;
|
|
17
20
|
};
|
|
18
|
-
slots(): {
|
|
19
|
-
|
|
20
|
-
subHeader: {};
|
|
21
|
-
footer: {};
|
|
22
|
-
};
|
|
23
|
-
bindings(): string;
|
|
21
|
+
slots(): {};
|
|
22
|
+
bindings(): "";
|
|
24
23
|
exports(): {};
|
|
25
24
|
}
|
|
26
25
|
interface $$IsomorphicComponent {
|
|
27
|
-
new <T
|
|
28
|
-
children?: any;
|
|
29
|
-
}>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
26
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
30
27
|
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
31
28
|
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
32
|
-
<T
|
|
29
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {
|
|
33
30
|
$$events?: ReturnType<__sveltets_Render<T>['events']>;
|
|
34
|
-
$$slots?: ReturnType<__sveltets_Render<T>['slots']>;
|
|
35
|
-
children?: any;
|
|
36
31
|
}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
37
32
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
38
33
|
}
|
|
39
34
|
declare const DataTable: $$IsomorphicComponent;
|
|
40
|
-
type DataTable<T
|
|
35
|
+
type DataTable<T> = InstanceType<typeof DataTable<T>>;
|
|
41
36
|
export default DataTable;
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
import { Checkbox } from "../../ui/checkbox";
|
|
3
3
|
import { cn } from "../../../utils";
|
|
4
4
|
import type { ComponentProps } from "svelte";
|
|
5
|
-
import type { Writable } from "svelte/store";
|
|
6
5
|
|
|
7
|
-
interface
|
|
8
|
-
checked
|
|
6
|
+
interface Props extends Omit<ComponentProps<Checkbox>, "checked"> {
|
|
7
|
+
checked?: boolean | "indeterminate";
|
|
8
|
+
class?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
let className: $$Props["class"] = undefined;
|
|
13
|
-
export { className as class };
|
|
14
|
-
export let checked: $$Props["checked"];
|
|
11
|
+
let { checked, class: className, ...rest }: Props = $props();
|
|
15
12
|
</script>
|
|
16
13
|
|
|
17
|
-
<Checkbox bind:checked
|
|
14
|
+
<Checkbox bind:checked class={cn(className)} {...rest} />
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Writable } from "svelte/store";
|
|
2
1
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
3
|
$$bindings?: Bindings;
|
|
@@ -13,9 +12,10 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
13
12
|
z_$$bindings?: Bindings;
|
|
14
13
|
}
|
|
15
14
|
declare const DataTableCheckbox: $$__sveltets_2_IsomorphicComponent<Omit<import("bits-ui").CheckboxProps, "checked"> & {
|
|
16
|
-
checked
|
|
15
|
+
checked?: boolean | "indeterminate";
|
|
16
|
+
class?: string;
|
|
17
17
|
}, {
|
|
18
18
|
[evt: string]: CustomEvent<any>;
|
|
19
|
-
}, {}, {},
|
|
19
|
+
}, {}, {}, "">;
|
|
20
20
|
type DataTableCheckbox = InstanceType<typeof DataTableCheckbox>;
|
|
21
21
|
export default DataTableCheckbox;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kayord/ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"!dist/**/*.spec.*"
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
|
+
"@tanstack/svelte-table": "^9.0.0-alpha.10",
|
|
29
30
|
"lucide-svelte": ">= 0.400.0 < 1.0.0",
|
|
30
31
|
"svelte": "^4.0.0 || ^5.0.0-next.1",
|
|
31
32
|
"sveltekit-superforms": "^2.15.1",
|
|
32
|
-
"zod": "^3.23.8"
|
|
33
|
-
"@tanstack/svelte-table": "^9.0.0-alpha.10"
|
|
33
|
+
"zod": "^3.23.8"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@internationalized/date": "^3.5.5",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"formsnap": "^1.0.1",
|
|
42
42
|
"mode-watcher": "^0.4.1",
|
|
43
43
|
"paneforge": "^0.0.5",
|
|
44
|
-
"svelte-headless-table": "^0.18.2",
|
|
45
44
|
"svelte-sonner": "^0.3.28",
|
|
46
45
|
"tailwind-merge": "^2.5.2",
|
|
47
46
|
"tailwind-variants": "^0.2.1",
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import { Button, Select } from "../../..";
|
|
3
|
-
import { ChevronLeftIcon, ChevronRightIcon, ChevronsLeftIcon, ChevronsRightIcon } from "lucide-svelte";
|
|
4
|
-
import type { TableViewModel } from "svelte-headless-table";
|
|
5
|
-
import type { AnyPlugins } from "svelte-headless-table/plugins";
|
|
6
|
-
|
|
7
|
-
export let tableModel: TableViewModel<T, AnyPlugins>;
|
|
8
|
-
export let showRowsPerPage: boolean = false;
|
|
9
|
-
|
|
10
|
-
const { pageRows, pluginStates, rows } = tableModel;
|
|
11
|
-
|
|
12
|
-
const { hasNextPage, hasPreviousPage, pageIndex, pageCount, pageSize } = pluginStates.page;
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<div class="flex items-center justify-end space-x-6 px-2 lg:space-x-8">
|
|
16
|
-
{#if showRowsPerPage}
|
|
17
|
-
<div class="flex items-center space-x-2">
|
|
18
|
-
<p class="text-sm font-medium">Rows per page</p>
|
|
19
|
-
<Select.Root
|
|
20
|
-
onSelectedChange={(selected) => pageSize.set(Number(selected?.value))}
|
|
21
|
-
selected={{ value: 10, label: "10" }}
|
|
22
|
-
>
|
|
23
|
-
<Select.Trigger class="h-8 w-[70px]">
|
|
24
|
-
<Select.Value placeholder="Select page size" />
|
|
25
|
-
</Select.Trigger>
|
|
26
|
-
<Select.Content>
|
|
27
|
-
<Select.Item value="10">10</Select.Item>
|
|
28
|
-
<Select.Item value="20">20</Select.Item>
|
|
29
|
-
<Select.Item value="30">30</Select.Item>
|
|
30
|
-
<Select.Item value="40">40</Select.Item>
|
|
31
|
-
<Select.Item value="50">50</Select.Item>
|
|
32
|
-
</Select.Content>
|
|
33
|
-
</Select.Root>
|
|
34
|
-
</div>
|
|
35
|
-
{/if}
|
|
36
|
-
<div class="flex w-[100px] items-center justify-center text-sm font-medium">
|
|
37
|
-
Page {$pageIndex + 1} of {$pageCount}
|
|
38
|
-
</div>
|
|
39
|
-
<div class="flex items-center space-x-2">
|
|
40
|
-
<Button
|
|
41
|
-
variant="outline"
|
|
42
|
-
class="hidden h-8 w-8 p-0 lg:flex"
|
|
43
|
-
on:click={() => ($pageIndex = 0)}
|
|
44
|
-
disabled={!$hasPreviousPage}
|
|
45
|
-
>
|
|
46
|
-
<span class="sr-only">Go to first page</span>
|
|
47
|
-
<ChevronsLeftIcon size={15} />
|
|
48
|
-
</Button>
|
|
49
|
-
<Button
|
|
50
|
-
variant="outline"
|
|
51
|
-
class="h-8 w-8 p-0"
|
|
52
|
-
on:click={() => ($pageIndex = $pageIndex - 1)}
|
|
53
|
-
disabled={!$hasPreviousPage}
|
|
54
|
-
>
|
|
55
|
-
<span class="sr-only">Go to previous page</span>
|
|
56
|
-
<ChevronLeftIcon size={15} />
|
|
57
|
-
</Button>
|
|
58
|
-
<Button
|
|
59
|
-
variant="outline"
|
|
60
|
-
class="h-8 w-8 p-0"
|
|
61
|
-
disabled={!$hasNextPage}
|
|
62
|
-
on:click={() => ($pageIndex = $pageIndex + 1)}
|
|
63
|
-
>
|
|
64
|
-
<span class="sr-only">Go to next page</span>
|
|
65
|
-
<ChevronRightIcon size={15} />
|
|
66
|
-
</Button>
|
|
67
|
-
<Button
|
|
68
|
-
variant="outline"
|
|
69
|
-
class="hidden h-8 w-8 p-0 lg:flex"
|
|
70
|
-
disabled={!$hasNextPage}
|
|
71
|
-
on:click={() => ($pageIndex = Math.ceil($rows.length / $pageRows.length) - 1)}
|
|
72
|
-
>
|
|
73
|
-
<span class="sr-only">Go to last page</span>
|
|
74
|
-
<ChevronsRightIcon size={15} />
|
|
75
|
-
</Button>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { TableViewModel } from "svelte-headless-table";
|
|
2
|
-
declare class __sveltets_Render<T> {
|
|
3
|
-
props(): {
|
|
4
|
-
tableModel: TableViewModel<T, AnyPlugins>;
|
|
5
|
-
showRowsPerPage?: boolean;
|
|
6
|
-
};
|
|
7
|
-
events(): {} & {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots(): {};
|
|
11
|
-
bindings(): string;
|
|
12
|
-
exports(): {};
|
|
13
|
-
}
|
|
14
|
-
interface $$IsomorphicComponent {
|
|
15
|
-
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
16
|
-
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
17
|
-
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
18
|
-
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {
|
|
19
|
-
$$events?: ReturnType<__sveltets_Render<T>['events']>;
|
|
20
|
-
}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
22
|
-
}
|
|
23
|
-
declare const DataTablePagination: $$IsomorphicComponent;
|
|
24
|
-
type DataTablePagination<T> = InstanceType<typeof DataTablePagination<T>>;
|
|
25
|
-
export default DataTablePagination;
|
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
export const data = [
|
|
2
|
-
{
|
|
3
|
-
id: "6571688d9f0abce385f90f19",
|
|
4
|
-
amount: 3251.85,
|
|
5
|
-
status: "processing",
|
|
6
|
-
email: "booneellis@hydrocom.com",
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
id: "6571688d16c5c39d87365775",
|
|
10
|
-
amount: 3990.8,
|
|
11
|
-
status: "pending",
|
|
12
|
-
email: "booneellis@hydrocom.com",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: "6571688dabee1f8960a07e79",
|
|
16
|
-
amount: 3802.42,
|
|
17
|
-
status: "success",
|
|
18
|
-
email: "booneellis@hydrocom.com",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "6571688d806e36ee570c326c",
|
|
22
|
-
amount: 3823.47,
|
|
23
|
-
status: "success",
|
|
24
|
-
email: "booneellis@hydrocom.com",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: "6571688ddcf972ded016aeca",
|
|
28
|
-
amount: 3355.74,
|
|
29
|
-
status: "failed",
|
|
30
|
-
email: "booneellis@hydrocom.com",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: "6571688da322842d9f5b675e",
|
|
34
|
-
amount: 2530.82,
|
|
35
|
-
status: "processing",
|
|
36
|
-
email: "booneellis@hydrocom.com",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "6571688d810ec3fcb8e66c50",
|
|
40
|
-
amount: 1056.29,
|
|
41
|
-
status: "failed",
|
|
42
|
-
email: "booneellis@hydrocom.com",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: "6571688d84b2863f0550c31e",
|
|
46
|
-
amount: 1319.59,
|
|
47
|
-
status: "processing",
|
|
48
|
-
email: "booneellis@hydrocom.com",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: "6571688de4d06ba36da0b2b1",
|
|
52
|
-
amount: 2289.99,
|
|
53
|
-
status: "failed",
|
|
54
|
-
email: "booneellis@hydrocom.com",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: "6571688dd3d4930e83e980bb",
|
|
58
|
-
amount: 1511.24,
|
|
59
|
-
status: "pending",
|
|
60
|
-
email: "booneellis@hydrocom.com",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
id: "6571688d9b2850305cbf9806",
|
|
64
|
-
amount: 1819.05,
|
|
65
|
-
status: "failed",
|
|
66
|
-
email: "booneellis@hydrocom.com",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: "6571688d0e2c8d403d9415a0",
|
|
70
|
-
amount: 1951.76,
|
|
71
|
-
status: "processing",
|
|
72
|
-
email: "booneellis@hydrocom.com",
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
id: "6571688df69ff77326a893f5",
|
|
76
|
-
amount: 2148.92,
|
|
77
|
-
status: "failed",
|
|
78
|
-
email: "booneellis@hydrocom.com",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "6571688deccddaa29de2f440",
|
|
82
|
-
amount: 2012.9,
|
|
83
|
-
status: "pending",
|
|
84
|
-
email: "booneellis@hydrocom.com",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: "6571688d448edf3bbdbc5c75",
|
|
88
|
-
amount: 1943.19,
|
|
89
|
-
status: "processing",
|
|
90
|
-
email: "booneellis@hydrocom.com",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: "6571688d81dd591cf6938d1b",
|
|
94
|
-
amount: 3879.18,
|
|
95
|
-
status: "failed",
|
|
96
|
-
email: "booneellis@hydrocom.com",
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
id: "6571688d8f6e9c3423e785b7",
|
|
100
|
-
amount: 2079.08,
|
|
101
|
-
status: "failed",
|
|
102
|
-
email: "booneellis@hydrocom.com",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
id: "6571688d84bfe2b4524cef0c",
|
|
106
|
-
amount: 2327.12,
|
|
107
|
-
status: "processing",
|
|
108
|
-
email: "booneellis@hydrocom.com",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: "6571688d0c506227be2ed29e",
|
|
112
|
-
amount: 3005.73,
|
|
113
|
-
status: "success",
|
|
114
|
-
email: "booneellis@hydrocom.com",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: "6571688d3558512f453741e5",
|
|
118
|
-
amount: 3759.09,
|
|
119
|
-
status: "processing",
|
|
120
|
-
email: "booneellis@hydrocom.com",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: "6571688d861e5902ca9c81ce",
|
|
124
|
-
amount: 1348.46,
|
|
125
|
-
status: "pending",
|
|
126
|
-
email: "booneellis@hydrocom.com",
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
id: "6571688dd14ec6fb48d51555",
|
|
130
|
-
amount: 2155.21,
|
|
131
|
-
status: "failed",
|
|
132
|
-
email: "booneellis@hydrocom.com",
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
id: "6571688ddab7f441f3b3b707",
|
|
136
|
-
amount: 2456.19,
|
|
137
|
-
status: "processing",
|
|
138
|
-
email: "booneellis@hydrocom.com",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
id: "6571688d5e9513b4e88c2d22",
|
|
142
|
-
amount: 2923.2,
|
|
143
|
-
status: "processing",
|
|
144
|
-
email: "booneellis@hydrocom.com",
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
id: "6571688d516b86893e68018c",
|
|
148
|
-
amount: 3191.41,
|
|
149
|
-
status: "failed",
|
|
150
|
-
email: "booneellis@hydrocom.com",
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
id: "6571688ddb067254dac9ab2b",
|
|
154
|
-
amount: 3847.64,
|
|
155
|
-
status: "processing",
|
|
156
|
-
email: "booneellis@hydrocom.com",
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
id: "6571688d39328a179413e29a",
|
|
160
|
-
amount: 3104.91,
|
|
161
|
-
status: "failed",
|
|
162
|
-
email: "booneellis@hydrocom.com",
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
id: "6571688d41c9c2a44423f21e",
|
|
166
|
-
amount: 2295.64,
|
|
167
|
-
status: "failed",
|
|
168
|
-
email: "booneellis@hydrocom.com",
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: "6571688dbe4e3344e7095a5f",
|
|
172
|
-
amount: 1036.06,
|
|
173
|
-
status: "success",
|
|
174
|
-
email: "booneellis@hydrocom.com",
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
id: "6571688df832d2beefc2d4b8",
|
|
178
|
-
amount: 3391.3,
|
|
179
|
-
status: "pending",
|
|
180
|
-
email: "booneellis@hydrocom.com",
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
id: "6571688d27d143c06cf7d538",
|
|
184
|
-
amount: 3109.48,
|
|
185
|
-
status: "success",
|
|
186
|
-
email: "booneellis@hydrocom.com",
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
id: "6571688df2823cc7272da879",
|
|
190
|
-
amount: 3822.19,
|
|
191
|
-
status: "failed",
|
|
192
|
-
email: "booneellis@hydrocom.com",
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
id: "6571688de4eb5e94cf60bcd2",
|
|
196
|
-
amount: 2526.2,
|
|
197
|
-
status: "success",
|
|
198
|
-
email: "booneellis@hydrocom.com",
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
id: "6571688df199424fd086ff48",
|
|
202
|
-
amount: 3775.85,
|
|
203
|
-
status: "failed",
|
|
204
|
-
email: "booneellis@hydrocom.com",
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
id: "6571688d70ecf0e6272da909",
|
|
208
|
-
amount: 3522.49,
|
|
209
|
-
status: "failed",
|
|
210
|
-
email: "booneellis@hydrocom.com",
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: "6571688d6d31ec3cb133046b",
|
|
214
|
-
amount: 1738.86,
|
|
215
|
-
status: "pending",
|
|
216
|
-
email: "booneellis@hydrocom.com",
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
id: "6571688d0e957b5f897ed8ce",
|
|
220
|
-
amount: 3362.06,
|
|
221
|
-
status: "processing",
|
|
222
|
-
email: "booneellis@hydrocom.com",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
id: "6571688d06d065921d92c32e",
|
|
226
|
-
amount: 1311.72,
|
|
227
|
-
status: "success",
|
|
228
|
-
email: "booneellis@hydrocom.com",
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
id: "6571688d45b2c5e27d04cf40",
|
|
232
|
-
amount: 3831.03,
|
|
233
|
-
status: "pending",
|
|
234
|
-
email: "booneellis@hydrocom.com",
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
id: "6571688d2cbf8c51474eb602",
|
|
238
|
-
amount: 1850.78,
|
|
239
|
-
status: "success",
|
|
240
|
-
email: "booneellis@hydrocom.com",
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
id: "6571688d16290d3f20d4daee",
|
|
244
|
-
amount: 1732.43,
|
|
245
|
-
status: "pending",
|
|
246
|
-
email: "booneellis@hydrocom.com",
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
id: "6571688dcda116e6798d4bae",
|
|
250
|
-
amount: 3852.99,
|
|
251
|
-
status: "failed",
|
|
252
|
-
email: "booneellis@hydrocom.com",
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
id: "6571688d5996339d8c18205b",
|
|
256
|
-
amount: 2717.96,
|
|
257
|
-
status: "success",
|
|
258
|
-
email: "booneellis@hydrocom.com",
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
id: "6571688d7a3f16b9aec84fa6",
|
|
262
|
-
amount: 2731.06,
|
|
263
|
-
status: "pending",
|
|
264
|
-
email: "booneellis@hydrocom.com",
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
id: "6571688d97b853eb9d7736ac",
|
|
268
|
-
amount: 1856.39,
|
|
269
|
-
status: "failed",
|
|
270
|
-
email: "booneellis@hydrocom.com",
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
id: "6571688d1d714ee82c096662",
|
|
274
|
-
amount: 2853.75,
|
|
275
|
-
status: "success",
|
|
276
|
-
email: "booneellis@hydrocom.com",
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
id: "6571688dfe47c72110657d3b",
|
|
280
|
-
amount: 2532.9,
|
|
281
|
-
status: "success",
|
|
282
|
-
email: "booneellis@hydrocom.com",
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: "6571688d3e4ce96490c3bad6",
|
|
286
|
-
amount: 2962.35,
|
|
287
|
-
status: "failed",
|
|
288
|
-
email: "booneellis@hydrocom.com",
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
id: "6571688d77af0b83c0d3f7c6",
|
|
292
|
-
amount: 3024.45,
|
|
293
|
-
status: "success",
|
|
294
|
-
email: "booneellis@hydrocom.com",
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
id: "6571688d3e1920bb93ac12a2",
|
|
298
|
-
amount: 2292.58,
|
|
299
|
-
status: "pending",
|
|
300
|
-
email: "booneellis@hydrocom.com",
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
id: "6571688d2183f305b6cbed72",
|
|
304
|
-
amount: 1820.61,
|
|
305
|
-
status: "failed",
|
|
306
|
-
email: "booneellis@hydrocom.com",
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
id: "6571688da48439ee80d276cd",
|
|
310
|
-
amount: 2544.19,
|
|
311
|
-
status: "success",
|
|
312
|
-
email: "booneellis@hydrocom.com",
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
id: "6571688d15c1368942e23e3a",
|
|
316
|
-
amount: 2054.55,
|
|
317
|
-
status: "processing",
|
|
318
|
-
email: "booneellis@hydrocom.com",
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
id: "6571688d0170dc46f4fcbfe6",
|
|
322
|
-
amount: 3567.82,
|
|
323
|
-
status: "processing",
|
|
324
|
-
email: "booneellis@hydrocom.com",
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
id: "6571688d3c68bef4bca4c670",
|
|
328
|
-
amount: 2842.55,
|
|
329
|
-
status: "processing",
|
|
330
|
-
email: "booneellis@hydrocom.com",
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
id: "6571688d09de886493b05ee0",
|
|
334
|
-
amount: 3123.12,
|
|
335
|
-
status: "success",
|
|
336
|
-
email: "booneellis@hydrocom.com",
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
id: "6571688d2c572aaa292b6c3f",
|
|
340
|
-
amount: 1849.11,
|
|
341
|
-
status: "success",
|
|
342
|
-
email: "booneellis@hydrocom.com",
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
id: "6571688d6e4d00a58e20c090",
|
|
346
|
-
amount: 1010.01,
|
|
347
|
-
status: "pending",
|
|
348
|
-
email: "booneellis@hydrocom.com",
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
id: "6571688df71c1c1f9b472f68",
|
|
352
|
-
amount: 2064.62,
|
|
353
|
-
status: "pending",
|
|
354
|
-
email: "booneellis@hydrocom.com",
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
id: "6571688de159964144606d23",
|
|
358
|
-
amount: 1073.91,
|
|
359
|
-
status: "success",
|
|
360
|
-
email: "booneellis@hydrocom.com",
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
id: "6571688d6fe0fa01f2d75bdf",
|
|
364
|
-
amount: 2239.24,
|
|
365
|
-
status: "processing",
|
|
366
|
-
email: "booneellis@hydrocom.com",
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
id: "6571688de6d27c9852528f3f",
|
|
370
|
-
amount: 2447.85,
|
|
371
|
-
status: "success",
|
|
372
|
-
email: "booneellis@hydrocom.com",
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
id: "6571688d40ae4820a039d25e",
|
|
376
|
-
amount: 2019.19,
|
|
377
|
-
status: "failed",
|
|
378
|
-
email: "booneellis@hydrocom.com",
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
id: "6571688d5da2eb24dc22673f",
|
|
382
|
-
amount: 1115.44,
|
|
383
|
-
status: "processing",
|
|
384
|
-
email: "booneellis@hydrocom.com",
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
id: "6571688d39c99eb24989b518",
|
|
388
|
-
amount: 3345.75,
|
|
389
|
-
status: "failed",
|
|
390
|
-
email: "booneellis@hydrocom.com",
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
id: "6571688d6884c37efcca0e29",
|
|
394
|
-
amount: 2341.32,
|
|
395
|
-
status: "processing",
|
|
396
|
-
email: "booneellis@hydrocom.com",
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
id: "6571688d1ed1c61ba1d4fc93",
|
|
400
|
-
amount: 2288.04,
|
|
401
|
-
status: "pending",
|
|
402
|
-
email: "booneellis@hydrocom.com",
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
id: "6571688d19b99bb0bcff11bd",
|
|
406
|
-
amount: 1493.28,
|
|
407
|
-
status: "pending",
|
|
408
|
-
email: "booneellis@hydrocom.com",
|
|
409
|
-
},
|
|
410
|
-
];
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import { FlexRender, type ColumnDef, type Table as TypeType, renderComponent } from "@tanstack/svelte-table";
|
|
3
|
-
import { Skeleton, Table } from "../../ui";
|
|
4
|
-
import Pagination from "./Pagination.svelte";
|
|
5
|
-
import type { Snippet } from "svelte";
|
|
6
|
-
import { fade } from "svelte/transition";
|
|
7
|
-
import { ProgressLoading } from "../progress-loading";
|
|
8
|
-
import DataTableCheckbox from "./DataTableCheckbox.svelte";
|
|
9
|
-
import VisibilitySelect from "./VisibilitySelect.svelte";
|
|
10
|
-
import FullscreenModeToggle from "./FullscreenModeToggle.svelte";
|
|
11
|
-
import { cn } from "../../../utils";
|
|
12
|
-
import { tableStore } from "./table.svelte";
|
|
13
|
-
|
|
14
|
-
interface Props<T> {
|
|
15
|
-
table: TypeType<T>;
|
|
16
|
-
columns: ColumnDef<T>[];
|
|
17
|
-
isLoading?: boolean;
|
|
18
|
-
header?: Snippet;
|
|
19
|
-
subHeader?: Snippet;
|
|
20
|
-
footer?: Snippet;
|
|
21
|
-
leftToolbar?: Snippet;
|
|
22
|
-
rightToolbar?: Snippet;
|
|
23
|
-
noDataMessage?: string;
|
|
24
|
-
hideHeader?: boolean;
|
|
25
|
-
enableVisibility?: boolean;
|
|
26
|
-
enableFullscreen?: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let {
|
|
30
|
-
table,
|
|
31
|
-
columns,
|
|
32
|
-
isLoading = false,
|
|
33
|
-
header,
|
|
34
|
-
subHeader,
|
|
35
|
-
footer,
|
|
36
|
-
leftToolbar,
|
|
37
|
-
rightToolbar,
|
|
38
|
-
noDataMessage = "No data",
|
|
39
|
-
hideHeader = false,
|
|
40
|
-
enableVisibility = false,
|
|
41
|
-
enableFullscreen = false,
|
|
42
|
-
}: Props<T> = $props();
|
|
43
|
-
|
|
44
|
-
const isPaginationEnabled = table.options.getPaginationRowModel !== undefined;
|
|
45
|
-
const enableRowSelection = table.options.enableRowSelection;
|
|
46
|
-
|
|
47
|
-
if (enableRowSelection) {
|
|
48
|
-
const rowSelectionColumn: ColumnDef<T> = {
|
|
49
|
-
id: "select",
|
|
50
|
-
// cell: (info) => "[]",
|
|
51
|
-
header: () =>
|
|
52
|
-
renderComponent(DataTableCheckbox, {
|
|
53
|
-
checked: table.getIsAllPageRowsSelected(),
|
|
54
|
-
onCheckedChange: () => table.toggleAllPageRowsSelected(),
|
|
55
|
-
}),
|
|
56
|
-
cell: (r) =>
|
|
57
|
-
renderComponent(DataTableCheckbox, {
|
|
58
|
-
checked: r.row.getIsSelected(),
|
|
59
|
-
onCheckedChange: () => r.row.toggleSelected(),
|
|
60
|
-
}),
|
|
61
|
-
enableResizing: false,
|
|
62
|
-
};
|
|
63
|
-
columns.unshift(rowSelectionColumn);
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<div
|
|
68
|
-
class={cn(
|
|
69
|
-
"w-full",
|
|
70
|
-
tableStore.isFullscreen ? "absolute left-0 top-0 z-10 h-screen bg-background transition-all" : "w-full"
|
|
71
|
-
)}
|
|
72
|
-
>
|
|
73
|
-
<div class="py-2">
|
|
74
|
-
{#if header}
|
|
75
|
-
{@render header()}
|
|
76
|
-
{:else}
|
|
77
|
-
<div class="flex items-center justify-between gap-2">
|
|
78
|
-
<div>
|
|
79
|
-
{#if leftToolbar}
|
|
80
|
-
{@render leftToolbar()}
|
|
81
|
-
{/if}
|
|
82
|
-
</div>
|
|
83
|
-
<div></div>
|
|
84
|
-
<div class="flex items-center justify-between gap-2">
|
|
85
|
-
{#if rightToolbar}
|
|
86
|
-
{@render rightToolbar()}
|
|
87
|
-
{/if}
|
|
88
|
-
{#if enableVisibility}
|
|
89
|
-
<div>
|
|
90
|
-
<VisibilitySelect {table} />
|
|
91
|
-
</div>
|
|
92
|
-
{/if}
|
|
93
|
-
{#if enableFullscreen}
|
|
94
|
-
<div>
|
|
95
|
-
<FullscreenModeToggle />
|
|
96
|
-
</div>
|
|
97
|
-
{/if}
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
{/if}
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
<div class="rounded-md border">
|
|
104
|
-
{#if isLoading}
|
|
105
|
-
<span in:fade={{ duration: 300 }}>
|
|
106
|
-
<ProgressLoading class="h-1" />
|
|
107
|
-
</span>
|
|
108
|
-
{/if}
|
|
109
|
-
|
|
110
|
-
{#if subHeader}
|
|
111
|
-
{@render subHeader()}
|
|
112
|
-
{/if}
|
|
113
|
-
|
|
114
|
-
<Table.Root class="table-auto">
|
|
115
|
-
{#if !hideHeader}
|
|
116
|
-
<Table.Header>
|
|
117
|
-
{#each table.getHeaderGroups() as headerGroup}
|
|
118
|
-
<Table.Row>
|
|
119
|
-
{#each headerGroup.headers as header}
|
|
120
|
-
<Table.Head colspan={header.colSpan}>
|
|
121
|
-
{#if !header.isPlaceholder}
|
|
122
|
-
<FlexRender content={header.column.columnDef.header} context={header.getContext()} />
|
|
123
|
-
{/if}
|
|
124
|
-
</Table.Head>
|
|
125
|
-
{/each}
|
|
126
|
-
</Table.Row>
|
|
127
|
-
{/each}
|
|
128
|
-
</Table.Header>
|
|
129
|
-
{/if}
|
|
130
|
-
<Table.Body>
|
|
131
|
-
{#if isLoading && table.getRowModel().rows.length == 0}
|
|
132
|
-
{#each { length: 5 } as _, i}
|
|
133
|
-
<Table.Row>
|
|
134
|
-
{#each columns as _cell}
|
|
135
|
-
<Table.Cell>
|
|
136
|
-
<Skeleton class="h-4" />
|
|
137
|
-
</Table.Cell>
|
|
138
|
-
{/each}
|
|
139
|
-
</Table.Row>
|
|
140
|
-
{/each}
|
|
141
|
-
{:else}
|
|
142
|
-
{#if table.getRowModel().rows.length == 0}
|
|
143
|
-
<Table.Row>
|
|
144
|
-
<Table.Cell colspan={table.getRowModel().rows.length}>
|
|
145
|
-
<div class="text-center">{noDataMessage}</div>
|
|
146
|
-
</Table.Cell>
|
|
147
|
-
</Table.Row>
|
|
148
|
-
{/if}
|
|
149
|
-
{#each table.getRowModel().rows as row}
|
|
150
|
-
<Table.Row data-state={row.getIsSelected() && "selected"}>
|
|
151
|
-
{#each row.getVisibleCells() as cell}
|
|
152
|
-
<Table.Cell style={`width: ${cell.getContext().column.getSize()}px;`}>
|
|
153
|
-
<FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />
|
|
154
|
-
</Table.Cell>
|
|
155
|
-
{/each}
|
|
156
|
-
</Table.Row>
|
|
157
|
-
{/each}
|
|
158
|
-
{/if}
|
|
159
|
-
</Table.Body>
|
|
160
|
-
</Table.Root>
|
|
161
|
-
{#if isLoading}
|
|
162
|
-
<span in:fade={{ duration: 300 }}>
|
|
163
|
-
<ProgressLoading class="h-1" />
|
|
164
|
-
</span>
|
|
165
|
-
{/if}
|
|
166
|
-
</div>
|
|
167
|
-
{#if isPaginationEnabled}
|
|
168
|
-
<Pagination {table} />
|
|
169
|
-
{/if}
|
|
170
|
-
|
|
171
|
-
{#if footer}
|
|
172
|
-
<div class="overflow-hidden rounded-b-md">
|
|
173
|
-
{@render footer()}
|
|
174
|
-
</div>
|
|
175
|
-
{/if}
|
|
176
|
-
</div>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type ColumnDef, type Table as TypeType } from "@tanstack/svelte-table";
|
|
2
|
-
import type { Snippet } from "svelte";
|
|
3
|
-
declare class __sveltets_Render<T> {
|
|
4
|
-
props(): {
|
|
5
|
-
table: TypeType<T>;
|
|
6
|
-
columns: ColumnDef<T>[];
|
|
7
|
-
isLoading?: boolean;
|
|
8
|
-
header?: Snippet;
|
|
9
|
-
subHeader?: Snippet;
|
|
10
|
-
footer?: Snippet;
|
|
11
|
-
leftToolbar?: Snippet;
|
|
12
|
-
rightToolbar?: Snippet;
|
|
13
|
-
noDataMessage?: string;
|
|
14
|
-
hideHeader?: boolean;
|
|
15
|
-
enableVisibility?: boolean;
|
|
16
|
-
enableFullscreen?: boolean;
|
|
17
|
-
};
|
|
18
|
-
events(): {} & {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots(): {};
|
|
22
|
-
bindings(): "";
|
|
23
|
-
exports(): {};
|
|
24
|
-
}
|
|
25
|
-
interface $$IsomorphicComponent {
|
|
26
|
-
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
27
|
-
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
28
|
-
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
29
|
-
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {
|
|
30
|
-
$$events?: ReturnType<__sveltets_Render<T>['events']>;
|
|
31
|
-
}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
32
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
33
|
-
}
|
|
34
|
-
declare const DataTable: $$IsomorphicComponent;
|
|
35
|
-
type DataTable<T> = InstanceType<typeof DataTable<T>>;
|
|
36
|
-
export default DataTable;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Checkbox } from "../../ui/checkbox";
|
|
3
|
-
import { cn } from "../../../utils";
|
|
4
|
-
import type { ComponentProps } from "svelte";
|
|
5
|
-
|
|
6
|
-
interface Props extends Omit<ComponentProps<Checkbox>, "checked"> {
|
|
7
|
-
checked?: boolean | "indeterminate";
|
|
8
|
-
class?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let { checked, class: className, ...rest }: Props = $props();
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<Checkbox bind:checked class={cn(className)} {...rest} />
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const DataTableCheckbox: $$__sveltets_2_IsomorphicComponent<Omit<import("bits-ui").CheckboxProps, "checked"> & {
|
|
15
|
-
checked?: boolean | "indeterminate";
|
|
16
|
-
class?: string;
|
|
17
|
-
}, {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
}, {}, {}, "">;
|
|
20
|
-
type DataTableCheckbox = InstanceType<typeof DataTableCheckbox>;
|
|
21
|
-
export default DataTableCheckbox;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as DataTableNew } from "./DataTable.svelte";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as DataTableNew } from "./DataTable.svelte";
|
|
File without changes
|
/package/dist/components/custom/{data-table-new → data-table}/FullscreenModeToggle.svelte.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|