@casoon/opengrid 0.1.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 +256 -0
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +123 -0
- package/engine/opengrid_wasm.d.ts +130 -0
- package/engine/opengrid_wasm.js +455 -0
- package/engine/opengrid_wasm_bg.wasm +0 -0
- package/engine/opengrid_wasm_bg.wasm.d.ts +19 -0
- package/loader.d.ts +683 -0
- package/loader.js +1000 -0
- package/package.json +58 -0
- package/pkg/opengrid_web_components.d.ts +222 -0
- package/pkg/opengrid_web_components.js +1248 -0
- package/pkg/opengrid_web_components_bg.wasm +0 -0
- package/pkg/opengrid_web_components_bg.wasm.d.ts +31 -0
- package/pkg/snippets/opengrid-web-core-e0ef3c8948ce8a1e/inline0.js +22 -0
- package/pkg/snippets/opengrid-web-core-e0ef3c8948ce8a1e/inline1.js +25 -0
- package/worker.js +59 -0
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@casoon/opengrid",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Accessible data grid, table and pivot as web components, driven by a portable Rust/WASM query engine.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"datagrid",
|
|
8
|
+
"pivot",
|
|
9
|
+
"web-components",
|
|
10
|
+
"accessibility",
|
|
11
|
+
"wasm"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT OR Apache-2.0",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/casoon/opengrid.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/casoon/opengrid#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/casoon/opengrid/issues"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./loader.d.ts",
|
|
25
|
+
"default": "./loader.js"
|
|
26
|
+
},
|
|
27
|
+
"./loader.js": {
|
|
28
|
+
"types": "./loader.d.ts",
|
|
29
|
+
"default": "./loader.js"
|
|
30
|
+
},
|
|
31
|
+
"./worker.js": "./worker.js",
|
|
32
|
+
"./pkg/*": "./pkg/*",
|
|
33
|
+
"./engine/*": "./engine/*",
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"main": "./loader.js",
|
|
37
|
+
"types": "./loader.d.ts",
|
|
38
|
+
"sideEffects": [
|
|
39
|
+
"./worker.js"
|
|
40
|
+
],
|
|
41
|
+
"files": [
|
|
42
|
+
"loader.js",
|
|
43
|
+
"loader.d.ts",
|
|
44
|
+
"worker.js",
|
|
45
|
+
"pkg/",
|
|
46
|
+
"engine/",
|
|
47
|
+
"LICENSE-MIT",
|
|
48
|
+
"LICENSE-APACHE",
|
|
49
|
+
"README.md",
|
|
50
|
+
"CHANGELOG.md"
|
|
51
|
+
],
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One piece of a CSV: with `header`, the header line (and the byte order
|
|
6
|
+
* mark) first. `options`: `{ delimiter, bom, protectFormulas, null }`, each
|
|
7
|
+
* optional (docs/guides/export.md, point 87).
|
|
8
|
+
*/
|
|
9
|
+
export function export_csv(result_json: string, options: any, header: boolean): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* One piece of a JSON array: the rows as objects, joined by commas. `first`:
|
|
13
|
+
* no row has been written yet (not "the first piece" — after an empty first
|
|
14
|
+
* piece it is still true), so no comma leads. `loader.js` writes the brackets.
|
|
15
|
+
*/
|
|
16
|
+
export function export_json(result_json: string, first: boolean): string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The pivot as it is shown, as CSV (issue #3).
|
|
20
|
+
*
|
|
21
|
+
* **The element exports what it shows, rather than handing out a query to
|
|
22
|
+
* run again.** A pivot is bounded (256 columns, 2 000 rows in V1) and the
|
|
23
|
+
* element holds all of it — there is no window to page past, so nothing is
|
|
24
|
+
* missing that a second request could fetch. A second request would only cost
|
|
25
|
+
* another `n+1` grouping sets and could answer differently from the table on
|
|
26
|
+
* screen if the data moved in between; and the labels are this element's
|
|
27
|
+
* texts, which an export away from the element would have to be handed. So:
|
|
28
|
+
* synchronous, no provider, and exactly the table the reader sees.
|
|
29
|
+
*
|
|
30
|
+
* One header line, each generated column named `2025 · total` — the reasons
|
|
31
|
+
* are at `opengrid_export::pivot_csv`. Subtotals and the grand total are rows
|
|
32
|
+
* with their labels, NULL and the empty group are named as in the table.
|
|
33
|
+
*
|
|
34
|
+
* `options`: `{ delimiter, bom, protectFormulas, null }`, each optional; any
|
|
35
|
+
* other key is an error. `null` while nothing is shown — before the first
|
|
36
|
+
* answer, while one loads, after an error — and for the table and the grid.
|
|
37
|
+
*/
|
|
38
|
+
export function get_pivot(host: HTMLElement, options: any): any;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The query of the current view, without a window (plan point 82).
|
|
42
|
+
*
|
|
43
|
+
* Exactly what the grid asks its provider for — the filter row, the facets and
|
|
44
|
+
* the free-text search and-ed together, the sort, the shown columns in their
|
|
45
|
+
* order — but with no `offset` and no `limit`: every match, not the loaded
|
|
46
|
+
* window. It is what a page exports, so that the export is what the reader
|
|
47
|
+
* sees rather than what the page believes the view to be. A grouped grid
|
|
48
|
+
* gives the rows, ordered by its groups first, the way it shows them.
|
|
49
|
+
*
|
|
50
|
+
* `null` for a grid that has no query yet (not connected, no `datasource`, no
|
|
51
|
+
* columns) or whose filter does not hold (the status line already says why),
|
|
52
|
+
* and for the table and the pivot.
|
|
53
|
+
*/
|
|
54
|
+
export function get_query(host: HTMLElement): any;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Reads the whole view as a plain JS object (plan point 59).
|
|
58
|
+
*
|
|
59
|
+
* Sort, filters, column layout and density — everything the reader chose about
|
|
60
|
+
* what is shown and how. **Not the selection**: it names positions, the grid
|
|
61
|
+
* has no key column, and sorting or filtering drops it precisely because after
|
|
62
|
+
* a different sort those positions hold different records. A restored view
|
|
63
|
+
* carrying one would not be incomplete, it would be wrong.
|
|
64
|
+
*
|
|
65
|
+
* A "saved view" is this value with a name on it, which is why the element has
|
|
66
|
+
* no view management of its own: naming, storing and deleting are the page's,
|
|
67
|
+
* the same line `docs/api.md` draws for editing.
|
|
68
|
+
*/
|
|
69
|
+
export function get_view(host: HTMLElement): any;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Registers `<opengrid-table>` and `<opengrid-grid>`; safe to call more than
|
|
73
|
+
* once.
|
|
74
|
+
*
|
|
75
|
+
* `loader.js` calls this after the WASM module is initialised; the browser test
|
|
76
|
+
* calls it directly.
|
|
77
|
+
*/
|
|
78
|
+
export function register(): void;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Sets the choices a column's editor offers (plan point 37).
|
|
82
|
+
*
|
|
83
|
+
* `choices` is a plain JS object keyed by column name, each value a list of
|
|
84
|
+
* strings. A column with choices gets a `<select>` instead of a typed input.
|
|
85
|
+
* V1 has no enum type, so the page is the only honest source of the options.
|
|
86
|
+
*/
|
|
87
|
+
export function set_choices(host: HTMLElement, choices: any): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sets how each column is presented (plan point 60).
|
|
91
|
+
*
|
|
92
|
+
* ```js
|
|
93
|
+
* loader.module.set_columns(host, {
|
|
94
|
+
* id: { width: 96, mono: true, muted: true },
|
|
95
|
+
* customer: { emphasis: true },
|
|
96
|
+
* amount: { width: 150, align: "end", aggregate: "sum", facet: "range" },
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* **The configuration narrows; it never widens.** A name the schema does not
|
|
101
|
+
* have, an aggregate the type does not allow (`sum` over text), a facet that
|
|
102
|
+
* does not fit — each is reported in the status line rather than ignored. A
|
|
103
|
+
* grid that looks configured and is not hides the typo that caused it.
|
|
104
|
+
*
|
|
105
|
+
* What the type already answers is not configurable: which filter operators a
|
|
106
|
+
* column offers is meaning, not taste. The alignment is taste, so it may be
|
|
107
|
+
* overridden.
|
|
108
|
+
*/
|
|
109
|
+
export function set_columns(host: HTMLElement, columns: any): void;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Overrides the texts a component writes itself (point 48).
|
|
113
|
+
*
|
|
114
|
+
* `texts` is a plain JS object with any subset of the keys `lang`, `loading`,
|
|
115
|
+
* `matchesOne`, `matchesOther`, `empty`, `error`, `errorUnknown`,
|
|
116
|
+
* `filterGroup`, `operatorLabel`, `valueLabel`, `clear` and `operators`; every
|
|
117
|
+
* key left out keeps its English default. `{count}`, `{column}` and `{cause}`
|
|
118
|
+
* are the placeholders. A `lang` is written onto the elements that carry these
|
|
119
|
+
* texts — the grid's filter row and status line, the table's error paragraph —
|
|
120
|
+
* so they are announced in the language they are written in. Never onto the
|
|
121
|
+
* data: the cells are the page's, in the page's language.
|
|
122
|
+
*
|
|
123
|
+
* Exported as `set_texts` beside `set_provider`, and like it, it takes effect
|
|
124
|
+
* immediately: the grid rebuilds, because its labels are part of the one-time
|
|
125
|
+
* skeleton (the filter row, the scroll offset and the focus are carried
|
|
126
|
+
* across). Call it **before** wiring the provider and the component renders the
|
|
127
|
+
* right words from its first paint.
|
|
128
|
+
* Sets the per-column display formats (plan point 42).
|
|
129
|
+
*
|
|
130
|
+
* `formats` is a plain JS object keyed by column name. A value is either a
|
|
131
|
+
* **function** `(text, value) => string` — `text` is what the component would
|
|
132
|
+
* have shown, `value` the JSON value — or an **`Intl` options object** with a
|
|
133
|
+
* `kind` of `"number"` (the default) or `"date"` and an optional `locale`;
|
|
134
|
+
* everything else in it goes to `Intl` unchanged.
|
|
135
|
+
*
|
|
136
|
+
* Formatting is display only: the filter, the sort and every comparison keep
|
|
137
|
+
* working on the value, because a grid that sorted by what it printed would
|
|
138
|
+
* have stopped honouring rules S4, S8 and S9.
|
|
139
|
+
*/
|
|
140
|
+
export function set_formats(host: HTMLElement, formats: any): void;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Attaches a data provider to a host element (points 14/16).
|
|
144
|
+
*
|
|
145
|
+
* `provider` is a JS object with an `execute(queryJson)` method that answers a
|
|
146
|
+
* Promise (or a value). Exported as `set_provider` from the components module,
|
|
147
|
+
* so the page wires its engine before or after connect; a connected host whose
|
|
148
|
+
* `datasource`/`columns` are present re-runs its query immediately. The tag
|
|
149
|
+
* name decides whether the table or the grid path runs.
|
|
150
|
+
*/
|
|
151
|
+
export function set_provider(host: HTMLElement, provider: any): void;
|
|
152
|
+
|
|
153
|
+
export function set_texts(host: HTMLElement, values: any): void;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Applies a whole view at once (plan point 59).
|
|
157
|
+
*
|
|
158
|
+
* **One query, not one per field.** Restoring a view field by field would flash
|
|
159
|
+
* through five intermediate results and announce each of them; the reader would
|
|
160
|
+
* hear four states that never existed.
|
|
161
|
+
*
|
|
162
|
+
* A view that names a column this grid does not have is reported in the status
|
|
163
|
+
* line and **not** applied in part — a grid that looks restored and is not is
|
|
164
|
+
* the worse failure (point 56 §Das Modell §2).
|
|
165
|
+
*/
|
|
166
|
+
export function set_view(host: HTMLElement, view: any): void;
|
|
167
|
+
|
|
168
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
169
|
+
|
|
170
|
+
export interface InitOutput {
|
|
171
|
+
readonly memory: WebAssembly.Memory;
|
|
172
|
+
readonly export_csv: (a: number, b: number, c: any, d: number) => [number, number, number, number];
|
|
173
|
+
readonly export_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
174
|
+
readonly get_pivot: (a: any, b: any) => [number, number, number];
|
|
175
|
+
readonly get_query: (a: any) => any;
|
|
176
|
+
readonly get_view: (a: any) => any;
|
|
177
|
+
readonly register: () => [number, number];
|
|
178
|
+
readonly set_choices: (a: any, b: any) => void;
|
|
179
|
+
readonly set_columns: (a: any, b: any) => void;
|
|
180
|
+
readonly set_formats: (a: any, b: any) => void;
|
|
181
|
+
readonly set_provider: (a: any, b: any) => void;
|
|
182
|
+
readonly set_texts: (a: any, b: any) => void;
|
|
183
|
+
readonly set_view: (a: any, b: any) => void;
|
|
184
|
+
readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_f19f0f38d6ea5adb___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_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
185
|
+
readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bindgen_66404d18cc2edcc2___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_66404d18cc2edcc2___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
186
|
+
readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_f19f0f38d6ea5adb___features__gen_HtmlElement__HtmlElement______true_: (a: number, b: number, c: any) => void;
|
|
187
|
+
readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_f19f0f38d6ea5adb___features__gen_HtmlElement__HtmlElement______true__3: (a: number, b: number, c: any) => void;
|
|
188
|
+
readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_f19f0f38d6ea5adb___features__gen_HtmlElement__HtmlElement______true__4: (a: number, b: number, c: any) => void;
|
|
189
|
+
readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_: (a: number, b: number, c: number) => void;
|
|
190
|
+
readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
191
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
192
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
193
|
+
readonly __externref_table_alloc: () => number;
|
|
194
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
195
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
196
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
197
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
198
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
199
|
+
readonly __wbindgen_start: () => void;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
206
|
+
* a precompiled `WebAssembly.Module`.
|
|
207
|
+
*
|
|
208
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
209
|
+
*
|
|
210
|
+
* @returns {InitOutput}
|
|
211
|
+
*/
|
|
212
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
216
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
217
|
+
*
|
|
218
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
219
|
+
*
|
|
220
|
+
* @returns {Promise<InitOutput>}
|
|
221
|
+
*/
|
|
222
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|