compote-ui 0.43.2 → 0.43.4
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.
|
@@ -15,7 +15,7 @@ export function createSvelteTable(options) {
|
|
|
15
15
|
return mergeObjects(resolvedOptions, options, {
|
|
16
16
|
state: mergeObjects(state, options.state || {}),
|
|
17
17
|
onStateChange: (updater) => {
|
|
18
|
-
if (updater
|
|
18
|
+
if (typeof updater === 'function')
|
|
19
19
|
state = updater(state);
|
|
20
20
|
else
|
|
21
21
|
state = mergeObjects(state, updater);
|
|
@@ -37,11 +37,14 @@ export function createTable(options) {
|
|
|
37
37
|
onColumnVisibilityChange: (updater) => {
|
|
38
38
|
// Without this, overriding onColumnVisibilityChange bypasses makeStateUpdater,
|
|
39
39
|
// so createSvelteTable's $state never updates and Svelte doesn't re-render.
|
|
40
|
-
table.options.onStateChange?.((old) =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
table.options.onStateChange?.((old) => {
|
|
41
|
+
const columnVisibility = typeof updater === 'function' ? updater(old.columnVisibility) : updater;
|
|
42
|
+
options.onColumnVisibilityChange(columnVisibility);
|
|
43
|
+
return {
|
|
44
|
+
...old,
|
|
45
|
+
columnVisibility
|
|
46
|
+
};
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
: {}),
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
<Popover.Content class="w-56 p-2" showArrow={false}>
|
|
43
43
|
<div class="border-b border-surface-3 px-2 pb-2">
|
|
44
44
|
<Checkbox
|
|
45
|
-
size="sm"
|
|
46
45
|
label="All columns"
|
|
47
46
|
checked={allColumnsVisibilityState}
|
|
48
47
|
onCheckedChange={({ checked }) => table.toggleAllColumnsVisible(checked === true)}
|
|
@@ -55,7 +54,6 @@
|
|
|
55
54
|
<div class="flex flex-col">
|
|
56
55
|
{#each allLeafColumns as column (column.id)}
|
|
57
56
|
<Checkbox
|
|
58
|
-
size="md"
|
|
59
57
|
label={getColumnLabel(column)}
|
|
60
58
|
class="min-h-8 rounded-sm px-2 hover:bg-surface-2"
|
|
61
59
|
checked={columnVisibility[column.id] !== false}
|