@aquera/nile-visualization 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.d.ts +8 -2
- package/dist/src/index.js +3 -0
- package/dist/src/internal/dashboard-adapters.d.ts +13 -0
- package/dist/src/internal/dashboard-adapters.js +123 -0
- package/dist/src/internal/highcharts-provider.js +27 -0
- package/dist/src/internal/types/chart-config.type.d.ts +2 -1
- package/dist/src/internal/types/chart-kpi-config.type.d.ts +5 -21
- package/dist/src/internal/types/chart-map-config.type.d.ts +29 -0
- package/dist/src/internal/types/chart-map-config.type.js +2 -0
- package/dist/src/internal/types/dashboard-config.type.d.ts +8 -0
- package/dist/src/internal/types/dashboard-config.type.js +2 -0
- package/dist/src/internal/types/index.d.ts +2 -1
- package/dist/src/internal/types/primitive-chart-config.type.d.ts +2 -1
- package/dist/src/internal/types/widget-config.type.d.ts +23 -0
- package/dist/src/internal/types/widget-config.type.js +2 -0
- package/dist/src/internal/types/widget-layout.type.d.ts +11 -0
- package/dist/src/internal/types/widget-layout.type.js +2 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.css.js +8 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.d.ts +2 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.js +8 -0
- package/dist/src/nile-chart/index.d.ts +2 -2
- package/dist/src/nile-chart/nile-chart-config.d.ts +121 -29
- package/dist/src/nile-chart/nile-chart.css.js +32 -7
- package/dist/src/nile-chart/nile-chart.d.ts +23 -7
- package/dist/src/nile-chart/nile-chart.js +148 -49
- package/dist/src/nile-dashboard-viewer/index.d.ts +2 -0
- package/dist/src/nile-dashboard-viewer/index.js +2 -0
- package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.css.d.ts +1 -0
- package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.css.js +29 -0
- package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.d.ts +43 -0
- package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.js +84 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +4 -4
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +2 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +6 -0
- package/dist/src/nile-map-chart/index.d.ts +2 -0
- package/dist/src/nile-map-chart/index.js +2 -0
- package/dist/src/nile-map-chart/nile-map-chart.css.d.ts +1 -0
- package/dist/src/nile-map-chart/nile-map-chart.css.js +28 -0
- package/dist/src/nile-map-chart/nile-map-chart.d.ts +74 -0
- package/dist/src/nile-map-chart/nile-map-chart.js +263 -0
- package/dist/src/nile-widget-viewer/index.d.ts +3 -0
- package/dist/src/nile-widget-viewer/index.js +2 -0
- package/dist/src/nile-widget-viewer/nile-widget-viewer.css.d.ts +1 -0
- package/dist/src/nile-widget-viewer/nile-widget-viewer.css.js +20 -0
- package/dist/src/nile-widget-viewer/nile-widget-viewer.d.ts +33 -0
- package/dist/src/nile-widget-viewer/nile-widget-viewer.js +50 -0
- package/package.json +4 -2
|
@@ -13,7 +13,7 @@ export const styles = css `
|
|
|
13
13
|
/* ── Card variant ── */
|
|
14
14
|
|
|
15
15
|
.kpi-card {
|
|
16
|
-
background:
|
|
16
|
+
background: transparent;
|
|
17
17
|
border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
18
18
|
border-radius: var(--nile-radius-radius-3xl, var(--ng-radius-xl));
|
|
19
19
|
box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));
|
|
@@ -79,17 +79,17 @@ export const styles = css `
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.kpi-trend--up {
|
|
82
|
-
background:
|
|
82
|
+
background: none;
|
|
83
83
|
color: var(--nile-colors-success-700, #067647);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.kpi-trend--down {
|
|
87
|
-
background:
|
|
87
|
+
background: none;
|
|
88
88
|
color: var(--nile-colors-error-700, #B42318);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.kpi-trend--neutral {
|
|
92
|
-
background:
|
|
92
|
+
background: none;
|
|
93
93
|
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -24,6 +24,8 @@ export interface ChartKpiSeparatedPayload {
|
|
|
24
24
|
gaugeColor?: string;
|
|
25
25
|
loading?: boolean;
|
|
26
26
|
options?: Highcharts.Options;
|
|
27
|
+
/** Optional min height when embedded in `<nile-chart>` (maps to host `min-height`). */
|
|
28
|
+
height?: string;
|
|
27
29
|
}
|
|
28
30
|
/** Separated `{ chart, aq }` input for `<nile-kpi-chart>`. */
|
|
29
31
|
export interface NileKpiConfigInputType {
|
|
@@ -86,6 +86,12 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
86
86
|
this.loading = c.loading;
|
|
87
87
|
if (c.options !== undefined)
|
|
88
88
|
this.options = c.options;
|
|
89
|
+
if (c.height !== undefined) {
|
|
90
|
+
if (c.height)
|
|
91
|
+
this.style.minHeight = c.height;
|
|
92
|
+
else
|
|
93
|
+
this.style.removeProperty('min-height');
|
|
94
|
+
}
|
|
89
95
|
}
|
|
90
96
|
if (aq) {
|
|
91
97
|
if (aq.chartTitle != null)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([hidden]) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.chart-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
min-height: var(--nile-height-200px, var(--ng-height-200px));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.chart-loading {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
min-height: inherit;
|
|
23
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
24
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
25
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=nile-map-chart.css.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import type Highcharts from 'highcharts';
|
|
3
|
+
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
import type { NileChartConfigInputType } from '../internal/types/index.js';
|
|
5
|
+
export interface MapChartDataPoint {
|
|
6
|
+
/** Highcharts map key matching the map topology (e.g. 'us-ca'). */
|
|
7
|
+
'hc-key'?: string;
|
|
8
|
+
value: number;
|
|
9
|
+
name?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export declare class NileMapChart extends NileElement {
|
|
14
|
+
static styles: CSSResultGroup;
|
|
15
|
+
private _hc;
|
|
16
|
+
private chart;
|
|
17
|
+
private resizeObserver;
|
|
18
|
+
private chartContainer;
|
|
19
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
20
|
+
config: NileChartConfigInputType | null;
|
|
21
|
+
/** The chart title displayed above the chart. */
|
|
22
|
+
chartTitle: string;
|
|
23
|
+
/** The subtitle displayed below the title. */
|
|
24
|
+
chartSubtitle: string;
|
|
25
|
+
/**
|
|
26
|
+
* Array of data points. Each point should have a value and a key matching the
|
|
27
|
+
* map topology (e.g. `{ 'hc-key': 'us-ca', value: 42 }`).
|
|
28
|
+
*/
|
|
29
|
+
data: MapChartDataPoint[];
|
|
30
|
+
/**
|
|
31
|
+
* GeoJSON or Highcharts topology object describing the map shapes.
|
|
32
|
+
* Obtain from https://code.highcharts.com/mapdata/ or supply your own.
|
|
33
|
+
*/
|
|
34
|
+
mapData: object | null;
|
|
35
|
+
/**
|
|
36
|
+
* How to join `data` with `mapData`. Defaults to `['hc-key', 'hc-key']`.
|
|
37
|
+
* Pass a single string to match by that property name on both sides,
|
|
38
|
+
* or a two-element array `[mapKey, dataKey]` for different key names.
|
|
39
|
+
*/
|
|
40
|
+
joinBy: string | string[];
|
|
41
|
+
/** Deep-merge override object for full Highcharts options. */
|
|
42
|
+
options: Highcharts.Options;
|
|
43
|
+
/** Whether to show a loading indicator instead of the chart. */
|
|
44
|
+
loading: boolean;
|
|
45
|
+
/** CSS height for the chart container. */
|
|
46
|
+
height: string;
|
|
47
|
+
/** Enable mouse-wheel zoom, double-click zoom, and +/− zoom buttons. Default: true. */
|
|
48
|
+
zoom: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Type of the primary map series.
|
|
51
|
+
* - `'map'` (default) — choropleth/filled regions
|
|
52
|
+
* - `'mapline'` — line/route overlay
|
|
53
|
+
* - `'mappoint'` — scatter points on map
|
|
54
|
+
* - `'mapbubble'` — sized bubbles on map
|
|
55
|
+
* For multi-series or `tiledwebmap`, pass `options.series` directly (it replaces the default series).
|
|
56
|
+
*/
|
|
57
|
+
seriesType: 'map' | 'mapline' | 'mappoint' | 'mapbubble' | 'tiledwebmap';
|
|
58
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
59
|
+
private applyConfig;
|
|
60
|
+
connectedCallback(): void;
|
|
61
|
+
disconnectedCallback(): void;
|
|
62
|
+
protected firstUpdated(): void;
|
|
63
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
64
|
+
private setupResizeObserver;
|
|
65
|
+
private buildOptions;
|
|
66
|
+
private initChart;
|
|
67
|
+
private destroyChart;
|
|
68
|
+
render(): TemplateResult;
|
|
69
|
+
}
|
|
70
|
+
declare global {
|
|
71
|
+
interface HTMLElementTagNameMap {
|
|
72
|
+
'nile-map-chart': NileMapChart;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import NileElement from '../internal/nile-element.js';
|
|
5
|
+
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
6
|
+
import { deepMerge } from '../internal/utils.js';
|
|
7
|
+
import { styles } from './nile-map-chart.css.js';
|
|
8
|
+
let NileMapChart = class NileMapChart extends NileElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this._hc = null;
|
|
12
|
+
this.chart = null;
|
|
13
|
+
this.resizeObserver = null;
|
|
14
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
15
|
+
this.config = null;
|
|
16
|
+
/** The chart title displayed above the chart. */
|
|
17
|
+
this.chartTitle = '';
|
|
18
|
+
/** The subtitle displayed below the title. */
|
|
19
|
+
this.chartSubtitle = '';
|
|
20
|
+
/**
|
|
21
|
+
* Array of data points. Each point should have a value and a key matching the
|
|
22
|
+
* map topology (e.g. `{ 'hc-key': 'us-ca', value: 42 }`).
|
|
23
|
+
*/
|
|
24
|
+
this.data = [];
|
|
25
|
+
/**
|
|
26
|
+
* GeoJSON or Highcharts topology object describing the map shapes.
|
|
27
|
+
* Obtain from https://code.highcharts.com/mapdata/ or supply your own.
|
|
28
|
+
*/
|
|
29
|
+
this.mapData = null;
|
|
30
|
+
/**
|
|
31
|
+
* How to join `data` with `mapData`. Defaults to `['hc-key', 'hc-key']`.
|
|
32
|
+
* Pass a single string to match by that property name on both sides,
|
|
33
|
+
* or a two-element array `[mapKey, dataKey]` for different key names.
|
|
34
|
+
*/
|
|
35
|
+
this.joinBy = ['hc-key', 'hc-key'];
|
|
36
|
+
/** Deep-merge override object for full Highcharts options. */
|
|
37
|
+
this.options = {};
|
|
38
|
+
/** Whether to show a loading indicator instead of the chart. */
|
|
39
|
+
this.loading = false;
|
|
40
|
+
/** CSS height for the chart container. */
|
|
41
|
+
this.height = '500px';
|
|
42
|
+
/** Enable mouse-wheel zoom, double-click zoom, and +/− zoom buttons. Default: true. */
|
|
43
|
+
this.zoom = true;
|
|
44
|
+
/**
|
|
45
|
+
* Type of the primary map series.
|
|
46
|
+
* - `'map'` (default) — choropleth/filled regions
|
|
47
|
+
* - `'mapline'` — line/route overlay
|
|
48
|
+
* - `'mappoint'` — scatter points on map
|
|
49
|
+
* - `'mapbubble'` — sized bubbles on map
|
|
50
|
+
* For multi-series or `tiledwebmap`, pass `options.series` directly (it replaces the default series).
|
|
51
|
+
*/
|
|
52
|
+
this.seriesType = 'map';
|
|
53
|
+
}
|
|
54
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
55
|
+
applyConfig(cfg) {
|
|
56
|
+
const { chart: c, aq } = cfg;
|
|
57
|
+
if (c) {
|
|
58
|
+
const map = c;
|
|
59
|
+
if (map.data)
|
|
60
|
+
this.data = map.data;
|
|
61
|
+
if (map.mapData)
|
|
62
|
+
this.mapData = map.mapData;
|
|
63
|
+
if (map.joinBy !== undefined)
|
|
64
|
+
this.joinBy = map.joinBy;
|
|
65
|
+
if (map.seriesType)
|
|
66
|
+
this.seriesType = map.seriesType;
|
|
67
|
+
if (map.height)
|
|
68
|
+
this.height = map.height;
|
|
69
|
+
if (map.loading !== undefined)
|
|
70
|
+
this.loading = map.loading;
|
|
71
|
+
if (map.zoom !== undefined)
|
|
72
|
+
this.zoom = map.zoom;
|
|
73
|
+
if (map.options)
|
|
74
|
+
this.options = map.options;
|
|
75
|
+
}
|
|
76
|
+
if (aq) {
|
|
77
|
+
if (aq.chartTitle)
|
|
78
|
+
this.chartTitle = aq.chartTitle;
|
|
79
|
+
if (aq.chartSubtitle)
|
|
80
|
+
this.chartSubtitle = aq.chartSubtitle;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
connectedCallback() {
|
|
84
|
+
super.connectedCallback();
|
|
85
|
+
if (this.config)
|
|
86
|
+
this.applyConfig(this.config);
|
|
87
|
+
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
super.disconnectedCallback();
|
|
90
|
+
this.destroyChart();
|
|
91
|
+
this.resizeObserver?.disconnect();
|
|
92
|
+
this.resizeObserver = null;
|
|
93
|
+
}
|
|
94
|
+
firstUpdated() {
|
|
95
|
+
// If config was set synchronously before the first render (common when the
|
|
96
|
+
// consumer assigns `.config = {...}` immediately after the element is in the
|
|
97
|
+
// DOM), connectedCallback will have missed it. Apply it here so buildOptions()
|
|
98
|
+
// has the full options—including series type, mapView, and projection—before
|
|
99
|
+
// Highcharts is ever initialised.
|
|
100
|
+
if (this.config)
|
|
101
|
+
this.applyConfig(this.config);
|
|
102
|
+
this.initChart();
|
|
103
|
+
this.setupResizeObserver();
|
|
104
|
+
}
|
|
105
|
+
updated(changedProperties) {
|
|
106
|
+
if (changedProperties.has('config') && this.config) {
|
|
107
|
+
this.applyConfig(this.config);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const chartProps = [
|
|
111
|
+
'data',
|
|
112
|
+
'mapData',
|
|
113
|
+
'joinBy',
|
|
114
|
+
'chartTitle',
|
|
115
|
+
'chartSubtitle',
|
|
116
|
+
'options',
|
|
117
|
+
'height',
|
|
118
|
+
'loading',
|
|
119
|
+
'zoom',
|
|
120
|
+
'seriesType',
|
|
121
|
+
];
|
|
122
|
+
const needsUpdate = chartProps.some(p => changedProperties.has(p));
|
|
123
|
+
if (!needsUpdate)
|
|
124
|
+
return;
|
|
125
|
+
if (this.loading) {
|
|
126
|
+
this.destroyChart();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (this.chart) {
|
|
130
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.initChart();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
setupResizeObserver() {
|
|
137
|
+
if (!this.chartContainer)
|
|
138
|
+
return;
|
|
139
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
140
|
+
this.chart?.reflow();
|
|
141
|
+
});
|
|
142
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
143
|
+
}
|
|
144
|
+
buildOptions() {
|
|
145
|
+
const self = this;
|
|
146
|
+
const defaults = {
|
|
147
|
+
chart: {
|
|
148
|
+
height: this.height,
|
|
149
|
+
},
|
|
150
|
+
title: {
|
|
151
|
+
text: this.chartTitle || undefined,
|
|
152
|
+
},
|
|
153
|
+
subtitle: {
|
|
154
|
+
text: this.chartSubtitle || undefined,
|
|
155
|
+
},
|
|
156
|
+
colorAxis: {
|
|
157
|
+
min: 0,
|
|
158
|
+
},
|
|
159
|
+
legend: {
|
|
160
|
+
enabled: true,
|
|
161
|
+
},
|
|
162
|
+
mapNavigation: {
|
|
163
|
+
enabled: this.zoom,
|
|
164
|
+
enableMouseWheelZoom: this.zoom,
|
|
165
|
+
enableDoubleClickZoom: this.zoom,
|
|
166
|
+
enableDoubleClickZoomTo: false,
|
|
167
|
+
buttonOptions: {
|
|
168
|
+
alignTo: 'spacingBox',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
series: this.seriesType !== 'tiledwebmap' ? [
|
|
172
|
+
{
|
|
173
|
+
type: this.seriesType,
|
|
174
|
+
data: this.data,
|
|
175
|
+
mapData: this.mapData ?? undefined,
|
|
176
|
+
joinBy: this.joinBy,
|
|
177
|
+
cursor: 'pointer',
|
|
178
|
+
point: {
|
|
179
|
+
events: {
|
|
180
|
+
click() {
|
|
181
|
+
self.emit('nile-chart-click', {
|
|
182
|
+
point: this,
|
|
183
|
+
name: this.name,
|
|
184
|
+
value: this.value,
|
|
185
|
+
key: this['hc-key'],
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
] : [],
|
|
192
|
+
credits: {
|
|
193
|
+
enabled: false,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
return deepMerge(defaults, this.options);
|
|
197
|
+
}
|
|
198
|
+
async initChart() {
|
|
199
|
+
if (this.loading || !this.chartContainer)
|
|
200
|
+
return;
|
|
201
|
+
if (!this._hc)
|
|
202
|
+
this._hc = await getHighcharts();
|
|
203
|
+
// Highcharts Maps module adds mapChart(); fall back to chart() if unavailable.
|
|
204
|
+
const hcAny = this._hc;
|
|
205
|
+
const factory = typeof hcAny.mapChart === 'function' ? hcAny.mapChart : hcAny.chart;
|
|
206
|
+
this.chart = factory(this.chartContainer, this.buildOptions());
|
|
207
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
208
|
+
}
|
|
209
|
+
destroyChart() {
|
|
210
|
+
if (this.chart) {
|
|
211
|
+
this.chart.destroy();
|
|
212
|
+
this.chart = null;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
render() {
|
|
216
|
+
if (this.loading) {
|
|
217
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
218
|
+
}
|
|
219
|
+
return html `<div class="chart-container"></div>`;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
NileMapChart.styles = styles;
|
|
223
|
+
__decorate([
|
|
224
|
+
query('.chart-container')
|
|
225
|
+
], NileMapChart.prototype, "chartContainer", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ type: Object })
|
|
228
|
+
], NileMapChart.prototype, "config", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property({ type: String, attribute: 'chart-title' })
|
|
231
|
+
], NileMapChart.prototype, "chartTitle", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
234
|
+
], NileMapChart.prototype, "chartSubtitle", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: Array })
|
|
237
|
+
], NileMapChart.prototype, "data", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
property({ type: Object })
|
|
240
|
+
], NileMapChart.prototype, "mapData", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
property({ type: Array })
|
|
243
|
+
], NileMapChart.prototype, "joinBy", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
property({ type: Object })
|
|
246
|
+
], NileMapChart.prototype, "options", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ type: Boolean, reflect: true })
|
|
249
|
+
], NileMapChart.prototype, "loading", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
property({ type: String })
|
|
252
|
+
], NileMapChart.prototype, "height", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
property({ type: Boolean })
|
|
255
|
+
], NileMapChart.prototype, "zoom", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
property({ type: String })
|
|
258
|
+
], NileMapChart.prototype, "seriesType", void 0);
|
|
259
|
+
NileMapChart = __decorate([
|
|
260
|
+
customElement('nile-map-chart')
|
|
261
|
+
], NileMapChart);
|
|
262
|
+
export { NileMapChart };
|
|
263
|
+
//# sourceMappingURL=nile-map-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([hidden]) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
nile-chart,
|
|
14
|
+
nile-kpi-chart {
|
|
15
|
+
display: block;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
//# sourceMappingURL=nile-widget-viewer.css.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
|
+
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
|
+
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
import type { NileWidgetConfig } from '../internal/types/widget-config.type.js';
|
|
5
|
+
import '../nile-chart/index.js';
|
|
6
|
+
import '../nile-kpi-chart/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Renders a single dashboard widget — either a `<nile-chart>` or a `<nile-kpi-chart>` —
|
|
9
|
+
* based on the discriminated `type` field of the config.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <nile-widget-viewer></nile-widget-viewer>
|
|
14
|
+
* ```
|
|
15
|
+
* ```js
|
|
16
|
+
* el.config = {
|
|
17
|
+
* type: 'chart',
|
|
18
|
+
* layout: { x: 0, y: 0, w: 6, h: 4 },
|
|
19
|
+
* nileConfig: { chart: { type: 'pie', data: [...] }, aq: { chartTitle: 'My Chart' } }
|
|
20
|
+
* };
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class NileWidgetViewer extends NileElement {
|
|
24
|
+
static styles: CSSResultGroup;
|
|
25
|
+
/** Widget configuration. Discriminated on `type`: `'chart'` or `'kpi'`. */
|
|
26
|
+
config: NileWidgetConfig | null;
|
|
27
|
+
render(): TemplateResult | typeof nothing;
|
|
28
|
+
}
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
'nile-widget-viewer': NileWidgetViewer;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { html, nothing } from 'lit';
|
|
4
|
+
import NileElement from '../internal/nile-element.js';
|
|
5
|
+
import { styles } from './nile-widget-viewer.css.js';
|
|
6
|
+
import '../nile-chart/index.js';
|
|
7
|
+
import '../nile-kpi-chart/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Renders a single dashboard widget — either a `<nile-chart>` or a `<nile-kpi-chart>` —
|
|
10
|
+
* based on the discriminated `type` field of the config.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <nile-widget-viewer></nile-widget-viewer>
|
|
15
|
+
* ```
|
|
16
|
+
* ```js
|
|
17
|
+
* el.config = {
|
|
18
|
+
* type: 'chart',
|
|
19
|
+
* layout: { x: 0, y: 0, w: 6, h: 4 },
|
|
20
|
+
* nileConfig: { chart: { type: 'pie', data: [...] }, aq: { chartTitle: 'My Chart' } }
|
|
21
|
+
* };
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
let NileWidgetViewer = class NileWidgetViewer extends NileElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
/** Widget configuration. Discriminated on `type`: `'chart'` or `'kpi'`. */
|
|
28
|
+
this.config = null;
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
if (!this.config)
|
|
32
|
+
return nothing;
|
|
33
|
+
if (this.config.type === 'chart') {
|
|
34
|
+
return html `<nile-chart .config=${this.config.nileConfig}></nile-chart>`;
|
|
35
|
+
}
|
|
36
|
+
if (this.config.type === 'kpi') {
|
|
37
|
+
return html `<nile-kpi-chart .config=${this.config.nileConfig}></nile-kpi-chart>`;
|
|
38
|
+
}
|
|
39
|
+
return nothing;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
NileWidgetViewer.styles = styles;
|
|
43
|
+
__decorate([
|
|
44
|
+
property({ type: Object })
|
|
45
|
+
], NileWidgetViewer.prototype, "config", void 0);
|
|
46
|
+
NileWidgetViewer = __decorate([
|
|
47
|
+
customElement('nile-widget-viewer')
|
|
48
|
+
], NileWidgetViewer);
|
|
49
|
+
export { NileWidgetViewer };
|
|
50
|
+
//# sourceMappingURL=nile-widget-viewer.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aquera/nile-visualization",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A visualization Library for the Nile Design System",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aquera Inc",
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
"./nile-ai-sender": "./dist/src/nile-ai-sender/index.js",
|
|
41
41
|
"./nile-ai-panel": "./dist/src/nile-ai-panel/index.js",
|
|
42
42
|
"./nile-kpi-chart": "./dist/src/nile-kpi-chart/index.js",
|
|
43
|
-
"./nile-chart": "./dist/src/nile-chart/index.js"
|
|
43
|
+
"./nile-chart": "./dist/src/nile-chart/index.js",
|
|
44
|
+
"./nile-widget-viewer": "./dist/src/nile-widget-viewer/index.js",
|
|
45
|
+
"./nile-dashboard-viewer": "./dist/src/nile-dashboard-viewer/index.js"
|
|
44
46
|
},
|
|
45
47
|
"files": [
|
|
46
48
|
"dist/src/**/*.js",
|