@casoon/opengrid 0.13.0 → 0.15.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 +491 -18
- package/README.md +17 -2
- package/engine/opengrid_wasm.d.ts +9 -0
- package/engine/opengrid_wasm.js +22 -0
- package/engine/opengrid_wasm_bg.wasm +0 -0
- package/engine/opengrid_wasm_bg.wasm.d.ts +1 -0
- package/loader.d.ts +215 -11
- package/loader.js +183 -43
- package/package.json +6 -6
- package/pkg/opengrid_web_components.d.ts +61 -26
- package/pkg/opengrid_web_components.js +250 -60
- package/pkg/opengrid_web_components_bg.wasm +0 -0
- package/pkg/opengrid_web_components_bg.wasm.d.ts +11 -8
- package/pkg/snippets/opengrid-web-components-ef3def04de0cb619/inline0.js +8 -0
- package/pkg/snippets/opengrid-web-components-ef3def04de0cb619/inline1.js +58 -0
- package/pkg/snippets/opengrid-web-core-78fdded9b8a374ed/inline2.js +89 -0
- package/react/index.d.ts +12 -0
- package/react/index.js +24 -4
- package/svelte/Opengrid.svelte +39 -10
- package/svelte/OpengridGrid.svelte +15 -0
- package/svelte/index.d.ts +45 -16
- package/vue/index.d.ts +37 -5
- package/vue/index.js +33 -7
- package/worker.js +11 -1
- package/pkg/snippets/opengrid-web-components-ad6dc2c80732d2d3/inline0.js +0 -17
- /package/pkg/snippets/{opengrid-web-core-19b41f3fd18cf51f → opengrid-web-core-78fdded9b8a374ed}/inline0.js +0 -0
- /package/pkg/snippets/{opengrid-web-core-19b41f3fd18cf51f → opengrid-web-core-78fdded9b8a374ed}/inline1.js +0 -0
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)
|
|
@@ -22,6 +23,10 @@
|
|
|
22
23
|
* transferred, not copied. Nothing engine-specific is serialised here.
|
|
23
24
|
*/
|
|
24
25
|
|
|
26
|
+
// The packaged engine glue, imported statically so that a bundler follows it and
|
|
27
|
+
// the `.wasm` beside it; `init` names another one with `moduleUrl`.
|
|
28
|
+
import * as packaged from "./engine/opengrid_wasm.js";
|
|
29
|
+
|
|
25
30
|
/** The single engine instance, created on `init` and reused for every query. */
|
|
26
31
|
let engine;
|
|
27
32
|
|
|
@@ -31,7 +36,7 @@ self.onmessage = async ({ data }) => {
|
|
|
31
36
|
case "init": {
|
|
32
37
|
// wasm-bindgen `--target web`: the default export initialises the
|
|
33
38
|
// module; the named `Engine` class is created afterwards.
|
|
34
|
-
const module = await import(data.moduleUrl);
|
|
39
|
+
const module = data.moduleUrl ? await import(/* @vite-ignore */ data.moduleUrl) : packaged;
|
|
35
40
|
await module.default(data.wasmUrl);
|
|
36
41
|
engine = new module.Engine();
|
|
37
42
|
self.postMessage({ type: "ready", id: data.id });
|
|
@@ -42,6 +47,11 @@ self.onmessage = async ({ data }) => {
|
|
|
42
47
|
self.postMessage({ type: "loaded", id: data.id });
|
|
43
48
|
break;
|
|
44
49
|
}
|
|
50
|
+
case "rows": {
|
|
51
|
+
engine.load_rows(data.name, data.rows, data.schema);
|
|
52
|
+
self.postMessage({ type: "loaded", id: data.id });
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
45
55
|
case "stats": {
|
|
46
56
|
// What the engine holds: its memory and each source's size, as JSON.
|
|
47
57
|
self.postMessage({ id: data.id, result: engine.stats() });
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export function __opengrid_intl_formatter(kind, locale, options) {
|
|
3
|
-
const loc = locale || undefined;
|
|
4
|
-
const format = kind === 'date'
|
|
5
|
-
? new Intl.DateTimeFormat(loc, options)
|
|
6
|
-
: new Intl.NumberFormat(loc, options);
|
|
7
|
-
return (text, value) => {
|
|
8
|
-
if (value === null || value === undefined) return '';
|
|
9
|
-
if (kind === 'date') {
|
|
10
|
-
const at = Date.parse(typeof value === 'string' && value.length === 10
|
|
11
|
-
? value + 'T00:00:00Z' : value);
|
|
12
|
-
return Number.isNaN(at) ? text : format.format(new Date(at));
|
|
13
|
-
}
|
|
14
|
-
const number = Number(value);
|
|
15
|
-
return Number.isFinite(number) ? format.format(number) : text;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
File without changes
|
|
File without changes
|