runeforge 0.0.60 → 0.0.61

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 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 `config.reorder` is set, 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. Per-column filters are unavailable for the same reason (a filtered-out row's position would become undefined).
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. Per-column filters are suppressed and row
63
- * order is fully owned by `reorder.compare`/`reorder.attribute` while
64
- * it's active — ignored entirely in server-pagination mode
65
- * (`pagination` set), since the full row set needs to be reachable
66
- * client-side for drag positions to be meaningful. */
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
- const reorderActive = $derived(!!reorder && !pagination);
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. Per-column filters are suppressed and row
31
- * order is fully owned by `reorder.compare`/`reorder.attribute` while
32
- * it's active — ignored entirely in server-pagination mode
33
- * (`pagination` set), since the full row set needs to be reachable
34
- * client-side for drag positions to be meaningful. */
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) && !reorderActive}
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runeforge",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "description": "SvelteKit toolkit for building metadata-driven CRUD interfaces with tables, forms, and actions",
5
5
  "license": "MIT",
6
6
  "author": "Ezequiel Puerta",