compote-ui 0.43.13 → 0.43.15
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.
|
@@ -13,7 +13,7 @@ export function createSvelteTable(options) {
|
|
|
13
13
|
function updateOptions() {
|
|
14
14
|
table.setOptions(() => {
|
|
15
15
|
return mergeObjects(resolvedOptions, options, {
|
|
16
|
-
state: mergeObjects(state, options.state || {}),
|
|
16
|
+
state: mergeObjects(() => state, options.state || {}),
|
|
17
17
|
onStateChange: (updater) => {
|
|
18
18
|
if (typeof updater === 'function')
|
|
19
19
|
state = updater(state);
|
|
@@ -56,15 +56,32 @@
|
|
|
56
56
|
const centerHeaderGroups = table.getCenterHeaderGroups();
|
|
57
57
|
const rightHeaderGroups = table.getRightHeaderGroups();
|
|
58
58
|
|
|
59
|
-
return centerHeaderGroups.map((headerGroup, index) =>
|
|
60
|
-
|
|
61
|
-
id: `${leftHeaderGroups[index]?.id ?? ''}|${headerGroup.id}|${rightHeaderGroups[index]?.id ?? ''}`,
|
|
62
|
-
headers: [
|
|
59
|
+
return centerHeaderGroups.map((headerGroup, index) => {
|
|
60
|
+
const merged = [
|
|
63
61
|
...(leftHeaderGroups[index]?.headers ?? []),
|
|
64
62
|
...headerGroup.headers,
|
|
65
63
|
...(rightHeaderGroups[index]?.headers ?? [])
|
|
66
|
-
]
|
|
67
|
-
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
// When a column group spans pinned and unpinned columns, TanStack splits it
|
|
67
|
+
// into separate header objects (one per section). Merge adjacent headers that
|
|
68
|
+
// share the same column.id so the group label renders once.
|
|
69
|
+
const headers = merged.reduce<typeof merged>((acc, header) => {
|
|
70
|
+
const prev = acc[acc.length - 1];
|
|
71
|
+
if (prev && prev.column.id === header.column.id) {
|
|
72
|
+
acc[acc.length - 1] = { ...prev, colSpan: prev.colSpan + header.colSpan };
|
|
73
|
+
} else {
|
|
74
|
+
acc.push(header);
|
|
75
|
+
}
|
|
76
|
+
return acc;
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
...headerGroup,
|
|
81
|
+
id: `${leftHeaderGroups[index]?.id ?? ''}|${headerGroup.id}|${rightHeaderGroups[index]?.id ?? ''}`,
|
|
82
|
+
headers
|
|
83
|
+
};
|
|
84
|
+
});
|
|
68
85
|
});
|
|
69
86
|
const visibleLeafColumns = $derived.by(() => {
|
|
70
87
|
const { columnVisibility } = getReactiveTableState(table);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compote-ui",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev --open",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@sveltejs/vite-plugin-svelte": "7.1.2",
|
|
66
66
|
"@tailwindcss/vite": "^4.2.4",
|
|
67
67
|
"@tanstack/svelte-virtual": "^3.13.24",
|
|
68
|
+
"@tanstack/table-core": "^8.21.3",
|
|
68
69
|
"@types/node": "^22.19.18",
|
|
69
70
|
"eslint": "^10.4.0",
|
|
70
71
|
"eslint-config-prettier": "^10.1.8",
|