@malloydata/render 0.0.135-dev240325191847 → 0.0.135-dev240326154530
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/component/render-webcomponent.d.ts +6 -0
- package/dist/component/render.d.ts +7 -17
- package/dist/component/result-context.d.ts +2 -3
- package/dist/component/table/table-context.d.ts +9 -0
- package/dist/component/{table-layout.d.ts → table/table-layout.d.ts} +2 -2
- package/dist/component/table/table.d.ts +9 -0
- package/dist/html/html_view.d.ts +1 -1
- package/dist/module/index.mjs +145243 -0
- package/dist/module/index.umd.js +1643 -0
- package/dist/module/style.css +1 -0
- package/dist/stories/bars.stories.d.ts +1 -1
- package/dist/stories/tables.stories.d.ts +1 -1
- package/dist/stories/themes.stories.d.ts +1 -1
- package/dist/webcomponent/malloy-render.mjs +90572 -0
- package/dist/webcomponent/malloy-render.umd.js +1491 -0
- package/dist/webcomponent/style.css +1 -0
- package/package.json +21 -7
- package/vite.config.ts +25 -0
- package/vite.config.webcomponent.ts +25 -0
- package/dist/bundle/bundled_renderer.js +0 -139374
- package/dist/bundle/bundled_renderer.min.js +0 -2374
- package/dist/bundle/main.js +0 -29
- package/dist/bundle/renderer.js +0 -71
- package/dist/component/bar-chart.js +0 -130
- package/dist/component/chart-settings.js +0 -152
- package/dist/component/render-numeric-field.js +0 -104
- package/dist/component/render-result-metadata.js +0 -91
- package/dist/component/render.js +0 -155
- package/dist/component/result-context.js +0 -28
- package/dist/component/table-layout.js +0 -83
- package/dist/component/table.d.ts +0 -35
- package/dist/component/table.js +0 -375
- package/dist/component/util.js +0 -53
- package/dist/component/vega-chart.js +0 -105
- package/dist/component/vega-lite-base-spec.js +0 -61
- package/dist/component/vega-types.js +0 -34
- package/dist/data_styles.js +0 -50
- package/dist/drill.js +0 -124
- package/dist/html/area_sparkline.js +0 -118
- package/dist/html/bar_chart.js +0 -70
- package/dist/html/bar_sparkline.js +0 -119
- package/dist/html/boolean.js +0 -53
- package/dist/html/bytes.js +0 -47
- package/dist/html/cartesian_chart.js +0 -110
- package/dist/html/chart.js +0 -120
- package/dist/html/column_sparkline.js +0 -120
- package/dist/html/container.js +0 -44
- package/dist/html/currency.js +0 -75
- package/dist/html/dashboard.js +0 -242
- package/dist/html/data_volume.js +0 -94
- package/dist/html/date.js +0 -66
- package/dist/html/duration.js +0 -108
- package/dist/html/html_view.js +0 -187
- package/dist/html/image.js +0 -77
- package/dist/html/index.js +0 -28
- package/dist/html/json.js +0 -52
- package/dist/html/line_chart.js +0 -72
- package/dist/html/link.js +0 -57
- package/dist/html/list.js +0 -73
- package/dist/html/list_detail.js +0 -33
- package/dist/html/number.js +0 -73
- package/dist/html/percent.js +0 -50
- package/dist/html/point_map.js +0 -182
- package/dist/html/scatter_chart.js +0 -72
- package/dist/html/segment_map.js +0 -151
- package/dist/html/shape_map.js +0 -194
- package/dist/html/sparkline.js +0 -120
- package/dist/html/state_codes.js +0 -137
- package/dist/html/table.js +0 -475
- package/dist/html/text.js +0 -65
- package/dist/html/unsupported.js +0 -72
- package/dist/html/utils.js +0 -277
- package/dist/html/vega_spec.js +0 -544
- package/dist/index.js +0 -47
- package/dist/main_renderer_factory.js +0 -101
- package/dist/renderer.js +0 -34
- package/dist/renderer_factory.js +0 -57
- package/dist/renderer_types.js +0 -25
- package/dist/stories/bars.stories.js +0 -52
- package/dist/stories/basic.stories.js +0 -34
- package/dist/stories/image.stories.js +0 -34
- package/dist/stories/render-malloy-legacy.js +0 -27
- package/dist/stories/tables.stories.js +0 -65
- package/dist/stories/themes.stories.js +0 -47
- package/dist/stories/util.js +0 -25
- package/dist/tags_utils.js +0 -30
package/dist/html/html_view.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
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.makeRenderer = exports.JSONView = exports.HTMLView = void 0;
|
|
26
|
-
const json_1 = require("./json");
|
|
27
|
-
const dashboard_1 = require("./dashboard");
|
|
28
|
-
const list_detail_1 = require("./list_detail");
|
|
29
|
-
const table_1 = require("./table");
|
|
30
|
-
const container_1 = require("./container");
|
|
31
|
-
const utils_1 = require("./utils");
|
|
32
|
-
const main_renderer_factory_1 = require("../main_renderer_factory");
|
|
33
|
-
const list_1 = require("./list");
|
|
34
|
-
require("../component/render");
|
|
35
|
-
class HTMLView {
|
|
36
|
-
constructor(document) {
|
|
37
|
-
this.document = document;
|
|
38
|
-
}
|
|
39
|
-
async render(result, options) {
|
|
40
|
-
const isNextRenderer = result.modelTag.has('renderer_next');
|
|
41
|
-
if (isNextRenderer) {
|
|
42
|
-
const el = this.document.createElement('malloy-render');
|
|
43
|
-
el.result = result;
|
|
44
|
-
return el;
|
|
45
|
-
}
|
|
46
|
-
const table = result.data;
|
|
47
|
-
const renderer = makeRenderer(table.field, this.document, options, {
|
|
48
|
-
size: 'large',
|
|
49
|
-
}, table.field.structDef.queryTimezone, result.tagParse().tag);
|
|
50
|
-
try {
|
|
51
|
-
// TODO Implement row streaming capability for some renderers: some renderers should be usable
|
|
52
|
-
// as a builder with `begin(field: StructDef)`, `row(field: StructDef, row: QueryDataRow)`,
|
|
53
|
-
// and `end(field: StructDef)` methods.
|
|
54
|
-
// Primarily, this should be possible for the `table` and `dashboard` renderers.
|
|
55
|
-
// This would only be used at this top level (and HTML view should support `begin`,
|
|
56
|
-
// `row`, and `end` as well).
|
|
57
|
-
return await renderer.render(table);
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
if (error instanceof Error) {
|
|
61
|
-
return (0, utils_1.createErrorElement)(this.document, error);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
return (0, utils_1.createErrorElement)(this.document, 'Internal error - Exception not an Error object.');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.HTMLView = HTMLView;
|
|
70
|
-
class JSONView {
|
|
71
|
-
constructor(document) {
|
|
72
|
-
this.document = document;
|
|
73
|
-
}
|
|
74
|
-
async render(table) {
|
|
75
|
-
const renderer = new json_1.HTMLJSONRenderer(this.document);
|
|
76
|
-
try {
|
|
77
|
-
return await renderer.render(table);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
if (error instanceof Error) {
|
|
81
|
-
return (0, utils_1.createErrorElement)(this.document, error);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
return (0, utils_1.createErrorElement)(this.document, 'Internal error - Exception not an Error object.');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.JSONView = JSONView;
|
|
90
|
-
const suffixMap = {
|
|
91
|
-
'shape_map': 'shape_map',
|
|
92
|
-
'point_map': 'point_map',
|
|
93
|
-
'bar_chart': 'bar_chart',
|
|
94
|
-
'image': 'image',
|
|
95
|
-
'json': 'json',
|
|
96
|
-
'segment_map': 'segment_map',
|
|
97
|
-
'dashboard': 'dashboard',
|
|
98
|
-
'line_chart': 'line_chart',
|
|
99
|
-
'scatter_chart': 'scatter_chart',
|
|
100
|
-
'url': 'url',
|
|
101
|
-
'list': 'list',
|
|
102
|
-
'list_detail': 'list_detail',
|
|
103
|
-
'sparkline': 'sparkline',
|
|
104
|
-
'sparkline_area': 'sparkline',
|
|
105
|
-
'sparkline_column': 'sparkline',
|
|
106
|
-
'sparkline_bar': 'sparkline',
|
|
107
|
-
};
|
|
108
|
-
function getRendererOptions(field, dataStyles) {
|
|
109
|
-
let renderer = dataStyles[field.name];
|
|
110
|
-
if (!renderer) {
|
|
111
|
-
for (const sourceClass of field.sourceClasses) {
|
|
112
|
-
if (!renderer) {
|
|
113
|
-
renderer = dataStyles[sourceClass];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const { name } = field;
|
|
118
|
-
for (const suffix in suffixMap) {
|
|
119
|
-
if (name.endsWith(`_${suffix}`)) {
|
|
120
|
-
const label = name.slice(0, name.length - suffix.length - 1);
|
|
121
|
-
return updateOrCreateRenderer(suffix, label, suffixMap, renderer);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return renderer;
|
|
125
|
-
}
|
|
126
|
-
function updateOrCreateRenderer(rendererKey, label, rendererMap, renderer) {
|
|
127
|
-
var _a, _b, _c;
|
|
128
|
-
var _d;
|
|
129
|
-
if (renderer) {
|
|
130
|
-
(_a = renderer.renderer) !== null && _a !== void 0 ? _a : (renderer.renderer = rendererMap[rendererKey]);
|
|
131
|
-
(_b = renderer.data) !== null && _b !== void 0 ? _b : (renderer.data = {});
|
|
132
|
-
(_c = (_d = renderer.data).label) !== null && _c !== void 0 ? _c : (_d.label = label);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
renderer = {
|
|
136
|
-
renderer: rendererMap[rendererKey],
|
|
137
|
-
data: {
|
|
138
|
-
label,
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
return renderer;
|
|
143
|
-
}
|
|
144
|
-
function isContainer(field) {
|
|
145
|
-
if (field.isExplore()) {
|
|
146
|
-
return field;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
throw new Error(`${field.name} does not contain fields and cannot be rendered this way`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function makeRenderer(field, document, options, styleDefaults, queryTimezone, tagged) {
|
|
153
|
-
const renderDef = getRendererOptions(field, options.dataStyles);
|
|
154
|
-
options.dataStyles[field.name] = renderDef;
|
|
155
|
-
const renderer = new main_renderer_factory_1.MainRendererFactory().create(renderDef, tagged, document, styleDefaults, options, field, queryTimezone);
|
|
156
|
-
if (renderer) {
|
|
157
|
-
return renderer;
|
|
158
|
-
}
|
|
159
|
-
if ((renderDef === null || renderDef === void 0 ? void 0 : renderDef.renderer) === 'dashboard' || tagged.has('dashboard')) {
|
|
160
|
-
return makeContainerRenderer(dashboard_1.HTMLDashboardRenderer, document, isContainer(field), options, tagged);
|
|
161
|
-
}
|
|
162
|
-
else if ((renderDef === null || renderDef === void 0 ? void 0 : renderDef.renderer) === 'list' || tagged.has('list')) {
|
|
163
|
-
return makeContainerRenderer(list_1.HTMLListRenderer, document, isContainer(field), options, tagged);
|
|
164
|
-
}
|
|
165
|
-
else if ((renderDef === null || renderDef === void 0 ? void 0 : renderDef.renderer) === 'list_detail' ||
|
|
166
|
-
tagged.has('list_detail')) {
|
|
167
|
-
return makeContainerRenderer(list_detail_1.HTMLListDetailRenderer, document, isContainer(field), options, tagged);
|
|
168
|
-
}
|
|
169
|
-
else if ((renderDef === null || renderDef === void 0 ? void 0 : renderDef.renderer) === 'table' ||
|
|
170
|
-
tagged.has('table') ||
|
|
171
|
-
!field.hasParentExplore() ||
|
|
172
|
-
field.isExploreField()) {
|
|
173
|
-
return makeContainerRenderer(table_1.HTMLTableRenderer, document, isContainer(field), options, tagged);
|
|
174
|
-
}
|
|
175
|
-
throw new Error(`Could not find a proper renderer for field ${field.name}`);
|
|
176
|
-
}
|
|
177
|
-
exports.makeRenderer = makeRenderer;
|
|
178
|
-
function makeContainerRenderer(cType, document, explore, options, tagged) {
|
|
179
|
-
const c = container_1.ContainerRenderer.make(cType, document, explore, options, tagged);
|
|
180
|
-
const result = {};
|
|
181
|
-
explore.intrinsicFields.forEach((field) => {
|
|
182
|
-
result[field.name] = makeRenderer(field, document, options, c.defaultStylesForChildren, explore.queryTimezone, field.tagParse().tag);
|
|
183
|
-
});
|
|
184
|
-
c.childRenderers = result;
|
|
185
|
-
return c;
|
|
186
|
-
}
|
|
187
|
-
//# sourceMappingURL=html_view.js.map
|
package/dist/html/image.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
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.ImageRendererFactory = exports.HTMLImageRenderer = void 0;
|
|
26
|
-
const utils_1 = require("./utils");
|
|
27
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
28
|
-
class HTMLImageRenderer {
|
|
29
|
-
constructor(document) {
|
|
30
|
-
this.document = document;
|
|
31
|
-
}
|
|
32
|
-
async render(data) {
|
|
33
|
-
var _a;
|
|
34
|
-
if (!data.isString()) {
|
|
35
|
-
return (0, utils_1.createErrorElement)(this.document, 'Invalid field for Image renderer');
|
|
36
|
-
}
|
|
37
|
-
const { tag } = data.field.tagParse();
|
|
38
|
-
const imgTag = tag.tag('image');
|
|
39
|
-
if (!imgTag) {
|
|
40
|
-
return (0, utils_1.createErrorElement)(this.document, 'Missing tag for Image renderer');
|
|
41
|
-
}
|
|
42
|
-
const element = data.isNull()
|
|
43
|
-
? (0, utils_1.createNullElement)(this.document)
|
|
44
|
-
: this.document.createElement('img');
|
|
45
|
-
const width = imgTag.text('width');
|
|
46
|
-
const height = imgTag.text('height');
|
|
47
|
-
// Both image and null placeholder get matching size
|
|
48
|
-
if (width)
|
|
49
|
-
element.style.width = width;
|
|
50
|
-
if (height)
|
|
51
|
-
element.style.height = height;
|
|
52
|
-
const img = element;
|
|
53
|
-
const altTag = imgTag.tag('alt');
|
|
54
|
-
if (altTag) {
|
|
55
|
-
const alt = (_a = (0, utils_1.getDynamicValue)({ tag: altTag, data })) !== null && _a !== void 0 ? _a : altTag.text();
|
|
56
|
-
if (alt)
|
|
57
|
-
img.alt = alt;
|
|
58
|
-
}
|
|
59
|
-
// Image specific props
|
|
60
|
-
if (!data.isNull()) {
|
|
61
|
-
img.src = data.value;
|
|
62
|
-
}
|
|
63
|
-
return element;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.HTMLImageRenderer = HTMLImageRenderer;
|
|
67
|
-
class ImageRendererFactory extends renderer_factory_1.RendererFactory {
|
|
68
|
-
create(document, _styleDefaults, _rendererOptions, _field, _options) {
|
|
69
|
-
return new HTMLImageRenderer(document);
|
|
70
|
-
}
|
|
71
|
-
get rendererName() {
|
|
72
|
-
return 'image';
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.ImageRendererFactory = ImageRendererFactory;
|
|
76
|
-
ImageRendererFactory.instance = new ImageRendererFactory();
|
|
77
|
-
//# sourceMappingURL=image.js.map
|
package/dist/html/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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.HTMLView = void 0;
|
|
26
|
-
var html_view_1 = require("./html_view");
|
|
27
|
-
Object.defineProperty(exports, "HTMLView", { enumerable: true, get: function () { return html_view_1.HTMLView; } });
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
package/dist/html/json.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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.JSONRendererFactory = exports.HTMLJSONRenderer = void 0;
|
|
26
|
-
const utils_1 = require("./utils");
|
|
27
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
28
|
-
class HTMLJSONRenderer {
|
|
29
|
-
constructor(document) {
|
|
30
|
-
this.document = document;
|
|
31
|
-
}
|
|
32
|
-
async render(table) {
|
|
33
|
-
if (!table.isArray() && !table.isRecord()) {
|
|
34
|
-
(0, utils_1.createErrorElement)(this.document, 'Invalid data for chart renderer.');
|
|
35
|
-
}
|
|
36
|
-
const element = this.document.createElement('pre');
|
|
37
|
-
element.appendChild(this.document.createTextNode(JSON.stringify(table.value, undefined, 2)));
|
|
38
|
-
return element;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.HTMLJSONRenderer = HTMLJSONRenderer;
|
|
42
|
-
class JSONRendererFactory extends renderer_factory_1.RendererFactory {
|
|
43
|
-
create(document, _styleDefaults, _rendererOptions, _field, _options) {
|
|
44
|
-
return new HTMLJSONRenderer(document);
|
|
45
|
-
}
|
|
46
|
-
get rendererName() {
|
|
47
|
-
return 'json';
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.JSONRendererFactory = JSONRendererFactory;
|
|
51
|
-
JSONRendererFactory.instance = new JSONRendererFactory();
|
|
52
|
-
//# sourceMappingURL=json.js.map
|
package/dist/html/line_chart.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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.LineChartRendererFactory = exports.HTMLLineChartRenderer = void 0;
|
|
26
|
-
const cartesian_chart_1 = require("./cartesian_chart");
|
|
27
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
28
|
-
class HTMLLineChartRenderer extends cartesian_chart_1.HTMLCartesianChartRenderer {
|
|
29
|
-
getMark() {
|
|
30
|
-
return 'line';
|
|
31
|
-
}
|
|
32
|
-
getDataType(field) {
|
|
33
|
-
if (field.isAtomicField()) {
|
|
34
|
-
if (field.isDate() || field.isTimestamp()) {
|
|
35
|
-
return 'temporal';
|
|
36
|
-
}
|
|
37
|
-
else if (field.isString()) {
|
|
38
|
-
return 'nominal';
|
|
39
|
-
}
|
|
40
|
-
else if (field.isNumber()) {
|
|
41
|
-
return 'quantitative';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
throw new Error('Invalid field type for line chart.');
|
|
45
|
-
}
|
|
46
|
-
getDataValue(data) {
|
|
47
|
-
if (data.isNull()) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
else if (data.isTimestamp() ||
|
|
51
|
-
data.isDate() ||
|
|
52
|
-
data.isNumber() ||
|
|
53
|
-
data.isString()) {
|
|
54
|
-
return data.value;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new Error('Invalid field type for line chart.');
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.HTMLLineChartRenderer = HTMLLineChartRenderer;
|
|
62
|
-
class LineChartRendererFactory extends renderer_factory_1.RendererFactory {
|
|
63
|
-
create(document, styleDefaults, rendererOptions, _field, options, timezone) {
|
|
64
|
-
return new HTMLLineChartRenderer(document, styleDefaults, rendererOptions, options, timezone);
|
|
65
|
-
}
|
|
66
|
-
get rendererName() {
|
|
67
|
-
return 'line_chart';
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.LineChartRendererFactory = LineChartRendererFactory;
|
|
71
|
-
LineChartRendererFactory.instance = new LineChartRendererFactory();
|
|
72
|
-
//# sourceMappingURL=line_chart.js.map
|
package/dist/html/link.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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.LinkRendererFactory = exports.HTMLLinkRenderer = void 0;
|
|
26
|
-
const utils_1 = require("./utils");
|
|
27
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
28
|
-
class HTMLLinkRenderer {
|
|
29
|
-
constructor(document) {
|
|
30
|
-
this.document = document;
|
|
31
|
-
}
|
|
32
|
-
async render(data) {
|
|
33
|
-
if (data.isNull()) {
|
|
34
|
-
return (0, utils_1.createNullElement)(this.document);
|
|
35
|
-
}
|
|
36
|
-
if (!data.isString()) {
|
|
37
|
-
return (0, utils_1.createErrorElement)(this.document, 'Invalid type for link renderer.');
|
|
38
|
-
}
|
|
39
|
-
const element = this.document.createElement('a');
|
|
40
|
-
element.href = data.value;
|
|
41
|
-
element.target = '_blank';
|
|
42
|
-
element.appendChild(this.document.createTextNode(data.value.replace(/\//g, '/\u200C')));
|
|
43
|
-
return element;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.HTMLLinkRenderer = HTMLLinkRenderer;
|
|
47
|
-
class LinkRendererFactory extends renderer_factory_1.RendererFactory {
|
|
48
|
-
create(document, _styleDefaults, _rendererOptions, _field, _options) {
|
|
49
|
-
return new HTMLLinkRenderer(document);
|
|
50
|
-
}
|
|
51
|
-
get rendererName() {
|
|
52
|
-
return 'link';
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.LinkRendererFactory = LinkRendererFactory;
|
|
56
|
-
LinkRendererFactory.instance = new LinkRendererFactory();
|
|
57
|
-
//# sourceMappingURL=link.js.map
|
package/dist/html/list.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
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.HTMLListRenderer = void 0;
|
|
26
|
-
const container_1 = require("./container");
|
|
27
|
-
const utils_1 = require("./utils");
|
|
28
|
-
class HTMLListRenderer extends container_1.ContainerRenderer {
|
|
29
|
-
constructor() {
|
|
30
|
-
super(...arguments);
|
|
31
|
-
this.childrenStyleDefaults = {
|
|
32
|
-
size: 'small',
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
getValueField(struct) {
|
|
36
|
-
return struct.intrinsicFields[0];
|
|
37
|
-
}
|
|
38
|
-
getDetailField(_struct) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
async render(table) {
|
|
42
|
-
if (!table.isArray()) {
|
|
43
|
-
return (0, utils_1.createErrorElement)(this.document, 'Invalid data for chart renderer.');
|
|
44
|
-
}
|
|
45
|
-
if (table.rowCount === 0) {
|
|
46
|
-
return this.document.createElement('span');
|
|
47
|
-
}
|
|
48
|
-
const valueField = this.getValueField(table.field);
|
|
49
|
-
const detailField = this.getDetailField(table.field);
|
|
50
|
-
const element = this.document.createElement('span');
|
|
51
|
-
let isFirst = true;
|
|
52
|
-
for (const row of table) {
|
|
53
|
-
if (!isFirst) {
|
|
54
|
-
element.appendChild(this.document.createTextNode(', '));
|
|
55
|
-
}
|
|
56
|
-
isFirst = false;
|
|
57
|
-
const childRenderer = this.childRenderers[valueField.name];
|
|
58
|
-
const rendered = await childRenderer.render(row.cell(valueField));
|
|
59
|
-
element.appendChild(rendered);
|
|
60
|
-
if (detailField) {
|
|
61
|
-
const childRenderer = this.childRenderers[detailField.name];
|
|
62
|
-
await (0, utils_1.yieldTask)();
|
|
63
|
-
const rendered = await childRenderer.render(row.cell(detailField));
|
|
64
|
-
element.appendChild(this.document.createTextNode('('));
|
|
65
|
-
element.appendChild(rendered);
|
|
66
|
-
element.appendChild(this.document.createTextNode(')'));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return element;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.HTMLListRenderer = HTMLListRenderer;
|
|
73
|
-
//# sourceMappingURL=list.js.map
|
package/dist/html/list_detail.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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.HTMLListDetailRenderer = void 0;
|
|
26
|
-
const list_1 = require("./list");
|
|
27
|
-
class HTMLListDetailRenderer extends list_1.HTMLListRenderer {
|
|
28
|
-
getDetailField(explore) {
|
|
29
|
-
return explore.intrinsicFields[1];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.HTMLListDetailRenderer = HTMLListDetailRenderer;
|
|
33
|
-
//# sourceMappingURL=list_detail.js.map
|
package/dist/html/number.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
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.NumberRendererFactory = exports.HTMLNumberRenderer = void 0;
|
|
26
|
-
const malloy_1 = require("@malloydata/malloy");
|
|
27
|
-
const text_1 = require("./text");
|
|
28
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
29
|
-
const ssf_1 = require("ssf");
|
|
30
|
-
class HTMLNumberRenderer extends text_1.HTMLTextRenderer {
|
|
31
|
-
constructor(document, options) {
|
|
32
|
-
super(document);
|
|
33
|
-
this.options = options;
|
|
34
|
-
}
|
|
35
|
-
getText(data) {
|
|
36
|
-
if (data.isNull()) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
if (this.options.value_format) {
|
|
40
|
-
try {
|
|
41
|
-
return (0, ssf_1.format)(this.options.value_format, data.number.value);
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
// TODO: explore surfacing invalid format error, ignoring it for now.
|
|
45
|
-
throw new Error(`Invalid value format: ${this.options.value_format}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return data.number.value.toLocaleString();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.HTMLNumberRenderer = HTMLNumberRenderer;
|
|
52
|
-
class NumberRendererFactory extends renderer_factory_1.RendererFactory {
|
|
53
|
-
constructor() {
|
|
54
|
-
super();
|
|
55
|
-
this.addExtractor((options, tagObj) => {
|
|
56
|
-
options.value_format = tagObj === null || tagObj === void 0 ? void 0 : tagObj.text();
|
|
57
|
-
}, this.rendererName, 'format');
|
|
58
|
-
}
|
|
59
|
-
activates(field) {
|
|
60
|
-
return (field.hasParentExplore() &&
|
|
61
|
-
field.isAtomicField() &&
|
|
62
|
-
field.type === malloy_1.AtomicFieldType.Number);
|
|
63
|
-
}
|
|
64
|
-
create(document, _styleDefaults, _rendererOptions, _field, options) {
|
|
65
|
-
return new HTMLNumberRenderer(document, options);
|
|
66
|
-
}
|
|
67
|
-
get rendererName() {
|
|
68
|
-
return 'number';
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.NumberRendererFactory = NumberRendererFactory;
|
|
72
|
-
NumberRendererFactory.instance = new NumberRendererFactory();
|
|
73
|
-
//# sourceMappingURL=number.js.map
|