@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.
Files changed (86) hide show
  1. package/dist/component/render-webcomponent.d.ts +6 -0
  2. package/dist/component/render.d.ts +7 -17
  3. package/dist/component/result-context.d.ts +2 -3
  4. package/dist/component/table/table-context.d.ts +9 -0
  5. package/dist/component/{table-layout.d.ts → table/table-layout.d.ts} +2 -2
  6. package/dist/component/table/table.d.ts +9 -0
  7. package/dist/html/html_view.d.ts +1 -1
  8. package/dist/module/index.mjs +145001 -0
  9. package/dist/module/index.umd.js +1643 -0
  10. package/dist/module/style.css +1 -0
  11. package/dist/stories/bars.stories.d.ts +1 -1
  12. package/dist/stories/tables.stories.d.ts +1 -1
  13. package/dist/stories/themes.stories.d.ts +1 -1
  14. package/dist/webcomponent/malloy-render.mjs +90572 -0
  15. package/dist/webcomponent/malloy-render.umd.js +1491 -0
  16. package/dist/webcomponent/style.css +1 -0
  17. package/package.json +21 -7
  18. package/vite.config.ts +25 -0
  19. package/vite.config.webcomponent.ts +25 -0
  20. package/dist/bundle/bundled_renderer.js +0 -139374
  21. package/dist/bundle/bundled_renderer.min.js +0 -2374
  22. package/dist/bundle/main.js +0 -29
  23. package/dist/bundle/renderer.js +0 -71
  24. package/dist/component/bar-chart.js +0 -130
  25. package/dist/component/chart-settings.js +0 -152
  26. package/dist/component/render-numeric-field.js +0 -104
  27. package/dist/component/render-result-metadata.js +0 -91
  28. package/dist/component/render.js +0 -155
  29. package/dist/component/result-context.js +0 -28
  30. package/dist/component/table-layout.js +0 -83
  31. package/dist/component/table.d.ts +0 -35
  32. package/dist/component/table.js +0 -375
  33. package/dist/component/util.js +0 -53
  34. package/dist/component/vega-chart.js +0 -105
  35. package/dist/component/vega-lite-base-spec.js +0 -61
  36. package/dist/component/vega-types.js +0 -34
  37. package/dist/data_styles.js +0 -50
  38. package/dist/drill.js +0 -124
  39. package/dist/html/area_sparkline.js +0 -118
  40. package/dist/html/bar_chart.js +0 -70
  41. package/dist/html/bar_sparkline.js +0 -119
  42. package/dist/html/boolean.js +0 -53
  43. package/dist/html/bytes.js +0 -47
  44. package/dist/html/cartesian_chart.js +0 -110
  45. package/dist/html/chart.js +0 -120
  46. package/dist/html/column_sparkline.js +0 -120
  47. package/dist/html/container.js +0 -44
  48. package/dist/html/currency.js +0 -75
  49. package/dist/html/dashboard.js +0 -242
  50. package/dist/html/data_volume.js +0 -94
  51. package/dist/html/date.js +0 -66
  52. package/dist/html/duration.js +0 -108
  53. package/dist/html/html_view.js +0 -187
  54. package/dist/html/image.js +0 -77
  55. package/dist/html/index.js +0 -28
  56. package/dist/html/json.js +0 -52
  57. package/dist/html/line_chart.js +0 -72
  58. package/dist/html/link.js +0 -57
  59. package/dist/html/list.js +0 -73
  60. package/dist/html/list_detail.js +0 -33
  61. package/dist/html/number.js +0 -73
  62. package/dist/html/percent.js +0 -50
  63. package/dist/html/point_map.js +0 -182
  64. package/dist/html/scatter_chart.js +0 -72
  65. package/dist/html/segment_map.js +0 -151
  66. package/dist/html/shape_map.js +0 -194
  67. package/dist/html/sparkline.js +0 -120
  68. package/dist/html/state_codes.js +0 -137
  69. package/dist/html/table.js +0 -475
  70. package/dist/html/text.js +0 -65
  71. package/dist/html/unsupported.js +0 -72
  72. package/dist/html/utils.js +0 -277
  73. package/dist/html/vega_spec.js +0 -544
  74. package/dist/index.js +0 -47
  75. package/dist/main_renderer_factory.js +0 -101
  76. package/dist/renderer.js +0 -34
  77. package/dist/renderer_factory.js +0 -57
  78. package/dist/renderer_types.js +0 -25
  79. package/dist/stories/bars.stories.js +0 -52
  80. package/dist/stories/basic.stories.js +0 -34
  81. package/dist/stories/image.stories.js +0 -34
  82. package/dist/stories/render-malloy-legacy.js +0 -27
  83. package/dist/stories/tables.stories.js +0 -65
  84. package/dist/stories/themes.stories.js +0 -47
  85. package/dist/stories/util.js +0 -25
  86. package/dist/tags_utils.js +0 -30
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFieldKey = exports.shouldRenderAs = exports.clamp = exports.getTextWidth = exports.valueIsString = exports.valueIsNumber = exports.isFirstChild = exports.isLastChild = void 0;
4
- function getLocationInParent(f) {
5
- var _a;
6
- const parent = f.parentExplore;
7
- return (_a = parent === null || parent === void 0 ? void 0 : parent.allFields.findIndex(pf => pf.name === f.name)) !== null && _a !== void 0 ? _a : -1;
8
- }
9
- function isLastChild(f) {
10
- if (f.parentExplore)
11
- return getLocationInParent(f) === f.parentExplore.allFields.length - 1;
12
- return true;
13
- }
14
- exports.isLastChild = isLastChild;
15
- function isFirstChild(f) {
16
- return getLocationInParent(f) === 0;
17
- }
18
- exports.isFirstChild = isFirstChild;
19
- function valueIsNumber(f, v) {
20
- return f.isAtomicField() && f.isNumber() && v !== null;
21
- }
22
- exports.valueIsNumber = valueIsNumber;
23
- function valueIsString(f, s) {
24
- return f.isAtomicField() && f.isString() && s !== null;
25
- }
26
- exports.valueIsString = valueIsString;
27
- function getTextWidth(text, font, canvasToUse) {
28
- const canvas = canvasToUse !== null && canvasToUse !== void 0 ? canvasToUse : document.createElement('canvas');
29
- const context = canvas.getContext('2d');
30
- context.font = font;
31
- const metrics = context.measureText(text);
32
- return metrics.width;
33
- }
34
- exports.getTextWidth = getTextWidth;
35
- function clamp(s, e, v) {
36
- return Math.max(s, Math.min(e, v));
37
- }
38
- exports.clamp = clamp;
39
- function shouldRenderAs(f) {
40
- if (f.isAtomicField())
41
- return 'cell';
42
- const { tag } = f.tagParse();
43
- if (tag.has('bar'))
44
- return 'bar-chart';
45
- else
46
- return 'table';
47
- }
48
- exports.shouldRenderAs = shouldRenderAs;
49
- function getFieldKey(f) {
50
- return JSON.stringify(f.fieldPath);
51
- }
52
- exports.getFieldKey = getFieldKey;
53
- //# sourceMappingURL=util.js.map
@@ -1,105 +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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
25
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
27
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
28
- return c > 3 && r && Object.defineProperty(target, key, r), r;
29
- };
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.VegaChart = void 0;
32
- const lit_1 = require("lit");
33
- const decorators_js_1 = require("lit/decorators.js");
34
- const vega_1 = require("vega");
35
- const vega_lite_1 = require("vega-lite");
36
- const vega_types_1 = require("./vega-types");
37
- let VegaChart = class VegaChart extends lit_1.LitElement {
38
- constructor() {
39
- super(...arguments);
40
- this.type = 'vega';
41
- this.el = null;
42
- this.view = null;
43
- }
44
- setupView() {
45
- if (this.view)
46
- this.view.finalize();
47
- const vegaspec = this.type === 'vega-lite'
48
- ? (0, vega_lite_1.compile)((0, vega_types_1.asVegaLiteSpec)(this.spec)).spec
49
- : (0, vega_types_1.asVegaSpec)(this.spec);
50
- this.view = new vega_1.View((0, vega_1.parse)(vegaspec))
51
- .initialize(this.el)
52
- .renderer('svg')
53
- .hover();
54
- if (this.width)
55
- this.view.width(this.width);
56
- if (this.height)
57
- this.view.height(this.height);
58
- this.view.run();
59
- }
60
- firstUpdated() {
61
- this.el = this.shadowRoot.getElementById('vis');
62
- this.setupView();
63
- }
64
- willUpdate(changedProperties) {
65
- if (changedProperties.has('spec') || changedProperties.has('type')) {
66
- if (this.el)
67
- this.setupView();
68
- }
69
- else {
70
- if ((changedProperties.has('width') || changedProperties.has('height')) &&
71
- this.view) {
72
- if (this.width)
73
- this.view.width(this.width);
74
- if (this.height)
75
- this.view.height(this.height);
76
- this.view.run();
77
- }
78
- }
79
- }
80
- render() {
81
- return (0, lit_1.html) ` <div id="vis"></div> `;
82
- }
83
- };
84
- exports.VegaChart = VegaChart;
85
- VegaChart.styles = (0, lit_1.css) `
86
- #vis > svg {
87
- display: block;
88
- }
89
- `;
90
- __decorate([
91
- (0, decorators_js_1.property)({ attribute: false })
92
- ], VegaChart.prototype, "spec", void 0);
93
- __decorate([
94
- (0, decorators_js_1.property)({ type: String })
95
- ], VegaChart.prototype, "type", void 0);
96
- __decorate([
97
- (0, decorators_js_1.property)({ type: Number })
98
- ], VegaChart.prototype, "width", void 0);
99
- __decorate([
100
- (0, decorators_js_1.property)({ type: Number })
101
- ], VegaChart.prototype, "height", void 0);
102
- exports.VegaChart = VegaChart = __decorate([
103
- (0, decorators_js_1.customElement)('malloy-vega-chart')
104
- ], VegaChart);
105
- //# sourceMappingURL=vega-chart.js.map
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseSpec = void 0;
4
- const grayMedium = '#727883';
5
- const gridGray = '#E5E7EB';
6
- const baseSpec = () => ({
7
- $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
8
- config: {
9
- axisY: {
10
- gridColor: gridGray,
11
- tickColor: gridGray,
12
- domain: false,
13
- labelFont: 'Inter, sans-serif',
14
- labelFontSize: 10,
15
- labelFontWeight: 'normal',
16
- labelColor: grayMedium,
17
- labelPadding: 5,
18
- titleColor: grayMedium,
19
- titleFont: 'Inter, sans-serif',
20
- titleFontSize: 12,
21
- titleFontWeight: 'bold',
22
- titlePadding: 10,
23
- labelOverlap: false,
24
- },
25
- axisX: {
26
- gridColor: gridGray,
27
- tickColor: gridGray,
28
- tickSize: 0,
29
- domain: false,
30
- labelFont: 'Inter, sans-serif',
31
- labelFontSize: 10,
32
- labelFontWeight: 'normal',
33
- labelPadding: 5,
34
- labelColor: grayMedium,
35
- titleColor: grayMedium,
36
- titleFont: 'Inter, sans-serif',
37
- titleFontSize: 12,
38
- titleFontWeight: 'bold',
39
- titlePadding: 10,
40
- },
41
- view: {
42
- strokeWidth: 0,
43
- },
44
- },
45
- params: [],
46
- padding: 0,
47
- autosize: {
48
- type: 'none',
49
- resize: true,
50
- contains: 'content',
51
- },
52
- // for vega-lite, if width/height is not specificed in spec it will try to autosize. Set values to prevent
53
- width: 1,
54
- height: 1,
55
- data: {
56
- values: [],
57
- },
58
- layer: [],
59
- });
60
- exports.baseSpec = baseSpec;
61
- //# sourceMappingURL=vega-lite-base-spec.js.map
@@ -1,34 +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.asVegaLiteSpec = exports.asVegaSpec = void 0;
26
- function asVegaSpec(v) {
27
- return v;
28
- }
29
- exports.asVegaSpec = asVegaSpec;
30
- function asVegaLiteSpec(v) {
31
- return v;
32
- }
33
- exports.asVegaLiteSpec = asVegaLiteSpec;
34
- //# sourceMappingURL=vega-types.js.map
@@ -1,50 +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.DurationUnit = exports.DataVolumeUnit = exports.Currency = void 0;
26
- var Currency;
27
- (function (Currency) {
28
- Currency["Dollars"] = "usd";
29
- Currency["Euros"] = "euro";
30
- Currency["Pounds"] = "pound";
31
- })(Currency || (exports.Currency = Currency = {}));
32
- var DataVolumeUnit;
33
- (function (DataVolumeUnit) {
34
- DataVolumeUnit["Bytes"] = "bytes";
35
- DataVolumeUnit["Kilobytes"] = "kb";
36
- DataVolumeUnit["Megabytes"] = "mb";
37
- DataVolumeUnit["Gigabytes"] = "gb";
38
- DataVolumeUnit["Terabytes"] = "tb";
39
- })(DataVolumeUnit || (exports.DataVolumeUnit = DataVolumeUnit = {}));
40
- var DurationUnit;
41
- (function (DurationUnit) {
42
- DurationUnit["Nanoseconds"] = "nanoseconds";
43
- DurationUnit["Microseconds"] = "microseconds";
44
- DurationUnit["Milliseconds"] = "milliseconds";
45
- DurationUnit["Seconds"] = "seconds";
46
- DurationUnit["Minutes"] = "minutes";
47
- DurationUnit["Hours"] = "hours";
48
- DurationUnit["Days"] = "days";
49
- })(DurationUnit || (exports.DurationUnit = DurationUnit = {}));
50
- //# sourceMappingURL=data_styles.js.map
package/dist/drill.js DELETED
@@ -1,124 +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.getDrillQuery = exports.getDrillFilters = void 0;
26
- const malloy_1 = require("@malloydata/malloy");
27
- const utils_1 = require("./html/utils");
28
- function filterQuote(s) {
29
- return `'${s.replace(/(['\\])/g, '\\$1')}'`;
30
- }
31
- function timestampToDateFilter(key, value, timeframe) {
32
- const adjustedTimeframe = timeframe === malloy_1.TimestampTimeframe.Minute
33
- ? malloy_1.TimestampTimeframe.Second
34
- : timeframe || malloy_1.TimestampTimeframe.Second;
35
- const filterValue = '@' + (0, utils_1.timeToString)(value, adjustedTimeframe);
36
- return { key, value: filterValue };
37
- }
38
- function getTableFilters(table) {
39
- const filters = [];
40
- for (const f of table.field.filters || []) {
41
- if (f.expressionType === 'scalar') {
42
- filters.push({ key: f.code, value: undefined });
43
- }
44
- }
45
- return filters;
46
- }
47
- function getRowFilters(row) {
48
- const filters = [];
49
- const dimensions = row.field.intrinsicFields.filter(field => field.isAtomicField() && field.sourceWasDimension());
50
- for (const dim of dimensions) {
51
- const cell = row.cell(dim);
52
- // if we have an expression, use it instead of the name of the field.
53
- let key = dim.isAtomicField() || dim.isQueryField() ? dim.expression : undefined;
54
- // Multi word column names.
55
- if (key !== undefined && key.includes(' ') && key === dim.name) {
56
- key = '`' + key + '`';
57
- }
58
- if (key && !cell.isArray()) {
59
- if (cell.isNull()) {
60
- filters.push({ key, value: 'null' });
61
- }
62
- else if (cell.isString()) {
63
- filters.push({ key, value: filterQuote(cell.value) });
64
- }
65
- else if (cell.isNumber() || cell.isBoolean()) {
66
- filters.push({ key, value: cell.value.toString() });
67
- }
68
- else if (cell.isTimestamp() || cell.isDate()) {
69
- let timeframe = cell.field.timeframe;
70
- // Dont let the timeframe for Date go down to seconds.
71
- if (cell.isDate() && timeframe === undefined) {
72
- timeframe = malloy_1.DateTimeframe.Day;
73
- }
74
- filters.push(timestampToDateFilter(key, cell.value, timeframe));
75
- }
76
- }
77
- }
78
- return filters;
79
- }
80
- function getFilters(data) {
81
- if (data.isRecord()) {
82
- return getRowFilters(data);
83
- }
84
- else {
85
- return getTableFilters(data);
86
- }
87
- }
88
- function getDrillFilters(data) {
89
- const filters = [];
90
- let current = data;
91
- while (current.parent) {
92
- filters.push(...getFilters(current));
93
- current = current.parent;
94
- }
95
- filters.push(...getFilters(current));
96
- const source = current.field.parentExplore;
97
- const formattedFilters = [];
98
- for (const { key, value } of filters) {
99
- if (value !== undefined) {
100
- formattedFilters.push(`${key} = ${value}`);
101
- }
102
- else {
103
- formattedFilters.push(key);
104
- }
105
- }
106
- // TODO HACK: some filters get duplicated by the language, and this
107
- // is a workaround until that is fixed
108
- const dedupedFilters = formattedFilters.filter((filter, index) => formattedFilters.find((otherFilter, otherIndex) => otherFilter === filter && index < otherIndex) === undefined);
109
- return { formattedFilters: dedupedFilters, source };
110
- }
111
- exports.getDrillFilters = getDrillFilters;
112
- function getDrillQuery(data) {
113
- const { formattedFilters, source } = getDrillFilters(data);
114
- let ret = `run: ${(source === null || source === void 0 ? void 0 : source.name) || '"unable to compute source"'} -> `;
115
- if (formattedFilters.length) {
116
- ret += `{ \n where: \n ${formattedFilters.join(',\n ')} \n} + {select: *}\n`;
117
- }
118
- else {
119
- ret += '{select: *}';
120
- }
121
- return { drillQuery: ret, drillFilters: formattedFilters };
122
- }
123
- exports.getDrillQuery = getDrillQuery;
124
- //# sourceMappingURL=drill.js.map
@@ -1,118 +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.AreaSparkLineRendererFactory = exports.HTMLAreaSparkLineRenderer = void 0;
26
- const sparkline_1 = require("./sparkline");
27
- const utils_1 = require("./utils");
28
- const vega_spec_1 = require("./vega_spec");
29
- const renderer_factory_1 = require("../renderer_factory");
30
- class HTMLAreaSparkLineRenderer extends sparkline_1.HTMLSparkLineRenderer {
31
- getVegaLiteSpec(data) {
32
- const fields = data.field.intrinsicFields;
33
- const xField = fields[0];
34
- const yField = fields[1];
35
- const colorField = fields[2];
36
- const xType = this.getDataType(xField);
37
- const yType = this.getDataType(yField);
38
- const colorType = colorField ? this.getDataType(colorField) : undefined;
39
- const colorDef = colorField !== undefined
40
- ? {
41
- field: colorField.name,
42
- type: colorType,
43
- axis: { title: null },
44
- scale: (0, utils_1.getColorScale)(colorType, false),
45
- }
46
- : { value: '#4285F4' };
47
- const xSort = xType === 'nominal' ? null : undefined;
48
- const ySort = yType === 'nominal' ? null : undefined;
49
- const xDef = {
50
- field: xField.name,
51
- type: xType,
52
- sort: xSort,
53
- axis: {
54
- title: null,
55
- domain: false,
56
- grid: false,
57
- lables: false,
58
- ticks: false,
59
- values: [],
60
- },
61
- scale: { zero: false },
62
- };
63
- const yDef = {
64
- field: yField.name,
65
- type: yType,
66
- sort: ySort,
67
- axis: {
68
- title: null,
69
- domain: false,
70
- ticks: false,
71
- grid: false,
72
- lables: false,
73
- values: [],
74
- },
75
- scale: { zero: false },
76
- };
77
- return {
78
- ...vega_spec_1.DEFAULT_SPEC,
79
- ...this.getSize(),
80
- data: {
81
- values: this.mapData(data),
82
- },
83
- config: {
84
- view: {
85
- stroke: 'transparent',
86
- },
87
- },
88
- mark: {
89
- type: 'area',
90
- line: {
91
- color: '#4285F4',
92
- },
93
- point: false,
94
- },
95
- encoding: {
96
- x: xDef,
97
- y: yDef,
98
- color: colorDef,
99
- },
100
- background: 'transparent',
101
- };
102
- }
103
- }
104
- exports.HTMLAreaSparkLineRenderer = HTMLAreaSparkLineRenderer;
105
- class AreaSparkLineRendererFactory extends renderer_factory_1.RendererFactory {
106
- isValidMatch(field) {
107
- return field.name.endsWith('area');
108
- }
109
- create(document, styleDefaults, rendererOptions, _field, options, timezone) {
110
- return new HTMLAreaSparkLineRenderer(document, styleDefaults, rendererOptions, options, timezone);
111
- }
112
- get rendererName() {
113
- return 'sparkline';
114
- }
115
- }
116
- exports.AreaSparkLineRendererFactory = AreaSparkLineRendererFactory;
117
- AreaSparkLineRendererFactory.instance = new AreaSparkLineRendererFactory();
118
- //# sourceMappingURL=area_sparkline.js.map
@@ -1,70 +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.BarChartRendererFactory = exports.HTMLBarChartRenderer = void 0;
26
- const cartesian_chart_1 = require("./cartesian_chart");
27
- const renderer_factory_1 = require("../renderer_factory");
28
- const utils_1 = require("./utils");
29
- class HTMLBarChartRenderer extends cartesian_chart_1.HTMLCartesianChartRenderer {
30
- getMark() {
31
- return 'bar';
32
- }
33
- getDataType(field) {
34
- if (field.isAtomicField()) {
35
- if (field.isDate() || field.isTimestamp() || field.isString()) {
36
- return 'nominal';
37
- }
38
- else if (field.isNumber()) {
39
- return 'quantitative';
40
- }
41
- }
42
- throw new Error('Invalid field type for bar chart.');
43
- }
44
- getDataValue(data) {
45
- if (data.isNull()) {
46
- return null;
47
- }
48
- else if (data.isTimestamp() || data.isDate()) {
49
- return (0, utils_1.timeToString)(data.value, data.field.timeframe, this.timezone);
50
- }
51
- else if (data.isNumber() || data.isString()) {
52
- return data.value;
53
- }
54
- else {
55
- throw new Error('Invalid field type for bar chart.');
56
- }
57
- }
58
- }
59
- exports.HTMLBarChartRenderer = HTMLBarChartRenderer;
60
- class BarChartRendererFactory extends renderer_factory_1.RendererFactory {
61
- create(document, styleDefaults, rendererOptions, _field, options, timezone) {
62
- return new HTMLBarChartRenderer(document, styleDefaults, rendererOptions, options, timezone);
63
- }
64
- get rendererName() {
65
- return 'bar_chart';
66
- }
67
- }
68
- exports.BarChartRendererFactory = BarChartRendererFactory;
69
- BarChartRendererFactory.instance = new BarChartRendererFactory();
70
- //# sourceMappingURL=bar_chart.js.map