@malloydata/render 0.0.24-dev230217173859 → 0.0.24-dev230217181455
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/dist/html/html_view.js
CHANGED
|
@@ -47,6 +47,7 @@ const text_1 = require("./text");
|
|
|
47
47
|
const vega_spec_1 = require("./vega_spec");
|
|
48
48
|
const container_1 = require("./container");
|
|
49
49
|
const utils_1 = require("./utils");
|
|
50
|
+
const unsupported_1 = require("./unsupported");
|
|
50
51
|
class HTMLView {
|
|
51
52
|
constructor(document) {
|
|
52
53
|
this.document = document;
|
|
@@ -218,6 +219,9 @@ function makeRenderer(field, document, options, styleDefaults) {
|
|
|
218
219
|
field.isExploreField()) {
|
|
219
220
|
return makeContainerRenderer(table_1.HTMLTableRenderer, document, isContainer(field), options);
|
|
220
221
|
}
|
|
222
|
+
else if (field.isAtomicField() && field.isUnsupported()) {
|
|
223
|
+
return new unsupported_1.HTMLUnsupportedRenderer(document);
|
|
224
|
+
}
|
|
221
225
|
else {
|
|
222
226
|
return new text_1.HTMLTextRenderer(document);
|
|
223
227
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataColumn } from "@malloydata/malloy";
|
|
2
|
+
import { Renderer } from "../renderer";
|
|
3
|
+
export declare class HTMLUnsupportedRenderer implements Renderer {
|
|
4
|
+
private readonly document;
|
|
5
|
+
constructor(document: Document);
|
|
6
|
+
getText(data: DataColumn): string | null;
|
|
7
|
+
render(data: DataColumn): Promise<HTMLElement>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.HTMLUnsupportedRenderer = void 0;
|
|
26
|
+
const utils_1 = require("./utils");
|
|
27
|
+
class HTMLUnsupportedRenderer {
|
|
28
|
+
constructor(document) {
|
|
29
|
+
this.document = document;
|
|
30
|
+
}
|
|
31
|
+
getText(data) {
|
|
32
|
+
const value = data.value;
|
|
33
|
+
if (typeof value === "string") {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
else if (value === null) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const record = data.value;
|
|
41
|
+
if ("value" in record && typeof record.value === "string") {
|
|
42
|
+
return record.value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return JSON.stringify(data.value);
|
|
46
|
+
}
|
|
47
|
+
async render(data) {
|
|
48
|
+
const text = this.getText(data);
|
|
49
|
+
if (text === null) {
|
|
50
|
+
return (0, utils_1.createNullElement)(this.document);
|
|
51
|
+
}
|
|
52
|
+
const element = this.document.createElement("span");
|
|
53
|
+
element.appendChild(this.document.createTextNode(text));
|
|
54
|
+
return element;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.HTMLUnsupportedRenderer = HTMLUnsupportedRenderer;
|
|
58
|
+
//# sourceMappingURL=unsupported.js.map
|
package/dist/html/utils.js
CHANGED
|
@@ -135,7 +135,7 @@ exports.timeToString = timeToString;
|
|
|
135
135
|
/**
|
|
136
136
|
* Use this function to break up expensive computation over multiple tasks.
|
|
137
137
|
*
|
|
138
|
-
* @
|
|
138
|
+
* @return A promise, which when awaited, puts subsequent code in a separate task.
|
|
139
139
|
*
|
|
140
140
|
* This is useful for cases when expensive code needs to run "concurrently" with a
|
|
141
141
|
* rendering / UI task. Sprinkling in `yieldTask`s into a long task allows other
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/render",
|
|
3
|
-
"version": "0.0.24-
|
|
3
|
+
"version": "0.0.24-dev230217181455",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"prepublishOnly": "npm run build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@malloydata/malloy": "^0.0.24-
|
|
21
|
+
"@malloydata/malloy": "^0.0.24-dev230217181455",
|
|
22
22
|
"us-atlas": "^3.0.0",
|
|
23
23
|
"vega": "^5.21.0",
|
|
24
24
|
"vega-lite": "^5.2.0"
|