@kayord/ui 4.0.0 → 4.0.2
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.
|
@@ -26,10 +26,8 @@
|
|
|
26
26
|
</p>
|
|
27
27
|
{/if}
|
|
28
28
|
<p>
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
of {table.options.data.length.toLocaleString()} rows
|
|
32
|
-
{/if}
|
|
29
|
+
{table.getRowModel().rows.length.toLocaleString()}
|
|
30
|
+
of {table.getRowCount().toLocaleString()} rows
|
|
33
31
|
</p>
|
|
34
32
|
</div>
|
|
35
33
|
<div class="flex items-center gap-6 lg:gap-8">
|
|
@@ -5,7 +5,7 @@ export type ControlledState = Partial<TableState<DataTableFeatures>>;
|
|
|
5
5
|
export type ShadTableOptions<TData extends RowData> = BaseOptions<TData> & {
|
|
6
6
|
enableRowSelectionUI?: boolean;
|
|
7
7
|
controlledState?: ControlledState;
|
|
8
|
-
resetPageIndexOn?: Array<keyof ControlledState
|
|
8
|
+
resetPageIndexOn?: Array<keyof ControlledState> | undefined;
|
|
9
9
|
};
|
|
10
10
|
export declare function createShadTable<TData extends RowData>(shadOptions: ShadTableOptions<TData>): Table<DataTableFeatures, TData>;
|
|
11
11
|
export { features };
|
|
@@ -3,15 +3,18 @@ import DataTableCheckbox from "./DataTableCheckbox.svelte";
|
|
|
3
3
|
import { renderComponent } from "../../ui/data-table";
|
|
4
4
|
import { features } from "./features";
|
|
5
5
|
export function createShadTable(shadOptions) {
|
|
6
|
-
const { enableRowSelectionUI = true, controlledState, resetPageIndexOn
|
|
6
|
+
const { enableRowSelectionUI = true, controlledState, resetPageIndexOn, ...rest } = shadOptions;
|
|
7
7
|
const externalHandlers = {};
|
|
8
8
|
if (controlledState) {
|
|
9
|
+
// Default: reset the page index on any controlled state change.
|
|
10
|
+
const resetKeys = resetPageIndexOn ?? Object.keys(controlledState);
|
|
9
11
|
for (const key of Object.keys(controlledState)) {
|
|
10
|
-
const resetPage =
|
|
12
|
+
const resetPage = resetKeys.includes(key);
|
|
11
13
|
externalHandlers[`on${key.charAt(0).toUpperCase()}${key.slice(1)}Change`] = (updater) => {
|
|
12
14
|
const record = controlledState;
|
|
13
15
|
record[key] = functionalUpdate(updater, record[key]);
|
|
14
|
-
|
|
16
|
+
// Never reset the page because the page itself changed.
|
|
17
|
+
if (resetPage && key !== "pagination" && controlledState.pagination) {
|
|
15
18
|
controlledState.pagination = { ...controlledState.pagination, pageIndex: 0 };
|
|
16
19
|
}
|
|
17
20
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kayord/ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/kayordDX/ui.git"
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"bits-ui": "2.
|
|
110
|
+
"bits-ui": "2.19.0",
|
|
111
111
|
"clsx": "^2.1.1",
|
|
112
112
|
"runed": "^0.37.1",
|
|
113
113
|
"tailwind-merge": "^3.6.0",
|
|
@@ -118,46 +118,46 @@
|
|
|
118
118
|
"@eslint/compat": "^2.1.0",
|
|
119
119
|
"@eslint/js": "^10.0.1",
|
|
120
120
|
"@internationalized/date": "^3.12.3",
|
|
121
|
-
"@lucide/svelte": "^1.
|
|
121
|
+
"@lucide/svelte": "^1.34.0",
|
|
122
122
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
123
|
-
"@sveltejs/kit": "^2.70.
|
|
123
|
+
"@sveltejs/kit": "^2.70.3",
|
|
124
124
|
"@sveltejs/package": "^2.5.8",
|
|
125
125
|
"@sveltejs/vite-plugin-svelte": "7.3.0",
|
|
126
126
|
"@tailwindcss/vite": "^4.3.3",
|
|
127
127
|
"@tanstack/svelte-table": "^9.1.2",
|
|
128
128
|
"@types/d3-scale": "^4.0.9",
|
|
129
|
-
"@types/d3-shape": "^3.
|
|
130
|
-
"@vitest/browser": "^4.1.
|
|
131
|
-
"@vitest/browser-playwright": "^4.1.
|
|
129
|
+
"@types/d3-shape": "^3.2.0",
|
|
130
|
+
"@vitest/browser": "^4.1.11",
|
|
131
|
+
"@vitest/browser-playwright": "^4.1.11",
|
|
132
132
|
"d3-scale": "^4.0.2",
|
|
133
133
|
"d3-shape": "^3.2.0",
|
|
134
134
|
"embla-carousel-svelte": "^8.6.0",
|
|
135
|
-
"eslint": "^10.
|
|
135
|
+
"eslint": "^10.9.1",
|
|
136
136
|
"eslint-config-prettier": "^10.1.8",
|
|
137
137
|
"eslint-plugin-svelte": "^3.23.0",
|
|
138
138
|
"formsnap": "^2.0.1",
|
|
139
139
|
"globals": "^17.11.0",
|
|
140
|
-
"layerchart": "^2.
|
|
140
|
+
"layerchart": "^2.3.0",
|
|
141
141
|
"mode-watcher": "^1.1.0",
|
|
142
142
|
"paneforge": "^1.0.2",
|
|
143
|
-
"playwright": "^1.
|
|
143
|
+
"playwright": "^1.62.1",
|
|
144
144
|
"prettier": "^3.9.6",
|
|
145
145
|
"prettier-plugin-svelte": "4.1.1",
|
|
146
146
|
"prettier-plugin-tailwindcss": "^0.8.1",
|
|
147
|
-
"publint": "^0.3.
|
|
147
|
+
"publint": "^0.3.24",
|
|
148
148
|
"shadcn-svelte": "^1.5.0",
|
|
149
|
-
"svelte": "^5.56.
|
|
149
|
+
"svelte": "^5.56.10",
|
|
150
150
|
"svelte-check": "^4.7.6",
|
|
151
|
-
"svelte-sonner": "^1.
|
|
151
|
+
"svelte-sonner": "^1.2.1",
|
|
152
152
|
"sveltekit-superforms": "^2.30.2",
|
|
153
153
|
"tailwindcss": "^4.3.3",
|
|
154
154
|
"tslib": "^2.8.1",
|
|
155
155
|
"tw-animate-css": "1.4.0",
|
|
156
156
|
"typescript": "^6.0.3",
|
|
157
|
-
"typescript-eslint": "^8.
|
|
157
|
+
"typescript-eslint": "^8.68.0",
|
|
158
158
|
"vaul-svelte": "1.0.0-next.7",
|
|
159
|
-
"vite": "^8.2.
|
|
160
|
-
"vitest": "^4.1.
|
|
159
|
+
"vite": "^8.2.2",
|
|
160
|
+
"vitest": "^4.1.11",
|
|
161
161
|
"vitest-browser-svelte": "^3.0.0"
|
|
162
162
|
},
|
|
163
163
|
"svelte": "./dist/index.js",
|