runeforge 0.0.60 → 0.0.62
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/README.md +2 -1
- package/dist/components/table/PaginatedTable.svelte +13 -7
- package/dist/components/table/PaginatedTable.svelte.d.ts +7 -5
- package/dist/components/table/TableHeader.svelte +1 -1
- package/dist/components/table/state.svelte.d.ts +1 -0
- package/dist/components/table/state.svelte.js +19 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -945,7 +945,8 @@ config={{
|
|
|
945
945
|
|
|
946
946
|
A few things worth knowing about how reorder mode behaves:
|
|
947
947
|
|
|
948
|
-
- **The list is ordered by `attribute` ascending (or `compare`, see below) the whole time reorder is active** — not by `_id`, not by whatever order the backend/array happens to return, and not by clicking a column header either: column-header sorting is unavailable while
|
|
948
|
+
- **The list is ordered by `attribute` ascending (or `compare`, see below) the whole time reorder is active** — not by `_id`, not by whatever order the backend/array happens to return, and not by clicking a column header either: column-header sorting is unavailable while reorder is active, since row order needs a single, unambiguous source of truth for dragging to mean anything. This holds even if `attribute` is `excludedFromList` and has no column of its own — ordering reads the raw row value regardless of what's rendered.
|
|
949
|
+
- **Column filters and reorder share the table, but not at the same time.** Filter controls stay visible the whole time — as soon as any column filter is set, reorder pauses (drag handles disappear, column-header sorting comes back, and the table behaves like a plain filtered/sorted one) since a filtered-out row's drag position would be undefined. Clearing every active filter resumes reorder automatically, back to `attribute`/`compare` ordering.
|
|
949
950
|
- **Pagination stays on.** To move a row across a page boundary, drag it to the narrow zone at either edge of the table and hold — after `pageFlipThresholdMs` (default `2000`) it flips to the previous/next page; keep hovering (without letting go) to flip again. Drop once you're on the right page.
|
|
950
951
|
- It's **not supported in [server-pagination mode](#server-side-pagination-sorting--filtering)** (a `PaginatedEnvelope` `data`) — cross-page drag positions aren't meaningful without a lot more server-side machinery, so `config.reorder` is ignored whenever server pagination is active.
|
|
951
952
|
- Set `enabled: false` to keep the configuration in place (attribute, endpoint, icon) but temporarily turn dragging off, without having to remove the whole object.
|
|
@@ -59,11 +59,13 @@
|
|
|
59
59
|
/** Current ordering + filters snapshot, kept in sync for callers that
|
|
60
60
|
* need to replicate the active query (e.g. exporting server-side). */
|
|
61
61
|
query?: TableQuery;
|
|
62
|
-
/** Turns on drag-to-reorder.
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
62
|
+
/** Turns on drag-to-reorder. Row order is fully owned by
|
|
63
|
+
* `reorder.compare`/`reorder.attribute` while it's active — active only
|
|
64
|
+
* when no column filter is currently set (a filter pauses reorder
|
|
65
|
+
* until it's cleared, see `reorderActive` below) and never in
|
|
66
|
+
* server-pagination mode (`pagination` set), since the full row set
|
|
67
|
+
* needs to be reachable client-side for drag positions to be
|
|
68
|
+
* meaningful. */
|
|
67
69
|
reorder?: ReorderOptions<T>;
|
|
68
70
|
/** Fires after a drag settles with the complete reordered row list
|
|
69
71
|
* (client mode only). The caller decides how to persist it. */
|
|
@@ -94,8 +96,12 @@
|
|
|
94
96
|
|
|
95
97
|
// Server-pagination mode owns its own full row set server-side, where
|
|
96
98
|
// drag positions can't be reconciled across pages — reorder only makes
|
|
97
|
-
// sense once the whole (client-mode) row set is reachable.
|
|
98
|
-
|
|
99
|
+
// sense once the whole (client-mode) row set is reachable. An active
|
|
100
|
+
// column filter pauses reorder the same way: a filtered-out row's drag
|
|
101
|
+
// position would be undefined, so reorder mode steps aside (and the
|
|
102
|
+
// table behaves like a plain sortable/filterable one) for as long as any
|
|
103
|
+
// filter stays on, resuming automatically once every filter clears.
|
|
104
|
+
const reorderActive = $derived(!!reorder && !pagination && !filter.hasAny());
|
|
99
105
|
|
|
100
106
|
const indexed = $derived(data.map((row, index): IndexedRow<T> => ({ row, index })));
|
|
101
107
|
// Dragging needs the complete row set reachable, so filters (which would
|
|
@@ -27,11 +27,13 @@ declare function $$render<T extends object = Record<string, unknown>>(): {
|
|
|
27
27
|
/** Current ordering + filters snapshot, kept in sync for callers that
|
|
28
28
|
* need to replicate the active query (e.g. exporting server-side). */
|
|
29
29
|
query?: TableQuery;
|
|
30
|
-
/** Turns on drag-to-reorder.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
/** Turns on drag-to-reorder. Row order is fully owned by
|
|
31
|
+
* `reorder.compare`/`reorder.attribute` while it's active — active only
|
|
32
|
+
* when no column filter is currently set (a filter pauses reorder
|
|
33
|
+
* until it's cleared, see `reorderActive` below) and never in
|
|
34
|
+
* server-pagination mode (`pagination` set), since the full row set
|
|
35
|
+
* needs to be reachable client-side for drag positions to be
|
|
36
|
+
* meaningful. */
|
|
35
37
|
reorder?: ReorderOptions<T>;
|
|
36
38
|
/** Fires after a drag settles with the complete reordered row list
|
|
37
39
|
* (client mode only). The caller decides how to persist it. */
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
direction={reorderActive ? null : sort.directionFor(col.attribute)}
|
|
71
71
|
onsort={() => sortBy(col)}
|
|
72
72
|
/>
|
|
73
|
-
{#if isFilterable(col)
|
|
73
|
+
{#if isFilterable(col)}
|
|
74
74
|
<ColumnFilter
|
|
75
75
|
column={col}
|
|
76
76
|
entries={distinctValues[col.attribute] ?? []}
|
|
@@ -26,6 +26,7 @@ export declare class FilterState {
|
|
|
26
26
|
to: string;
|
|
27
27
|
};
|
|
28
28
|
hasActive(attribute: string): boolean;
|
|
29
|
+
hasAny(): boolean;
|
|
29
30
|
isChecked(attribute: string, value: string): boolean;
|
|
30
31
|
setText(attribute: string, value: string): void;
|
|
31
32
|
toggleValue(attribute: string, value: string): void;
|
|
@@ -66,6 +66,18 @@ export class FilterState {
|
|
|
66
66
|
(this.values.get(attribute)?.size ?? 0) > 0 ||
|
|
67
67
|
!!(this.dateRanges.get(attribute)?.from || this.dateRanges.get(attribute)?.to));
|
|
68
68
|
}
|
|
69
|
+
hasAny() {
|
|
70
|
+
for (const value of this.text.values())
|
|
71
|
+
if (value)
|
|
72
|
+
return true;
|
|
73
|
+
for (const set of this.values.values())
|
|
74
|
+
if (set.size > 0)
|
|
75
|
+
return true;
|
|
76
|
+
for (const range of this.dateRanges.values())
|
|
77
|
+
if (range.from || range.to)
|
|
78
|
+
return true;
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
69
81
|
isChecked(attribute, value) {
|
|
70
82
|
return this.values.get(attribute)?.has(value) ?? false;
|
|
71
83
|
}
|
|
@@ -125,8 +137,13 @@ export class FilterState {
|
|
|
125
137
|
if (text && !cell.toLowerCase().includes(text.toLowerCase()))
|
|
126
138
|
return false;
|
|
127
139
|
const selected = this.values.get(col.attribute);
|
|
128
|
-
if (selected && selected.size > 0
|
|
129
|
-
|
|
140
|
+
if (selected && selected.size > 0) {
|
|
141
|
+
const key = col.type === 'boolean'
|
|
142
|
+
? String(!!row[col.attribute])
|
|
143
|
+
: cell;
|
|
144
|
+
if (!selected.has(key))
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
130
147
|
return true;
|
|
131
148
|
});
|
|
132
149
|
}
|