@malloydata/render 0.0.135-dev240322231911 → 0.0.135-dev240326020414
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 +145001 -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
|
@@ -1,119 +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.BarSparkLineRendererFactory = exports.HTMLBarSparkLineRenderer = void 0;
|
|
26
|
-
const utils_1 = require("./utils");
|
|
27
|
-
const vega_spec_1 = require("./vega_spec");
|
|
28
|
-
const bar_chart_1 = require("./bar_chart");
|
|
29
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
30
|
-
class HTMLBarSparkLineRenderer extends bar_chart_1.HTMLBarChartRenderer {
|
|
31
|
-
getSize() {
|
|
32
|
-
if (this.size === 'large') {
|
|
33
|
-
return { height: 250, width: 100 };
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return { height: 125, width: 50 };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
getVegaLiteSpec(data) {
|
|
40
|
-
const fields = data.field.intrinsicFields;
|
|
41
|
-
const xField = fields[0];
|
|
42
|
-
const yField = fields[1];
|
|
43
|
-
const colorField = fields[2];
|
|
44
|
-
const xType = this.getDataType(xField);
|
|
45
|
-
const yType = this.getDataType(yField);
|
|
46
|
-
const colorType = colorField ? this.getDataType(colorField) : undefined;
|
|
47
|
-
const mark = { type: this.getMark(), tooltip: true };
|
|
48
|
-
const colorDef = colorField !== undefined
|
|
49
|
-
? {
|
|
50
|
-
field: colorField.name,
|
|
51
|
-
type: colorType,
|
|
52
|
-
axis: { title: null },
|
|
53
|
-
scale: (0, utils_1.getColorScale)(colorType, true),
|
|
54
|
-
}
|
|
55
|
-
: { value: '#4285F4' };
|
|
56
|
-
const xSort = xType === 'nominal' ? null : undefined;
|
|
57
|
-
const ySort = yType === 'nominal' ? null : undefined;
|
|
58
|
-
const xDef = {
|
|
59
|
-
field: xField.name,
|
|
60
|
-
type: xType,
|
|
61
|
-
sort: xSort,
|
|
62
|
-
axis: {
|
|
63
|
-
title: null,
|
|
64
|
-
domain: false,
|
|
65
|
-
grid: false,
|
|
66
|
-
ticks: false,
|
|
67
|
-
values: [],
|
|
68
|
-
},
|
|
69
|
-
scale: { zero: false },
|
|
70
|
-
};
|
|
71
|
-
const yDef = {
|
|
72
|
-
field: yField.name,
|
|
73
|
-
type: yType,
|
|
74
|
-
sort: ySort,
|
|
75
|
-
axis: {
|
|
76
|
-
title: null,
|
|
77
|
-
domain: false,
|
|
78
|
-
ticks: false,
|
|
79
|
-
grid: false,
|
|
80
|
-
values: [],
|
|
81
|
-
},
|
|
82
|
-
scale: { zero: false },
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
...vega_spec_1.DEFAULT_SPEC,
|
|
86
|
-
...this.getSize(),
|
|
87
|
-
data: {
|
|
88
|
-
values: this.mapData(data),
|
|
89
|
-
},
|
|
90
|
-
config: {
|
|
91
|
-
view: {
|
|
92
|
-
stroke: 'transparent',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
mark,
|
|
96
|
-
encoding: {
|
|
97
|
-
y: xDef,
|
|
98
|
-
x: yDef,
|
|
99
|
-
color: colorDef,
|
|
100
|
-
},
|
|
101
|
-
background: 'transparent',
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.HTMLBarSparkLineRenderer = HTMLBarSparkLineRenderer;
|
|
106
|
-
class BarSparkLineRendererFactory extends renderer_factory_1.RendererFactory {
|
|
107
|
-
isValidMatch(field) {
|
|
108
|
-
return field.name.endsWith('_bar');
|
|
109
|
-
}
|
|
110
|
-
create(document, styleDefaults, rendererOptions, _field, options, timezone) {
|
|
111
|
-
return new HTMLBarSparkLineRenderer(document, styleDefaults, rendererOptions, options, timezone);
|
|
112
|
-
}
|
|
113
|
-
get rendererName() {
|
|
114
|
-
return 'sparkline';
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.BarSparkLineRendererFactory = BarSparkLineRendererFactory;
|
|
118
|
-
BarSparkLineRendererFactory.instance = new BarSparkLineRendererFactory();
|
|
119
|
-
//# sourceMappingURL=bar_sparkline.js.map
|
package/dist/html/boolean.js
DELETED
|
@@ -1,53 +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.BooleanRendererFactory = exports.HTMLBooleanRenderer = void 0;
|
|
26
|
-
const malloy_1 = require("@malloydata/malloy");
|
|
27
|
-
const text_1 = require("./text");
|
|
28
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
29
|
-
class HTMLBooleanRenderer extends text_1.HTMLTextRenderer {
|
|
30
|
-
getText(data) {
|
|
31
|
-
if (data.isNull()) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return `${data.boolean.value}`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.HTMLBooleanRenderer = HTMLBooleanRenderer;
|
|
38
|
-
class BooleanRendererFactory extends renderer_factory_1.RendererFactory {
|
|
39
|
-
activates(field) {
|
|
40
|
-
return (field.hasParentExplore() &&
|
|
41
|
-
field.isAtomicField() &&
|
|
42
|
-
field.type === malloy_1.AtomicFieldType.Boolean);
|
|
43
|
-
}
|
|
44
|
-
create(document, _styleDefaults, _rendererOptions, _field, _options) {
|
|
45
|
-
return new HTMLBooleanRenderer(document);
|
|
46
|
-
}
|
|
47
|
-
get rendererName() {
|
|
48
|
-
return 'boolean';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.BooleanRendererFactory = BooleanRendererFactory;
|
|
52
|
-
BooleanRendererFactory.instance = new BooleanRendererFactory();
|
|
53
|
-
//# sourceMappingURL=boolean.js.map
|
package/dist/html/bytes.js
DELETED
|
@@ -1,47 +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.BytesRendererFactory = exports.HTMLBytesRenderer = void 0;
|
|
26
|
-
const text_1 = require("./text");
|
|
27
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
28
|
-
class HTMLBytesRenderer extends text_1.HTMLTextRenderer {
|
|
29
|
-
getText(data) {
|
|
30
|
-
if (data.isNull()) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return data.bytes.value.toString('base64');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.HTMLBytesRenderer = HTMLBytesRenderer;
|
|
37
|
-
class BytesRendererFactory extends renderer_factory_1.RendererFactory {
|
|
38
|
-
create(document, _styleDefaults, _rendererOptions, _field, _options) {
|
|
39
|
-
return new HTMLBytesRenderer(document);
|
|
40
|
-
}
|
|
41
|
-
get rendererName() {
|
|
42
|
-
return 'bytes';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.BytesRendererFactory = BytesRendererFactory;
|
|
46
|
-
BytesRendererFactory.instance = new BytesRendererFactory();
|
|
47
|
-
//# sourceMappingURL=bytes.js.map
|
|
@@ -1,110 +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.HTMLCartesianChartRenderer = void 0;
|
|
26
|
-
const chart_1 = require("./chart");
|
|
27
|
-
const utils_1 = require("./utils");
|
|
28
|
-
const vega_spec_1 = require("./vega_spec");
|
|
29
|
-
class HTMLCartesianChartRenderer extends chart_1.HTMLChartRenderer {
|
|
30
|
-
getVegaLiteSpec(data) {
|
|
31
|
-
const fields = data.field.intrinsicFields;
|
|
32
|
-
const xField = fields[0];
|
|
33
|
-
const yField = fields[1];
|
|
34
|
-
const colorField = fields[2];
|
|
35
|
-
const sizeField = fields[3];
|
|
36
|
-
const shapeField = fields[4];
|
|
37
|
-
const xType = this.getDataType(xField);
|
|
38
|
-
const yType = this.getDataType(yField);
|
|
39
|
-
const colorType = colorField ? this.getDataType(colorField) : undefined;
|
|
40
|
-
const sizeType = sizeField ? this.getDataType(sizeField) : undefined;
|
|
41
|
-
const shapeType = shapeField ? this.getDataType(shapeField) : undefined;
|
|
42
|
-
const mark = this.getMark();
|
|
43
|
-
const colorDef = colorField !== undefined
|
|
44
|
-
? {
|
|
45
|
-
field: colorField.name,
|
|
46
|
-
type: colorType,
|
|
47
|
-
axis: {
|
|
48
|
-
title: (0, utils_1.formatTitle)(this.options, colorField, undefined, this.timezone),
|
|
49
|
-
},
|
|
50
|
-
scale: (0, utils_1.getColorScale)(colorType, mark === 'bar'),
|
|
51
|
-
}
|
|
52
|
-
: { value: '#4285F4' };
|
|
53
|
-
const sizeDef = sizeField
|
|
54
|
-
? {
|
|
55
|
-
field: sizeField.name,
|
|
56
|
-
type: sizeType,
|
|
57
|
-
axis: {
|
|
58
|
-
title: (0, utils_1.formatTitle)(this.options, sizeField, undefined, this.timezone),
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
: undefined;
|
|
62
|
-
const shapeDef = shapeField
|
|
63
|
-
? {
|
|
64
|
-
field: shapeField.name,
|
|
65
|
-
type: shapeType,
|
|
66
|
-
axis: {
|
|
67
|
-
title: (0, utils_1.formatTitle)(this.options, shapeField, undefined, this.timezone),
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
: undefined;
|
|
71
|
-
const xSort = xType === 'nominal' ? null : undefined;
|
|
72
|
-
const ySort = yType === 'nominal' ? null : undefined;
|
|
73
|
-
const xDef = {
|
|
74
|
-
field: xField.name,
|
|
75
|
-
type: xType,
|
|
76
|
-
sort: xSort,
|
|
77
|
-
axis: {
|
|
78
|
-
title: (0, utils_1.formatTitle)(this.options, xField, undefined, this.timezone),
|
|
79
|
-
},
|
|
80
|
-
scale: { zero: false },
|
|
81
|
-
};
|
|
82
|
-
const yDef = {
|
|
83
|
-
field: yField.name,
|
|
84
|
-
type: yType,
|
|
85
|
-
sort: ySort,
|
|
86
|
-
axis: {
|
|
87
|
-
title: (0, utils_1.formatTitle)(this.options, yField, undefined, this.timezone),
|
|
88
|
-
},
|
|
89
|
-
scale: { zero: false },
|
|
90
|
-
};
|
|
91
|
-
return {
|
|
92
|
-
...vega_spec_1.DEFAULT_SPEC,
|
|
93
|
-
...this.getSize(),
|
|
94
|
-
data: {
|
|
95
|
-
values: this.mapData(data),
|
|
96
|
-
},
|
|
97
|
-
mark,
|
|
98
|
-
encoding: {
|
|
99
|
-
x: xDef,
|
|
100
|
-
y: yDef,
|
|
101
|
-
size: sizeDef,
|
|
102
|
-
color: colorDef,
|
|
103
|
-
shape: shapeDef,
|
|
104
|
-
},
|
|
105
|
-
background: 'transparent',
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
exports.HTMLCartesianChartRenderer = HTMLCartesianChartRenderer;
|
|
110
|
-
//# sourceMappingURL=cartesian_chart.js.map
|
package/dist/html/chart.js
DELETED
|
@@ -1,120 +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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
27
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
28
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
29
|
-
}
|
|
30
|
-
Object.defineProperty(o, k2, desc);
|
|
31
|
-
}) : (function(o, m, k, k2) {
|
|
32
|
-
if (k2 === undefined) k2 = k;
|
|
33
|
-
o[k2] = m[k];
|
|
34
|
-
}));
|
|
35
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
36
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
37
|
-
}) : function(o, v) {
|
|
38
|
-
o["default"] = v;
|
|
39
|
-
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
41
|
-
if (mod && mod.__esModule) return mod;
|
|
42
|
-
var result = {};
|
|
43
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
44
|
-
__setModuleDefault(result, mod);
|
|
45
|
-
return result;
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.HTMLChartRenderer = void 0;
|
|
49
|
-
const lite = __importStar(require("vega-lite"));
|
|
50
|
-
const vega = __importStar(require("vega"));
|
|
51
|
-
const utils_1 = require("../html/utils");
|
|
52
|
-
class HTMLChartRenderer {
|
|
53
|
-
mapData(data) {
|
|
54
|
-
const mappedRows = [];
|
|
55
|
-
for (const row of data) {
|
|
56
|
-
const mappedRow = {};
|
|
57
|
-
for (const field of data.field.intrinsicFields) {
|
|
58
|
-
let dataValue = this.getDataValue(row.cell(field));
|
|
59
|
-
if (dataValue instanceof Date) {
|
|
60
|
-
dataValue = (0, utils_1.normalizeToTimezone)(dataValue, this.timezone);
|
|
61
|
-
}
|
|
62
|
-
mappedRow[field.name] = dataValue;
|
|
63
|
-
}
|
|
64
|
-
mappedRows.push(mappedRow);
|
|
65
|
-
}
|
|
66
|
-
return mappedRows;
|
|
67
|
-
}
|
|
68
|
-
getSize() {
|
|
69
|
-
if (this.size === 'large') {
|
|
70
|
-
return { height: 350, width: 500 };
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
return { height: 175, width: 250 };
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
constructor(document, styleDefaults, options, chartOptions = {}, timezone) {
|
|
77
|
-
this.document = document;
|
|
78
|
-
this.styleDefaults = styleDefaults;
|
|
79
|
-
this.options = options;
|
|
80
|
-
this.timezone = timezone;
|
|
81
|
-
this.size = chartOptions.size || this.styleDefaults.size || 'medium';
|
|
82
|
-
}
|
|
83
|
-
async render(table) {
|
|
84
|
-
if (!table.isArray()) {
|
|
85
|
-
throw new Error('Invalid type for chart renderer');
|
|
86
|
-
}
|
|
87
|
-
const spec = this.getVegaLiteSpec(table);
|
|
88
|
-
const vegaspec = lite.compile(spec, {
|
|
89
|
-
logger: {
|
|
90
|
-
level(newLevel) {
|
|
91
|
-
if (newLevel !== undefined) {
|
|
92
|
-
return this;
|
|
93
|
-
}
|
|
94
|
-
return 0;
|
|
95
|
-
},
|
|
96
|
-
info() {
|
|
97
|
-
return this;
|
|
98
|
-
},
|
|
99
|
-
error() {
|
|
100
|
-
return this;
|
|
101
|
-
},
|
|
102
|
-
warn() {
|
|
103
|
-
return this;
|
|
104
|
-
},
|
|
105
|
-
debug() {
|
|
106
|
-
return this;
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
}).spec;
|
|
110
|
-
const view = new vega.View(vega.parse(vegaspec), {
|
|
111
|
-
renderer: 'none',
|
|
112
|
-
});
|
|
113
|
-
view.logger().level(-1);
|
|
114
|
-
const element = this.document.createElement('div');
|
|
115
|
-
element.innerHTML = await view.toSVG();
|
|
116
|
-
return element;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.HTMLChartRenderer = HTMLChartRenderer;
|
|
120
|
-
//# sourceMappingURL=chart.js.map
|
|
@@ -1,120 +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.ColumnSparkLineRendererFactory = exports.HTMLColumnSparkLineRenderer = void 0;
|
|
26
|
-
const utils_1 = require("./utils");
|
|
27
|
-
const vega_spec_1 = require("./vega_spec");
|
|
28
|
-
const bar_chart_1 = require("./bar_chart");
|
|
29
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
30
|
-
class HTMLColumnSparkLineRenderer extends bar_chart_1.HTMLBarChartRenderer {
|
|
31
|
-
getSize() {
|
|
32
|
-
if (this.size === 'large') {
|
|
33
|
-
return { height: 100, width: 250 };
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return { height: 50, width: 125 };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
getVegaLiteSpec(data) {
|
|
40
|
-
const fields = data.field.intrinsicFields;
|
|
41
|
-
const xField = fields[0];
|
|
42
|
-
const yField = fields[1];
|
|
43
|
-
const colorField = fields[2];
|
|
44
|
-
const xType = this.getDataType(xField);
|
|
45
|
-
const yType = this.getDataType(yField);
|
|
46
|
-
const colorType = colorField ? this.getDataType(colorField) : undefined;
|
|
47
|
-
// const mark = this.getMark();
|
|
48
|
-
const mark = { type: this.getMark(), tooltip: true };
|
|
49
|
-
const colorDef = colorField !== undefined
|
|
50
|
-
? {
|
|
51
|
-
field: colorField.name,
|
|
52
|
-
type: colorType,
|
|
53
|
-
axis: { title: null },
|
|
54
|
-
scale: (0, utils_1.getColorScale)(colorType, true),
|
|
55
|
-
}
|
|
56
|
-
: { value: '#4285F4' };
|
|
57
|
-
const xSort = xType === 'nominal' ? null : undefined;
|
|
58
|
-
const ySort = yType === 'nominal' ? null : undefined;
|
|
59
|
-
const xDef = {
|
|
60
|
-
field: xField.name,
|
|
61
|
-
type: xType,
|
|
62
|
-
sort: xSort,
|
|
63
|
-
axis: {
|
|
64
|
-
title: null,
|
|
65
|
-
domain: false,
|
|
66
|
-
grid: false,
|
|
67
|
-
ticks: false,
|
|
68
|
-
values: [],
|
|
69
|
-
},
|
|
70
|
-
scale: { zero: false },
|
|
71
|
-
};
|
|
72
|
-
const yDef = {
|
|
73
|
-
field: yField.name,
|
|
74
|
-
type: yType,
|
|
75
|
-
sort: ySort,
|
|
76
|
-
axis: {
|
|
77
|
-
title: null,
|
|
78
|
-
domain: false,
|
|
79
|
-
ticks: false,
|
|
80
|
-
grid: false,
|
|
81
|
-
values: [],
|
|
82
|
-
},
|
|
83
|
-
scale: { zero: false },
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
...vega_spec_1.DEFAULT_SPEC,
|
|
87
|
-
...this.getSize(),
|
|
88
|
-
data: {
|
|
89
|
-
values: this.mapData(data),
|
|
90
|
-
},
|
|
91
|
-
config: {
|
|
92
|
-
view: {
|
|
93
|
-
stroke: 'transparent',
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
mark,
|
|
97
|
-
encoding: {
|
|
98
|
-
x: xDef,
|
|
99
|
-
y: yDef,
|
|
100
|
-
color: colorDef,
|
|
101
|
-
},
|
|
102
|
-
background: 'transparent',
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.HTMLColumnSparkLineRenderer = HTMLColumnSparkLineRenderer;
|
|
107
|
-
class ColumnSparkLineRendererFactory extends renderer_factory_1.RendererFactory {
|
|
108
|
-
isValidMatch(field) {
|
|
109
|
-
return field.name.endsWith('_column');
|
|
110
|
-
}
|
|
111
|
-
create(document, styleDefaults, rendererOptions, _field, options, timezone) {
|
|
112
|
-
return new HTMLColumnSparkLineRenderer(document, styleDefaults, rendererOptions, options, timezone);
|
|
113
|
-
}
|
|
114
|
-
get rendererName() {
|
|
115
|
-
return 'sparkline';
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.ColumnSparkLineRendererFactory = ColumnSparkLineRendererFactory;
|
|
119
|
-
ColumnSparkLineRendererFactory.instance = new ColumnSparkLineRendererFactory();
|
|
120
|
-
//# sourceMappingURL=column_sparkline.js.map
|
package/dist/html/container.js
DELETED
|
@@ -1,44 +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.ContainerRenderer = void 0;
|
|
26
|
-
const renderer_1 = require("../renderer");
|
|
27
|
-
class ContainerRenderer extends renderer_1.RenderTree {
|
|
28
|
-
constructor() {
|
|
29
|
-
super(...arguments);
|
|
30
|
-
this.childRenderers = {};
|
|
31
|
-
}
|
|
32
|
-
get defaultStylesForChildren() {
|
|
33
|
-
return this.childrenStyleDefaults;
|
|
34
|
-
}
|
|
35
|
-
// We can't use a normal constructor here because we need
|
|
36
|
-
// we need to be fully constructed before we construct
|
|
37
|
-
// our children.
|
|
38
|
-
static make(c, document, exploreField, options, tagged) {
|
|
39
|
-
const n = new c(document, options, tagged);
|
|
40
|
-
return n;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.ContainerRenderer = ContainerRenderer;
|
|
44
|
-
//# sourceMappingURL=container.js.map
|
package/dist/html/currency.js
DELETED
|
@@ -1,75 +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.CurrencyRendererFactory = exports.HTMLCurrencyRenderer = void 0;
|
|
26
|
-
const text_1 = require("./text");
|
|
27
|
-
const renderer_factory_1 = require("../renderer_factory");
|
|
28
|
-
const data_styles_1 = require("../data_styles");
|
|
29
|
-
class HTMLCurrencyRenderer extends text_1.HTMLTextRenderer {
|
|
30
|
-
constructor(document, options) {
|
|
31
|
-
super(document);
|
|
32
|
-
this.options = options;
|
|
33
|
-
}
|
|
34
|
-
getText(data) {
|
|
35
|
-
if (data.isNull()) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
let unitText = '$';
|
|
39
|
-
switch (this.options.currency) {
|
|
40
|
-
case data_styles_1.Currency.Euros:
|
|
41
|
-
unitText = '€';
|
|
42
|
-
break;
|
|
43
|
-
case data_styles_1.Currency.Pounds:
|
|
44
|
-
unitText = '£';
|
|
45
|
-
break;
|
|
46
|
-
case data_styles_1.Currency.Dollars:
|
|
47
|
-
// Do nothing.
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
const numText = data.number.value.toLocaleString('en-US', {
|
|
51
|
-
minimumFractionDigits: 2,
|
|
52
|
-
maximumFractionDigits: 2,
|
|
53
|
-
});
|
|
54
|
-
return `${unitText}${numText}`;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.HTMLCurrencyRenderer = HTMLCurrencyRenderer;
|
|
58
|
-
class CurrencyRendererFactory extends renderer_factory_1.RendererFactory {
|
|
59
|
-
constructor() {
|
|
60
|
-
super();
|
|
61
|
-
this.addExtractor((options, tag) => {
|
|
62
|
-
var _a;
|
|
63
|
-
options.currency = (_a = tag === null || tag === void 0 ? void 0 : tag.text()) !== null && _a !== void 0 ? _a : data_styles_1.Currency.Dollars;
|
|
64
|
-
}, this.rendererName);
|
|
65
|
-
}
|
|
66
|
-
create(document, _styleDefaults, _rendererOptions, _field, options) {
|
|
67
|
-
return new HTMLCurrencyRenderer(document, options);
|
|
68
|
-
}
|
|
69
|
-
get rendererName() {
|
|
70
|
-
return 'currency';
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.CurrencyRendererFactory = CurrencyRendererFactory;
|
|
74
|
-
CurrencyRendererFactory.instance = new CurrencyRendererFactory();
|
|
75
|
-
//# sourceMappingURL=currency.js.map
|