@zhangt58/svelte-vtable 0.4.1 → 0.4.3
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.
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
className = '',
|
|
30
30
|
// callback when perPage changes: onperpage({ perPage })
|
|
31
31
|
onperpage = undefined,
|
|
32
|
+
// set false to hide the Filters button (e.g. when inline column filters are in use)
|
|
33
|
+
showFilters = true,
|
|
32
34
|
} = $props();
|
|
33
35
|
|
|
34
36
|
const perPageOptions = [
|
|
@@ -191,11 +193,14 @@
|
|
|
191
193
|
</script>
|
|
192
194
|
|
|
193
195
|
<div class="w-full">
|
|
194
|
-
|
|
196
|
+
<!-- Search, range and per-page sit together on the left; pagination is
|
|
197
|
+
pushed to the right and wraps below on narrow widths. -->
|
|
198
|
+
<div class="flex flex-wrap items-center w-full gap-x-3 gap-y-1 px-0 py-0">
|
|
195
199
|
<!-- Search field on the left -->
|
|
196
|
-
<div class="
|
|
200
|
+
<div class="min-w-0">
|
|
197
201
|
<div class="flex items-center gap-2">
|
|
198
202
|
<!-- Styled button to open/close filters modal -->
|
|
203
|
+
{#if showFilters}
|
|
199
204
|
<div class="flex items-center gap-1 relative">
|
|
200
205
|
<button
|
|
201
206
|
type="button"
|
|
@@ -237,8 +242,9 @@
|
|
|
237
242
|
>
|
|
238
243
|
{/if}
|
|
239
244
|
</div>
|
|
245
|
+
{/if}
|
|
240
246
|
|
|
241
|
-
<div class="vtable-search-wrapper relative flex items-center">
|
|
247
|
+
<div class="vtable-search-wrapper relative flex items-center w-64 max-w-full">
|
|
242
248
|
<svg
|
|
243
249
|
class="absolute left-3 h-4 w-4 text-gray-400 pointer-events-none"
|
|
244
250
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -294,9 +300,9 @@
|
|
|
294
300
|
</div>
|
|
295
301
|
|
|
296
302
|
<!-- Range count badge + per-page selector -->
|
|
297
|
-
<div class="flex-
|
|
303
|
+
<div class="flex shrink-0 items-center gap-2">
|
|
298
304
|
<span
|
|
299
|
-
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200 whitespace-nowrap"
|
|
305
|
+
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium tabular-nums bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200 whitespace-nowrap"
|
|
300
306
|
>
|
|
301
307
|
Showing {startItem} to {endItem} of {totalItems}
|
|
302
308
|
</span>
|
|
@@ -305,6 +311,7 @@
|
|
|
305
311
|
<div class="flex items-center gap-2">
|
|
306
312
|
<select
|
|
307
313
|
id={perPageSelectId}
|
|
314
|
+
aria-label="Rows per page"
|
|
308
315
|
class="vtable-perpage-select py-1 pl-3 pr-7 text-sm rounded-md border border-gray-300 bg-white dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100"
|
|
309
316
|
bind:value={perPage}
|
|
310
317
|
>
|
|
@@ -316,10 +323,13 @@
|
|
|
316
323
|
</div>
|
|
317
324
|
|
|
318
325
|
<!-- Pagination navigation -->
|
|
319
|
-
<
|
|
326
|
+
<div class="ml-auto shrink-0">
|
|
327
|
+
<PaginationBar {pages} {currentPage} onpage={goTo} />
|
|
328
|
+
</div>
|
|
320
329
|
</div>
|
|
321
330
|
</div>
|
|
322
331
|
|
|
332
|
+
{#if showFilters}
|
|
323
333
|
<FiltersModal
|
|
324
334
|
bind:open={filtersVisible}
|
|
325
335
|
columnFilters={effectiveColumnFilters}
|
|
@@ -329,6 +339,7 @@
|
|
|
329
339
|
{showCounts}
|
|
330
340
|
{className}
|
|
331
341
|
/>
|
|
342
|
+
{/if}
|
|
332
343
|
|
|
333
344
|
<style>/* ── Theming contract — override these on :root or any wrapper element ── */
|
|
334
345
|
:root {
|
|
@@ -21,6 +21,7 @@ declare const DataTableControls: import("svelte").Component<{
|
|
|
21
21
|
showCounts?: boolean;
|
|
22
22
|
className?: string;
|
|
23
23
|
onperpage?: any;
|
|
24
|
+
showFilters?: boolean;
|
|
24
25
|
}, {}, "perPage">;
|
|
25
26
|
type $$ComponentProps = {
|
|
26
27
|
search?: string;
|
|
@@ -40,4 +41,5 @@ type $$ComponentProps = {
|
|
|
40
41
|
showCounts?: boolean;
|
|
41
42
|
className?: string;
|
|
42
43
|
onperpage?: any;
|
|
44
|
+
showFilters?: boolean;
|
|
43
45
|
};
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
className = '',
|
|
31
31
|
// callback when perPage changes: onperpage({ perPage })
|
|
32
32
|
onperpage = undefined,
|
|
33
|
+
// set false to hide the Filters button (e.g. when inline column filters are in use)
|
|
34
|
+
showFilters = true,
|
|
33
35
|
} = $props();
|
|
34
36
|
|
|
35
37
|
const perPageOptions = [
|
|
@@ -197,6 +199,7 @@
|
|
|
197
199
|
<div class="flex-1">
|
|
198
200
|
<div class="flex items-center gap-2">
|
|
199
201
|
<!-- Styled button to open/close filters modal -->
|
|
202
|
+
{#if showFilters}
|
|
200
203
|
<div class="flex items-center gap-1 relative">
|
|
201
204
|
<button
|
|
202
205
|
type="button"
|
|
@@ -238,6 +241,7 @@
|
|
|
238
241
|
>
|
|
239
242
|
{/if}
|
|
240
243
|
</div>
|
|
244
|
+
{/if}
|
|
241
245
|
|
|
242
246
|
<Search
|
|
243
247
|
size="sm"
|
|
@@ -271,6 +275,7 @@
|
|
|
271
275
|
</div>
|
|
272
276
|
</div>
|
|
273
277
|
|
|
278
|
+
{#if showFilters}
|
|
274
279
|
<FiltersModal
|
|
275
280
|
bind:open={filtersVisible}
|
|
276
281
|
columnFilters={effectiveColumnFilters}
|
|
@@ -280,6 +285,7 @@
|
|
|
280
285
|
{showCounts}
|
|
281
286
|
{className}
|
|
282
287
|
/>
|
|
288
|
+
{/if}
|
|
283
289
|
|
|
284
290
|
<style>/* ── Theming contract — override these on :root or any wrapper element ── */
|
|
285
291
|
:root {
|
|
@@ -21,6 +21,7 @@ declare const DataTableControls: import("svelte").Component<{
|
|
|
21
21
|
showCounts?: boolean;
|
|
22
22
|
className?: string;
|
|
23
23
|
onperpage?: any;
|
|
24
|
+
showFilters?: boolean;
|
|
24
25
|
}, {}, "perPage">;
|
|
25
26
|
type $$ComponentProps = {
|
|
26
27
|
search?: string;
|
|
@@ -40,4 +41,5 @@ type $$ComponentProps = {
|
|
|
40
41
|
showCounts?: boolean;
|
|
41
42
|
className?: string;
|
|
42
43
|
onperpage?: any;
|
|
44
|
+
showFilters?: boolean;
|
|
43
45
|
};
|