@kayord/ui 0.15.6 → 0.16.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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as DataTable } from "./DataTable.svelte";
|
|
2
|
-
export {
|
|
2
|
+
export { ShadTable } from "./shad-table.svelte";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as DataTable } from "./DataTable.svelte";
|
|
2
|
-
export {
|
|
2
|
+
export { ShadTable } from "./shad-table.svelte";
|
|
@@ -131,129 +131,6 @@ export class ShadTable {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
export const createShadTable = (options) => {
|
|
135
|
-
// Set the default getCoreRowModel
|
|
136
|
-
if (!options.getCoreRowModel) {
|
|
137
|
-
options.getCoreRowModel = getCoreRowModel();
|
|
138
|
-
}
|
|
139
|
-
const plainOptions = options;
|
|
140
|
-
const resolvedOptions = mergeObjects({
|
|
141
|
-
state: {},
|
|
142
|
-
onStateChange() { },
|
|
143
|
-
renderFallbackValue: null,
|
|
144
|
-
mergeOptions: (defaultOptions, options) => {
|
|
145
|
-
return mergeObjects(defaultOptions, options);
|
|
146
|
-
},
|
|
147
|
-
}, plainOptions);
|
|
148
|
-
const table = createTable(resolvedOptions);
|
|
149
|
-
let state = $state(table.initialState);
|
|
150
|
-
function updateOptions() {
|
|
151
|
-
table.setOptions((prev) => {
|
|
152
|
-
return mergeObjects(prev, options, {
|
|
153
|
-
state: mergeObjects(state, options.state || {}),
|
|
154
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
155
|
-
onStateChange: (updater) => {
|
|
156
|
-
if (updater instanceof Function)
|
|
157
|
-
state = updater(state);
|
|
158
|
-
else
|
|
159
|
-
state = mergeObjects(state, updater);
|
|
160
|
-
options.onStateChange?.(updater);
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
// Sorting
|
|
166
|
-
if ((options.enableSorting ?? true) && !options.getSortedRowModel) {
|
|
167
|
-
options.getSortedRowModel = getSortedRowModel();
|
|
168
|
-
options.onSortingChange = (updater) => {
|
|
169
|
-
if (typeof updater === "function") {
|
|
170
|
-
if (options.state?.sorting) {
|
|
171
|
-
options.state.sorting = updater(options.state.sorting);
|
|
172
|
-
}
|
|
173
|
-
else if (state.sorting) {
|
|
174
|
-
state.sorting = updater(state.sorting);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
if (options.state?.sorting) {
|
|
179
|
-
options.state.sorting = updater;
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
state.sorting = updater;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
// Paging
|
|
188
|
-
if ((options.enablePaging ?? true) && !options.getPaginationRowModel) {
|
|
189
|
-
options.getPaginationRowModel = getPaginationRowModel();
|
|
190
|
-
options.onPaginationChange = (updater) => {
|
|
191
|
-
if (typeof updater === "function") {
|
|
192
|
-
if (options.state?.pagination) {
|
|
193
|
-
options.state.pagination = updater(options.state.pagination);
|
|
194
|
-
}
|
|
195
|
-
else if (state.pagination) {
|
|
196
|
-
state.pagination = updater(state.pagination);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
if (options.state?.pagination) {
|
|
201
|
-
options.state.pagination = updater;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
state.pagination = updater;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
// Row Selection
|
|
210
|
-
if ((options.enableRowSelection ?? true) && !options.onRowSelectionChange) {
|
|
211
|
-
options.onRowSelectionChange = (updater) => {
|
|
212
|
-
if (typeof updater === "function") {
|
|
213
|
-
if (options.state?.rowSelection) {
|
|
214
|
-
options.state.rowSelection = updater(options.state.rowSelection);
|
|
215
|
-
}
|
|
216
|
-
else if (state.rowSelection) {
|
|
217
|
-
state.rowSelection = updater(state.rowSelection);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
if (options.state?.rowSelection) {
|
|
222
|
-
options.state.rowSelection = updater;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
state.rowSelection = updater;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
// Column Visibility
|
|
231
|
-
if ((options.enableVisibility ?? false) && !options.onColumnVisibilityChange) {
|
|
232
|
-
options.onColumnVisibilityChange = (updater) => {
|
|
233
|
-
if (typeof updater === "function") {
|
|
234
|
-
if (options.state?.columnVisibility) {
|
|
235
|
-
options.state.columnVisibility = updater(options.state.columnVisibility);
|
|
236
|
-
}
|
|
237
|
-
else if (state.columnVisibility) {
|
|
238
|
-
state.columnVisibility = updater(state.columnVisibility);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
if (options.state?.columnVisibility) {
|
|
243
|
-
options.state.columnVisibility = updater;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
state.columnVisibility = updater;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
updateOptions();
|
|
252
|
-
$effect.pre(() => {
|
|
253
|
-
updateOptions();
|
|
254
|
-
});
|
|
255
|
-
return table;
|
|
256
|
-
};
|
|
257
134
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
258
135
|
function mergeObjects(...sources) {
|
|
259
136
|
const target = {};
|
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.16.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -47,30 +47,30 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@lucide/svelte": "^0.483.0",
|
|
50
|
-
"@sveltejs/adapter-auto": "^
|
|
51
|
-
"@sveltejs/kit": "^2.20.
|
|
50
|
+
"@sveltejs/adapter-auto": "^5.0.0",
|
|
51
|
+
"@sveltejs/kit": "^2.20.2",
|
|
52
52
|
"@sveltejs/package": "^2.3.10",
|
|
53
53
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
54
|
-
"@tailwindcss/vite": "^4.0.
|
|
54
|
+
"@tailwindcss/vite": "^4.0.15",
|
|
55
55
|
"@testing-library/jest-dom": "^6.6.3",
|
|
56
56
|
"@testing-library/svelte": "^5.2.7",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
58
|
-
"@typescript-eslint/parser": "^8.
|
|
59
|
-
"eslint": "^9.
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
58
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
59
|
+
"eslint": "^9.23.0",
|
|
60
60
|
"eslint-config-prettier": "^10.1.1",
|
|
61
|
-
"eslint-plugin-svelte": "^3.3.
|
|
61
|
+
"eslint-plugin-svelte": "^3.3.3",
|
|
62
62
|
"happy-dom": "^17.4.4",
|
|
63
63
|
"prettier": "^3.5.3",
|
|
64
64
|
"prettier-plugin-svelte": "^3.3.3",
|
|
65
65
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
66
66
|
"publint": "^0.3.9",
|
|
67
|
-
"svelte": "^5.
|
|
67
|
+
"svelte": "^5.25.3",
|
|
68
68
|
"svelte-check": "^4.1.5",
|
|
69
|
-
"tailwindcss": "^4.0.
|
|
69
|
+
"tailwindcss": "^4.0.15",
|
|
70
70
|
"tslib": "^2.8.1",
|
|
71
71
|
"tw-animate-css": "1.2.4",
|
|
72
72
|
"typescript": "^5.8.2",
|
|
73
|
-
"vite": "^6.2.
|
|
73
|
+
"vite": "^6.2.3",
|
|
74
74
|
"vitest": "^3.0.9",
|
|
75
75
|
"zod": "^3.24.2"
|
|
76
76
|
},
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"types": "./dist/index.d.ts",
|
|
79
79
|
"main": "./dist/index.js",
|
|
80
80
|
"type": "module",
|
|
81
|
-
"packageManager": "pnpm@10.6.
|
|
81
|
+
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af",
|
|
82
82
|
"scripts": {
|
|
83
83
|
"dev": "vite dev",
|
|
84
84
|
"build": "vite build && npm run package",
|