@kronor/dtv 7.6.1 → 7.6.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/dist/index.es.js CHANGED
@@ -22550,11 +22550,11 @@ function oE(e, n) {
22550
22550
  }
22551
22551
  let gp = 0;
22552
22552
  function yd(e, n) {
22553
- const t = n === void 0 ? (e.staticOrdering ?? []).flatMap((r) => Gv(r)) : n === null ? [] : [n];
22554
- return t.some((r) => r.field === e.paginationKey) || t.push({
22553
+ const t = (e.staticOrdering ?? []).flatMap((o) => Gv(o)), a = n ? [n, ...t.filter((o) => o.field !== n.field)] : t;
22554
+ return a.some((o) => o.field === e.paginationKey) || a.push({
22555
22555
  field: e.paginationKey,
22556
22556
  direction: e.paginationDirection ?? "DESC"
22557
- }), t;
22557
+ }), a;
22558
22558
  }
22559
22559
  function hd(e, n) {
22560
22560
  if (e === null) return;
@@ -46,11 +46,10 @@ export interface ActionAPI {
46
46
  * GraphQL field path the column sorts by — dotted for nested columns, e.g.
47
47
  * `customer.profile.status` — not the column id.
48
48
  *
49
- * Always pass this value to `buildGraphQLQueryVariables` as its `ordering`
50
- * argument, `null` included, to build variables that order and paginate exactly
51
- * like the table on screen (`null` means "pagination key only", which is what an
52
- * unsorted table queries). Omitting the argument is not the same thing: it
53
- * selects the view's `staticOrdering`, which the table never queries by.
49
+ * Pass it to `buildGraphQLQueryVariables` as its `ordering` argument to build
50
+ * variables that order and paginate exactly like the table on screen. The view's
51
+ * `staticOrdering` is applied either way — it trails this ordering as a
52
+ * tie-breaker, and stands alone when this is `null`.
54
53
  */
55
54
  ordering: DataOrdering | null;
56
55
  /** Build a GraphQLQueryAST for an arbitrary rootField (usually the current view root field). */
@@ -48,6 +48,7 @@ Add additional docs here for transforms, custom filters, etc. as needed.
48
48
  - For rendered or composite columns, set `orderBy` on the table column JSON to one of the scalar GraphQL fields selected by `data` to enable sorting.
49
49
  - `orderBy` may be a dot-separated path for nested order fields, such as `customer.profile.status`.
50
50
  - Users can order by one sortable header at a time. Clicking a sorted header a third time removes the header ordering.
51
+ - A view's `staticOrdering` always applies: the sorted header leads and static entries trail it as tie-breakers, so an unsorted table orders by `staticOrdering` alone. An entry for the field the user sorted by is dropped, since their direction supersedes it. A unique `paginationKey` ordering closes the list.
51
52
 
52
53
  ```jsonc
53
54
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronor/dtv",
3
- "version": "7.6.1",
3
+ "version": "7.6.2",
4
4
  "description": "Schema-driven, declarative table views with advanced filtering, data fetching and AI-assisted filter generation.",
5
5
  "repository": {
6
6
  "type": "git",