@casoon/opengrid 0.13.0 → 0.14.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,123 @@ Two things belong in every release entry and are easy to leave out:
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [0.14.0] — 2026-10-26
22
+
23
+ **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
24
+ **Browsers:** Chromium (the whole e2e suite: 1231 passed). Firefox and WebKit on Linux
25
+ (`gh workflow run ci.yml -f browsers=true`): 1216 passed, 19 skipped by design, one WebKit test of
26
+ the narrow filter row passed on its retry. The first run found the new paste tests failing in
27
+ Firefox — the test's synthetic `ClipboardEvent`, whose `clipboardData` Firefox does not take, not
28
+ the grid.
29
+
30
+ The grid edits like a working tool: new rows from the keyboard, a pasted block with a preview,
31
+ lists in a cell, undo, one value for many rows, validation while typing, row actions and editing
32
+ while grouped — and the page can hand it rows it already holds. Releases now come from a tag
33
+ workflow with npm Trusted Publishing.
34
+
35
+ **Module sizes** (brotli, `just measure-modules`): the elements 249.7 → 279.4 KiB, the engine
36
+ 139.9 → 145.4 KiB, measured against v0.13.0 — within their bounds, which the feature PRs raised as they grew them
37
+ (`scripts/module-budget.txt`).
38
+
39
+ **What breaks:**
40
+ - Rust: public enums gained variants for lists, so an exhaustive `match` must handle them —
41
+ `Value::List`, `DataType::ListUtf8` and `ListInt64`, `FilterExpr` and `ValidatedFilter`
42
+ `Has`, `HasAll` and `IsEmpty`, `CmpOp::Has` and `HasAll`, `QueryError::ListNotOrdered`,
43
+ `ValueError::NullInList`, and the grid's `FilterOp::IsEmpty`.
44
+ - Wire format: unchanged for existing columns; a reader older than 0.14.0 refuses a result that
45
+ carries a list column ("unknown type code").
46
+
47
+ ### Added
48
+
49
+ - **List values in a cell, with a type-ahead editor** ([#185](https://github.com/casoon/opengrid/issues/185)).
50
+ Schema types `list<utf8>` and `list<int64>`: shown as chips, edited in an ARIA combobox over
51
+ `set_choices` (which may now give `{ value, label }` pairs), several picks, `Backspace` takes
52
+ the last back, `Enter` commits, a text that is no choice is refused with the reason. Filter
53
+ operators **contains**, **contains all** and **is empty** (`has`, `has_all`, `is_empty` on the wire).
54
+ A plain column with choices gets the same combobox instead of a `<select>`. Engine, wire format
55
+ (type codes 8 and 9, additive), CSV (a JSON array in the cell), SQLite (JSON text, `json_each`)
56
+ and PostgreSQL (arrays) agree on 20 conformance cases. **A list has no order:** sorting,
57
+ grouping or `min`/`max` on a list column is refused (`ListNotOrdered`).
58
+ **What breaks:** a page that read `Value` or `DataType` exhaustively in Rust must handle the new
59
+ variants; the wire format is unchanged for existing columns; a reader older than this version
60
+ refuses a result that carries a list column ("unknown type code").
61
+ - **Undo and redo of edits** ([#186](https://github.com/casoon/opengrid/issues/186)).
62
+ `Ctrl`/`Cmd`+`Z` and `Shift`+`Ctrl`/`Cmd`+`Z` (or `Ctrl`+`Y`) walk the grid's own history of
63
+ cell edits, added rows and pastes (a paste is one step). Each step fires the original event
64
+ with `undo: true` (`redo: true` forward), so the page saves it like any edit; the status line
65
+ says what was undone. The history ends when the source is replaced.
66
+ - **Validation while typing, without blocking** ([#188](https://github.com/casoon/opengrid/issues/188)).
67
+ `set_validators(host, { column: (value, row) => null | { level, message } })` runs on every
68
+ keystroke in the editor and on commit; the message shows under the editor, stays on the cell
69
+ (`data-validation`) and is said once in the status line. An error does not block the commit
70
+ unless the column is `{ validate, block: true }`; type errors from the schema always block.
71
+ `set_cell_state(..., "invalid", message)` reports a finding the page computes elsewhere.
72
+ - **One value for every selected row** ([#187](https://github.com/casoon/opengrid/issues/187)).
73
+ With rows selected, `F2` or the column menu's "Set for selected rows" opens the column's editor
74
+ once; committing fires one `opengrid-bulk-change` `{ keys, column, value }` and marks the cells
75
+ unsaved. Needs `row-key`; a read-only column refuses it.
76
+ - **Pasting a block from a spreadsheet, with a preview** ([#184](https://github.com/casoon/opengrid/issues/184)).
77
+ `Ctrl`/`Cmd`+`V` on a cell anchors the clipboard's tab-separated (or CSV) text there and
78
+ shows what would happen first — each value read against its column in the grid's number
79
+ notation, unreadable ones marked with the reason, a sentence in the live region. `Enter`
80
+ applies, `Escape` discards; applying fires one `opengrid-paste` with every change and the
81
+ rows past the end (added rows with `add-row`, otherwise cut off). Formula-looking text is
82
+ never evaluated.
83
+ - **Adding a record from the keyboard** ([#183](https://github.com/casoon/opengrid/issues/183)).
84
+ `add-row` shows an empty new row after the last one; `Enter` goes on through the columns,
85
+ `Enter` in the last one (or `Ctrl`/`Cmd`+`Enter`) fires `opengrid-row-add`
86
+ `{ values, provisionalKey }` and shows the row at once, unsaved, with a fresh new row focused
87
+ under it. `set_row_state(host, provisionalKey, "saved" | "error" | "saving", detail)` answers.
88
+ Required fields (not nullable) are marked, and adding without one is refused with the cell
89
+ named. Off while grouped, in a tree and with `page-size`.
90
+ - **Row actions** ([#189](https://github.com/casoon/opengrid/issues/189)).
91
+ `set_actions(host, [{ id, label }])` adds a trailing column per action with a button on
92
+ every row, reachable as cells of the grid; activating one fires `opengrid-row-action`
93
+ `{ id, row, key }`. The labels are the accessible names; group headers and the total have
94
+ no button.
95
+ - **Editing while grouped** ([#190](https://github.com/casoon/opengrid/issues/190)). With a
96
+ `row-key`, the data rows of a grouped grid edit; the change names the record by its key.
97
+ Group headers and the total stay read-only, selection stays off, and a replaced source
98
+ refreshes the group aggregates.
99
+ - **Rows the page already holds** ([#182](https://github.com/casoon/opengrid/issues/182)).
100
+ `loadRows(name, rows, schema)` on the local and the worker provider (`load_rows` on the
101
+ engine) takes an array of objects keyed by field name; the schema stays required and the
102
+ result is the same as the same data through CSV. Loading under a name that is already loaded
103
+ replaces the source all at once; a grid on it re-runs its query and keeps its sort, filter
104
+ and focus (by `row-key`). A value that does not fit is refused with the row and field named,
105
+ and the old rows stay. Providers gain `loadRows` and `watch` (`docs/guides/data-you-have.md`).
106
+ - **A tree's level in SQL, on request** ([#132](https://github.com/casoon/opengrid/issues/132)).
107
+ `SqliteConnector::with_tree_pushdown(true)` and `PostgresDataSource::with_tree_pushdown(true)`
108
+ answer a level and its subtree aggregates (T1–T7) with `WITH RECURSIVE` and report the
109
+ capability `tree`; the flat tree stays the engine's. **Off by default**: measured on 100 000
110
+ nodes it is slower than the engine's way where the database is close (SQLite about 75 ms
111
+ against 900 ms, a local PostgreSQL about 170 ms against 365–540 ms) — worth it only for a
112
+ large tree over a slow link (`docs/guides/connectors.md`). Every tree case passes against
113
+ both databases either way, and a differential test compares the pushdown with the engine on
114
+ a generated tree of 100 000 nodes.
115
+
116
+ ### Changed
117
+
118
+ - **Project page** ([#197](https://github.com/casoon/opengrid/issues/197)). The start page
119
+ title is short enough for two lines; the three components it named moved into the lead. The
120
+ hero shows a tighter capture of the grid from the live demo, with a narrower one on phones.
121
+ - **Releases:** the npm packages are published by a Release workflow on the tag, with npm Trusted Publishing (provenance, no token), after approval in the `npm` environment; `pnpm release` now checks the commit and sets the tag.
122
+
123
+ ## `@casoon/opengrid-mcp` [0.13.0] — 2026-10-14
124
+
125
+ **Not yet tried in a host.** No chat client has rendered the view yet — Claude Desktop
126
+ included; the e2e suite runs it in a test host of its own, and the release installs the
127
+ packed tarball and asks it over stdio. **Screen-reader pairings tested: none.**
128
+
129
+ The first release of the MCP server ([#140](https://github.com/casoon/opengrid/issues/140)):
130
+ opengrid's grid as an MCP App, on `@casoon/opengrid` 0.13.0. The model and the reader work
131
+ on one view; the rows stay with the server. Sources are a CSV with schema or a source of an
132
+ `opengrid-server` (URL and token); six tools (`opengrid_open`, `opengrid_set_view`,
133
+ `opengrid_describe`, `opengrid_selection`, and for the grid only `opengrid_query`,
134
+ `opengrid_sync`). The view ships the elements translated with wasm2js, because the hosts'
135
+ CSP allows no WebAssembly. Published alone, under the tag `opengrid-mcp-v0.13.0`; from the
136
+ next release on it comes out with `@casoon/opengrid`, with the same version.
137
+
21
138
  ## [0.13.0] — 2026-10-10
22
139
 
23
140
  **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
@@ -815,7 +932,7 @@ tested.
815
932
  connection off rather than ending a short file. `Content-Disposition` names
816
933
  the file after the source, `X-Total-Count` carries the row count. A million
817
934
  rows from PostgreSQL keep the server under 40 MiB (measured in
818
- [docs/guides/where-queries-run.md](docs/guides/where-queries-run.md)).
935
+ [docs/guides/where-queries-run.mdx](docs/guides/where-queries-run.mdx)).
819
936
  `createRestProvider(...).export(query, options)` fetches it as a `Blob`, and
820
937
  `exportRows` uses a provider's `export` when there is one — one request
821
938
  instead of pieces, the same file. No request of the REST or pivot provider
package/README.md CHANGED
@@ -101,7 +101,7 @@ connect(document.querySelector("opengrid-grid"), {
101
101
  });
102
102
  ```
103
103
 
104
- See [Where queries run](https://github.com/casoon/opengrid/blob/main/docs/guides/where-queries-run.md).
104
+ See [Where queries run](https://github.com/casoon/opengrid/blob/main/docs/guides/where-queries-run.mdx).
105
105
 
106
106
  ## React, Vue, Svelte
107
107
 
@@ -34,6 +34,14 @@ export class Engine {
34
34
  * (plan/spezifikation/04-local-engine.md §Ingest).
35
35
  */
36
36
  load_csv(name: string, bytes: Uint8Array, schema_json: string): void;
37
+ /**
38
+ * Registers a source from rows the page already holds (issue #182): a
39
+ * JSON array of objects keyed by field name, values in the wire notation
40
+ * of E13. The schema is required, as for CSV. A name that is already
41
+ * loaded is **replaced** — all or nothing: a row that does not fit is
42
+ * refused with its row and field named, and the old source stays.
43
+ */
44
+ load_rows(name: string, rows_json: string, schema_json: string): void;
37
45
  /**
38
46
  * An engine without data. `load_csv` adds sources.
39
47
  */
@@ -136,6 +144,7 @@ export interface InitOutput {
136
144
  readonly engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
137
145
  readonly engine_execute_columns: (a: number, b: number, c: number) => [number, number, number, number];
138
146
  readonly engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
147
+ readonly engine_load_rows: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
139
148
  readonly engine_new: () => number;
140
149
  readonly engine_pivot: (a: number, b: number, c: number) => [number, number, number, number];
141
150
  readonly engine_pivot_columns: (a: number, b: number, c: number) => [number, number, number, number];
@@ -88,6 +88,28 @@ export class Engine {
88
88
  throw takeFromExternrefTable0(ret[0]);
89
89
  }
90
90
  }
91
+ /**
92
+ * Registers a source from rows the page already holds (issue #182): a
93
+ * JSON array of objects keyed by field name, values in the wire notation
94
+ * of E13. The schema is required, as for CSV. A name that is already
95
+ * loaded is **replaced** — all or nothing: a row that does not fit is
96
+ * refused with its row and field named, and the old source stays.
97
+ * @param {string} name
98
+ * @param {string} rows_json
99
+ * @param {string} schema_json
100
+ */
101
+ load_rows(name, rows_json, schema_json) {
102
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
103
+ const len0 = WASM_VECTOR_LEN;
104
+ const ptr1 = passStringToWasm0(rows_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
+ const len1 = WASM_VECTOR_LEN;
106
+ const ptr2 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
107
+ const len2 = WASM_VECTOR_LEN;
108
+ const ret = wasm.engine_load_rows(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
109
+ if (ret[1]) {
110
+ throw takeFromExternrefTable0(ret[0]);
111
+ }
112
+ }
91
113
  /**
92
114
  * An engine without data. `load_csv` adds sources.
93
115
  */
Binary file
@@ -6,6 +6,7 @@ export const __wbg_planner_free: (a: number, b: number) => void;
6
6
  export const engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
7
7
  export const engine_execute_columns: (a: number, b: number, c: number) => [number, number, number, number];
8
8
  export const engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
9
+ export const engine_load_rows: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
9
10
  export const engine_new: () => number;
10
11
  export const engine_pivot: (a: number, b: number, c: number) => [number, number, number, number];
11
12
  export const engine_pivot_columns: (a: number, b: number, c: number) => [number, number, number, number];
package/loader.d.ts CHANGED
@@ -96,6 +96,28 @@ export interface OpengridModule {
96
96
  * Requires `row-key`.
97
97
  */
98
98
  set_values(host: HTMLElement, values: CellValue[]): void;
99
+ /**
100
+ * Gives every row actions (issue #189): one trailing column each, a button per
101
+ * row. Click, or `Enter`/`Space` on the cell, fires `opengrid-row-action`.
102
+ * The label is the accessible name; group headers and the total have no button.
103
+ */
104
+ set_actions(host: HTMLElement, actions: RowAction[]): void;
105
+ /**
106
+ * What became of a row the reader added (issue #183), by the `provisionalKey`
107
+ * `opengrid-row-add` gave. `saved` takes the record's `row-key` as `detail`
108
+ * when it has one now; `error` takes the message, said in the live region.
109
+ */
110
+ set_row_state(
111
+ host: HTMLElement,
112
+ provisionalKey: string,
113
+ state: "saving" | "saved" | "error",
114
+ detail?: WireValue | string,
115
+ ): void;
116
+ /**
117
+ * Validators that run while the reader types (issue #188). A function never
118
+ * blocks the commit; `{ validate, block: true }` blocks on an `error`.
119
+ */
120
+ set_validators(host: HTMLElement, validators: Record<string, Validator | ValidatorRule>): void;
99
121
  /** Defines the three elements. `loadOpengrid()` calls it. */
100
122
  register(): void;
101
123
  }
@@ -217,6 +239,17 @@ export interface ExecuteOptions {
217
239
  export interface EngineProvider extends Provider {
218
240
  /** Loads CSV bytes as the source `name`, against a schema (JSON). */
219
241
  load(name: string, bytes: ArrayBuffer | Uint8Array, schema: string): Promise<void>;
242
+ /**
243
+ * Loads rows the page already holds as the source `name` (issue #182): an
244
+ * array of objects keyed by field name — or that array as JSON text — with
245
+ * values in the wire notation of the result (decimals as strings, dates as
246
+ * `YYYY-MM-DD`). The schema stays required. A name that is already loaded is
247
+ * replaced, all or nothing; a grid on it re-runs its query and keeps its view.
248
+ * A value that does not fit its field rejects with the row and field named.
249
+ */
250
+ loadRows(name: string, rows: readonly Record<string, unknown>[] | string, schema: string): Promise<void>;
251
+ /** Called by `set_provider`; the grid is told when a source it shows is replaced. */
252
+ watch(host: HTMLElement): void;
220
253
  /** What the engine holds: its memory and each source's size (issue #70). */
221
254
  stats(): Promise<EngineStats>;
222
255
  /** Stops a worker; a no-op in the tab. */
@@ -235,6 +268,8 @@ export interface EngineStats {
235
268
  /** The engine of the engine module, as `createLocalProvider` uses it. */
236
269
  export interface Engine {
237
270
  load_csv(name: string, bytes: Uint8Array, schema: string): void;
271
+ /** Rows as JSON text (an array of objects); replaces a source of that name (issue #182). */
272
+ load_rows(name: string, rowsJson: string, schema: string): void;
238
273
  /** The result as JSON. */
239
274
  execute(queryJson: string): string;
240
275
  /** The result in the binary form — what the tab and worker providers answer. */
@@ -465,7 +500,11 @@ export type FilterOperator =
465
500
  | "contains"
466
501
  | "starts_with"
467
502
  | "is_null"
468
- | "is_not_null";
503
+ | "is_not_null"
504
+ /** A list column holds the value / every value / nothing (issue #185). */
505
+ | "has"
506
+ | "has_all"
507
+ | "is_empty";
469
508
 
470
509
  /** An aggregate in group rows and the grand total. */
471
510
  export type Aggregate = "sum" | "avg" | "count" | "min" | "max" | "range";
@@ -500,7 +539,8 @@ export interface ColumnConfig {
500
539
  }
501
540
 
502
541
  /** What `set_cell_state` says became of an edit. */
503
- export type CellState = "saving" | "saved" | "error";
542
+ /** `invalid`: a finding the page computed elsewhere; `message` is its sentence. */
543
+ export type CellState = "saving" | "saved" | "error" | "invalid";
504
544
 
505
545
  /** One value for `set_values`: the record by its `row-key`, the column, the value. */
506
546
  export interface CellValue {
@@ -519,7 +559,11 @@ export type Format =
519
559
 
520
560
  export type Formats = Record<string, Format>;
521
561
 
522
- export type Choices = Record<string, string[]>;
562
+ /** One choice: a value, or a `{ value, label }` pair — the label is shown, the value is stored. */
563
+ export type Choice = string | number | { value: string | number; label?: string };
564
+
565
+ /** The choices of each column; a list column is edited only with them (issue #185). */
566
+ export type Choices = Record<string, Choice[]>;
523
567
 
524
568
  // ---------------------------------------------------------------------------
525
569
  // The view
@@ -790,7 +834,41 @@ export type TextKey =
790
834
  | "total"
791
835
  | "subtotal"
792
836
  | "noValue"
793
- | "emptyValue";
837
+ | "emptyValue"
838
+ | "newRow"
839
+ | "rowAdded"
840
+ | "pastePreview"
841
+ | "pasteApply"
842
+ | "pasteDiscard"
843
+ | "pasteUnreadable"
844
+ | "pasteBadOne"
845
+ | "pasteBadOther"
846
+ | "pasteCutOff"
847
+ | "pasteApplied"
848
+ | "pasteDiscarded"
849
+ | "pasteBlocked"
850
+ | "bulkCaption"
851
+ | "bulkApply"
852
+ | "bulkMenu"
853
+ | "bulkReadonly"
854
+ | "bulkDone"
855
+ | "validationWarning"
856
+ | "validationError"
857
+ | "typeList"
858
+ | "choicesOne"
859
+ | "choicesOther"
860
+ | "choiceRefused"
861
+ | "listItemAdded"
862
+ | "listItemRemoved"
863
+ | "listItemRemove"
864
+ | "undoCell"
865
+ | "redoCell"
866
+ | "undoAdded"
867
+ | "redoAdded"
868
+ | "undoPaste"
869
+ | "redoPaste"
870
+ | "undoNothing"
871
+ | "redoNothing";
794
872
 
795
873
  /**
796
874
  * Any subset of the texts; what is left out keeps its English default. `lang`
@@ -828,6 +906,71 @@ export interface CellChangeDetail {
828
906
  column: string;
829
907
  value: string;
830
908
  previous: string;
909
+ /** Set when this change is an undo or a redo (issue #186). */
910
+ undo?: true;
911
+ redo?: true;
912
+ }
913
+
914
+ /** What a validator says about a value, or `null` for nothing. */
915
+ export type Finding = { level: "warning" | "error"; message: string } | null | undefined;
916
+ /** `value` is the text in the editor, `row` the record as loaded, by field name. */
917
+ export type Validator = (value: string, row: Record<string, WireValue>) => Finding;
918
+ /** A validator that may block the commit on an `error`. */
919
+ export interface ValidatorRule {
920
+ validate: Validator;
921
+ block?: boolean;
922
+ }
923
+
924
+ /** One action of `set_actions`. */
925
+ export interface RowAction {
926
+ id: string;
927
+ label: string;
928
+ }
929
+
930
+ /** `opengrid-row-action`: an action was activated on a row (issue #189). */
931
+ export interface RowActionDetail {
932
+ id: string;
933
+ /** The row's position — in a grouped grid a display position; use `key`. */
934
+ row: number;
935
+ /** With `row-key` only: the record's value of that field. */
936
+ key?: WireValue;
937
+ }
938
+
939
+ /** `opengrid-row-add`: a record was typed into the new row (issue #183). */
940
+ export interface RowAddDetail {
941
+ /** The values by field name, in the wire notation of a result. */
942
+ values: Record<string, WireValue>;
943
+ /** What `set_row_state` names the row by until it has a key of its own. */
944
+ provisionalKey: string;
945
+ /** Set when this add is undone — delete the row — or redone (issue #186). */
946
+ undo?: true;
947
+ redo?: true;
948
+ }
949
+
950
+ /** `opengrid-bulk-change`: one value for the selected rows (issue #187). */
951
+ export interface BulkChangeDetail {
952
+ /** The `row-key` values of the selected records. */
953
+ keys: WireValue[];
954
+ column: string;
955
+ value: string;
956
+ }
957
+
958
+ /** `opengrid-paste`: a pasted block was applied (issue #184). */
959
+ export interface PasteDetail {
960
+ /** One per cell of an existing row. */
961
+ changes: {
962
+ /** With `row-key` only: the record's value of that field. */
963
+ key?: WireValue;
964
+ row: number;
965
+ column: string;
966
+ value: string;
967
+ previous: string;
968
+ }[];
969
+ /** The rows past the end, with `add-row`. */
970
+ added: RowAddDetail[];
971
+ /** Set when this paste is undone or redone (issue #186). */
972
+ undo?: true;
973
+ redo?: true;
831
974
  }
832
975
 
833
976
  /** `opengrid-query`: one answer of the grid's provider (issue #70). */
@@ -858,6 +1001,10 @@ export interface OpengridEventMap {
858
1001
  "opengrid-cell-change": CustomEvent<CellChangeDetail>;
859
1002
  "opengrid-view-change": CustomEvent<ViewChangeDetail>;
860
1003
  "opengrid-query": CustomEvent<QueryDetail>;
1004
+ "opengrid-row-action": CustomEvent<RowActionDetail>;
1005
+ "opengrid-row-add": CustomEvent<RowAddDetail>;
1006
+ "opengrid-paste": CustomEvent<PasteDetail>;
1007
+ "opengrid-bulk-change": CustomEvent<BulkChangeDetail>;
861
1008
  }
862
1009
 
863
1010
  // ---------------------------------------------------------------------------
@@ -888,6 +1035,8 @@ export interface OpengridGridAttributes {
888
1035
  facets?: string;
889
1036
  toolbar?: string;
890
1037
  "column-menu"?: string;
1038
+ /** An empty row after the last one to type a new record into (`opengrid-row-add`). */
1039
+ "add-row"?: string;
891
1040
  selection?: string;
892
1041
  density?: Density;
893
1042
  /** One of the built-in looks; Base when absent. */
package/loader.js CHANGED
@@ -198,6 +198,8 @@ export function createWorkerProvider({
198
198
  });
199
199
  }
200
200
 
201
+ const watchers = createWatchers();
202
+
201
203
  function start() {
202
204
  if (!worker) {
203
205
  worker = new Worker(workerScript, { type: "module" });
@@ -215,6 +217,23 @@ export function createWorkerProvider({
215
217
  await start();
216
218
  const buffer = toTransferable(bytes);
217
219
  await request({ type: "load", name, bytes: buffer, schema }, [buffer]);
220
+ watchers.loaded(name);
221
+ },
222
+
223
+ /**
224
+ * Loads rows the page already holds — an array of objects keyed by field
225
+ * name (or that array as JSON text) — against a schema (issue #182). A
226
+ * name already loaded is replaced, all or nothing.
227
+ */
228
+ async loadRows(name, rows, schema) {
229
+ await start();
230
+ await request({ type: "rows", name, rows: rowsJson(rows), schema });
231
+ watchers.loaded(name);
232
+ },
233
+
234
+ /** Called by `set_provider`: the grids to tell when a source is replaced. */
235
+ watch(host) {
236
+ watchers.watch(host);
218
237
  },
219
238
 
220
239
  /** Runs a query JSON and resolves with the result in the binary form. */
@@ -255,6 +274,49 @@ export function createWorkerProvider({
255
274
  };
256
275
  }
257
276
 
277
+ /**
278
+ * The grids on an engine provider's sources (issue #182).
279
+ *
280
+ * `watch(host)` is called by `set_provider`; the host is held weakly, so a
281
+ * removed grid is still collected (point 74). Loading a source — under a new
282
+ * name or over a loaded one, which replaces it — tells every watching grid on
283
+ * that name with an `opengrid-source-replaced` event — it re-runs its query and
284
+ * keeps its view.
285
+ */
286
+ function createWatchers() {
287
+ const hosts = new Set();
288
+ return {
289
+ watch(host) {
290
+ for (const ref of hosts) {
291
+ if (ref.deref() === host) {
292
+ return;
293
+ }
294
+ }
295
+ hosts.add(new WeakRef(host));
296
+ },
297
+ /**
298
+ * Tells the grids on `name` that it was loaded. A first load counts too: the
299
+ * engine may hold the source from before this provider (a grid that asked
300
+ * early shows its error until the rows arrive).
301
+ */
302
+ loaded(name) {
303
+ for (const ref of [...hosts]) {
304
+ const host = ref.deref();
305
+ if (!host) {
306
+ hosts.delete(ref);
307
+ } else if (host.getAttribute("datasource") === name) {
308
+ host.dispatchEvent(new CustomEvent("opengrid-source-replaced", { detail: { name } }));
309
+ }
310
+ }
311
+ },
312
+ };
313
+ }
314
+
315
+ /** Rows as the engine reads them: a JSON array of objects, as text. */
316
+ function rowsJson(rows) {
317
+ return typeof rows === "string" ? rows : JSON.stringify(rows);
318
+ }
319
+
258
320
  /**
259
321
  * A provider over an engine that is already initialised on the main thread.
260
322
  *
@@ -265,6 +327,7 @@ export function createWorkerProvider({
265
327
  * @returns {{load: Function, execute: Function, terminate: Function}}
266
328
  */
267
329
  export function createLocalProvider(engine) {
330
+ const watchers = createWatchers();
268
331
  return {
269
332
  /** Where the queries run; the grid names it in its footer (issue #33). */
270
333
  kind: "local",
@@ -274,6 +337,14 @@ export function createLocalProvider(engine) {
274
337
  bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes),
275
338
  schema,
276
339
  );
340
+ watchers.loaded(name);
341
+ },
342
+ async loadRows(name, rows, schema) {
343
+ engine.load_rows(name, rowsJson(rows), schema);
344
+ watchers.loaded(name);
345
+ },
346
+ watch(host) {
347
+ watchers.watch(host);
277
348
  },
278
349
  execute(queryJson) {
279
350
  return engine.execute_columns(queryJson);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casoon/opengrid",
3
- "version": "0.13.0",
3
+ "version": "0.14.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,15 @@ export function get_view(host: HTMLElement): any;
80
80
  */
81
81
  export function register(): void;
82
82
 
83
+ /**
84
+ * Gives every row of a grid actions (issue #189): `[{ id, label }]`, one
85
+ * trailing column each, with a button per row. Activating one — click, or
86
+ * `Enter` and `Space` on its cell — fires `opengrid-row-action` with
87
+ * `{ id, key, row }`; `key` is the `row-key` value, and group headers and the
88
+ * total have no button. The label is the accessible name.
89
+ */
90
+ export function set_actions(host: HTMLElement, actions: any): void;
91
+
83
92
  /**
84
93
  * Says what became of an edit the page saves (issue #153).
85
94
  *
@@ -96,8 +105,10 @@ export function set_cell_state(host: HTMLElement, key: any, column: string, stat
96
105
  * Sets the choices a column's editor offers (plan point 37).
97
106
  *
98
107
  * `choices` is a plain JS object keyed by column name, each value a list of
99
- * strings. A column with choices gets a `<select>` instead of a typed input.
100
- * V1 has no enum type, so the page is the only honest source of the options.
108
+ * strings, numbers or `{ value, label }` pairs. A column with choices gets a
109
+ * type-ahead combobox instead of a typed input (issue #185), and a list column
110
+ * is edited with one only. V1 has no enum type, so the page is the only honest
111
+ * source of the options.
101
112
  */
102
113
  export function set_choices(host: HTMLElement, choices: any): void;
103
114
 
@@ -165,8 +176,24 @@ export function set_formats(host: HTMLElement, formats: any): void;
165
176
  */
166
177
  export function set_provider(host: HTMLElement, provider: any): void;
167
178
 
179
+ /**
180
+ * What became of a row the reader added (issue #183): `state` is `saving`,
181
+ * `saved` or `error`. `detail` is the record's `row-key` for `saved`, the
182
+ * message for `error` — said in the status line, as `set_cell_state` says one.
183
+ */
184
+ export function set_row_state(host: HTMLElement, provisional_key: string, state: string, detail: any): void;
185
+
168
186
  export function set_texts(host: HTMLElement, values: any): void;
169
187
 
188
+ /**
189
+ * Gives columns a validator that runs while the reader types (issue #188):
190
+ * `{ column: (value, row) => null | { level: "warning" | "error", message } }`,
191
+ * or `{ column: { validate, block: true } }` to make an `error` block the
192
+ * commit. The answer is shown under the editor and stays on the cell; it blocks
193
+ * only where the column asks for it (what the schema refuses always does).
194
+ */
195
+ export function set_validators(host: HTMLElement, validators: any): void;
196
+
170
197
  /**
171
198
  * Shows values the page computes (issue #153): `[{ key, column, value }]`.
172
199
  *
@@ -207,22 +234,25 @@ export interface InitOutput {
207
234
  readonly get_query: (a: any) => any;
208
235
  readonly get_view: (a: any) => any;
209
236
  readonly register: () => [number, number];
237
+ readonly set_actions: (a: any, b: any) => void;
210
238
  readonly set_cell_state: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => void;
211
239
  readonly set_choices: (a: any, b: any) => void;
212
240
  readonly set_columns: (a: any, b: any) => void;
213
241
  readonly set_formats: (a: any, b: any) => void;
214
242
  readonly set_provider: (a: any, b: any) => void;
243
+ readonly set_row_state: (a: any, b: number, c: number, d: number, e: number, f: any) => void;
215
244
  readonly set_texts: (a: any, b: any) => void;
245
+ readonly set_validators: (a: any, b: any) => void;
216
246
  readonly set_values: (a: any, b: any) => void;
217
247
  readonly set_view: (a: any, b: any, c: any) => void;
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;
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];
220
- readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true_: (a: number, b: number, c: any) => void;
221
- readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__2: (a: number, b: number, c: any) => void;
222
- readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__4: (a: number, b: number, c: any) => void;
223
- readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__5: (a: number, b: number, c: any) => void;
224
- readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___u32______true_: (a: number, b: number, c: number) => void;
225
- readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke_______true_: (a: number, b: number) => void;
248
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___web_sys_b5c30633085262f3___features__gen_HtmlElement__HtmlElement__alloc_42d2b33bd937efdb___string__String__core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String___core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
249
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___wasm_bindgen_4cfd459b66780f67___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4cfd459b66780f67___JsError___true_: (a: number, b: number, c: any) => [number, number];
250
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true_: (a: number, b: number, c: any) => void;
251
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__2: (a: number, b: number, c: any) => void;
252
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__4: (a: number, b: number, c: any) => void;
253
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__5: (a: number, b: number, c: any) => void;
254
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___u32______true_: (a: number, b: number, c: number) => void;
255
+ readonly wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke_______true_: (a: number, b: number) => void;
226
256
  readonly __wbindgen_exn_store: (a: number) => void;
227
257
  readonly __externref_table_alloc: () => number;
228
258
  readonly __wbindgen_externrefs: WebAssembly.Table;
@@ -1,9 +1,9 @@
1
1
  /* @ts-self-types="./opengrid_web_components.d.ts" */
2
- import { __opengrid_intl_formatter } from './snippets/opengrid-web-components-ad6dc2c80732d2d3/inline0.js';
3
- import { __opengrid_define_element } from './snippets/opengrid-web-core-19b41f3fd18cf51f/inline1.js';
4
- import * as import1 from "./snippets/opengrid-web-core-19b41f3fd18cf51f/inline0.js"
5
- import * as import2 from "./snippets/opengrid-web-core-19b41f3fd18cf51f/inline0.js"
6
- import * as import3 from "./snippets/opengrid-web-core-19b41f3fd18cf51f/inline0.js"
2
+ import { __opengrid_intl_formatter } from './snippets/opengrid-web-components-56667a20e9158a6a/inline0.js';
3
+ import { __opengrid_define_element } from './snippets/opengrid-web-core-a3505e32fee0c1ed/inline1.js';
4
+ import * as import1 from "./snippets/opengrid-web-core-a3505e32fee0c1ed/inline0.js"
5
+ import * as import2 from "./snippets/opengrid-web-core-a3505e32fee0c1ed/inline0.js"
6
+ import * as import3 from "./snippets/opengrid-web-core-a3505e32fee0c1ed/inline0.js"
7
7
 
8
8
 
9
9
  /**
@@ -150,6 +150,19 @@ export function register() {
150
150
  }
151
151
  }
152
152
 
153
+ /**
154
+ * Gives every row of a grid actions (issue #189): `[{ id, label }]`, one
155
+ * trailing column each, with a button per row. Activating one — click, or
156
+ * `Enter` and `Space` on its cell — fires `opengrid-row-action` with
157
+ * `{ id, key, row }`; `key` is the `row-key` value, and group headers and the
158
+ * total have no button. The label is the accessible name.
159
+ * @param {HTMLElement} host
160
+ * @param {any} actions
161
+ */
162
+ export function set_actions(host, actions) {
163
+ wasm.set_actions(host, actions);
164
+ }
165
+
153
166
  /**
154
167
  * Says what became of an edit the page saves (issue #153).
155
168
  *
@@ -179,8 +192,10 @@ export function set_cell_state(host, key, column, state, message) {
179
192
  * Sets the choices a column's editor offers (plan point 37).
180
193
  *
181
194
  * `choices` is a plain JS object keyed by column name, each value a list of
182
- * strings. A column with choices gets a `<select>` instead of a typed input.
183
- * V1 has no enum type, so the page is the only honest source of the options.
195
+ * strings, numbers or `{ value, label }` pairs. A column with choices gets a
196
+ * type-ahead combobox instead of a typed input (issue #185), and a list column
197
+ * is edited with one only. V1 has no enum type, so the page is the only honest
198
+ * source of the options.
184
199
  * @param {HTMLElement} host
185
200
  * @param {any} choices
186
201
  */
@@ -264,6 +279,23 @@ export function set_provider(host, provider) {
264
279
  wasm.set_provider(host, provider);
265
280
  }
266
281
 
282
+ /**
283
+ * What became of a row the reader added (issue #183): `state` is `saving`,
284
+ * `saved` or `error`. `detail` is the record's `row-key` for `saved`, the
285
+ * message for `error` — said in the status line, as `set_cell_state` says one.
286
+ * @param {HTMLElement} host
287
+ * @param {string} provisional_key
288
+ * @param {string} state
289
+ * @param {any} detail
290
+ */
291
+ export function set_row_state(host, provisional_key, state, detail) {
292
+ const ptr0 = passStringToWasm0(provisional_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
+ const len0 = WASM_VECTOR_LEN;
294
+ const ptr1 = passStringToWasm0(state, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
295
+ const len1 = WASM_VECTOR_LEN;
296
+ wasm.set_row_state(host, ptr0, len0, ptr1, len1, detail);
297
+ }
298
+
267
299
  /**
268
300
  * @param {HTMLElement} host
269
301
  * @param {any} values
@@ -272,6 +304,19 @@ export function set_texts(host, values) {
272
304
  wasm.set_texts(host, values);
273
305
  }
274
306
 
307
+ /**
308
+ * Gives columns a validator that runs while the reader types (issue #188):
309
+ * `{ column: (value, row) => null | { level: "warning" | "error", message } }`,
310
+ * or `{ column: { validate, block: true } }` to make an `error` block the
311
+ * commit. The answer is shown under the editor and stays on the cell; it blocks
312
+ * only where the column asks for it (what the schema refuses always does).
313
+ * @param {HTMLElement} host
314
+ * @param {any} validators
315
+ */
316
+ export function set_validators(host, validators) {
317
+ wasm.set_validators(host, validators);
318
+ }
319
+
275
320
  /**
276
321
  * Shows values the page computes (issue #153): `[{ key, column, value }]`.
277
322
  *
@@ -317,10 +362,10 @@ function __wbg_get_imports() {
317
362
  const ret = Error(getStringFromWasm0(arg0, arg1));
318
363
  return ret;
319
364
  },
320
- __wbg___opengrid_define_element_dc83f3c3aea1a1c1: function(arg0, arg1, arg2, arg3, arg4, arg5) {
365
+ __wbg___opengrid_define_element_8f22e1bc45c60af7: function(arg0, arg1, arg2, arg3, arg4, arg5) {
321
366
  __opengrid_define_element(getStringFromWasm0(arg0, arg1), arg2, arg3, arg4, arg5);
322
367
  },
323
- __wbg___opengrid_intl_formatter_77f1e896c6fe6b8d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
368
+ __wbg___opengrid_intl_formatter_c545f3d8646ebd4b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
324
369
  const ret = __opengrid_intl_formatter(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4);
325
370
  return ret;
326
371
  }, arguments); },
@@ -407,6 +452,10 @@ function __wbg_get_imports() {
407
452
  const ret = arg0.call(arg1);
408
453
  return ret;
409
454
  }, arguments); },
455
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
456
+ const ret = arg0.call(arg1, arg2);
457
+ return ret;
458
+ }, arguments); },
410
459
  __wbg_call_e3b662382210db98: function() { return handleError(function (arg0, arg1, arg2, arg3) {
411
460
  const ret = arg0.call(arg1, arg2, arg3);
412
461
  return ret;
@@ -427,6 +476,10 @@ function __wbg_get_imports() {
427
476
  const ret = arg0.clientLeft;
428
477
  return ret;
429
478
  },
479
+ __wbg_clipboardData_b99e24e2d915217c: function(arg0) {
480
+ const ret = arg0.clipboardData;
481
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
482
+ },
430
483
  __wbg_closest_d889c758da4bb13b: function() { return handleError(function (arg0, arg1, arg2) {
431
484
  const ret = arg0.closest(getStringFromWasm0(arg1, arg2));
432
485
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -489,6 +542,13 @@ function __wbg_get_imports() {
489
542
  const ret = arg0.getComputedStyle(arg1);
490
543
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
491
544
  }, arguments); },
545
+ __wbg_getData_fcb88fae21d94f1e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
546
+ const ret = arg1.getData(getStringFromWasm0(arg2, arg3));
547
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
548
+ const len1 = WASM_VECTOR_LEN;
549
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
550
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
551
+ }, arguments); },
492
552
  __wbg_getPropertyValue_dc6b061239dad6f1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
493
553
  const ret = arg1.getPropertyValue(getStringFromWasm0(arg2, arg3));
494
554
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -546,6 +606,10 @@ function __wbg_get_imports() {
546
606
  const ret = arg0.innerWidth;
547
607
  return ret;
548
608
  }, arguments); },
609
+ __wbg_insertBefore_9121f73148bc4f7c: function() { return handleError(function (arg0, arg1, arg2) {
610
+ const ret = arg0.insertBefore(arg1, arg2);
611
+ return ret;
612
+ }, arguments); },
549
613
  __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
550
614
  let result;
551
615
  try {
@@ -556,6 +620,16 @@ function __wbg_get_imports() {
556
620
  const ret = result;
557
621
  return ret;
558
622
  },
623
+ __wbg_instanceof_ClipboardEvent_93c99362e111fcef: function(arg0) {
624
+ let result;
625
+ try {
626
+ result = arg0 instanceof ClipboardEvent;
627
+ } catch (_) {
628
+ result = false;
629
+ }
630
+ const ret = result;
631
+ return ret;
632
+ },
559
633
  __wbg_instanceof_CssStyleSheet_69eb2b4dfaec58a9: function(arg0) {
560
634
  let result;
561
635
  try {
@@ -842,6 +916,9 @@ function __wbg_get_imports() {
842
916
  const ret = arg0.right;
843
917
  return ret;
844
918
  },
919
+ __wbg_scrollIntoView_5262843155744b69: function(arg0) {
920
+ arg0.scrollIntoView();
921
+ },
845
922
  __wbg_scrollIntoView_d8b806f471b7418e: function(arg0, arg1) {
846
923
  arg0.scrollIntoView(arg1);
847
924
  },
@@ -853,6 +930,9 @@ function __wbg_get_imports() {
853
930
  const ret = arg0.scrollTop;
854
931
  return ret;
855
932
  },
933
+ __wbg_select_439dea2335b9e472: function(arg0) {
934
+ arg0.select();
935
+ },
856
936
  __wbg_selectedIndex_97ad3dd8ed57cf47: function(arg0) {
857
937
  const ret = arg0.selectedIndex;
858
938
  return ret;
@@ -988,6 +1068,10 @@ function __wbg_get_imports() {
988
1068
  const ret = arg0.then(arg1);
989
1069
  return ret;
990
1070
  },
1071
+ __wbg_toLocaleString_09a867f646b9e754: function(arg0, arg1, arg2) {
1072
+ const ret = arg0.toLocaleString(getStringFromWasm0(arg1, arg2));
1073
+ return ret;
1074
+ },
991
1075
  __wbg_top_fe120acfa924a430: function(arg0) {
992
1076
  const ret = arg0.top;
993
1077
  return ret;
@@ -1018,43 +1102,43 @@ function __wbg_get_imports() {
1018
1102
  return ret;
1019
1103
  },
1020
1104
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1021
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 215, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1022
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_);
1105
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 227, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1106
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___wasm_bindgen_4cfd459b66780f67___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4cfd459b66780f67___JsError___true_);
1023
1107
  return ret;
1024
1108
  },
1025
1109
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1026
- // 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`.
1027
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true_);
1110
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 19, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1111
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true_);
1028
1112
  return ret;
1029
1113
  },
1030
1114
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1031
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1032
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__2);
1115
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 19, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1116
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__2);
1033
1117
  return ret;
1034
1118
  },
1035
1119
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1036
- // 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`.
1037
- const ret = makeMutClosure(arg0, arg1, 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_);
1120
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement"), String, Option(String), Option(String)], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1121
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___web_sys_b5c30633085262f3___features__gen_HtmlElement__HtmlElement__alloc_42d2b33bd937efdb___string__String__core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String___core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String_______true_);
1038
1122
  return ret;
1039
1123
  },
1040
1124
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1041
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1042
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__4);
1125
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement")], shim_idx: 19, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1126
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__4);
1043
1127
  return ret;
1044
1128
  },
1045
1129
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
1046
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1047
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__5);
1130
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 19, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1131
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__5);
1048
1132
  return ret;
1049
1133
  },
1050
1134
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
1051
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 201, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1052
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___u32______true_);
1135
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 213, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1136
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___u32______true_);
1053
1137
  return ret;
1054
1138
  },
1055
1139
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
1056
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 17, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1057
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke_______true_);
1140
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1141
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke_______true_);
1058
1142
  return ret;
1059
1143
  },
