@kronor/dtv 7.6.0 → 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.
@@ -2,6 +2,7 @@ import { ActionDefinition, ActionUserDataAPI } from '../framework/actions';
2
2
  import { View } from '../framework/view';
3
3
  import type { ShowToastFn } from '../framework/toast';
4
4
  import { FilterState, PaginationState } from '../framework/state';
5
+ import type { DataOrdering } from '../framework/data-ordering';
5
6
  export interface ActionButtonsProps {
6
7
  actions: ActionDefinition[];
7
8
  selectedView: View;
@@ -13,7 +14,8 @@ export interface ActionButtonsProps {
13
14
  showToast: ShowToastFn;
14
15
  paginationState: PaginationState;
15
16
  rowsPerPage: number;
17
+ ordering: DataOrdering | null;
16
18
  userData: ActionUserDataAPI;
17
19
  }
18
- export declare function ActionButtons({ actions, selectedView, filterState, selectedRows, setFilterState, refetch, applyFilters, showToast, paginationState, rowsPerPage, userData }: ActionButtonsProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function ActionButtons({ actions, selectedView, filterState, selectedRows, setFilterState, refetch, applyFilters, showToast, paginationState, rowsPerPage, ordering, userData }: ActionButtonsProps): import("react/jsx-runtime").JSX.Element;
19
21
  export default ActionButtons;
@@ -1,5 +1,6 @@
1
1
  import type { View } from './view';
2
2
  import type { FilterState } from './state';
3
+ import type { DataOrdering } from './data-ordering';
3
4
  import { generateGraphQLQueryAST, renderGraphQLQuery } from './graphql';
4
5
  import { generateColumnAliasedGraphQLQueryAST } from './graphql/query';
5
6
  import { buildGraphQLQueryVariables } from './data';
@@ -39,6 +40,18 @@ export interface ActionAPI {
39
40
  showToast: ShowToastFn;
40
41
  /** Current rows-per-page setting for pagination. */
41
42
  rowsPerPage: number;
43
+ /**
44
+ * The ordering the table is currently showing: the ordering the user picked by
45
+ * sorting a column, or `null` when they have not sorted anything. `field` is the
46
+ * GraphQL field path the column sorts by — dotted for nested columns, e.g.
47
+ * `customer.profile.status` — not the column id.
48
+ *
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`.
53
+ */
54
+ ordering: DataOrdering | null;
42
55
  /** Build a GraphQLQueryAST for an arbitrary rootField (usually the current view root field). */
43
56
  generateGraphQLQueryAST: typeof generateGraphQLQueryAST;
44
57
  /** Build a GraphQLQueryAST with top-level selections aliased to column ids. */
@@ -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.0",
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",