@kayord/ui 2.1.4 → 2.1.6
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.
|
@@ -103,12 +103,15 @@
|
|
|
103
103
|
// Set url search params
|
|
104
104
|
$effect(() => {
|
|
105
105
|
if (table.options.useURLSearchParams) {
|
|
106
|
-
const
|
|
106
|
+
const search = table.getState().globalFilter;
|
|
107
|
+
const page = table.getState().pagination.pageIndex;
|
|
108
|
+
const sort = encodeSorting(table.getState());
|
|
109
|
+
const filter = encodeColumnFilters(table.getState());
|
|
107
110
|
untrack(() => {
|
|
108
|
-
params.search =
|
|
109
|
-
params.page =
|
|
110
|
-
params.sort =
|
|
111
|
-
params.filter =
|
|
111
|
+
params.search = search;
|
|
112
|
+
params.page = page;
|
|
113
|
+
params.sort = sort;
|
|
114
|
+
params.filter = filter;
|
|
112
115
|
});
|
|
113
116
|
}
|
|
114
117
|
});
|
|
@@ -195,7 +198,7 @@
|
|
|
195
198
|
|
|
196
199
|
<Table.Body>
|
|
197
200
|
{#if isLoading && table.getRowModel().rows.length == 0}
|
|
198
|
-
{#each { length: 5 }
|
|
201
|
+
{#each { length: 5 }, i (i)}
|
|
199
202
|
<Table.Row>
|
|
200
203
|
{#each table.getAllColumns() as _cell (_cell)}
|
|
201
204
|
<Table.Cell>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type RowData, type RowModel, type Table
|
|
2
|
-
|
|
1
|
+
import { type RowData, type RowModel, type Table } from "@tanstack/table-core";
|
|
2
|
+
import type { BaseOptions } from "./types";
|
|
3
|
+
interface ShadTableOptions<TData extends RowData> extends BaseOptions<TData> {
|
|
3
4
|
getCoreRowModel?: (table: Table<any>) => () => RowModel<any>;
|
|
4
5
|
enablePaging?: boolean;
|
|
5
6
|
enableVisibility?: boolean;
|
|
@@ -10,10 +10,10 @@ export function createShadTable(shadOptions) {
|
|
|
10
10
|
return () => { };
|
|
11
11
|
});
|
|
12
12
|
const defaultOptions = {
|
|
13
|
-
columns: shadOptions.columns,
|
|
14
13
|
get data() {
|
|
15
14
|
return shadOptions.data;
|
|
16
15
|
},
|
|
16
|
+
columns: shadOptions.columns,
|
|
17
17
|
getCoreRowModel: getCoreRowModel(),
|
|
18
18
|
getPaginationRowModel: getPaginationRowModel(),
|
|
19
19
|
getSortedRowModel: getSortedRowModel(),
|
|
@@ -25,10 +25,7 @@ export function createShadTable(shadOptions) {
|
|
|
25
25
|
// enableFilters: true,
|
|
26
26
|
enableGlobalFilter: true,
|
|
27
27
|
onSortingChange: (updater) => {
|
|
28
|
-
if (
|
|
29
|
-
options.state.sorting = typeof updater === "function" ? updater(options.state.sorting) : updater;
|
|
30
|
-
}
|
|
31
|
-
else if (state.sorting) {
|
|
28
|
+
if (state.sorting) {
|
|
32
29
|
state.sorting = typeof updater === "function" ? updater(state.sorting) : updater;
|
|
33
30
|
}
|
|
34
31
|
notifyTableUpdate?.();
|
|
@@ -43,49 +40,31 @@ export function createShadTable(shadOptions) {
|
|
|
43
40
|
// columnPinning = typeof updater === "function" ? updater(columnPinning) : updater;
|
|
44
41
|
// },
|
|
45
42
|
onColumnVisibilityChange: (updater) => {
|
|
46
|
-
if (
|
|
47
|
-
options.state.columnVisibility =
|
|
48
|
-
typeof updater === "function" ? updater(options.state.columnVisibility) : updater;
|
|
49
|
-
}
|
|
50
|
-
else if (state.columnVisibility) {
|
|
43
|
+
if (state.columnVisibility) {
|
|
51
44
|
state.columnVisibility = typeof updater === "function" ? updater(state.columnVisibility) : updater;
|
|
52
45
|
}
|
|
53
46
|
notifyTableUpdate?.();
|
|
54
47
|
},
|
|
55
48
|
onPaginationChange: (updater) => {
|
|
56
|
-
if (
|
|
57
|
-
options.state.pagination = typeof updater === "function" ? updater(options.state.pagination) : updater;
|
|
58
|
-
}
|
|
59
|
-
else if (state.pagination) {
|
|
49
|
+
if (state.pagination) {
|
|
60
50
|
state.pagination = typeof updater === "function" ? updater(state.pagination) : updater;
|
|
61
51
|
}
|
|
62
52
|
notifyTableUpdate?.();
|
|
63
53
|
},
|
|
64
54
|
onColumnFiltersChange: (updater) => {
|
|
65
|
-
if (
|
|
66
|
-
options.state.columnFilters = typeof updater === "function" ? updater(options.state.columnFilters) : updater;
|
|
67
|
-
}
|
|
68
|
-
else if (state.columnFilters) {
|
|
55
|
+
if (state.columnFilters) {
|
|
69
56
|
state.columnFilters = typeof updater === "function" ? updater(state.columnFilters) : updater;
|
|
70
57
|
}
|
|
71
58
|
notifyTableUpdate?.();
|
|
72
59
|
},
|
|
73
60
|
onRowSelectionChange: (updater) => {
|
|
74
|
-
if (
|
|
75
|
-
options.state.rowSelection = typeof updater === "function" ? updater(options.state.rowSelection) : updater;
|
|
76
|
-
}
|
|
77
|
-
else if (state.rowSelection) {
|
|
61
|
+
if (state.rowSelection) {
|
|
78
62
|
state.rowSelection = typeof updater === "function" ? updater(state.rowSelection) : updater;
|
|
79
63
|
}
|
|
80
64
|
notifyTableUpdate?.();
|
|
81
65
|
},
|
|
82
66
|
onGlobalFilterChange: (updater) => {
|
|
83
|
-
|
|
84
|
-
options.state.globalFilter = typeof updater === "function" ? updater(options.state.globalFilter) : updater;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
state.globalFilter = typeof updater === "function" ? updater(state.globalFilter) : updater;
|
|
88
|
-
}
|
|
67
|
+
state.globalFilter = typeof updater === "function" ? updater(state.globalFilter) : updater;
|
|
89
68
|
notifyTableUpdate?.();
|
|
90
69
|
},
|
|
91
70
|
};
|
|
@@ -96,8 +75,6 @@ export function createShadTable(shadOptions) {
|
|
|
96
75
|
defaultOptions.getPaginationRowModel = undefined;
|
|
97
76
|
defaultOptions.manualPagination = true;
|
|
98
77
|
}
|
|
99
|
-
// Use default but extend with shadOptions, excluding data to preserve reactivity.
|
|
100
|
-
// Using mergeObjects to keep getter in tact
|
|
101
78
|
const options = mergeObjects(defaultOptions, shadOptions ?? {});
|
|
102
79
|
const resolvedOptions = mergeObjects({
|
|
103
80
|
state: {},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kayord/ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.6",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -110,9 +110,9 @@
|
|
|
110
110
|
"@eslint/compat": "^2.0.1",
|
|
111
111
|
"@eslint/js": "^9.39.2",
|
|
112
112
|
"@internationalized/date": "^3.10.1",
|
|
113
|
-
"@lucide/svelte": "^0.
|
|
113
|
+
"@lucide/svelte": "^0.563.1",
|
|
114
114
|
"@sveltejs/adapter-auto": "^7.0.0",
|
|
115
|
-
"@sveltejs/kit": "^2.50.
|
|
115
|
+
"@sveltejs/kit": "^2.50.1",
|
|
116
116
|
"@sveltejs/package": "^2.5.7",
|
|
117
117
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
118
118
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"eslint-config-prettier": "^10.1.8",
|
|
128
128
|
"eslint-plugin-svelte": "^3.14.0",
|
|
129
129
|
"formsnap": "^2.0.1",
|
|
130
|
-
"globals": "^17.
|
|
130
|
+
"globals": "^17.1.0",
|
|
131
131
|
"layerchart": "2.0.0-next.40",
|
|
132
132
|
"mode-watcher": "^1.1.0",
|
|
133
133
|
"paneforge": "^1.0.2",
|