1060
1144
  __wbindgen_cast_0000000000000009: function(arg0) {
@@ -1080,51 +1164,51 @@ function __wbg_get_imports() {
1080
1164
  return {
1081
1165
  __proto__: null,
1082
1166
  "./opengrid_web_components_bg.js": import0,
1083
- "./snippets/opengrid-web-core-19b41f3fd18cf51f/inline0.js": import1,
1084
- "./snippets/opengrid-web-core-19b41f3fd18cf51f/inline0.js": import2,
1085
- "./snippets/opengrid-web-core-19b41f3fd18cf51f/inline0.js": import3,
1167
+ "./snippets/opengrid-web-core-a3505e32fee0c1ed/inline0.js": import1,
1168
+ "./snippets/opengrid-web-core-a3505e32fee0c1ed/inline0.js": import2,
1169
+ "./snippets/opengrid-web-core-a3505e32fee0c1ed/inline0.js": import3,
1086
1170
  };
1087
1171
  }
1088
1172
 
1089
- function wasm_bindgen_6af9200f0870d488___convert__closures_____invoke_______true_(arg0, arg1) {
1090
- wasm.wasm_bindgen_6af9200f0870d488___convert__closures_____invoke_______true_(arg0, arg1);
1173
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke_______true_(arg0, arg1) {
1174
+ wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke_______true_(arg0, arg1);
1091
1175
  }
1092
1176
 
1093
- function wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true_(arg0, arg1, arg2) {
1094
- wasm.wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true_(arg0, arg1, arg2);
1177
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true_(arg0, arg1, arg2) {
1178
+ wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true_(arg0, arg1, arg2);
1095
1179
  }
1096
1180
 
1097
- function wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__2(arg0, arg1, arg2) {
1098
- wasm.wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__2(arg0, arg1, arg2);
1181
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__2(arg0, arg1, arg2) {
1182
+ wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__2(arg0, arg1, arg2);
1099
1183
  }
1100
1184
 
1101
- function wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__4(arg0, arg1, arg2) {
1102
- wasm.wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__4(arg0, arg1, arg2);
1185
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__4(arg0, arg1, arg2) {
1186
+ wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__4(arg0, arg1, arg2);
1103
1187
  }
1104
1188
 
1105
- function wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__5(arg0, arg1, arg2) {
1106
- wasm.wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__5(arg0, arg1, arg2);
1189
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__5(arg0, arg1, arg2) {
1190
+ wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__5(arg0, arg1, arg2);
1107
1191
  }
1108
1192
 
1109
- function wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_(arg0, arg1, arg2) {
1110
- const ret = wasm.wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_(arg0, arg1, arg2);
1193
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___wasm_bindgen_4cfd459b66780f67___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4cfd459b66780f67___JsError___true_(arg0, arg1, arg2) {
1194
+ const ret = wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___wasm_bindgen_4cfd459b66780f67___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4cfd459b66780f67___JsError___true_(arg0, arg1, arg2);
1111
1195
  if (ret[1]) {
1112
1196
  throw takeFromExternrefTable0(ret[0]);
1113
1197
  }
1114
1198
  }
1115
1199
 
1116
- function 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_(arg0, arg1, arg2, arg3, arg4, arg5) {
1200
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___web_sys_b5c30633085262f3___features__gen_HtmlElement__HtmlElement__alloc_42d2b33bd937efdb___string__String__core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String___core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String_______true_(arg0, arg1, arg2, arg3, arg4, arg5) {
1117
1201
  const ptr0 = passStringToWasm0(arg3, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1118
1202
  const len0 = WASM_VECTOR_LEN;
1119
1203
  var ptr1 = isLikeNone(arg4) ? 0 : passStringToWasm0(arg4, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1120
1204
  var len1 = WASM_VECTOR_LEN;
1121
1205
  var ptr2 = isLikeNone(arg5) ? 0 : passStringToWasm0(arg5, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1122
1206
  var len2 = WASM_VECTOR_LEN;
1123
- wasm.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_(arg0, arg1, arg2, ptr0, len0, ptr1, len1, ptr2, len2);
1207
+ wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___web_sys_b5c30633085262f3___features__gen_HtmlElement__HtmlElement__alloc_42d2b33bd937efdb___string__String__core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String___core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String_______true_(arg0, arg1, arg2, ptr0, len0, ptr1, len1, ptr2, len2);
1124
1208
  }
1125
1209
 
1126
- function wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___u32______true_(arg0, arg1, arg2) {
1127
- wasm.wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___u32______true_(arg0, arg1, arg2);
1210
+ function wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___u32______true_(arg0, arg1, arg2) {
1211
+ wasm.wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___u32______true_(arg0, arg1, arg2);
1128
1212
  }
1129
1213
 
1130
1214
 
Binary file
@@ -7,22 +7,25 @@ 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_actions: (a: any, b: any) => void;
10
11
  export const set_cell_state: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => void;
11
12
  export const set_choices: (a: any, b: any) => void;
12
13
  export const set_columns: (a: any, b: any) => void;
13
14
  export const set_formats: (a: any, b: any) => void;
14
15
  export const set_provider: (a: any, b: any) => void;
16
+ export const set_row_state: (a: any, b: number, c: number, d: number, e: number, f: any) => void;
15
17
  export const set_texts: (a: any, b: any) => void;
18
+ export const set_validators: (a: any, b: any) => void;
16
19
  export const set_values: (a: any, b: any) => void;
17
20
  export const set_view: (a: any, b: any, c: any) => void;
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;
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];
20
- export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true_: (a: number, b: number, c: any) => void;
21
- export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__2: (a: number, b: number, c: any) => void;
22
- export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__4: (a: number, b: number, c: any) => void;
23
- export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___js_sys_9485a4494ece8a82___Array______true__5: (a: number, b: number, c: any) => void;
24
- export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___u32______true_: (a: number, b: number, c: number) => void;
25
- export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke_______true_: (a: number, b: number) => void;
21
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___web_sys_b5c30633085262f3___features__gen_HtmlElement__HtmlElement__alloc_42d2b33bd937efdb___string__String__core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String___core_37ee0ce0c4cd57d5___option__Option_alloc_42d2b33bd937efdb___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
22
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___wasm_bindgen_4cfd459b66780f67___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_4cfd459b66780f67___JsError___true_: (a: number, b: number, c: any) => [number, number];
23
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true_: (a: number, b: number, c: any) => void;
24
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__2: (a: number, b: number, c: any) => void;
25
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__4: (a: number, b: number, c: any) => void;
26
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___js_sys_167d7a02263935a1___Array______true__5: (a: number, b: number, c: any) => void;
27
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke___u32______true_: (a: number, b: number, c: number) => void;
28
+ export const wasm_bindgen_4cfd459b66780f67___convert__closures_____invoke_______true_: (a: number, b: number) => void;
26
29
  export const __wbindgen_exn_store: (a: number) => void;
27
30
  export const __externref_table_alloc: () => number;
28
31
  export const __wbindgen_externrefs: WebAssembly.Table;
package/worker.js CHANGED
@@ -12,6 +12,7 @@
12
12
  * init { type:"init", id, moduleUrl, wasmUrl } -> { type:"ready", id }
13
13
  * load { type:"load", id, name, bytes, schema }
14
14
  * -> { type:"loaded", id }
15
+ * rows { type:"rows", id, name, rows, schema } -> { type:"loaded", id } (issue #182)
15
16
  * query { type:"query", id, query } -> { id, result }
16
17
  * stats { type:"stats", id } -> { id, result } (issue #70)
17
18
  * pivot { type:"pivot", id, pivot } -> { id, result } (issue #28)
@@ -42,6 +43,11 @@ self.onmessage = async ({ data }) => {
42
43
  self.postMessage({ type: "loaded", id: data.id });
43
44
  break;
44
45
  }
46
+ case "rows": {
47
+ engine.load_rows(data.name, data.rows, data.schema);
48
+ self.postMessage({ type: "loaded", id: data.id });
49
+ break;
50
+ }
45
51
  case "stats": {
46
52
  // What the engine holds: its memory and each source's size, as JSON.
47
53
  self.postMessage({ id: data.id, result: engine.stats() });