@r2digisolutions/ui 0.22.1 → 0.22.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.
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import * as DataTableTypes from './core/types.js';
|
|
3
|
+
export type { DataTableTypes };
|
|
4
|
+
</script>
|
|
5
|
+
|
|
1
6
|
<script lang="ts" generics="T extends { id?: any }">
|
|
2
7
|
import type { Snippet } from 'svelte';
|
|
3
8
|
import { tick } from 'svelte';
|
|
@@ -47,7 +52,7 @@
|
|
|
47
52
|
const manager = new DataTableManager<T>(options);
|
|
48
53
|
|
|
49
54
|
let filterValues = $state<Record<string, any>>({});
|
|
50
|
-
let container:
|
|
55
|
+
let container: renderDivElement | null = $state(null);
|
|
51
56
|
let rightMenu = $state<{ open: boolean; x: number; y: number }>({ open: false, x: 0, y: 0 });
|
|
52
57
|
let rightClickContext = $state<CellContext<T> | null>(null);
|
|
53
58
|
let measuring = $state(true);
|
|
@@ -85,11 +90,11 @@
|
|
|
85
90
|
if (!container) return;
|
|
86
91
|
const widths: Record<string, number> = {};
|
|
87
92
|
for (const c of manager.columns) {
|
|
88
|
-
const head = container.querySelector(`[data-dt-head="${c.id}"]`) as
|
|
93
|
+
const head = container.querySelector(`[data-dt-head="${c.id}"]`) as renderElement | null;
|
|
89
94
|
let maxW = head ? head.offsetWidth : 0;
|
|
90
95
|
const cells = Array.from(
|
|
91
96
|
container.querySelectorAll(`[data-dt-cell="1"][data-col-id="${c.id}"]`)
|
|
92
|
-
).slice(0, SAMPLE_ROWS) as
|
|
97
|
+
).slice(0, SAMPLE_ROWS) as renderElement[];
|
|
93
98
|
for (const el of cells) maxW = Math.max(maxW, el.offsetWidth);
|
|
94
99
|
if (c.minWidth != null) maxW = Math.max(maxW, c.minWidth);
|
|
95
100
|
if (c.width != null) maxW = Math.max(maxW, c.width);
|
|
@@ -192,7 +197,7 @@
|
|
|
192
197
|
checked={manager.state.items.length > 0 &&
|
|
193
198
|
manager.state.items.every((r) => manager.state.selected.has(rowId(r)))}
|
|
194
199
|
onclick={(e) =>
|
|
195
|
-
(e.currentTarget as
|
|
200
|
+
(e.currentTarget as renderInputElement).checked
|
|
196
201
|
? manager.selectAllCurrentPage(rowId)
|
|
197
202
|
: manager.clearSelection()}
|
|
198
203
|
/>
|
|
@@ -305,7 +310,7 @@
|
|
|
305
310
|
/>{:else}<ChevronRight class="h-4 w-4" />{/if}
|
|
306
311
|
</button>
|
|
307
312
|
{/if}
|
|
308
|
-
{@
|
|
313
|
+
{@render rowActions(row)}
|
|
309
314
|
</div>
|
|
310
315
|
</div>
|
|
311
316
|
{:else if endExtras}
|