compote-ui 0.41.2 → 0.42.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.
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
readOnly,
|
|
19
19
|
multiple,
|
|
20
20
|
loading = false,
|
|
21
|
+
class: className,
|
|
21
22
|
...restProps
|
|
22
23
|
}: ComboboxProps<T> = $props();
|
|
23
24
|
|
|
@@ -87,7 +88,11 @@
|
|
|
87
88
|
{multiple}
|
|
88
89
|
{readOnly}
|
|
89
90
|
{...restProps}
|
|
90
|
-
class={cn(
|
|
91
|
+
class={cn(
|
|
92
|
+
layout === 'horizontal' ? 'flex items-center gap-1.5' : 'grid gap-1.5',
|
|
93
|
+
'w-full',
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
91
96
|
>
|
|
92
97
|
{#if label}
|
|
93
98
|
<Combobox.Label class="text-sm">
|
|
@@ -98,7 +103,7 @@
|
|
|
98
103
|
|
|
99
104
|
<Combobox.Control
|
|
100
105
|
class={cn(
|
|
101
|
-
'flex min-h-9 items-center gap-1 rounded border bg-surface-1 px-3 shadow-sm',
|
|
106
|
+
'flex min-h-9 min-w-0 items-center gap-1 rounded border bg-surface-1 px-3 shadow-sm',
|
|
102
107
|
'focus-within:ring-1 focus-within:ring-ring',
|
|
103
108
|
'data-invalid:border-danger data-invalid:focus-within:ring-danger',
|
|
104
109
|
multiple && 'flex-wrap py-1'
|
|
@@ -118,7 +123,7 @@
|
|
|
118
123
|
{/if}
|
|
119
124
|
<Combobox.Input
|
|
120
125
|
placeholder={placeholder ?? 'Search...'}
|
|
121
|
-
class="flex-1 bg-transparent text-sm outline-none placeholder:text-ink-dim disabled:cursor-not-allowed disabled:opacity-50"
|
|
126
|
+
class="min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-ink-dim disabled:cursor-not-allowed disabled:opacity-50"
|
|
122
127
|
/>
|
|
123
128
|
{#if !readOnly}
|
|
124
129
|
<Combobox.ClearTrigger class="text-ink-dim transition-colors hover:text-ink">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ColumnResizeMode, type Row, type RowData, type SvelteTable, type TableState } from '@tanstack/svelte-table';
|
|
1
|
+
import { type ColumnResizeMode, type ColumnVisibilityState, type Row, type RowData, type SvelteTable, type TableState } from '@tanstack/svelte-table';
|
|
2
2
|
import type { DataTableColumn, DataTableLeafColumn } from './types';
|
|
3
3
|
declare const dataTableFeatures: {
|
|
4
4
|
columnVisibilityFeature: import("@tanstack/table-core").TableFeature<import("@tanstack/table-core").ColumnVisibilityFeatureConstructors<import("@tanstack/table-core").TableFeatures, RowData>>;
|
|
@@ -24,6 +24,7 @@ export type CreateDataTableOptions<T extends RowData> = {
|
|
|
24
24
|
enableMultiRowSelection?: boolean | ((row: Row<DataTableFeatures, T>) => boolean);
|
|
25
25
|
enableSorting?: boolean;
|
|
26
26
|
debugTable?: boolean;
|
|
27
|
+
onColumnVisibilityChange?: (visibility: ColumnVisibilityState) => void;
|
|
27
28
|
};
|
|
28
29
|
export declare function createTable<T extends RowData>(options: CreateDataTableOptions<T>): SvelteTable<{
|
|
29
30
|
columnVisibilityFeature: import("@tanstack/table-core").TableFeature<import("@tanstack/table-core").ColumnVisibilityFeatureConstructors<import("@tanstack/table-core").TableFeatures, RowData>>;
|
|
@@ -17,7 +17,7 @@ function oneOfFilterFn(row, columnId, filterValue) {
|
|
|
17
17
|
oneOfFilterFn.autoRemove = (val) => !Array.isArray(val) || val.length === 0;
|
|
18
18
|
export function createTable(options) {
|
|
19
19
|
const localeCtx = useLocaleContext();
|
|
20
|
-
|
|
20
|
+
const table = createTanStackTable({
|
|
21
21
|
_features: dataTableFeatures,
|
|
22
22
|
_rowModels: {
|
|
23
23
|
sortedRowModel: createSortedRowModel(sortFns),
|
|
@@ -61,6 +61,15 @@ export function createTable(options) {
|
|
|
61
61
|
sorting: state.sorting,
|
|
62
62
|
columnFilters: state.columnFilters
|
|
63
63
|
}));
|
|
64
|
+
if (options.onColumnVisibilityChange) {
|
|
65
|
+
const { onColumnVisibilityChange } = options;
|
|
66
|
+
const orig = table.setColumnVisibility.bind(table);
|
|
67
|
+
table.setColumnVisibility = (updater) => {
|
|
68
|
+
orig(updater);
|
|
69
|
+
onColumnVisibilityChange(table.store.state.columnVisibility);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return table;
|
|
64
73
|
}
|
|
65
74
|
function createColumnVisibility(columns) {
|
|
66
75
|
return getLeafColumns(columns).reduce((visibility, column) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compote-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev --open",
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
12
12
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
13
13
|
"lint": "prettier --check . && eslint .",
|
|
14
|
-
"format": "prettier --write ."
|
|
14
|
+
"format": "prettier --write .",
|
|
15
|
+
"patch": "npm version patch && npm publish",
|
|
16
|
+
"minor": "npm version minor && npm publish"
|
|
15
17
|
},
|
|
16
18
|
"files": [
|
|
17
19
|
"dist",
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
"eslint-plugin-svelte": "^3.17.0",
|
|
70
72
|
"globals": "^17.5.0",
|
|
71
73
|
"prettier": "^3.8.3",
|
|
72
|
-
"prettier-plugin-svelte": "^3.
|
|
74
|
+
"prettier-plugin-svelte": "^3.5.2",
|
|
73
75
|
"prettier-plugin-tailwindcss": "^0.8.0",
|
|
74
76
|
"publint": "^0.3.17",
|
|
75
77
|
"svelte": "^5.55.4",
|
|
@@ -77,9 +79,9 @@
|
|
|
77
79
|
"tailwindcss": "^4.2.4",
|
|
78
80
|
"tw-animate-css": "^1.4.0",
|
|
79
81
|
"typescript": "^6.0.3",
|
|
80
|
-
"typescript-eslint": "^8.59.
|
|
82
|
+
"typescript-eslint": "^8.59.3",
|
|
81
83
|
"unplugin-icons": "^23.0.1",
|
|
82
|
-
"vite": "^8.0.
|
|
84
|
+
"vite": "^8.0.12"
|
|
83
85
|
},
|
|
84
86
|
"keywords": [
|
|
85
87
|
"svelte"
|