@aquera/nile-visualization 2.9.35 → 2.9.37
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/README.md +7 -0
- package/dist/src/internal/types/aq-config.type.d.ts +10 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +23 -1
- package/dist/src/nile-chart/nile-chart.css.d.ts +1 -1
- package/dist/src/nile-chart/nile-chart.css.js +58 -2
- package/dist/src/nile-chart/nile-chart.d.ts +7 -0
- package/dist/src/nile-chart/nile-chart.js +79 -4
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +10 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +18 -3
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +75 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,13 @@ To run a local development server that serves the basic demo located in `demo/in
|
|
|
36
36
|
|
|
37
37
|
In this section, you can find the updates for each release of `nile-visualization`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
|
|
38
38
|
|
|
39
|
+
#### Version 2.9.37 (October 12, 2026)
|
|
40
|
+
- Nile KPI Chart: The value info icon is now configurable with `valueInfoIcon`, `valueInfoIconMethod`, `valueInfoIconSize` and `valueInfoIconColor` (`nile-glyph` icons only). Defaults are unchanged (UIF-1379)
|
|
41
|
+
- Nile Chart: Added a header info icon for all chart types. Set `chartInfo` (with a `chartTitle`), and optionally `chartInfoIcon`, `chartInfoIconMethod`, `chartInfoIconSize` and `chartInfoIconColor` (UIF-1379)
|
|
42
|
+
|
|
43
|
+
#### Version 2.9.36 (September 30, 2026)
|
|
44
|
+
- Nile KPI Chart: Fixed the sparkline getting partly cut off after a data refresh or resize. The chart is now resized to match its box instead of resetting to `sparklineHeight`, and sparkline resize animation is turned off (UIF-1370)
|
|
45
|
+
|
|
39
46
|
#### Version 2.9.35 (September 29, 2026)
|
|
40
47
|
- Nile Chart: KPI tiles no longer get the `no-header` top padding on `nile-chart-inner`, with or without `aq` and `noHeader`. Other chart types are unchanged (UIF-1368)
|
|
41
48
|
|
|
@@ -5,6 +5,16 @@ import type { NileChartMenuConfig, NileChartMenuItem } from '../../nile-chart/ni
|
|
|
5
5
|
export interface AqConfigType {
|
|
6
6
|
chartTitle?: string;
|
|
7
7
|
chartSubtitle?: string;
|
|
8
|
+
/** Info text shown on hover/focus of an icon beside the header title. Empty → no icon (needs a title). */
|
|
9
|
+
chartInfo?: string;
|
|
10
|
+
/** `nile-glyph` name for the header info icon (default: 'ng-info-circle'). */
|
|
11
|
+
chartInfoIcon?: string;
|
|
12
|
+
/** `nile-glyph` `method` for the header info icon (default: 'stroke'). */
|
|
13
|
+
chartInfoIconMethod?: string;
|
|
14
|
+
/** `nile-glyph` `size` for the header info icon (default: unset, so `nile-glyph`'s own 16). The hover/focus target keeps a 16px token minimum. */
|
|
15
|
+
chartInfoIconSize?: string | number;
|
|
16
|
+
/** `nile-glyph` `color` for the header info icon, passed through unchanged. An explicit colour overrides the hover colour. */
|
|
17
|
+
chartInfoIconColor?: string;
|
|
8
18
|
/** Font size for the header title (number → px, or any CSS length string). */
|
|
9
19
|
titleFontSize?: string | number;
|
|
10
20
|
/** Font size for the header subtitle (number → px, or any CSS length string). */
|
|
@@ -16,7 +16,7 @@ import type { RadarChartSeriesData } from '../nile-radar-chart/nile-radar-chart.
|
|
|
16
16
|
import type { GaugeBand } from '../nile-gauge-chart/nile-gauge-chart.js';
|
|
17
17
|
import type { WaterfallDataPoint } from '../nile-waterfall-chart/nile-waterfall-chart.js';
|
|
18
18
|
import type { ForecastConfigFields, ForecastSeriesInput } from '../internal/utils/chart-forecast.js';
|
|
19
|
-
import type { KpiVariant, KpiValueFormat, KpiNumberSystem, SparklineType, TrendDirection } from '../nile-kpi-chart/nile-kpi-chart.js';
|
|
19
|
+
import type { KpiVariant, KpiValueFormat, KpiNumberSystem, SparklineType, TrendDirection, KpiInfoPlacement } from '../nile-kpi-chart/nile-kpi-chart.js';
|
|
20
20
|
import type { MapChartDataPoint } from '../nile-map-chart/nile-map-chart.js';
|
|
21
21
|
import type { StatusLightConfig } from '../nile-chart-message/nile-chart-message.js';
|
|
22
22
|
import type { ChartListVariant, ChartListItem, ChartListMarker } from '../nile-chart-list/nile-chart-list.js';
|
|
@@ -93,6 +93,16 @@ export interface NileAiConfig {
|
|
|
93
93
|
export interface NileChartConfigBase extends HighchartsPassthroughConfig {
|
|
94
94
|
chartTitle?: string;
|
|
95
95
|
chartSubtitle?: string;
|
|
96
|
+
/** Info text shown on hover/focus of an icon beside the header title. Empty → no icon (needs a title). */
|
|
97
|
+
chartInfo?: string;
|
|
98
|
+
/** `nile-glyph` name for the header info icon (default: 'ng-info-circle'). */
|
|
99
|
+
chartInfoIcon?: string;
|
|
100
|
+
/** `nile-glyph` `method` for the header info icon (default: 'stroke'). */
|
|
101
|
+
chartInfoIconMethod?: string;
|
|
102
|
+
/** `nile-glyph` `size` for the header info icon (default: unset, so `nile-glyph`'s own 16). The hover/focus target keeps a 16px token minimum. */
|
|
103
|
+
chartInfoIconSize?: string | number;
|
|
104
|
+
/** `nile-glyph` `color` for the header info icon, passed through unchanged. An explicit colour overrides the hover colour. */
|
|
105
|
+
chartInfoIconColor?: string;
|
|
96
106
|
titleFontSize?: string | number;
|
|
97
107
|
subtitleFontSize?: string | number;
|
|
98
108
|
noHeader?: boolean;
|
|
@@ -538,6 +548,18 @@ export interface NileKpiChartConfig extends NileChartConfigBase {
|
|
|
538
548
|
gaugeLabelYOffset?: number;
|
|
539
549
|
valueFontSize?: string | number;
|
|
540
550
|
valueColor?: string;
|
|
551
|
+
/** Info text for an icon beside the value. Empty → no icon. */
|
|
552
|
+
valueInfo?: string;
|
|
553
|
+
/** Info icon position relative to the value (default: 'top-right'). */
|
|
554
|
+
valueInfoPlacement?: KpiInfoPlacement;
|
|
555
|
+
/** `nile-glyph` name for the info icon (default: 'ng-info-circle'). */
|
|
556
|
+
valueInfoIcon?: string;
|
|
557
|
+
/** `nile-glyph` `method` for the info icon (default: 'stroke'). */
|
|
558
|
+
valueInfoIconMethod?: string;
|
|
559
|
+
/** `nile-glyph` `size` for the info icon (default: unset, so `nile-glyph`'s own 16). Changes the glyph only; the hover/focus target keeps the 16px token minimum. */
|
|
560
|
+
valueInfoIconSize?: string | number;
|
|
561
|
+
/** `nile-glyph` `color` for the info icon, passed through as-is. An explicit colour overrides the hover colour. Default: follows `--nile-kpi-info-color`. */
|
|
562
|
+
valueInfoIconColor?: string;
|
|
541
563
|
labelColor?: string;
|
|
542
564
|
labelFontSize?: string | number;
|
|
543
565
|
labelFontWeight?: string | number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const tooltipCss = "\n .nile-chart-header-tooltip {\n position: fixed;\n display: none;\n transform: translate(-50%, calc(-100% - 10px));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));\n font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));\n line-height: 1.4;\n padding: 4px 10px;\n border-radius: 6px;\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space:
|
|
1
|
+
export declare const tooltipCss = "\n .nile-chart-header-tooltip {\n position: fixed;\n display: none;\n transform: translate(-50%, calc(-100% - 10px));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));\n font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));\n line-height: 1.4;\n padding: 4px 10px;\n border-radius: 6px;\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space: normal;\n width: max-content;\n max-width: min(320px, calc(100vw - 16px));\n overflow-wrap: anywhere;\n z-index: 2147483647;\n box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));\n }\n .nile-chart-header-tooltip.below {\n transform: translate(-50%, 10px);\n }\n .nile-chart-header-tooltip.below::after {\n top: auto;\n bottom: 100%;\n border-top-color: transparent;\n border-bottom-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n .nile-chart-header-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: var(--tip-arrow-x, 50%);\n transform: translateX(-50%);\n border: 5px solid transparent;\n border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n";
|
|
2
2
|
export declare function injectGlobalChartMenuOverrides(): void;
|
|
3
3
|
export declare const styles: import("lit").CSSResult;
|
|
@@ -14,15 +14,27 @@ export const tooltipCss = `
|
|
|
14
14
|
border-radius: 6px;
|
|
15
15
|
border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
16
16
|
pointer-events: none;
|
|
17
|
-
white-space:
|
|
17
|
+
white-space: normal;
|
|
18
|
+
width: max-content;
|
|
19
|
+
max-width: min(320px, calc(100vw - 16px));
|
|
20
|
+
overflow-wrap: anywhere;
|
|
18
21
|
z-index: 2147483647;
|
|
19
22
|
box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));
|
|
20
23
|
}
|
|
24
|
+
.nile-chart-header-tooltip.below {
|
|
25
|
+
transform: translate(-50%, 10px);
|
|
26
|
+
}
|
|
27
|
+
.nile-chart-header-tooltip.below::after {
|
|
28
|
+
top: auto;
|
|
29
|
+
bottom: 100%;
|
|
30
|
+
border-top-color: transparent;
|
|
31
|
+
border-bottom-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
32
|
+
}
|
|
21
33
|
.nile-chart-header-tooltip::after {
|
|
22
34
|
content: '';
|
|
23
35
|
position: absolute;
|
|
24
36
|
top: 100%;
|
|
25
|
-
left: 50
|
|
37
|
+
left: var(--tip-arrow-x, 50%);
|
|
26
38
|
transform: translateX(-50%);
|
|
27
39
|
border: 5px solid transparent;
|
|
28
40
|
border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
@@ -170,6 +182,50 @@ export const styles = css `
|
|
|
170
182
|
flex: 1 1 auto;
|
|
171
183
|
}
|
|
172
184
|
|
|
185
|
+
/* Only rendered when chartInfo is set; otherwise the title <p> sits directly in the titles column. */
|
|
186
|
+
.nile-chart-header-title-row {
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
190
|
+
min-width: 0;
|
|
191
|
+
width: 100%;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.nile-chart-header-title-row .nile-chart-header-title {
|
|
195
|
+
width: auto;
|
|
196
|
+
flex: 0 1 auto;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.nile-chart-header-info {
|
|
200
|
+
display: inline-flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: center;
|
|
203
|
+
flex: 0 0 auto;
|
|
204
|
+
/* Hover/focus target never shrinks below the default glyph size, whatever chartInfoIconSize is. */
|
|
205
|
+
min-width: var(--nile-height-16px, var(--ng-height-16px));
|
|
206
|
+
min-height: var(--nile-height-16px, var(--ng-height-16px));
|
|
207
|
+
color: var(--nile-chart-header-info-color, var(--nile-colors-neutral-700, var(--ng-colors-fg-tertiary-600)));
|
|
208
|
+
border-radius: 50%;
|
|
209
|
+
cursor: pointer;
|
|
210
|
+
outline: none;
|
|
211
|
+
transition: color var(--nile-transition-duration-default, var(--ng-transition-duration-default)) ease;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* currentColor follows .nile-chart-header-info's colour. */
|
|
215
|
+
.nile-chart-header-info nile-glyph {
|
|
216
|
+
display: block;
|
|
217
|
+
--nile-svg-fill: currentColor;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.nile-chart-header-info:hover,
|
|
221
|
+
.nile-chart-header-info:focus-visible {
|
|
222
|
+
color: var(--nile-chart-header-info-hover-color, var(--nile-colors-dark-900, var(--ng-colors-fg-tertiary-hover)));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.nile-chart-header-info:focus-visible {
|
|
226
|
+
box-shadow: 0 0 0 2px var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
|
|
227
|
+
}
|
|
228
|
+
|
|
173
229
|
.nile-chart-header-title {
|
|
174
230
|
margin: 0;
|
|
175
231
|
font-family: var(--nile-font-family-serif-colfax-medium, var(--ng-font-family-display));
|
|
@@ -86,6 +86,7 @@ import '../nile-ai-panel/index.js';
|
|
|
86
86
|
export declare class NileChart extends NileElement {
|
|
87
87
|
static styles: CSSResultGroup;
|
|
88
88
|
private _headerTipEl;
|
|
89
|
+
private _headerInfoTipActive;
|
|
89
90
|
private _headerResizeObs;
|
|
90
91
|
/** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
|
|
91
92
|
config: NileChartConfig | NileChartConfigInputType | null;
|
|
@@ -227,6 +228,7 @@ export declare class NileChart extends NileElement {
|
|
|
227
228
|
/** Normalize a numeric (→px) or string dimension to a CSS length. */
|
|
228
229
|
private static toCssSize;
|
|
229
230
|
private get titleFontSize();
|
|
231
|
+
private headerInfo;
|
|
230
232
|
private get subtitleFontSize();
|
|
231
233
|
private onHeaderSlotChange;
|
|
232
234
|
private onHeaderActionsSlotChange;
|
|
@@ -247,6 +249,11 @@ export declare class NileChart extends NileElement {
|
|
|
247
249
|
private renderAiTrigger;
|
|
248
250
|
private _showHeaderTip;
|
|
249
251
|
private _hideHeaderTip;
|
|
252
|
+
private _onViewportMove;
|
|
253
|
+
private _onHeaderInfoEnter;
|
|
254
|
+
private _onHeaderInfoKeydown;
|
|
255
|
+
/** Info icon beside the header title. Tooltip, focus and ARIA live on the wrapper, not the glyph. */
|
|
256
|
+
private renderHeaderInfo;
|
|
250
257
|
private _onHeaderTextEnter;
|
|
251
258
|
private _syncHeaderTruncationA11y;
|
|
252
259
|
private renderHeader;
|
|
@@ -2,6 +2,7 @@ var NileChart_1;
|
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { html, nothing } from 'lit';
|
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
6
|
import NileElement from '../internal/base/nile-element.js';
|
|
6
7
|
import { styles, tooltipCss, injectGlobalChartMenuOverrides } from './nile-chart.css.js';
|
|
7
8
|
import { HIGHCHARTS_PASSTHROUGH_KEYS } from '../internal/types/index.js';
|
|
@@ -165,6 +166,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
165
166
|
constructor() {
|
|
166
167
|
super(...arguments);
|
|
167
168
|
this._headerTipEl = null;
|
|
169
|
+
this._headerInfoTipActive = false;
|
|
168
170
|
this._headerResizeObs = null;
|
|
169
171
|
/** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
|
|
170
172
|
this.config = null;
|
|
@@ -283,14 +285,26 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
283
285
|
}
|
|
284
286
|
};
|
|
285
287
|
this.resolvedConfig = null;
|
|
288
|
+
// The tooltip is fixed to the viewport and placed once, so any scroll (including a touch-drag while the
|
|
289
|
+
// finger is still down, when no leave/blur fires) would strand it away from its anchor. Hide it instead.
|
|
290
|
+
this._onViewportMove = () => this._hideHeaderTip();
|
|
286
291
|
// Reveal the full text when a title/subtitle is truncated. Accepts any Event
|
|
287
292
|
// so it works for BOTH pointer (mouseenter) and keyboard (focus) users.
|
|
293
|
+
this._onHeaderInfoEnter = (e) => {
|
|
294
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
295
|
+
this._showHeaderTip(String(this.headerInfo('chartInfo') ?? ''), rect.left + rect.width / 2, rect.top, rect.height);
|
|
296
|
+
this._headerInfoTipActive = true;
|
|
297
|
+
};
|
|
298
|
+
this._onHeaderInfoKeydown = (e) => {
|
|
299
|
+
if (e.key === 'Escape')
|
|
300
|
+
this._hideHeaderTip();
|
|
301
|
+
};
|
|
288
302
|
this._onHeaderTextEnter = (e) => {
|
|
289
303
|
const el = e.currentTarget;
|
|
290
304
|
if (el.scrollWidth <= el.clientWidth)
|
|
291
305
|
return;
|
|
292
306
|
const rect = el.getBoundingClientRect();
|
|
293
|
-
this._showHeaderTip(el.textContent ?? '', rect.left + rect.width / 2, rect.top);
|
|
307
|
+
this._showHeaderTip(el.textContent ?? '', rect.left + rect.width / 2, rect.top, rect.height);
|
|
294
308
|
};
|
|
295
309
|
// ── ECharts engine path (NILE-005) ──────────────────────────────
|
|
296
310
|
this._echart = null;
|
|
@@ -387,6 +401,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
387
401
|
document.removeEventListener('click', this.handleOutsideClick);
|
|
388
402
|
this.removeEventListener('nile-chart-ready', this.handleChartReady);
|
|
389
403
|
this.removeEventListener('dblclick', this._onDoubleTap);
|
|
404
|
+
this._hideHeaderTip();
|
|
390
405
|
this._headerTipEl?.remove();
|
|
391
406
|
this._headerTipEl = null;
|
|
392
407
|
this._headerResizeObs?.disconnect();
|
|
@@ -412,6 +427,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
412
427
|
return this.mergeChartTypeFromAttr({ ...input });
|
|
413
428
|
}
|
|
414
429
|
updated(changedProperties) {
|
|
430
|
+
// The icon can disappear (config swap, drill-down) with the pointer still on it, so no leave/blur ever fires.
|
|
431
|
+
if (this._headerInfoTipActive && !this.shadowRoot?.querySelector('.nile-chart-header-info'))
|
|
432
|
+
this._hideHeaderTip();
|
|
415
433
|
if (changedProperties.has('engine')) {
|
|
416
434
|
this._echartsFallback = false; // re-evaluate on every engine flip
|
|
417
435
|
if (this.engine !== 'echarts')
|
|
@@ -551,6 +569,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
551
569
|
get titleFontSize() {
|
|
552
570
|
return NileChart_1.toCssSize(this.activeConfig?.titleFontSize ?? this.resolvedConfig?.titleFontSize);
|
|
553
571
|
}
|
|
572
|
+
headerInfo(key) {
|
|
573
|
+
// The info keys travel as a unit: once the active config sets chartInfo (even '' to clear it) all
|
|
574
|
+
// five keys come from it, so its text is never paired with another config's icon, size or colour.
|
|
575
|
+
const source = this.activeConfig?.chartInfo !== undefined ? this.activeConfig : this.resolvedConfig;
|
|
576
|
+
return source?.[key];
|
|
577
|
+
}
|
|
554
578
|
get subtitleFontSize() {
|
|
555
579
|
return NileChart_1.toCssSize(this.activeConfig?.subtitleFontSize ?? this.resolvedConfig?.subtitleFontSize);
|
|
556
580
|
}
|
|
@@ -764,17 +788,57 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
764
788
|
<slot name="nile-ai-trigger-after"></slot>
|
|
765
789
|
`;
|
|
766
790
|
}
|
|
767
|
-
_showHeaderTip(text, x, y) {
|
|
791
|
+
_showHeaderTip(text, x, y, anchorHeight = 0) {
|
|
768
792
|
if (!this._headerTipEl)
|
|
769
793
|
return;
|
|
770
794
|
this._headerTipEl.textContent = text;
|
|
771
795
|
this._headerTipEl.style.left = `${x}px`;
|
|
772
796
|
this._headerTipEl.style.top = `${y}px`;
|
|
773
797
|
this._headerTipEl.style.display = 'block';
|
|
798
|
+
window.addEventListener('scroll', this._onViewportMove, { capture: true, passive: true });
|
|
799
|
+
window.addEventListener('resize', this._onViewportMove, { passive: true });
|
|
800
|
+
// Keep the tooltip inside the viewport; the arrow keeps pointing at the anchor.
|
|
801
|
+
const margin = 8;
|
|
802
|
+
const half = this._headerTipEl.offsetWidth / 2;
|
|
803
|
+
const cx = Math.min(Math.max(x, half + margin), Math.max(half + margin, window.innerWidth - half - margin));
|
|
804
|
+
this._headerTipEl.style.left = `${cx}px`;
|
|
805
|
+
this._headerTipEl.style.setProperty('--tip-arrow-x', `${half + x - cx}px`);
|
|
806
|
+
// Not enough room above the anchor: drop below it instead.
|
|
807
|
+
const above = y - this._headerTipEl.offsetHeight - 10 >= margin;
|
|
808
|
+
this._headerTipEl.classList.toggle('below', !above);
|
|
809
|
+
if (!above)
|
|
810
|
+
this._headerTipEl.style.top = `${y + anchorHeight}px`;
|
|
774
811
|
}
|
|
775
812
|
_hideHeaderTip() {
|
|
813
|
+
this._headerInfoTipActive = false;
|
|
776
814
|
if (this._headerTipEl)
|
|
777
815
|
this._headerTipEl.style.display = 'none';
|
|
816
|
+
window.removeEventListener('scroll', this._onViewportMove, true);
|
|
817
|
+
window.removeEventListener('resize', this._onViewportMove);
|
|
818
|
+
}
|
|
819
|
+
/** Info icon beside the header title. Tooltip, focus and ARIA live on the wrapper, not the glyph. */
|
|
820
|
+
renderHeaderInfo() {
|
|
821
|
+
const info = String(this.headerInfo('chartInfo') ?? '');
|
|
822
|
+
if (!info)
|
|
823
|
+
return nothing;
|
|
824
|
+
const size = this.headerInfo('chartInfoIconSize');
|
|
825
|
+
return html `<span
|
|
826
|
+
class="nile-chart-header-info"
|
|
827
|
+
part="header-info"
|
|
828
|
+
role="img"
|
|
829
|
+
tabindex="0"
|
|
830
|
+
aria-label=${info}
|
|
831
|
+
@mouseenter=${this._onHeaderInfoEnter}
|
|
832
|
+
@mouseleave=${() => this._hideHeaderTip()}
|
|
833
|
+
@focus=${this._onHeaderInfoEnter}
|
|
834
|
+
@blur=${() => this._hideHeaderTip()}
|
|
835
|
+
@keydown=${this._onHeaderInfoKeydown}
|
|
836
|
+
><nile-glyph
|
|
837
|
+
name=${this.headerInfo('chartInfoIcon') || 'ng-info-circle'}
|
|
838
|
+
method=${this.headerInfo('chartInfoIconMethod') || 'stroke'}
|
|
839
|
+
size=${ifDefined(size === '' || size == null ? undefined : size)}
|
|
840
|
+
color=${this.headerInfo('chartInfoIconColor') || 'currentColor'}
|
|
841
|
+
></nile-glyph></span>`;
|
|
778
842
|
}
|
|
779
843
|
_syncHeaderTruncationA11y() {
|
|
780
844
|
const root = this.shadowRoot;
|
|
@@ -790,7 +854,8 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
790
854
|
}
|
|
791
855
|
else {
|
|
792
856
|
el.removeAttribute('tabindex');
|
|
793
|
-
this.
|
|
857
|
+
if (!this._headerInfoTipActive)
|
|
858
|
+
this._hideHeaderTip();
|
|
794
859
|
}
|
|
795
860
|
}
|
|
796
861
|
}
|
|
@@ -809,7 +874,11 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
809
874
|
<slot name="header" @slotchange=${this.onHeaderSlotChange}></slot>
|
|
810
875
|
${showDefaultTitles
|
|
811
876
|
? html `
|
|
812
|
-
${title
|
|
877
|
+
${title
|
|
878
|
+
? this.headerInfo('chartInfo')
|
|
879
|
+
? html `<div class="nile-chart-header-title-row" part="header-title-row">${html `<p class="nile-chart-header-title" part="header-title" style=${titleFontSize ? `font-size:${titleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${title}</p>`}${this.renderHeaderInfo()}</div>`
|
|
880
|
+
: html `<p class="nile-chart-header-title" part="header-title" style=${titleFontSize ? `font-size:${titleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${title}</p>`
|
|
881
|
+
: nothing}
|
|
813
882
|
${subtitle ? html `<p class="nile-chart-header-subtitle" part="header-subtitle" style=${subtitleFontSize ? `font-size:${subtitleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${subtitle}</p>` : nothing}
|
|
814
883
|
`
|
|
815
884
|
: nothing}
|
|
@@ -2130,6 +2199,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
2130
2199
|
gaugeLabelYOffset: k.gaugeLabelYOffset,
|
|
2131
2200
|
valueFontSize: k.valueFontSize,
|
|
2132
2201
|
valueColor: k.valueColor,
|
|
2202
|
+
valueInfo: k.valueInfo,
|
|
2203
|
+
valueInfoPlacement: k.valueInfoPlacement,
|
|
2204
|
+
valueInfoIcon: k.valueInfoIcon,
|
|
2205
|
+
valueInfoIconMethod: k.valueInfoIconMethod,
|
|
2206
|
+
valueInfoIconSize: k.valueInfoIconSize,
|
|
2207
|
+
valueInfoIconColor: k.valueInfoIconColor,
|
|
2133
2208
|
labelColor: k.labelColor,
|
|
2134
2209
|
labelFontSize: k.labelFontSize,
|
|
2135
2210
|
labelFontWeight: k.labelFontWeight,
|
|
@@ -70,7 +70,7 @@ export const styles = css `
|
|
|
70
70
|
--nile-kpi-forecast-font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
|
|
71
71
|
--nile-kpi-description-font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
|
|
72
72
|
--nile-kpi-description-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
73
|
-
/* Value info icon (
|
|
73
|
+
/* Value info icon (default size is nile-glyph's own 16). */
|
|
74
74
|
--nile-kpi-info-color: var(--nile-colors-neutral-700, var(--ng-colors-fg-tertiary-600));
|
|
75
75
|
--nile-kpi-info-hover-color: var(--nile-colors-dark-900, var(--ng-colors-fg-tertiary-hover));
|
|
76
76
|
display: flex;
|
|
@@ -198,7 +198,12 @@ export const styles = css `
|
|
|
198
198
|
|
|
199
199
|
.kpi-info {
|
|
200
200
|
display: inline-flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: center;
|
|
201
203
|
flex: 0 0 auto;
|
|
204
|
+
/* Hover/focus target never shrinks below the default glyph size, whatever valueInfoIconSize is. */
|
|
205
|
+
min-width: var(--nile-height-16px, var(--ng-height-16px));
|
|
206
|
+
min-height: var(--nile-height-16px, var(--ng-height-16px));
|
|
202
207
|
color: var(--nile-kpi-info-color);
|
|
203
208
|
border-radius: 50%;
|
|
204
209
|
cursor: pointer;
|
|
@@ -226,6 +231,10 @@ export const styles = css `
|
|
|
226
231
|
align-self: flex-start;
|
|
227
232
|
}
|
|
228
233
|
|
|
234
|
+
.kpi-info--center {
|
|
235
|
+
align-self: center;
|
|
236
|
+
}
|
|
237
|
+
|
|
229
238
|
.kpi-info--bottom {
|
|
230
239
|
align-self: flex-end;
|
|
231
240
|
}
|
|
@@ -7,7 +7,7 @@ export type KpiVariant = 'default' | 'card' | 'gauge' | 'accent';
|
|
|
7
7
|
export type SparklineType = 'area' | 'line' | 'column' | 'bar' | 'spline' | 'areaspline' | 'pie' | 'scatter';
|
|
8
8
|
export type KpiValueFormat = 'auto' | 'K' | 'M' | 'B' | 'T' | 'none';
|
|
9
9
|
export type KpiNumberSystem = 'indian' | 'international';
|
|
10
|
-
export type KpiInfoPlacement = 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
|
|
10
|
+
export type KpiInfoPlacement = 'top-right' | 'center-right' | 'bottom-right' | 'top-left' | 'center-left' | 'bottom-left';
|
|
11
11
|
/** `chart` slice for `<nile-kpi-chart>.config` (discriminated by `type: 'kpi'`). */
|
|
12
12
|
export interface ChartKpiSeparatedPayload {
|
|
13
13
|
type: 'kpi';
|
|
@@ -70,6 +70,14 @@ export interface ChartKpiSeparatedPayload {
|
|
|
70
70
|
valueInfo?: string;
|
|
71
71
|
/** Info icon position relative to the value (default: 'top-right'). */
|
|
72
72
|
valueInfoPlacement?: KpiInfoPlacement;
|
|
73
|
+
/** `nile-glyph` name for the info icon (default: 'ng-info-circle'). */
|
|
74
|
+
valueInfoIcon?: string;
|
|
75
|
+
/** `nile-glyph` `method` for the info icon (default: 'stroke'). */
|
|
76
|
+
valueInfoIconMethod?: string;
|
|
77
|
+
/** `nile-glyph` `size` for the info icon (default: the 16px height token)*/
|
|
78
|
+
valueInfoIconSize?: string | number;
|
|
79
|
+
/** nile-glyph` `color` for the info icon, passed through unchanged */
|
|
80
|
+
valueInfoIconColor?: string;
|
|
73
81
|
/** Custom text shown in the loading state (default: 'Loading...'). */
|
|
74
82
|
loadingText?: string;
|
|
75
83
|
/** Whether the hover tooltip is shown on value / sparkline / gauge (default: true). */
|
|
@@ -241,8 +249,16 @@ export declare class NileKpiChart extends NileElement {
|
|
|
241
249
|
valueColor: string;
|
|
242
250
|
/** Info text shown on hover/focus of an icon beside the value. Empty → no icon. */
|
|
243
251
|
valueInfo: string;
|
|
244
|
-
/** Info icon position: top-/bottom- (superscript/subscript), -left (before prefix) / -right (after suffix). */
|
|
252
|
+
/** Info icon position: top-/center-/bottom- (superscript/vertically centred/subscript), -left (before prefix) / -right (after suffix). */
|
|
245
253
|
valueInfoPlacement: KpiInfoPlacement;
|
|
254
|
+
/** `nile-glyph` name used for the info icon. Empty → 'ng-info-circle'. */
|
|
255
|
+
valueInfoIcon: string;
|
|
256
|
+
/** `nile-glyph` `method` for the info icon. */
|
|
257
|
+
valueInfoIconMethod: string;
|
|
258
|
+
/** `nile-glyph` `size` for the info icon. Changes the glyph only, not the hover/focus target (min: the 16px height token). Empty → not passed, so `nile-glyph` uses its own default (16). */
|
|
259
|
+
valueInfoIconSize: string | number;
|
|
260
|
+
/** `nile-glyph` `color` for the info icon */
|
|
261
|
+
valueInfoIconColor: string;
|
|
246
262
|
/** Custom text shown in the loading state. */
|
|
247
263
|
loadingText: string;
|
|
248
264
|
/** Whether the hover tooltip is shown on value / sparkline / gauge. */
|
|
@@ -306,7 +322,6 @@ export declare class NileKpiChart extends NileElement {
|
|
|
306
322
|
disconnectedCallback(): void;
|
|
307
323
|
protected firstUpdated(): void;
|
|
308
324
|
protected updated(changedProperties: PropertyValues): void;
|
|
309
|
-
private _lastSparkSize;
|
|
310
325
|
private _lastGaugeSize;
|
|
311
326
|
private _gaugeRafScheduled;
|
|
312
327
|
private _scheduleGaugeSync;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
3
|
import { html, nothing } from 'lit';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
5
|
import NileElement from '../internal/base/nile-element.js';
|
|
5
6
|
import { getHighcharts } from '../internal/utils/highcharts-provider.js';
|
|
6
7
|
import { styles, tooltipCss } from './nile-kpi-chart.css.js';
|
|
@@ -120,8 +121,16 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
120
121
|
this.valueColor = '';
|
|
121
122
|
/** Info text shown on hover/focus of an icon beside the value. Empty → no icon. */
|
|
122
123
|
this.valueInfo = '';
|
|
123
|
-
/** Info icon position: top-/bottom- (superscript/subscript), -left (before prefix) / -right (after suffix). */
|
|
124
|
+
/** Info icon position: top-/center-/bottom- (superscript/vertically centred/subscript), -left (before prefix) / -right (after suffix). */
|
|
124
125
|
this.valueInfoPlacement = 'top-right';
|
|
126
|
+
/** `nile-glyph` name used for the info icon. Empty → 'ng-info-circle'. */
|
|
127
|
+
this.valueInfoIcon = 'ng-info-circle';
|
|
128
|
+
/** `nile-glyph` `method` for the info icon. */
|
|
129
|
+
this.valueInfoIconMethod = 'stroke';
|
|
130
|
+
/** `nile-glyph` `size` for the info icon. Changes the glyph only, not the hover/focus target (min: the 16px height token). Empty → not passed, so `nile-glyph` uses its own default (16). */
|
|
131
|
+
this.valueInfoIconSize = '';
|
|
132
|
+
/** `nile-glyph` `color` for the info icon */
|
|
133
|
+
this.valueInfoIconColor = '';
|
|
125
134
|
/** Custom text shown in the loading state. */
|
|
126
135
|
this.loadingText = 'Loading...';
|
|
127
136
|
/** Whether the hover tooltip is shown on value / sparkline / gauge. */
|
|
@@ -174,7 +183,6 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
174
183
|
this._hideTip();
|
|
175
184
|
};
|
|
176
185
|
// ── Chart sizing ─────────────────────────────────────────────────────────
|
|
177
|
-
this._lastSparkSize = { w: 0, h: 0 };
|
|
178
186
|
this._lastGaugeSize = { w: 0, h: 0 };
|
|
179
187
|
this._gaugeRafScheduled = false;
|
|
180
188
|
// ── Sparkline mousemove tooltip ──────────────────────────────────────────
|
|
@@ -592,8 +600,16 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
592
600
|
this.valueColor = c.valueColor;
|
|
593
601
|
if (c.valueInfo !== undefined)
|
|
594
602
|
this.valueInfo = c.valueInfo;
|
|
595
|
-
if (c.valueInfoPlacement
|
|
603
|
+
if (c.valueInfoPlacement != null)
|
|
596
604
|
this.valueInfoPlacement = c.valueInfoPlacement;
|
|
605
|
+
if (c.valueInfoIcon != null)
|
|
606
|
+
this.valueInfoIcon = c.valueInfoIcon;
|
|
607
|
+
if (c.valueInfoIconMethod != null)
|
|
608
|
+
this.valueInfoIconMethod = c.valueInfoIconMethod;
|
|
609
|
+
if (c.valueInfoIconSize != null)
|
|
610
|
+
this.valueInfoIconSize = c.valueInfoIconSize;
|
|
611
|
+
if (c.valueInfoIconColor != null)
|
|
612
|
+
this.valueInfoIconColor = c.valueInfoIconColor;
|
|
597
613
|
if (c.loadingText !== undefined)
|
|
598
614
|
this.loadingText = c.loadingText;
|
|
599
615
|
if (c.tooltipEnabled !== undefined)
|
|
@@ -686,6 +702,11 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
686
702
|
}
|
|
687
703
|
if (this.config)
|
|
688
704
|
this.applyConfig(this.config);
|
|
705
|
+
if (this.hasUpdated) {
|
|
706
|
+
this.setupResizeObserver();
|
|
707
|
+
this.initSparkline();
|
|
708
|
+
this.initGauge();
|
|
709
|
+
}
|
|
689
710
|
}
|
|
690
711
|
disconnectedCallback() {
|
|
691
712
|
super.disconnectedCallback();
|
|
@@ -718,12 +739,20 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
718
739
|
}
|
|
719
740
|
const sparklineProps = ['sparkline', 'sparklineColor', 'sparklineHeight', 'sparklineLineWidth',
|
|
720
741
|
'sparklineType', 'sparklineFillOpacity', 'sparklineMarkers', 'options'];
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
742
|
+
const spark = this.sparklineChart;
|
|
743
|
+
const sparkStale = !!spark && spark.renderTo !== this.sparklineContainer;
|
|
744
|
+
if (sparkStale || sparklineProps.some(p => changedProperties.has(p))) {
|
|
745
|
+
if (spark && !sparkStale) {
|
|
746
|
+
// Size is owned by syncSparklineChartSize(). Leaving chart.height in
|
|
747
|
+
// would resize the chart back to sparklineHeight and clip the plot.
|
|
748
|
+
const opts = this.buildSparklineOptions();
|
|
749
|
+
opts.chart = { ...opts.chart };
|
|
750
|
+
delete opts.chart.height;
|
|
751
|
+
spark.update(opts, true, true);
|
|
724
752
|
requestAnimationFrame(() => this.syncSparklineChartSize());
|
|
725
753
|
}
|
|
726
754
|
else {
|
|
755
|
+
this.destroySparkline();
|
|
727
756
|
this.initSparkline();
|
|
728
757
|
}
|
|
729
758
|
}
|
|
@@ -739,12 +768,15 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
739
768
|
'gaugeStartAngle', 'gaugeEndAngle', 'gaugeInnerRadius', 'gaugeOuterRadius', 'gaugeRounded',
|
|
740
769
|
'gaugeHeight', 'gaugeLabelFontSize', 'gaugeLabelColor', 'gaugeLabelFontWeight',
|
|
741
770
|
'gaugeLabelYOffset', 'options', 'variant'];
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
771
|
+
const gauge = this.gaugeChart;
|
|
772
|
+
const gaugeStale = !!gauge && gauge.renderTo !== this.gaugeContainer;
|
|
773
|
+
if (gaugeStale || gaugeProps.some(p => changedProperties.has(p))) {
|
|
774
|
+
if (gauge && !gaugeStale) {
|
|
775
|
+
gauge.update(this.buildGaugeOptions(), true, true);
|
|
745
776
|
requestAnimationFrame(() => this.syncGaugeChartSize());
|
|
746
777
|
}
|
|
747
778
|
else {
|
|
779
|
+
this.destroyGauge();
|
|
748
780
|
this.initGauge();
|
|
749
781
|
}
|
|
750
782
|
}
|
|
@@ -790,22 +822,19 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
790
822
|
this._scheduleGaugeSync();
|
|
791
823
|
}
|
|
792
824
|
syncSparklineChartSize() {
|
|
793
|
-
|
|
825
|
+
const chart = this.sparklineChart;
|
|
826
|
+
if (!chart || !this.sparklineContainer)
|
|
794
827
|
return;
|
|
828
|
+
const drawn = chart.container;
|
|
829
|
+
const prevDisplay = drawn.style.display;
|
|
830
|
+
drawn.style.display = 'none';
|
|
795
831
|
const rect = this.sparklineContainer.getBoundingClientRect();
|
|
832
|
+
drawn.style.display = prevDisplay;
|
|
796
833
|
const w = Math.max(1, Math.round(rect.width));
|
|
797
834
|
const h = Math.max(22, Math.round(rect.height));
|
|
798
|
-
if (w ===
|
|
799
|
-
return;
|
|
800
|
-
this._lastSparkSize = { w, h };
|
|
801
|
-
// Rebuild the chart
|
|
802
|
-
this.destroySparkline();
|
|
803
|
-
if (!this._hc)
|
|
835
|
+
if (w === chart.chartWidth && h === chart.chartHeight)
|
|
804
836
|
return;
|
|
805
|
-
|
|
806
|
-
this.sparklineChart.setSize(w, h, false);
|
|
807
|
-
this.sparklineContainer.addEventListener('mousemove', this._onSparklineMouseMove);
|
|
808
|
-
this.sparklineContainer.addEventListener('mouseleave', this._onSparklineMouseLeave);
|
|
837
|
+
chart.update({ chart: { width: w, height: h } }, true, false, false);
|
|
809
838
|
}
|
|
810
839
|
_reconcileFit() {
|
|
811
840
|
if (!this.hasAttribute('fit')) {
|
|
@@ -848,7 +877,8 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
848
877
|
// Pie variant — a compact pie with no slice labels / connectors.
|
|
849
878
|
if (seriesType === 'pie') {
|
|
850
879
|
const defaults = {
|
|
851
|
-
|
|
880
|
+
// animation: false — see the non-pie defaults below.
|
|
881
|
+
chart: { type: 'pie', height: this.sparklineHeight, margin: [0, 0, 0, 0], backgroundColor: 'transparent', animation: false },
|
|
852
882
|
title: { text: undefined },
|
|
853
883
|
subtitle: { text: undefined },
|
|
854
884
|
legend: { enabled: false },
|
|
@@ -922,7 +952,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
922
952
|
states: { hover: { lineWidth, halo: null } },
|
|
923
953
|
};
|
|
924
954
|
const defaults = {
|
|
925
|
-
chart: { type: seriesType, height: this.sparklineHeight, margin: [2, 0, 2, 0], backgroundColor: 'transparent' },
|
|
955
|
+
chart: { type: seriesType, height: this.sparklineHeight, margin: [2, 0, 2, 0], backgroundColor: 'transparent', animation: false },
|
|
926
956
|
title: { text: undefined },
|
|
927
957
|
subtitle: { text: undefined },
|
|
928
958
|
xAxis: { visible: false },
|
|
@@ -1030,7 +1060,8 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
1030
1060
|
this._hc = await getHighcharts();
|
|
1031
1061
|
this.destroySparkline();
|
|
1032
1062
|
this.sparklineChart = this._hc.chart(this.sparklineContainer, this.buildSparklineOptions());
|
|
1033
|
-
|
|
1063
|
+
this.resizeObserver?.observe(this.sparklineContainer);
|
|
1064
|
+
// Force a reflow after the next layout pass
|
|
1034
1065
|
requestAnimationFrame(() => {
|
|
1035
1066
|
this.syncSparklineChartSize();
|
|
1036
1067
|
requestAnimationFrame(() => this.syncSparklineChartSize());
|
|
@@ -1079,9 +1110,9 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
1079
1110
|
renderValueInfo() {
|
|
1080
1111
|
if (!this.valueInfo)
|
|
1081
1112
|
return nothing;
|
|
1082
|
-
const [vertical, side] = this.valueInfoPlacement.split('-');
|
|
1113
|
+
const [vertical, side] = (typeof this.valueInfoPlacement === 'string' ? this.valueInfoPlacement : 'top-right').split('-');
|
|
1083
1114
|
return html `<span
|
|
1084
|
-
class="kpi-info kpi-info--${vertical === 'bottom'
|
|
1115
|
+
class="kpi-info kpi-info--${vertical === 'bottom' || vertical === 'center' ? vertical : 'top'} kpi-info--${side === 'left' ? 'left' : 'right'}"
|
|
1085
1116
|
part="value-info"
|
|
1086
1117
|
role="img"
|
|
1087
1118
|
tabindex="0"
|
|
@@ -1091,7 +1122,12 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
1091
1122
|
@focus=${this._onInfoEnter}
|
|
1092
1123
|
@blur=${this._onTipLeave}
|
|
1093
1124
|
@keydown=${this._onTrendKeydown}
|
|
1094
|
-
><nile-glyph
|
|
1125
|
+
><nile-glyph
|
|
1126
|
+
name=${this.valueInfoIcon || 'ng-info-circle'}
|
|
1127
|
+
method=${this.valueInfoIconMethod || 'stroke'}
|
|
1128
|
+
size=${ifDefined(this.valueInfoIconSize === '' || this.valueInfoIconSize == null ? undefined : this.valueInfoIconSize)}
|
|
1129
|
+
color=${this.valueInfoIconColor || 'currentColor'}
|
|
1130
|
+
></nile-glyph></span>`;
|
|
1095
1131
|
}
|
|
1096
1132
|
renderTrend() {
|
|
1097
1133
|
if (this.trendValue === null)
|
|
@@ -1156,7 +1192,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
1156
1192
|
const fmt = rawNum != null ? this.formatValue(rawNum) : null;
|
|
1157
1193
|
const displayValue = fmt ? fmt.display : String(this.value ?? '');
|
|
1158
1194
|
const showTooltip = !!fmt && fmt.display !== fmt.full;
|
|
1159
|
-
const infoLeft = this.valueInfoPlacement.endsWith('-left');
|
|
1195
|
+
const infoLeft = typeof this.valueInfoPlacement === 'string' && this.valueInfoPlacement.endsWith('-left');
|
|
1160
1196
|
return html `
|
|
1161
1197
|
<div class="kpi ${isGauge ? 'kpi--gauge' : ''}">
|
|
1162
1198
|
${this.label ? html `<p
|
|
@@ -1355,6 +1391,18 @@ __decorate([
|
|
|
1355
1391
|
__decorate([
|
|
1356
1392
|
property({ type: String, attribute: 'value-info-placement' })
|
|
1357
1393
|
], NileKpiChart.prototype, "valueInfoPlacement", void 0);
|
|
1394
|
+
__decorate([
|
|
1395
|
+
property({ type: String, attribute: true })
|
|
1396
|
+
], NileKpiChart.prototype, "valueInfoIcon", void 0);
|
|
1397
|
+
__decorate([
|
|
1398
|
+
property({ type: String, attribute: true })
|
|
1399
|
+
], NileKpiChart.prototype, "valueInfoIconMethod", void 0);
|
|
1400
|
+
__decorate([
|
|
1401
|
+
property({ attribute: true })
|
|
1402
|
+
], NileKpiChart.prototype, "valueInfoIconSize", void 0);
|
|
1403
|
+
__decorate([
|
|
1404
|
+
property({ type: String, attribute: true })
|
|
1405
|
+
], NileKpiChart.prototype, "valueInfoIconColor", void 0);
|
|
1358
1406
|
__decorate([
|
|
1359
1407
|
property({ type: String, attribute: 'loading-text' })
|
|
1360
1408
|
], NileKpiChart.prototype, "loadingText", void 0);
|