@casoon/opengrid 0.7.1 → 0.8.0

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 CHANGED
@@ -18,6 +18,81 @@ Two things belong in every release entry and are easy to leave out:
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [0.8.0] — 2026-09-30
22
+
23
+ **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
24
+ **Browsers:** Chromium (the whole e2e suite, 1047 passed) and WebKit (Playwright's, not Safari:
25
+ 516 passed, 10 skipped). Firefox: **not run**.
26
+
27
+ The pivot on the grid's level: titles and formats, a view and events, sorting, folding, choosing
28
+ the fields and filtering — each from the keyboard, each part of the view.
29
+
30
+ **What breaks:**
31
+ - `<opengrid-pivot>`'s row-dimension headers — and its measure headers without a column
32
+ dimension — hold a sort button now, and a group's subtotal header a fold button; the direction
33
+ and fold marks are `aria-hidden` text beside the names. A page that read a header's
34
+ `textContent` reads the mark too; read the button's first `span`, or what a reader hears.
35
+ - Rust: `PivotQuery` and `ValidatedPivotQuery` have new fields (`sort`; `orders`, `sort`), so a
36
+ struct literal needs them. The JSON form is unchanged for a pivot without `sort`.
37
+
38
+ **Module sizes** (brotli, `just measure-modules`): the elements 206.2 → 224.0 KiB, the engine
39
+ 115.2 → 118.8 KiB; both bounds raised with their reasons in `scripts/module-budget.txt`.
40
+
41
+ ### Added
42
+
43
+ - **Titles and formats in `<opengrid-pivot>`** ([#104](https://github.com/casoon/opengrid/issues/104)).
44
+ `set_columns` gives a row dimension or a measure its `title`, and `set_formats` formats
45
+ dimension values in the headers and measure cells, by field name or measure alias — as at the
46
+ grid and the table. NULL and the empty string keep their words in a header. Any option but
47
+ `title` is reported in the status line. `get_pivot` still exports raw names and values.
48
+ - **A view and events for `<opengrid-pivot>`** ([#106](https://github.com/casoon/opengrid/issues/106)).
49
+ `get_view`/`set_view` read and write `{ rows, columns, values }` — the three attributes as one
50
+ value, set in one query — and `opengrid-view-change` reports every change of them.
51
+ `opengrid-query` now fires after every pivot answer too. `OpengridPivot`'s `view`,
52
+ `defaultView` and `onViewChange` are typed `PivotView` in React, Vue and Svelte;
53
+ `get_view<PivotView>(pivot)` in TypeScript. `ViewChangeDetail` and `Connection` take a type
54
+ parameter whose default is the grid's, so existing code compiles unchanged.
55
+ - **Sorting in `<opengrid-pivot>`** ([#108](https://github.com/casoon/opengrid/issues/108)).
56
+ Each level is ordered by its own values or by a measure over the whole row, ascending or
57
+ descending; subtotals stay after their group (new rule P9, with conformance cases on the local
58
+ engine, WebAssembly, PostgreSQL and the export). The pivot query takes `sort:
59
+ [{ field, by?, direction }]` — sent only when there is one — and the element a `sort` attribute
60
+ that is part of its view. Row-dimension headers, and measure headers without a column
61
+ dimension, are sort buttons with `aria-sort`. On PostgreSQL a sorted pivot runs one query per
62
+ level instead of one `GROUPING SETS` statement.
63
+ - **Folding groups in `<opengrid-pivot>`** ([#110](https://github.com/casoon/opengrid/issues/110)).
64
+ With two row dimensions or more, a group's subtotal row header is a button with
65
+ `aria-expanded` that folds the group's rows away and opens them again, without a new query.
66
+ The status line says it (`groupCollapsed` / `groupExpanded`); the folded groups are a
67
+ `collapsed` attribute, part of the view. New parts `group-toggle` and `group-mark`.
68
+ - **Choosing the fields of `<opengrid-pivot>`** ([#112](https://github.com/casoon/opengrid/issues/112)).
69
+ With the `toolbar` attribute the reader chooses rows, the column and measures: per axis a
70
+ group of chips — move earlier/later, remove — and an add menu ("+ Row", "+ Column",
71
+ "+ Measure") offering what the page offers in the new `fields` and `measures` attributes. No
72
+ dragging; the menu has the grid's keyboard. Each change is one view, one query. New parts
73
+ `field-group`, `add-field`, `field-menu`, `chip-move`, and twelve text keys (`pivotToolbar`,
74
+ `addRow`, `fieldRemove`, …).
75
+ - **Filtering `<opengrid-pivot>`** ([#114](https://github.com/casoon/opengrid/issues/114)).
76
+ A `filter` attribute takes the wire's filter JSON and is part of the view; the filter acts on
77
+ the raw rows, before the pivot. With `toolbar` the reader gets a "Filters" group: a field for an
78
+ expression in the grid's language (`country = DE and qty ≥ 3`) and a removable chip per clause,
79
+ plus "Remove all". The types come from a pivot the provider already answers (the pivot has no
80
+ schema of its own). Three new text keys: `pivotFilters`, `pivotFilterLabel`, `pivotFilterHint`.
81
+
82
+ ## [0.7.2] — 2026-09-30
83
+
84
+ **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
85
+ **Browsers:** Chromium, the whole e2e suite. A fix to the toolbar's column list; nothing breaks.
86
+
87
+ ### Fixed
88
+
89
+ - **"Columns" stays open while columns are ticked** ([#101](https://github.com/casoon/opengrid/issues/101)).
90
+ Unticking one column closed the list and put the focus into the table header, because each
91
+ tick rebuilds the grid. The list is now a panel under its button, like "+ Filter": it stays
92
+ open across the rebuild with the focus on the ticked checkbox, and closes on `Escape` (focus
93
+ back to the button), a click outside or the button. It no longer opens inline and pushes the
94
+ toolbar aside.
95
+
21
96
  ## [0.7.1] — 2026-09-30
22
97
 
23
98
  **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
Binary file
package/loader.d.ts CHANGED
@@ -44,10 +44,15 @@ export interface OpengridModule {
44
44
  set_formats(host: HTMLElement, formats: Formats): void;
45
45
  /** Per-column editor choices: `{ customer: ["Alpha", "Beta"] }`. */
46
46
  set_choices(host: HTMLElement, choices: Choices): void;
47
- /** The whole view as one value; `null` before the grid is connected. */
48
- get_view(host: HTMLElement): View | null;
47
+ /**
48
+ * The whole view as one value; `null` before the element is connected. A
49
+ * pivot's is a {@link PivotView}: `get_view<PivotView>(pivot)`.
50
+ */
51
+ get_view<V extends View | PivotView = View>(host: HTMLElement): V | null;
49
52
  /** Applies a view in one step and one query. Parts left out keep their default. */
50
53
  set_view(host: HTMLElement, view: ViewInput): void;
54
+ /** A pivot's view: `rows`, `columns` and `values` at once, one query. */
55
+ set_view(host: HTMLElement, view: PivotViewInput): void;
51
56
  /** Per-column presentation; narrows what the schema allows, never widens it. */
52
57
  set_columns(host: HTMLElement, columns: Columns): void;
53
58
  /**
@@ -100,7 +105,14 @@ export interface ConnectOptions {
100
105
  onCellChange?: (detail: CellChangeDetail) => void;
101
106
  }
102
107
 
103
- export interface Connection {
108
+ /** `connect`'s options for `<opengrid-pivot>`: its view is a {@link PivotView}. */
109
+ export type PivotConnectOptions = Omit<ConnectOptions, "view" | "defaultView" | "onViewChange"> & {
110
+ view?: PivotViewInput | null;
111
+ defaultView?: PivotViewInput;
112
+ onViewChange?: (view: PivotView) => void;
113
+ };
114
+
115
+ export interface Connection<O = ConnectOptions> {
104
116
  /** Settles once the module is loaded and the options are applied. */
105
117
  ready: Promise<LoadResult>;
106
118
  /**
@@ -108,7 +120,7 @@ export interface Connection {
108
120
  * `undefined` resets it — except `provider`, and `view`, where it means the
109
121
  * grid leads.
110
122
  */
111
- update(options?: ConnectOptions): void;
123
+ update(options?: O): void;
112
124
  /** Removes the listeners. The element keeps its state. */
113
125
  disconnect(): void;
114
126
  }
@@ -121,6 +133,10 @@ export interface Connection {
121
133
  * a page that needs its own URLs calls `loadOpengrid(options)` first.
122
134
  */
123
135
  export function connect(host: HTMLElement, options?: ConnectOptions): Connection;
136
+ export function connect(
137
+ host: HTMLElement,
138
+ options: PivotConnectOptions,
139
+ ): Connection<PivotConnectOptions>;
124
140
 
125
141
  // ---------------------------------------------------------------------------
126
142
  // Providers
@@ -512,6 +528,45 @@ export interface View {
512
528
  facets: Record<string, FacetSelection>;
513
529
  }
514
530
 
531
+ /** A pivot measure, as the contract writes it: `{ field: "qty", fn: "sum", as: "total" }`. */
532
+ export interface PivotMeasure {
533
+ /** Absent for `count`. */
534
+ field?: string;
535
+ fn: string;
536
+ as: string;
537
+ }
538
+
539
+ /**
540
+ * The view of `<opengrid-pivot>`: what it pivots by and what it measures — its
541
+ * `rows`, `columns`, `values`, `sort`, `collapsed` and `filter` attributes as
542
+ * one value.
543
+ */
544
+ export interface PivotView {
545
+ rows: string[];
546
+ columns: string[];
547
+ values: PivotMeasure[];
548
+ /** How each level is ordered; empty is every level ascending by its values. */
549
+ sort: PivotSort[];
550
+ /** The folded groups, each as its path of keys; a NULL key is `null`. */
551
+ collapsed: WireValue[][];
552
+ /** The filter on the raw rows, as the wire writes it; `null` for none. */
553
+ filter: Record<string, unknown> | null;
554
+ }
555
+
556
+ /**
557
+ * One level's order (rule P9): `field` names the row dimension; without `by`
558
+ * the level is ordered by its own values, with it by that measure over the
559
+ * whole row. A subtotal stays after its group.
560
+ */
561
+ export interface PivotSort {
562
+ field: string;
563
+ by?: string;
564
+ direction: "asc" | "desc";
565
+ }
566
+
567
+ /** What `set_view` takes for a pivot: a part left out is empty. */
568
+ export type PivotViewInput = Partial<PivotView>;
569
+
515
570
  /** The query of a view, as `get_query` gives it: every match, no window. */
516
571
  export interface ViewQuery {
517
572
  source: string;
@@ -612,6 +667,21 @@ export type TextKey =
612
667
  | "apply"
613
668
  | "addGrouping"
614
669
  | "groupingFull"
670
+ | "pivotToolbar"
671
+ | "pivotRows"
672
+ | "pivotColumns"
673
+ | "pivotMeasures"
674
+ | "addRow"
675
+ | "addColumn"
676
+ | "addMeasure"
677
+ | "columnFull"
678
+ | "nothingToAdd"
679
+ | "fieldRemove"
680
+ | "fieldEarlier"
681
+ | "fieldLater"
682
+ | "pivotFilters"
683
+ | "pivotFilterLabel"
684
+ | "pivotFilterHint"
615
685
  | "filterAny"
616
686
  | "booleanTrue"
617
687
  | "booleanFalse"
@@ -702,8 +772,9 @@ export interface QueryDetail {
702
772
  }
703
773
 
704
774
  /** `opengrid-view-change`: the whole view after the change. */
705
- export interface ViewChangeDetail {
706
- view: View;
775
+ export interface ViewChangeDetail<V = View> {
776
+ /** A pivot's is a {@link PivotView}. */
777
+ view: V;
707
778
  }
708
779
 
709
780
  /** The events, by name. All bubble, all are composed, none is cancelable. */
@@ -758,6 +829,18 @@ export interface OpengridPivotAttributes {
758
829
  columns?: string;
759
830
  /** The measures as the contract's JSON: `[{"field":"qty","fn":"sum","as":"total"}]`. */
760
831
  values?: string;
832
+ /** How each level is ordered, as the wire's JSON: `[{"field":"country","by":"total","direction":"desc"}]`. */
833
+ sort?: string;
834
+ /** The folded groups, as a JSON list of group paths: `[["DE"],[null]]`. */
835
+ collapsed?: string;
836
+ /** Shows the field toolbar; presence is what counts. */
837
+ toolbar?: string;
838
+ /** The fields a reader may pivot by, comma-separated. */
839
+ fields?: string;
840
+ /** The measures a reader may add, as the contract's JSON. */
841
+ measures?: string;
842
+ /** The filter on the raw rows, as the wire's JSON: `{"field":"country","op":"eq","value":"DE"}`. */
843
+ filter?: string;
761
844
  theme?: Theme;
762
845
  }
763
846
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casoon/opengrid",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Accessible data grid, table and pivot as web components, driven by a portable Rust/WASM query engine — with React, Vue and Svelte components.",
6
6
  "keywords": [
@@ -65,6 +65,9 @@ export function get_query(host: HTMLElement): any;
65
65
  * A "saved view" is this value with a name on it, which is why the element has
66
66
  * no view management of its own: naming, storing and deleting are the page's,
67
67
  * the same line `docs/api.md` draws for editing.
68
+ *
69
+ * A pivot's view is what it pivots by and measures (issue #106):
70
+ * `{ rows, columns, values }`.
68
71
  */
69
72
  export function get_view(host: HTMLElement): any;
70
73
 
@@ -162,6 +165,9 @@ export function set_texts(host: HTMLElement, values: any): void;
162
165
  * A view that names a column this grid does not have is reported in the status
163
166
  * line and **not** applied in part — a grid that looks restored and is not is
164
167
  * the worse failure (point 56 §Das Modell §2).
168
+ *
169
+ * A pivot takes `{ rows, columns, values }` and writes them to its attributes
170
+ * at once (issue #106).
165
171
  */
166
172
  export function set_view(host: HTMLElement, view: any): void;
167
173
 
@@ -1,8 +1,8 @@
1
1
  /* @ts-self-types="./opengrid_web_components.d.ts" */
2
- import { __opengrid_define_element } from './snippets/opengrid-web-core-bc2e9f7f34704c7f/inline1.js';
3
- import * as import1 from "./snippets/opengrid-web-core-bc2e9f7f34704c7f/inline0.js"
4
- import * as import2 from "./snippets/opengrid-web-core-bc2e9f7f34704c7f/inline0.js"
5
- import * as import3 from "./snippets/opengrid-web-core-bc2e9f7f34704c7f/inline0.js"
2
+ import { __opengrid_define_element } from './snippets/opengrid-web-core-e69c5e78cdf8dd2b/inline1.js';
3
+ import * as import1 from "./snippets/opengrid-web-core-e69c5e78cdf8dd2b/inline0.js"
4
+ import * as import2 from "./snippets/opengrid-web-core-e69c5e78cdf8dd2b/inline0.js"
5
+ import * as import3 from "./snippets/opengrid-web-core-e69c5e78cdf8dd2b/inline0.js"
6
6
 
7
7
 
8
8
  /**
@@ -124,6 +124,9 @@ export function get_query(host) {
124
124
  * A "saved view" is this value with a name on it, which is why the element has
125
125
  * no view management of its own: naming, storing and deleting are the page's,
126
126
  * the same line `docs/api.md` draws for editing.
127
+ *
128
+ * A pivot's view is what it pivots by and measures (issue #106):
129
+ * `{ rows, columns, values }`.
127
130
  * @param {HTMLElement} host
128
131
  * @returns {any}
129
132
  */
@@ -253,6 +256,9 @@ export function set_texts(host, values) {
253
256
  * A view that names a column this grid does not have is reported in the status
254
257
  * line and **not** applied in part — a grid that looks restored and is not is
255
258
  * the worse failure (point 56 §Das Modell §2).
259
+ *
260
+ * A pivot takes `{ rows, columns, values }` and writes them to its attributes
261
+ * at once (issue #106).
256
262
  * @param {HTMLElement} host
257
263
  * @param {any} view
258
264
  */
@@ -266,7 +272,7 @@ function __wbg_get_imports() {
266
272
  const ret = Error(getStringFromWasm0(arg0, arg1));
267
273
  return ret;
268
274
  },
269
- __wbg___opengrid_define_element_b163d1ac1f4be22f: function(arg0, arg1, arg2, arg3, arg4, arg5) {
275
+ __wbg___opengrid_define_element_240632039493c3d3: function(arg0, arg1, arg2, arg3, arg4, arg5) {
270
276
  __opengrid_define_element(getStringFromWasm0(arg0, arg1), arg2, arg3, arg4, arg5);
271
277
  },
272
278
  __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
@@ -541,6 +547,16 @@ function __wbg_get_imports() {
541
547
  const ret = result;
542
548
  return ret;
543
549
  },
550
+ __wbg_instanceof_KeyboardEvent_be49f2d8e15d587a: function(arg0) {
551
+ let result;
552
+ try {
553
+ result = arg0 instanceof KeyboardEvent;
554
+ } catch (_) {
555
+ result = false;
556
+ }
557
+ const ret = result;
558
+ return ret;
559
+ },
544
560
  __wbg_instanceof_Object_33f20e6f12439f3e: function(arg0) {
545
561
  let result;
546
562
  try {
@@ -642,6 +658,10 @@ function __wbg_get_imports() {
642
658
  const ret = arg0.length;
643
659
  return ret;
644
660
  },
661
+ __wbg_matches_9f92e758db2111f0: function() { return handleError(function (arg0, arg1, arg2) {
662
+ const ret = arg0.matches(getStringFromWasm0(arg1, arg2));
663
+ return ret;
664
+ }, arguments); },
645
665
  __wbg_metaKey_d961c7572a9f84f5: function(arg0) {
646
666
  const ret = arg0.metaKey;
647
667
  return ret;
@@ -932,42 +952,42 @@ function __wbg_get_imports() {
932
952
  return ret;
933
953
  },
934
954
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
935
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 182, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
955
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 214, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
936
956
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bindgen_66404d18cc2edcc2___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_66404d18cc2edcc2___JsError___true_);
937
957
  return ret;
938
958
  },
939
959
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
940
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
960
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 16, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
941
961
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true_);
942
962
  return ret;
943
963
  },
944
964
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
945
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
965
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 16, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
946
966
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__2);
947
967
  return ret;
948
968
  },
949
969
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
950
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement"), String, Option(String), Option(String)], shim_idx: 19, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
970
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement"), String, Option(String), Option(String)], shim_idx: 17, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
951
971
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_90ed3bea5014610e___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_);
952
972
  return ret;
953
973
  },
954
974
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
955
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
975
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement")], shim_idx: 16, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
956
976
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__4);
957
977
  return ret;
958
978
  },
959
979
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
960
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
980
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 16, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
961
981
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__5);
962
982
  return ret;
963
983
  },
964
984
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
965
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 168, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
985
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 200, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
966
986
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_);
967
987
  return ret;
968
988
  },
969
989
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
970
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 17, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
990
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 15, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
971
991
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true_);
972
992
  return ret;
973
993
  },
@@ -994,9 +1014,9 @@ function __wbg_get_imports() {
994
1014
  return {
995
1015
  __proto__: null,
996
1016
  "./opengrid_web_components_bg.js": import0,
997
- "./snippets/opengrid-web-core-bc2e9f7f34704c7f/inline0.js": import1,
998
- "./snippets/opengrid-web-core-bc2e9f7f34704c7f/inline0.js": import2,
999
- "./snippets/opengrid-web-core-bc2e9f7f34704c7f/inline0.js": import3,
1017
+ "./snippets/opengrid-web-core-e69c5e78cdf8dd2b/inline0.js": import1,
1018
+ "./snippets/opengrid-web-core-e69c5e78cdf8dd2b/inline0.js": import2,
1019
+ "./snippets/opengrid-web-core-e69c5e78cdf8dd2b/inline0.js": import3,
1000
1020
  };
1001
1021
  }
1002
1022
 
Binary file
package/react/index.d.ts CHANGED
@@ -27,6 +27,7 @@ import type {
27
27
  OpengridGridElement,
28
28
  OpengridPivotElement,
29
29
  OpengridTableElement,
30
+ PivotConnectOptions,
30
31
  } from "../loader.js";
31
32
 
32
33
  /** What the element itself takes from React, minus what the component owns. */
@@ -66,7 +67,8 @@ export interface OpengridTableProps extends ConnectOptions, ElementProps {
66
67
  theme?: Theme;
67
68
  }
68
69
 
69
- export interface OpengridPivotProps extends ConnectOptions, ElementProps {
70
+ /** A pivot's view is a `PivotView`: its `rows`, `columns` and `values`. */
71
+ export interface OpengridPivotProps extends PivotConnectOptions, ElementProps {
70
72
  label?: string;
71
73
  datasource?: string;
72
74
  /** Comma-separated row dimensions, outermost first. */
@@ -75,6 +77,18 @@ export interface OpengridPivotProps extends ConnectOptions, ElementProps {
75
77
  columns?: string;
76
78
  /** The measures as the contract's JSON. */
77
79
  values?: string;
80
+ /** How each level is ordered, as the wire's JSON; part of the view. */
81
+ sort?: string;
82
+ /** The folded groups, as a JSON list of group paths; part of the view. */
83
+ collapsed?: string;
84
+ /** Shows the field toolbar. */
85
+ toolbar?: boolean;
86
+ /** The fields a reader may pivot by, comma-separated. */
87
+ fields?: string;
88
+ /** The measures a reader may add, as the contract's JSON. */
89
+ measures?: string;
90
+ /** The filter on the raw rows, as the wire's JSON; part of the view. */
91
+ filter?: string;
78
92
  theme?: Theme;
79
93
  }
80
94
 
package/react/index.js CHANGED
@@ -170,7 +170,13 @@ export const OpengridPivot = component(
170
170
  rows: "rows",
171
171
  columns: "columns",
172
172
  values: "values",
173
+ sort: "sort",
174
+ collapsed: "collapsed",
175
+ toolbar: "toolbar",
176
+ fields: "fields",
177
+ measures: "measures",
178
+ filter: "filter",
173
179
  theme: "theme",
174
180
  },
175
- [],
181
+ ["toolbar"],
176
182
  );
@@ -2,12 +2,15 @@
2
2
  <script>
3
3
  import Opengrid from "./Opengrid.svelte";
4
4
 
5
- let { label, datasource, rows, columns, values, theme, view = $bindable(), element = $bindable(), ...rest } = $props();
5
+ let { label, datasource, rows, columns, values, sort, collapsed, toolbar = false, fields, measures, filter, theme, view = $bindable(), element = $bindable(), ...rest } = $props();
6
+
7
+ /** A boolean attribute is present or absent; `false` is absent. */
8
+ const flag = (on) => (on ? "" : undefined);
6
9
  </script>
7
10
 
8
11
  <Opengrid
9
12
  tag="opengrid-pivot"
10
- attributes={{ label, datasource, rows, columns, values, theme }}
13
+ attributes={{ label, datasource, rows, columns, values, sort, collapsed, toolbar: flag(toolbar), fields, measures, filter, theme }}
11
14
  bind:view
12
15
  bind:element
13
16
  {...rest}
package/svelte/index.d.ts CHANGED
@@ -21,6 +21,8 @@ import type {
21
21
  Density,
22
22
  Theme,
23
23
  Mode,
24
+ PivotConnectOptions,
25
+ PivotView,
24
26
  SelectionChangeDetail,
25
27
  View,
26
28
  } from "../loader.js";
@@ -69,7 +71,18 @@ export interface OpengridTableProps extends Options, ElementProps {
69
71
  theme?: Theme;
70
72
  }
71
73
 
72
- export interface OpengridPivotProps extends Options, ElementProps {
74
+ /** The pivot's options: its view is a `PivotView`. */
75
+ type PivotOptions = Omit<
76
+ PivotConnectOptions,
77
+ "onViewChange" | "onSelectionChange" | "onCellChange"
78
+ > & {
79
+ element?: HTMLElement;
80
+ onviewchange?: (view: PivotView) => void;
81
+ onselectionchange?: (detail: SelectionChangeDetail) => void;
82
+ oncellchange?: (detail: CellChangeDetail) => void;
83
+ };
84
+
85
+ export interface OpengridPivotProps extends PivotOptions, ElementProps {
73
86
  label?: string;
74
87
  datasource?: string;
75
88
  /** Comma-separated row dimensions, outermost first. */
@@ -78,6 +91,18 @@ export interface OpengridPivotProps extends Options, ElementProps {
78
91
  columns?: string;
79
92
  /** The measures as the contract's JSON. */
80
93
  values?: string;
94
+ /** How each level is ordered, as the wire's JSON; part of the view. */
95
+ sort?: string;
96
+ /** The folded groups, as a JSON list of group paths; part of the view. */
97
+ collapsed?: string;
98
+ /** Shows the field toolbar. */
99
+ toolbar?: boolean;
100
+ /** The fields a reader may pivot by, comma-separated. */
101
+ fields?: string;
102
+ /** The measures a reader may add, as the contract's JSON. */
103
+ measures?: string;
104
+ /** The filter on the raw rows, as the wire's JSON; part of the view. */
105
+ filter?: string;
81
106
  theme?: Theme;
82
107
  }
83
108
 
package/vue/index.d.ts CHANGED
@@ -14,6 +14,8 @@ import type {
14
14
  Density,
15
15
  Theme,
16
16
  Mode,
17
+ PivotConnectOptions,
18
+ PivotView,
17
19
  SelectionChangeDetail,
18
20
  View,
19
21
  } from "../loader.js";
@@ -60,7 +62,13 @@ export interface OpengridTableProps extends Options {
60
62
  theme?: Theme;
61
63
  }
62
64
 
63
- export interface OpengridPivotProps extends Options {
65
+ /** The pivot's events: its view is a `PivotView`. */
66
+ export type OpengridPivotEmits = Omit<OpengridEmits, "update:view"> & {
67
+ "update:view": (view: PivotView) => void;
68
+ };
69
+
70
+ export interface OpengridPivotProps
71
+ extends Omit<PivotConnectOptions, "onViewChange" | "onSelectionChange" | "onCellChange"> {
64
72
  label?: string;
65
73
  datasource?: string;
66
74
  /** Comma-separated row dimensions, outermost first. */
@@ -69,9 +77,21 @@ export interface OpengridPivotProps extends Options {
69
77
  columns?: string;
70
78
  /** The measures as the contract's JSON. */
71
79
  values?: string;
80
+ /** How each level is ordered, as the wire's JSON; part of the view. */
81
+ sort?: string;
82
+ /** The folded groups, as a JSON list of group paths; part of the view. */
83
+ collapsed?: string;
84
+ /** Shows the field toolbar. */
85
+ toolbar?: boolean;
86
+ /** The fields a reader may pivot by, comma-separated. */
87
+ fields?: string;
88
+ /** The measures a reader may add, as the contract's JSON. */
89
+ measures?: string;
90
+ /** The filter on the raw rows, as the wire's JSON; part of the view. */
91
+ filter?: string;
72
92
  theme?: Theme;
73
93
  }
74
94
 
75
95
  export const OpengridGrid: DefineSetupFnComponent<OpengridGridProps, OpengridEmits>;
76
96
  export const OpengridTable: DefineSetupFnComponent<OpengridTableProps, OpengridEmits>;
77
- export const OpengridPivot: DefineSetupFnComponent<OpengridPivotProps, OpengridEmits>;
97
+ export const OpengridPivot: DefineSetupFnComponent<OpengridPivotProps, OpengridPivotEmits>;
package/vue/index.js CHANGED
@@ -162,7 +162,13 @@ export const OpengridPivot = component(
162
162
  rows: "rows",
163
163
  columns: "columns",
164
164
  values: "values",
165
+ sort: "sort",
166
+ collapsed: "collapsed",
167
+ toolbar: "toolbar",
168
+ fields: "fields",
169
+ measures: "measures",
170
+ filter: "filter",
165
171
  theme: "theme",
166
172
  },
167
- [],
173
+ ["toolbar"],
168
174
  );