@svelte-lean/table 0.3.0 → 0.3.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.
- package/CHANGELOG.md +12 -0
- package/dist/style.css +24 -0
- package/dist/table/data-table.svelte +18 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @svelte-lean/table
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Grid layout: content drawn straight into a cell (a badge, a chip, a link) keeps its own width instead of stretching across the cell; the selection and expand columns center their control. A click on a disabled `data-action` control reports no `onAction`.
|
|
8
|
+
|
|
9
|
+
## 0.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- The selection count moves out of the toolbar: with a pager it ends the pager's status line (`Page 1 of 15 · 144 rows · 3 selected`), without one it stays in the toolbar; either way it shows only while rows are selected, never as "0 selected". A table with selection and nothing else in its toolbar no longer draws an empty band above its header row.
|
|
14
|
+
|
|
3
15
|
## 0.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/style.css
CHANGED
|
@@ -858,12 +858,36 @@
|
|
|
858
858
|
align-items: center;
|
|
859
859
|
min-width: 0;
|
|
860
860
|
}
|
|
861
|
+
/* The renderer's own boxes in a cell fill it; content drawn straight into a cell (a badge, a
|
|
862
|
+
chip, a link in a plain grid cell, a control) keeps its own width. */
|
|
861
863
|
:where(
|
|
862
864
|
.slean-table[data-layout='grid'] > .slean-table-scroll > table > * > tr > :is(th, td) > *
|
|
865
|
+
) {
|
|
866
|
+
flex: 0 1 auto;
|
|
867
|
+
}
|
|
868
|
+
:where(
|
|
869
|
+
.slean-table[data-layout='grid']
|
|
870
|
+
> .slean-table-scroll
|
|
871
|
+
> table
|
|
872
|
+
> *
|
|
873
|
+
> tr
|
|
874
|
+
> :is(th, td)
|
|
875
|
+
> :is(.slean-table-cell, .slean-table-heading, .slean-table-editor)
|
|
863
876
|
) {
|
|
864
877
|
flex: 1 1 auto;
|
|
865
878
|
min-width: 0;
|
|
866
879
|
}
|
|
880
|
+
/* The selection and expand columns center their one control. */
|
|
881
|
+
:where(
|
|
882
|
+
.slean-table[data-layout='grid']
|
|
883
|
+
> .slean-table-scroll
|
|
884
|
+
> table
|
|
885
|
+
> *
|
|
886
|
+
> tr
|
|
887
|
+
> :is(.slean-table-selection, .slean-table-expander)
|
|
888
|
+
) {
|
|
889
|
+
justify-content: center;
|
|
890
|
+
}
|
|
867
891
|
:where(
|
|
868
892
|
.slean-table[data-layout='grid'] > .slean-table-scroll > table > * > tr > .slean-table-full
|
|
869
893
|
) {
|
|
@@ -865,6 +865,8 @@
|
|
|
865
865
|
}
|
|
866
866
|
/** The page status: a manual table without `rowCount` does not know its total. */
|
|
867
867
|
const rowsKnown = $derived(!manual || rowCount !== undefined);
|
|
868
|
+
/** Without a pager the toolbar carries the selection count, and only while something is chosen. */
|
|
869
|
+
const selectedInToolbar = $derived(Boolean(selection) && !pagination && s.selection.length > 0);
|
|
868
870
|
const headerRowCount = $derived(showHeader ? table.headers.length + (filters ? 1 : 0) : 0);
|
|
869
871
|
/** A manual page is part of a known total: `aria-rowcount` and `aria-rowindex` say where. */
|
|
870
872
|
const ariaRowCount = $derived(
|
|
@@ -1063,7 +1065,10 @@
|
|
|
1063
1065
|
const target = e.target as HTMLElement;
|
|
1064
1066
|
const action = target.closest<HTMLElement>('[data-action]');
|
|
1065
1067
|
if (action && cell.contains(action)) {
|
|
1066
|
-
|
|
1068
|
+
// A disabled control reports nothing (a click can still be dispatched on one).
|
|
1069
|
+
if (!action.matches(':disabled, [aria-disabled="true"]')) {
|
|
1070
|
+
onAction?.(action.dataset.action ?? '', row, action, index);
|
|
1071
|
+
}
|
|
1067
1072
|
return;
|
|
1068
1073
|
}
|
|
1069
1074
|
const control = target.closest(NOT_ROW_CLICK);
|
|
@@ -1475,7 +1480,11 @@
|
|
|
1475
1480
|
<!-- The toolbar exists only when something goes in it: an empty flex row would still paint its
|
|
1476
1481
|
padding as a blank band above the header row (Svelte keeps a text node between the blocks,
|
|
1477
1482
|
so `:empty` cannot hide it). -->
|
|
1478
|
-
|
|
1483
|
+
<!-- The selection count sits in the pager's status line when there is a pager, and in the
|
|
1484
|
+
toolbar only without one; either way it shows while something is selected, never "0". -->
|
|
1485
|
+
{#if searchable || toolbar || selectedInToolbar || columnControls}<div
|
|
1486
|
+
class="slean-table-toolbar"
|
|
1487
|
+
>
|
|
1479
1488
|
{#if searchable}<input
|
|
1480
1489
|
class="slean-table-search slean-table-input"
|
|
1481
1490
|
type="search"
|
|
@@ -1485,7 +1494,7 @@
|
|
|
1485
1494
|
oninput={(e) => delayed('search', e.currentTarget.value, (v) => table.setSearch(v))}
|
|
1486
1495
|
/>{/if}
|
|
1487
1496
|
{#if toolbar}{@render toolbar(model)}{/if}
|
|
1488
|
-
{#if
|
|
1497
|
+
{#if selectedInToolbar}<span class="slean-table-selected" aria-live="polite"
|
|
1489
1498
|
>{m.selected(s.selection.length)}</span
|
|
1490
1499
|
>{/if}
|
|
1491
1500
|
{#if columnControls}<details class="slean-table-columns">
|
|
@@ -1726,7 +1735,12 @@
|
|
|
1726
1735
|
</div>
|
|
1727
1736
|
{#if pagination}<div class="slean-table-pagination">
|
|
1728
1737
|
<span class="slean-table-page-status" aria-live="polite"
|
|
1729
|
-
>{m.page(
|
|
1738
|
+
>{m.page(
|
|
1739
|
+
model.pageIndex + 1,
|
|
1740
|
+
model.pageCount,
|
|
1741
|
+
rowsKnown ? model.total : undefined
|
|
1742
|
+
)}{#if selection && s.selection.length > 0}
|
|
1743
|
+
· <span class="slean-table-selected">{m.selected(s.selection.length)}</span>{/if}</span
|
|
1730
1744
|
>{#if pageSizeSelect === 'custom'}<span class="slean-table-page-size"
|
|
1731
1745
|
><span id="{uid}-page-size">{m.pageSize}</span>
|
|
1732
1746
|
<div class="slean-table-page-select" {...SELECT_ROOT} data-size="sm">
|