@casoon/opengrid 0.7.2 → 0.8.1

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,79 @@ Two things belong in every release entry and are easy to leave out:
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [0.8.1] — 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. A fix to the types; nothing breaks.
25
+
26
+ ### Fixed
27
+
28
+ - **`get_view` no longer widens a grid's view** ([#117](https://github.com/casoon/opengrid/issues/117)).
29
+ 0.8.0 made it generic, and where its result flowed into a typed place TypeScript inferred
30
+ `View | PivotView`. It is two overloads now: without a type argument the grid's `View`,
31
+ with one (`get_view<PivotView>(pivot)`) the pivot's.
32
+
33
+ ## [0.8.0] — 2026-09-30
34
+
35
+ **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
36
+ **Browsers:** Chromium (the whole e2e suite, 1047 passed) and WebKit (Playwright's, not Safari:
37
+ 516 passed, 10 skipped). Firefox: **not run**.
38
+
39
+ The pivot on the grid's level: titles and formats, a view and events, sorting, folding, choosing
40
+ the fields and filtering — each from the keyboard, each part of the view.
41
+
42
+ **What breaks:**
43
+ - `<opengrid-pivot>`'s row-dimension headers — and its measure headers without a column
44
+ dimension — hold a sort button now, and a group's subtotal header a fold button; the direction
45
+ and fold marks are `aria-hidden` text beside the names. A page that read a header's
46
+ `textContent` reads the mark too; read the button's first `span`, or what a reader hears.
47
+ - Rust: `PivotQuery` and `ValidatedPivotQuery` have new fields (`sort`; `orders`, `sort`), so a
48
+ struct literal needs them. The JSON form is unchanged for a pivot without `sort`.
49
+
50
+ **Module sizes** (brotli, `just measure-modules`): the elements 206.2 → 224.0 KiB, the engine
51
+ 115.2 → 118.8 KiB; both bounds raised with their reasons in `scripts/module-budget.txt`.
52
+
53
+ ### Added
54
+
55
+ - **Titles and formats in `<opengrid-pivot>`** ([#104](https://github.com/casoon/opengrid/issues/104)).
56
+ `set_columns` gives a row dimension or a measure its `title`, and `set_formats` formats
57
+ dimension values in the headers and measure cells, by field name or measure alias — as at the
58
+ grid and the table. NULL and the empty string keep their words in a header. Any option but
59
+ `title` is reported in the status line. `get_pivot` still exports raw names and values.
60
+ - **A view and events for `<opengrid-pivot>`** ([#106](https://github.com/casoon/opengrid/issues/106)).
61
+ `get_view`/`set_view` read and write `{ rows, columns, values }` — the three attributes as one
62
+ value, set in one query — and `opengrid-view-change` reports every change of them.
63
+ `opengrid-query` now fires after every pivot answer too. `OpengridPivot`'s `view`,
64
+ `defaultView` and `onViewChange` are typed `PivotView` in React, Vue and Svelte;
65
+ `get_view<PivotView>(pivot)` in TypeScript. `ViewChangeDetail` and `Connection` take a type
66
+ parameter whose default is the grid's, so existing code compiles unchanged.
67
+ - **Sorting in `<opengrid-pivot>`** ([#108](https://github.com/casoon/opengrid/issues/108)).
68
+ Each level is ordered by its own values or by a measure over the whole row, ascending or
69
+ descending; subtotals stay after their group (new rule P9, with conformance cases on the local
70
+ engine, WebAssembly, PostgreSQL and the export). The pivot query takes `sort:
71
+ [{ field, by?, direction }]` — sent only when there is one — and the element a `sort` attribute
72
+ that is part of its view. Row-dimension headers, and measure headers without a column
73
+ dimension, are sort buttons with `aria-sort`. On PostgreSQL a sorted pivot runs one query per
74
+ level instead of one `GROUPING SETS` statement.
75
+ - **Folding groups in `<opengrid-pivot>`** ([#110](https://github.com/casoon/opengrid/issues/110)).
76
+ With two row dimensions or more, a group's subtotal row header is a button with
77
+ `aria-expanded` that folds the group's rows away and opens them again, without a new query.
78
+ The status line says it (`groupCollapsed` / `groupExpanded`); the folded groups are a
79
+ `collapsed` attribute, part of the view. New parts `group-toggle` and `group-mark`.
80
+ - **Choosing the fields of `<opengrid-pivot>`** ([#112](https://github.com/casoon/opengrid/issues/112)).
81
+ With the `toolbar` attribute the reader chooses rows, the column and measures: per axis a
82
+ group of chips — move earlier/later, remove — and an add menu ("+ Row", "+ Column",
83
+ "+ Measure") offering what the page offers in the new `fields` and `measures` attributes. No
84
+ dragging; the menu has the grid's keyboard. Each change is one view, one query. New parts
85
+ `field-group`, `add-field`, `field-menu`, `chip-move`, and twelve text keys (`pivotToolbar`,
86
+ `addRow`, `fieldRemove`, …).
87
+ - **Filtering `<opengrid-pivot>`** ([#114](https://github.com/casoon/opengrid/issues/114)).
88
+ A `filter` attribute takes the wire's filter JSON and is part of the view; the filter acts on
89
+ the raw rows, before the pivot. With `toolbar` the reader gets a "Filters" group: a field for an
90
+ expression in the grid's language (`country = DE and qty ≥ 3`) and a removable chip per clause,
91
+ plus "Remove all". The types come from a pivot the provider already answers (the pivot has no
92
+ schema of its own). Three new text keys: `pivotFilters`, `pivotFilterLabel`, `pivotFilterHint`.
93
+
21
94
  ## [0.7.2] — 2026-09-30
22
95
 
23
96
  **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,17 @@ 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. */
47
+ /** The whole view as one value; `null` before the element is connected. */
48
48
  get_view(host: HTMLElement): View | null;
49
+ /**
50
+ * A pivot's view: `get_view<PivotView>(pivot)`. An overload of its own, so
51
+ * a grid's view is never widened to either kind.
52
+ */
53
+ get_view<V extends PivotView>(host: HTMLElement): V | null;
49
54
  /** Applies a view in one step and one query. Parts left out keep their default. */
50
55
  set_view(host: HTMLElement, view: ViewInput): void;
56
+ /** A pivot's view: `rows`, `columns` and `values` at once, one query. */
57
+ set_view(host: HTMLElement, view: PivotViewInput): void;
51
58
  /** Per-column presentation; narrows what the schema allows, never widens it. */
52
59
  set_columns(host: HTMLElement, columns: Columns): void;
53
60
  /**
@@ -100,7 +107,14 @@ export interface ConnectOptions {
100
107
  onCellChange?: (detail: CellChangeDetail) => void;
101
108
  }
102
109
 
103
- export interface Connection {
110
+ /** `connect`'s options for `<opengrid-pivot>`: its view is a {@link PivotView}. */
111
+ export type PivotConnectOptions = Omit<ConnectOptions, "view" | "defaultView" | "onViewChange"> & {
112
+ view?: PivotViewInput | null;
113
+ defaultView?: PivotViewInput;
114
+ onViewChange?: (view: PivotView) => void;
115
+ };
116
+
117
+ export interface Connection<O = ConnectOptions> {
104
118
  /** Settles once the module is loaded and the options are applied. */
105
119
  ready: Promise<LoadResult>;
106
120
  /**
@@ -108,7 +122,7 @@ export interface Connection {
108
122
  * `undefined` resets it — except `provider`, and `view`, where it means the
109
123
  * grid leads.
110
124
  */
111
- update(options?: ConnectOptions): void;
125
+ update(options?: O): void;
112
126
  /** Removes the listeners. The element keeps its state. */
113
127
  disconnect(): void;
114
128
  }
@@ -121,6 +135,10 @@ export interface Connection {
121
135
  * a page that needs its own URLs calls `loadOpengrid(options)` first.
122
136
  */
123
137
  export function connect(host: HTMLElement, options?: ConnectOptions): Connection;
138
+ export function connect(
139
+ host: HTMLElement,
140
+ options: PivotConnectOptions,
141
+ ): Connection<PivotConnectOptions>;
124
142
 
125
143
  // ---------------------------------------------------------------------------
126
144
  // Providers
@@ -512,6 +530,45 @@ export interface View {
512
530
  facets: Record<string, FacetSelection>;
513
531
  }
514
532
 
533
+ /** A pivot measure, as the contract writes it: `{ field: "qty", fn: "sum", as: "total" }`. */
534
+ export interface PivotMeasure {
535
+ /** Absent for `count`. */
536
+ field?: string;
537
+ fn: string;
538
+ as: string;
539
+ }
540
+
541
+ /**
542
+ * The view of `<opengrid-pivot>`: what it pivots by and what it measures — its
543
+ * `rows`, `columns`, `values`, `sort`, `collapsed` and `filter` attributes as
544
+ * one value.
545
+ */
546
+ export interface PivotView {
547
+ rows: string[];
548
+ columns: string[];
549
+ values: PivotMeasure[];
550
+ /** How each level is ordered; empty is every level ascending by its values. */
551
+ sort: PivotSort[];
552
+ /** The folded groups, each as its path of keys; a NULL key is `null`. */
553
+ collapsed: WireValue[][];
554
+ /** The filter on the raw rows, as the wire writes it; `null` for none. */
555
+ filter: Record<string, unknown> | null;
556
+ }
557
+
558
+ /**
559
+ * One level's order (rule P9): `field` names the row dimension; without `by`
560
+ * the level is ordered by its own values, with it by that measure over the
561
+ * whole row. A subtotal stays after its group.
562
+ */
563
+ export interface PivotSort {
564
+ field: string;
565
+ by?: string;
566
+ direction: "asc" | "desc";
567
+ }
568
+
569
+ /** What `set_view` takes for a pivot: a part left out is empty. */
570
+ export type PivotViewInput = Partial<PivotView>;
571
+
515
572
  /** The query of a view, as `get_query` gives it: every match, no window. */
516
573
  export interface ViewQuery {
517
574
  source: string;
@@ -612,6 +669,21 @@ export type TextKey =
612
669
  | "apply"
613
670
  | "addGrouping"
614
671
  | "groupingFull"
672
+ | "pivotToolbar"
673
+ | "pivotRows"
674
+ | "pivotColumns"
675
+ | "pivotMeasures"
676
+ | "addRow"
677
+ | "addColumn"
678
+ | "addMeasure"
679
+ | "columnFull"
680
+ | "nothingToAdd"
681
+ | "fieldRemove"
682
+ | "fieldEarlier"
683
+ | "fieldLater"
684
+ | "pivotFilters"
685
+ | "pivotFilterLabel"
686
+ | "pivotFilterHint"
615
687
  | "filterAny"
616
688
  | "booleanTrue"
617
689
  | "booleanFalse"
@@ -702,8 +774,9 @@ export interface QueryDetail {
702
774
  }
703
775
 
704
776
  /** `opengrid-view-change`: the whole view after the change. */
705
- export interface ViewChangeDetail {
706
- view: View;
777
+ export interface ViewChangeDetail<V = View> {
778
+ /** A pivot's is a {@link PivotView}. */
779
+ view: V;
707
780
  }
708
781
 
709
782
  /** The events, by name. All bubble, all are composed, none is cancelable. */
@@ -758,6 +831,18 @@ export interface OpengridPivotAttributes {
758
831
  columns?: string;
759
832
  /** The measures as the contract's JSON: `[{"field":"qty","fn":"sum","as":"total"}]`. */
760
833
  values?: string;
834
+ /** How each level is ordered, as the wire's JSON: `[{"field":"country","by":"total","direction":"desc"}]`. */
835
+ sort?: string;
836
+ /** The folded groups, as a JSON list of group paths: `[["DE"],[null]]`. */
837
+ collapsed?: string;
838
+ /** Shows the field toolbar; presence is what counts. */
839
+ toolbar?: string;
840
+ /** The fields a reader may pivot by, comma-separated. */
841
+ fields?: string;
842
+ /** The measures a reader may add, as the contract's JSON. */
843
+ measures?: string;
844
+ /** The filter on the raw rows, as the wire's JSON: `{"field":"country","op":"eq","value":"DE"}`. */
845
+ filter?: string;
761
846
  theme?: Theme;
762
847
  }
763
848
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casoon/opengrid",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
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-606a4bfc28493045/inline1.js';
3
- import * as import1 from "./snippets/opengrid-web-core-606a4bfc28493045/inline0.js"
4
- import * as import2 from "./snippets/opengrid-web-core-606a4bfc28493045/inline0.js"
5
- import * as import3 from "./snippets/opengrid-web-core-606a4bfc28493045/inline0.js"
2
+ import { __opengrid_define_element } from './snippets/opengrid-web-core-df12892104a61710/inline1.js';
3
+ import * as import1 from "./snippets/opengrid-web-core-df12892104a61710/inline0.js"
4
+ import * as import2 from "./snippets/opengrid-web-core-df12892104a61710/inline0.js"
5
+ import * as import3 from "./snippets/opengrid-web-core-df12892104a61710/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_2fc342e44388bc44: function(arg0, arg1, arg2, arg3, arg4, arg5) {
275
+ __wbg___opengrid_define_element_904842d97080c84a: 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 {
@@ -936,42 +952,42 @@ function __wbg_get_imports() {
936
952
  return ret;
937
953
  },
938
954
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
939
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 184, 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`.
940
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_);
941
957
  return ret;
942
958
  },
943
959
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
944
- // 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`.
945
961
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true_);
946
962
  return ret;
947
963
  },
948
964
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
949
- // 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`.
950
966
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__2);
951
967
  return ret;
952
968
  },
953
969
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
954
- // 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`.
955
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_);
956
972
  return ret;
957
973
  },
958
974
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
959
- // 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`.
960
976
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__4);
961
977
  return ret;
962
978
  },
963
979
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
964
- // 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`.
965
981
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__5);
966
982
  return ret;
967
983
  },
968
984
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
969
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 170, 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`.
970
986
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_);
971
987
  return ret;
972
988
  },
973
989
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
974
- // 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`.
975
991
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true_);
976
992
  return ret;
977
993
  },
@@ -998,9 +1014,9 @@ function __wbg_get_imports() {
998
1014
  return {
999
1015
  __proto__: null,
1000
1016
  "./opengrid_web_components_bg.js": import0,
1001
- "./snippets/opengrid-web-core-606a4bfc28493045/inline0.js": import1,
1002
- "./snippets/opengrid-web-core-606a4bfc28493045/inline0.js": import2,
1003
- "./snippets/opengrid-web-core-606a4bfc28493045/inline0.js": import3,
1017
+ "./snippets/opengrid-web-core-df12892104a61710/inline0.js": import1,
1018
+ "./snippets/opengrid-web-core-df12892104a61710/inline0.js": import2,
1019
+ "./snippets/opengrid-web-core-df12892104a61710/inline0.js": import3,
1004
1020
  };
1005
1021
  }
1006
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
  );