@casoon/opengrid 0.10.0 → 0.11.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,41 @@ Two things belong in every release entry and are easy to leave out:
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [0.11.0] — 2026-10-08
22
+
23
+ **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
24
+ **Browsers:** Chromium (the whole e2e suite: 1127 passed), WebKit (`just e2e-browsers` on macOS:
25
+ 556 passed, 10 skipped by design). Firefox, on Linux (`gh workflow run ci.yml -f browsers=true`,
26
+ since Playwright's Firefox does not start on the release machine): **two failures** — an unnamed
27
+ tab stop in the narrow toolbar and a scroll area 1 px short after unfolding a cell
28
+ ([#157](https://github.com/casoon/opengrid/issues/157)); everything else passed.
29
+
30
+ The grid as an editing surface a page saves cell by cell: the edit names its record, the page says
31
+ what became of it, and fills columns of its own. Asked for by a grade entry grid.
32
+
33
+ **What breaks:** nothing. Every change is an addition.
34
+
35
+ **Module sizes** (brotli, `just measure-modules`): the elements 239.8 → 243.5 KiB, past their bound,
36
+ which this release raises (`scripts/module-budget.txt`); the engine is unchanged to the byte.
37
+
38
+ ### Added
39
+
40
+ - **Saving edits from the page** ([#153](https://github.com/casoon/opengrid/issues/153)).
41
+ - `row-key="<field>"` names the record: `opengrid-cell-change` carries `key`, the edited row's
42
+ value of that field, next to `row` — which holds only until something sorts or reloads.
43
+ - `set_cell_state(host, key, column, state, message?)` with `saving`, `saved` or `error`.
44
+ `saved` takes the unsaved mark off without a reload; `error` keeps the value and the mark,
45
+ sets `aria-invalid` and says `message` in the grid's one polite live region. The focus never
46
+ moves.
47
+ - Each state is a part of its own next to `cell` — `cell-saving`, `cell-saved`, `cell-error` —
48
+ so a page styles it with `::part(cell-error)`.
49
+ - `set_values(host, [{ key, column, value }])` shows values the page computes. Not edits: no
50
+ unsaved mark, no event.
51
+ - `readonly: true` in `set_columns`: the column never opens an editor and its cells say
52
+ `aria-readonly`. `<opengrid-table>` refuses the option.
53
+ - States and values name records, so they outlive sorting, filtering and reloading; another
54
+ `row-key` or `datasource` forgets them. A guide: *Saving edits from the page*.
55
+
21
56
  ## [0.10.0] — 2026-10-02
22
57
 
23
58
  **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
Binary file
package/loader.d.ts CHANGED
@@ -75,6 +75,27 @@ export interface OpengridModule {
75
75
  * Values are in the canonical wire notation: a float `2` reads `2.0`.
76
76
  */
77
77
  get_pivot(host: HTMLElement, options?: CsvOptions): string | null;
78
+ /**
79
+ * What became of an edit the page saves (issue #153). `key` is the record's
80
+ * `row-key` value as `opengrid-cell-change` gave it. `saved` clears the
81
+ * unsaved mark; `error` keeps the value and says `message` in the live
82
+ * region. The cell's part is then `cell cell-<state>` (`::part(cell-error)`);
83
+ * the focus never moves.
84
+ * Requires `row-key`.
85
+ */
86
+ set_cell_state(
87
+ host: HTMLElement,
88
+ key: WireValue,
89
+ column: string,
90
+ state: CellState,
91
+ message?: string,
92
+ ): void;
93
+ /**
94
+ * Values the page computes, shown in place of the source's — not edits: no
95
+ * unsaved mark, no event. The column is `readonly` in `set_columns`.
96
+ * Requires `row-key`.
97
+ */
98
+ set_values(host: HTMLElement, values: CellValue[]): void;
78
99
  /** Defines the three elements. `loadOpengrid()` calls it. */
79
100
  register(): void;
80
101
  }
@@ -471,6 +492,21 @@ export interface ColumnConfig {
471
492
  muted?: boolean;
472
493
  aggregate?: Aggregate;
473
494
  facet?: FacetKind;
495
+ /**
496
+ * The page fills this column (`set_values`): it never opens an editor and
497
+ * its cells are announced as read-only. The grid only.
498
+ */
499
+ readonly?: boolean;
500
+ }
501
+
502
+ /** What `set_cell_state` says became of an edit. */
503
+ export type CellState = "saving" | "saved" | "error";
504
+
505
+ /** One value for `set_values`: the record by its `row-key`, the column, the value. */
506
+ export interface CellValue {
507
+ key: WireValue;
508
+ column: string;
509
+ value: WireValue;
474
510
  }
475
511
 
476
512
  export type Columns = Record<string, ColumnConfig>;
@@ -782,6 +818,11 @@ export interface SelectionChangeDetail {
782
818
  /** `opengrid-cell-change`: everything a page needs to persist an edit. */
783
819
  export interface CellChangeDetail {
784
820
  row: number;
821
+ /**
822
+ * With `row-key` only: the edited row's value of that field — `null` when
823
+ * the result does not carry it. The record, where `row` is a position.
824
+ */
825
+ key?: WireValue;
785
826
  column: string;
786
827
  value: string;
787
828
  previous: string;
@@ -839,6 +880,8 @@ export interface OpengridGridAttributes {
839
880
  tree?: string;
840
881
  /** The field the parent key refers to; `id` when absent. */
841
882
  "tree-key"?: string;
883
+ /** The field that names a record: `key` in `opengrid-cell-change`. */
884
+ "row-key"?: string;
842
885
  search?: string;
843
886
  facets?: string;
844
887
  toolbar?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casoon/opengrid",
3
- "version": "0.10.0",
3
+ "version": "0.11.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": [
@@ -80,6 +80,18 @@ export function get_view(host: HTMLElement): any;
80
80
  */
81
81
  export function register(): void;
82
82
 
83
+ /**
84
+ * Says what became of an edit the page saves (issue #153).
85
+ *
86
+ * `key` is the record's `row-key` value, as `opengrid-cell-change` gave it;
87
+ * `state` is `saving`, `saved` or `error`. `saved` takes the unsaved mark
88
+ * off; `error` keeps the value and the mark and says `message` in the live
89
+ * region. The state shows on the cell as `data-state`, stays with the record
90
+ * through sorting and reloading, and never moves the focus. Nothing happens
91
+ * without `row-key`, or for a key, column or state the grid does not know.
92
+ */
93
+ export function set_cell_state(host: HTMLElement, key: any, column: string, state: string, message?: string | null): void;
94
+
83
95
  /**
84
96
  * Sets the choices a column's editor offers (plan point 37).
85
97
  *
@@ -155,6 +167,15 @@ export function set_provider(host: HTMLElement, provider: any): void;
155
167
 
156
168
  export function set_texts(host: HTMLElement, values: any): void;
157
169
 
170
+ /**
171
+ * Shows values the page computes (issue #153): `[{ key, column, value }]`.
172
+ *
173
+ * Not edits: no unsaved mark, no `opengrid-cell-change`. They stand over the
174
+ * source's value for that record until the page sets another. A column the
175
+ * page fills is `readonly` in `set_columns`. Requires `row-key`.
176
+ */
177
+ export function set_values(host: HTMLElement, values: any): void;
178
+
158
179
  /**
159
180
  * Applies a whole view at once (plan point 59).
160
181
  *
@@ -186,11 +207,13 @@ export interface InitOutput {
186
207
  readonly get_query: (a: any) => any;
187
208
  readonly get_view: (a: any) => any;
188
209
  readonly register: () => [number, number];
210
+ readonly set_cell_state: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => void;
189
211
  readonly set_choices: (a: any, b: any) => void;
190
212
  readonly set_columns: (a: any, b: any) => void;
191
213
  readonly set_formats: (a: any, b: any) => void;
192
214
  readonly set_provider: (a: any, b: any) => void;
193
215
  readonly set_texts: (a: any, b: any) => void;
216
+ readonly set_values: (a: any, b: any) => void;
194
217
  readonly set_view: (a: any, b: any, c: any) => void;
195
218
  readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___web_sys_390d3ac0468b6516___features__gen_HtmlElement__HtmlElement__alloc_cb2b8d99256f33df___string__String__core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String___core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
196
219
  readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_: (a: number, b: number, c: any) => [number, number];
@@ -1,9 +1,9 @@
1
1
  /* @ts-self-types="./opengrid_web_components.d.ts" */
2
- import { __opengrid_intl_formatter } from './snippets/opengrid-web-components-cfa74f7f54f9c66d/inline0.js';
3
- import { __opengrid_define_element } from './snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline1.js';
4
- import * as import1 from "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js"
5
- import * as import2 from "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js"
6
- import * as import3 from "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js"
2
+ import { __opengrid_intl_formatter } from './snippets/opengrid-web-components-04a0bde4d39568d3/inline0.js';
3
+ import { __opengrid_define_element } from './snippets/opengrid-web-core-8c4306a3e0319748/inline1.js';
4
+ import * as import1 from "./snippets/opengrid-web-core-8c4306a3e0319748/inline0.js"
5
+ import * as import2 from "./snippets/opengrid-web-core-8c4306a3e0319748/inline0.js"
6
+ import * as import3 from "./snippets/opengrid-web-core-8c4306a3e0319748/inline0.js"
7
7
 
8
8
 
9
9
  /**
@@ -150,6 +150,31 @@ export function register() {
150
150
  }
151
151
  }
152
152
 
153
+ /**
154
+ * Says what became of an edit the page saves (issue #153).
155
+ *
156
+ * `key` is the record's `row-key` value, as `opengrid-cell-change` gave it;
157
+ * `state` is `saving`, `saved` or `error`. `saved` takes the unsaved mark
158
+ * off; `error` keeps the value and the mark and says `message` in the live
159
+ * region. The state shows on the cell as `data-state`, stays with the record
160
+ * through sorting and reloading, and never moves the focus. Nothing happens
161
+ * without `row-key`, or for a key, column or state the grid does not know.
162
+ * @param {HTMLElement} host
163
+ * @param {any} key
164
+ * @param {string} column
165
+ * @param {string} state
166
+ * @param {string | null} [message]
167
+ */
168
+ export function set_cell_state(host, key, column, state, message) {
169
+ const ptr0 = passStringToWasm0(column, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
170
+ const len0 = WASM_VECTOR_LEN;
171
+ const ptr1 = passStringToWasm0(state, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
172
+ const len1 = WASM_VECTOR_LEN;
173
+ var ptr2 = isLikeNone(message) ? 0 : passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
174
+ var len2 = WASM_VECTOR_LEN;
175
+ wasm.set_cell_state(host, key, ptr0, len0, ptr1, len1, ptr2, len2);
176
+ }
177
+
153
178
  /**
154
179
  * Sets the choices a column's editor offers (plan point 37).
155
180
  *
@@ -247,6 +272,19 @@ export function set_texts(host, values) {
247
272
  wasm.set_texts(host, values);
248
273
  }
249
274
 
275
+ /**
276
+ * Shows values the page computes (issue #153): `[{ key, column, value }]`.
277
+ *
278
+ * Not edits: no unsaved mark, no `opengrid-cell-change`. They stand over the
279
+ * source's value for that record until the page sets another. A column the
280
+ * page fills is `readonly` in `set_columns`. Requires `row-key`.
281
+ * @param {HTMLElement} host
282
+ * @param {any} values
283
+ */
284
+ export function set_values(host, values) {
285
+ wasm.set_values(host, values);
286
+ }
287
+
250
288
  /**
251
289
  * Applies a whole view at once (plan point 59).
252
290
  *
@@ -279,10 +317,10 @@ function __wbg_get_imports() {
279
317
  const ret = Error(getStringFromWasm0(arg0, arg1));
280
318
  return ret;
281
319
  },
282
- __wbg___opengrid_define_element_7231be6371bb9dcb: function(arg0, arg1, arg2, arg3, arg4, arg5) {
320
+ __wbg___opengrid_define_element_1a8e6a7af087e9e4: function(arg0, arg1, arg2, arg3, arg4, arg5) {
283
321
  __opengrid_define_element(getStringFromWasm0(arg0, arg1), arg2, arg3, arg4, arg5);
284
322
  },
285
- __wbg___opengrid_intl_formatter_9b6d5f011d93dec7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
323
+ __wbg___opengrid_intl_formatter_8256df1502ec6039: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
286
324
  const ret = __opengrid_intl_formatter(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4);
287
325
  return ret;
288
326
  }, arguments); },
@@ -1017,9 +1055,9 @@ function __wbg_get_imports() {
1017
1055
  return {
1018
1056
  __proto__: null,
1019
1057
  "./opengrid_web_components_bg.js": import0,
1020
- "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js": import1,
1021
- "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js": import2,
1022
- "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js": import3,
1058
+ "./snippets/opengrid-web-core-8c4306a3e0319748/inline0.js": import1,
1059
+ "./snippets/opengrid-web-core-8c4306a3e0319748/inline0.js": import2,
1060
+ "./snippets/opengrid-web-core-8c4306a3e0319748/inline0.js": import3,
1023
1061
  };
1024
1062
  }
1025
1063
 
Binary file
@@ -7,11 +7,13 @@ export const get_pivot: (a: any, b: any) => [number, number, number];
7
7
  export const get_query: (a: any) => any;
8
8
  export const get_view: (a: any) => any;
9
9
  export const register: () => [number, number];
10
+ export const set_cell_state: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => void;
10
11
  export const set_choices: (a: any, b: any) => void;
11
12
  export const set_columns: (a: any, b: any) => void;
12
13
  export const set_formats: (a: any, b: any) => void;
13
14
  export const set_provider: (a: any, b: any) => void;
14
15
  export const set_texts: (a: any, b: any) => void;
16
+ export const set_values: (a: any, b: any) => void;
15
17
  export const set_view: (a: any, b: any, c: any) => void;
16
18
  export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___web_sys_390d3ac0468b6516___features__gen_HtmlElement__HtmlElement__alloc_cb2b8d99256f33df___string__String__core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String___core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
17
19
  export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_: (a: number, b: number, c: any) => [number, number];