@aquera/nile-visualization 2.9.38 → 2.9.39
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 +5 -0
- package/dist/src/internal/types/aq-config.type.d.ts +2 -0
- package/dist/src/internal/utils/highcharts-compat.d.ts +27 -0
- package/dist/src/internal/utils/highcharts-compat.js +80 -0
- package/dist/src/internal/utils/highcharts-compat.test.d.ts +1 -0
- package/dist/src/internal/utils/highcharts-compat.test.js +116 -0
- package/dist/src/internal/utils/highcharts-provider.js +31 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +3 -0
- package/dist/src/nile-chart/nile-chart-empty.d.ts +22 -0
- package/dist/src/nile-chart/nile-chart-empty.js +264 -0
- package/dist/src/nile-chart/nile-chart-empty.test.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart-empty.test.js +897 -0
- package/dist/src/nile-chart/nile-chart-skeleton.d.ts +2 -0
- package/dist/src/nile-chart/nile-chart-skeleton.js +9 -0
- package/dist/src/nile-chart/nile-chart-skeleton.test.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart-skeleton.test.js +137 -0
- package/dist/src/nile-chart/nile-chart.css.js +123 -0
- package/dist/src/nile-chart/nile-chart.d.ts +8 -0
- package/dist/src/nile-chart/nile-chart.js +58 -4
- package/package.json +3 -3
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { type TemplateResult } from 'lit';
|
|
2
2
|
export declare function renderChartSkeleton(chartType: string | undefined): TemplateResult;
|
|
3
|
+
/** Static, decorative ghost for the empty state: solid shapes only, no loading semantics. */
|
|
4
|
+
export declare function renderChartGhost(chartType: string | undefined): TemplateResult;
|
|
@@ -181,4 +181,13 @@ export function renderChartSkeleton(chartType) {
|
|
|
181
181
|
const v = variantFor(chartType);
|
|
182
182
|
return html `<div part="skeleton skeleton-${v}" class="nile-chart-skeleton nile-chart-skeleton--${v}" aria-busy="true" aria-label="Loading chart">${renderBody(v)}</div>`;
|
|
183
183
|
}
|
|
184
|
+
// ── Empty-state ghost: separate from the default skeleton above, which it does not alter ──
|
|
185
|
+
// Line-like charts have no solid shape of their own, so the ghost uses columns.
|
|
186
|
+
const GHOST_AS_COLUMNS = new Set(['line', 'trendline', 'anomaly']);
|
|
187
|
+
/** Static, decorative ghost for the empty state: solid shapes only, no loading semantics. */
|
|
188
|
+
export function renderChartGhost(chartType) {
|
|
189
|
+
const base = variantFor(chartType);
|
|
190
|
+
const v = GHOST_AS_COLUMNS.has(base) ? 'columns' : base;
|
|
191
|
+
return html `<div part="skeleton skeleton-${v} skeleton-ghost" class="nile-chart-skeleton nile-chart-skeleton--${v} nile-chart-skeleton--ghost" aria-hidden="true">${renderBody(v)}</div>`;
|
|
192
|
+
}
|
|
184
193
|
//# sourceMappingURL=nile-chart-skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './nile-chart';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default loading skeleton (renderChartSkeleton) and the empty-state ghost
|
|
3
|
+
* (renderChartGhost) are separate rendering paths. These tests pin the default path
|
|
4
|
+
* and prove the ghost's substitutions, styles and semantics never reach it.
|
|
5
|
+
*/
|
|
6
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
7
|
+
import { render } from 'lit';
|
|
8
|
+
import './nile-chart';
|
|
9
|
+
import { renderChartSkeleton, renderChartGhost } from './nile-chart-skeleton';
|
|
10
|
+
const mount = (tpl) => {
|
|
11
|
+
const host = document.createElement('div');
|
|
12
|
+
render(tpl, host);
|
|
13
|
+
return host.firstElementChild;
|
|
14
|
+
};
|
|
15
|
+
// One representative chart type per skeleton family, plus an unmapped type (falls back to bars).
|
|
16
|
+
const FAMILY_BY_TYPE = {
|
|
17
|
+
column: 'columns', line: 'line', area: 'line', trendline: 'trendline', anomaly: 'anomaly',
|
|
18
|
+
pie: 'pie', scatter: 'scatter', heatmap: 'heatmap', radar: 'radar', timeline: 'timeline',
|
|
19
|
+
kpi: 'kpi', grid: 'grid', filter: 'filter', somethingUnmapped: 'bars',
|
|
20
|
+
};
|
|
21
|
+
const settle = async (el) => {
|
|
22
|
+
await el.updateComplete;
|
|
23
|
+
await el.updateComplete;
|
|
24
|
+
await new Promise(requestAnimationFrame);
|
|
25
|
+
};
|
|
26
|
+
describe('default skeleton vs empty-state ghost', () => {
|
|
27
|
+
describe('default skeleton (renderChartSkeleton) is unchanged', () => {
|
|
28
|
+
it('takes only the chart type; there is no ghost option on the default path', () => {
|
|
29
|
+
expect(renderChartSkeleton.length).to.equal(1);
|
|
30
|
+
});
|
|
31
|
+
for (const [type, family] of Object.entries(FAMILY_BY_TYPE)) {
|
|
32
|
+
it(`${type} renders the "${family}" skeleton with loading semantics and nothing ghost-related`, () => {
|
|
33
|
+
const sk = mount(renderChartSkeleton(type));
|
|
34
|
+
expect(sk.className).to.equal(`nile-chart-skeleton nile-chart-skeleton--${family}`);
|
|
35
|
+
expect(sk.getAttribute('part')).to.equal(`skeleton skeleton-${family}`);
|
|
36
|
+
expect(sk.getAttribute('aria-busy')).to.equal('true');
|
|
37
|
+
expect(sk.getAttribute('aria-label')).to.equal('Loading chart');
|
|
38
|
+
expect(sk.hasAttribute('aria-hidden')).to.be.false;
|
|
39
|
+
expect(sk.querySelector('.nile-chart-skeleton--ghost')).to.be.null;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
it('line, trendline and anomaly keep their own line shapes (no column substitution)', () => {
|
|
43
|
+
for (const type of ['line', 'area', 'trendline', 'anomaly']) {
|
|
44
|
+
const sk = mount(renderChartSkeleton(type));
|
|
45
|
+
expect(sk.querySelector('.nile-chart-skeleton-line'), type).to.exist;
|
|
46
|
+
expect(sk.querySelector('.nile-chart-skeleton-columns'), type).to.be.null;
|
|
47
|
+
expect(sk.className, type).to.not.contain('--columns');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
it('keeps its axis row, where the ghost has none', () => {
|
|
51
|
+
expect(mount(renderChartSkeleton('column')).querySelector('.nile-chart-skeleton-xaxis-row')).to.exist;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe('ghost (renderChartGhost) is a separate, decorative path', () => {
|
|
55
|
+
it('is hidden from assistive tech and carries no loading semantics', () => {
|
|
56
|
+
const g = mount(renderChartGhost('column'));
|
|
57
|
+
expect(g.getAttribute('aria-hidden')).to.equal('true');
|
|
58
|
+
expect(g.hasAttribute('aria-busy')).to.be.false;
|
|
59
|
+
expect(g.hasAttribute('aria-label')).to.be.false;
|
|
60
|
+
expect(g.classList.contains('nile-chart-skeleton--ghost')).to.be.true;
|
|
61
|
+
expect(g.getAttribute('part')).to.contain('skeleton-ghost');
|
|
62
|
+
});
|
|
63
|
+
it('substitutes solid columns for line, trendline and anomaly (and area) only in ghost mode', () => {
|
|
64
|
+
for (const type of ['line', 'area', 'trendline', 'anomaly']) {
|
|
65
|
+
const g = mount(renderChartGhost(type));
|
|
66
|
+
expect(g.className, type).to.contain('--columns');
|
|
67
|
+
expect(g.querySelector('.nile-chart-skeleton-columns'), type).to.exist;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
it('keeps every other family as it is', () => {
|
|
71
|
+
for (const type of ['column', 'pie', 'scatter', 'heatmap', 'radar', 'timeline', 'kpi', 'grid', 'filter', 'somethingUnmapped']) {
|
|
72
|
+
const g = mount(renderChartGhost(type));
|
|
73
|
+
expect(g.className, type).to.contain(`--${FAMILY_BY_TYPE[type]}`);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('ghost renders leave no trace on later default renders', () => {
|
|
78
|
+
const htmlOf = (tpl) => {
|
|
79
|
+
const host = document.createElement('div');
|
|
80
|
+
render(tpl, host);
|
|
81
|
+
return host.innerHTML;
|
|
82
|
+
};
|
|
83
|
+
const TYPES = [...Object.keys(FAMILY_BY_TYPE), undefined];
|
|
84
|
+
it('a default render after ghost renders is identical to one taken before them', () => {
|
|
85
|
+
const before = TYPES.map((t) => htmlOf(renderChartSkeleton(t)));
|
|
86
|
+
for (const t of TYPES) {
|
|
87
|
+
htmlOf(renderChartGhost(t));
|
|
88
|
+
htmlOf(renderChartGhost(t));
|
|
89
|
+
}
|
|
90
|
+
const after = TYPES.map((t) => htmlOf(renderChartSkeleton(t)));
|
|
91
|
+
expect(after).to.deep.equal(before);
|
|
92
|
+
});
|
|
93
|
+
it('interleaving ghost and default renders for the same type keeps each output stable', () => {
|
|
94
|
+
for (const t of ['line', 'trendline', 'anomaly', 'column']) {
|
|
95
|
+
const skeleton = htmlOf(renderChartSkeleton(t));
|
|
96
|
+
const ghost = htmlOf(renderChartGhost(t));
|
|
97
|
+
expect(htmlOf(renderChartSkeleton(t)), `${t} skeleton`).to.equal(skeleton);
|
|
98
|
+
expect(htmlOf(renderChartGhost(t)), `${t} ghost`).to.equal(ghost);
|
|
99
|
+
expect(skeleton, t).to.not.equal(ghost);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
describe('in <nile-chart>', () => {
|
|
104
|
+
it('loading shows the default skeleton: no ghost wrapper, class, or ghost styles', async () => {
|
|
105
|
+
const el = await fixture(html `<nile-chart loading></nile-chart>`);
|
|
106
|
+
el.config = { chart: { type: 'column', data: [], categories: ['a'] }, aq: {} };
|
|
107
|
+
await settle(el);
|
|
108
|
+
const root = el.shadowRoot;
|
|
109
|
+
const sk = root.querySelector('.nile-chart-skeleton');
|
|
110
|
+
expect(sk).to.exist;
|
|
111
|
+
expect(sk.getAttribute('aria-busy')).to.equal('true');
|
|
112
|
+
expect(root.querySelector('.nile-chart-skeleton--ghost')).to.be.null;
|
|
113
|
+
expect(root.querySelector('.nile-chart-empty__ghost')).to.be.null;
|
|
114
|
+
// Ghost CSS must not apply: the axis row is shown and the fill still animates.
|
|
115
|
+
const xrow = sk.querySelector('.nile-chart-skeleton-xaxis-row');
|
|
116
|
+
expect(getComputedStyle(xrow).display).to.not.equal('none');
|
|
117
|
+
const fill = sk.querySelector('.nile-chart-skeleton-fill');
|
|
118
|
+
expect(getComputedStyle(fill).animationName).to.not.equal('none');
|
|
119
|
+
});
|
|
120
|
+
it('a ghost colour variable on the host does not recolour the default skeleton', async () => {
|
|
121
|
+
const el = await fixture(html `<nile-chart loading style="--nile-chart-ghost-color: rgb(255, 0, 0)"></nile-chart>`);
|
|
122
|
+
el.config = { chart: { type: 'column', data: [], categories: ['a'] }, aq: {} };
|
|
123
|
+
await settle(el);
|
|
124
|
+
const fill = el.shadowRoot.querySelector('.nile-chart-skeleton-fill');
|
|
125
|
+
expect(getComputedStyle(fill).backgroundColor).to.not.equal('rgb(255, 0, 0)');
|
|
126
|
+
});
|
|
127
|
+
it('the empty state shows the ghost, and not the default skeleton', async () => {
|
|
128
|
+
const el = await fixture(html `<nile-chart></nile-chart>`);
|
|
129
|
+
el.config = { chart: { type: 'line', data: [], categories: ['a'] }, aq: {} };
|
|
130
|
+
await settle(el);
|
|
131
|
+
const root = el.shadowRoot;
|
|
132
|
+
expect(root.querySelector('.nile-chart-empty__ghost .nile-chart-skeleton--ghost')).to.exist;
|
|
133
|
+
expect(root.querySelector('.nile-chart-skeleton[aria-busy="true"]')).to.be.null;
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=nile-chart-skeleton.test.js.map
|
|
@@ -1020,6 +1020,129 @@ export const styles = css `
|
|
|
1020
1020
|
justify-content: center;
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
|
+
/* ── Empty state (replaces the plotting area when there is nothing to plot) ── */
|
|
1024
|
+
|
|
1025
|
+
.nile-chart-empty {
|
|
1026
|
+
position: relative;
|
|
1027
|
+
display: flex;
|
|
1028
|
+
flex-direction: column;
|
|
1029
|
+
align-items: center;
|
|
1030
|
+
/* "safe" top-aligns when content is taller than the cell; plain value is the fallback. */
|
|
1031
|
+
justify-content: center;
|
|
1032
|
+
justify-content: safe center;
|
|
1033
|
+
gap: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
1034
|
+
width: 100%;
|
|
1035
|
+
height: 100%;
|
|
1036
|
+
min-height: var(--nile-chart-min-height, var(--nile-height-200px, var(--ng-height-200px)));
|
|
1037
|
+
padding: var(--nile-spacing-3xl, var(--ng-spacing-3xl));
|
|
1038
|
+
box-sizing: border-box;
|
|
1039
|
+
text-align: center;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
:host([fit]) .nile-chart-empty {
|
|
1043
|
+
min-height: 0;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
:host([fit]) .nile-chart-empty__description {
|
|
1047
|
+
-webkit-line-clamp: 3;
|
|
1048
|
+
line-clamp: 3;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/* Ghost behind the message: static, non-interactive. Slot "empty-ghost" replaces it. */
|
|
1052
|
+
.nile-chart-empty__ghost {
|
|
1053
|
+
display: block;
|
|
1054
|
+
position: absolute;
|
|
1055
|
+
inset: 0;
|
|
1056
|
+
pointer-events: none;
|
|
1057
|
+
overflow: hidden;
|
|
1058
|
+
opacity: var(--ng-opacity-20);
|
|
1059
|
+
}
|
|
1060
|
+
.nile-chart-skeleton--ghost {
|
|
1061
|
+
--nile-colors-neutral-400: var(--nile-chart-ghost-color, var(--ng-colors-border-primary));
|
|
1062
|
+
--nile-colors-neutral-300: var(--ng-colors-border-secondary);
|
|
1063
|
+
}
|
|
1064
|
+
/* Shapes only: no axis rules, axis labels or legend. */
|
|
1065
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-xaxis-row,
|
|
1066
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-ylabel-sk,
|
|
1067
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-legend { display: none; }
|
|
1068
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-body,
|
|
1069
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-columns,
|
|
1070
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-scatter { padding-left: 0; }
|
|
1071
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-body::before,
|
|
1072
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-columns::before,
|
|
1073
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-columns::after,
|
|
1074
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-scatter::before,
|
|
1075
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-scatter::after { display: none; }
|
|
1076
|
+
/* Static. */
|
|
1077
|
+
.nile-chart-skeleton--ghost *,
|
|
1078
|
+
.nile-chart-skeleton--ghost *::before,
|
|
1079
|
+
.nile-chart-skeleton--ghost *::after,
|
|
1080
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-kpi-spark path { animation: none; }
|
|
1081
|
+
.nile-chart-skeleton--ghost nile-skeleton-loader::part(skeleton) { animation: none; opacity: 1; }
|
|
1082
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-fill,
|
|
1083
|
+
.nile-chart-skeleton--ghost .nile-chart-skeleton-radar-data { opacity: 1; }
|
|
1084
|
+
.nile-chart-empty__ghost ::slotted(*) {
|
|
1085
|
+
width: 100%;
|
|
1086
|
+
height: 100%;
|
|
1087
|
+
object-fit: contain;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/* <nile-lite-tooltip> wrappers around the title / description. */
|
|
1091
|
+
.nile-chart-empty__tip {
|
|
1092
|
+
position: relative;
|
|
1093
|
+
z-index: 1;
|
|
1094
|
+
display: flex;
|
|
1095
|
+
flex-direction: column;
|
|
1096
|
+
flex-shrink: 0;
|
|
1097
|
+
max-width: 100%;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
.nile-chart-empty__tip[hidden] {
|
|
1101
|
+
display: none;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/* Gray badge around the title; a slotted empty-title changes the text, not the badge. Style it with ::part(empty-badge). */
|
|
1105
|
+
.nile-chart-empty__badge {
|
|
1106
|
+
display: inline;
|
|
1107
|
+
box-decoration-break: clone;
|
|
1108
|
+
-webkit-box-decoration-break: clone;
|
|
1109
|
+
padding: var(--ng-spacing-xxs) var(--ng-spacing-md-alt);
|
|
1110
|
+
border: var(--ng-border-width-1) solid var(--ng-componentcolors-utility-gray-300);
|
|
1111
|
+
border-radius: var(--ng-radius-full);
|
|
1112
|
+
background: var(--ng-componentcolors-utility-gray-50);
|
|
1113
|
+
color: var(--ng-componentcolors-utility-gray-700);
|
|
1114
|
+
font-size: var(--ng-font-size-text-sm);
|
|
1115
|
+
font-weight: var(--ng-font-weight-medium);
|
|
1116
|
+
}
|
|
1117
|
+
/* A long title clamps to two lines with an ellipsis; the tooltip shows it in full. */
|
|
1118
|
+
.nile-chart-empty__title {
|
|
1119
|
+
display: -webkit-box;
|
|
1120
|
+
-webkit-box-orient: vertical;
|
|
1121
|
+
-webkit-line-clamp: 2;
|
|
1122
|
+
line-clamp: 2;
|
|
1123
|
+
overflow: hidden;
|
|
1124
|
+
overflow-wrap: anywhere;
|
|
1125
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
1126
|
+
font-size: var(--nile-type-scale-4, var(--ng-font-size-text-md));
|
|
1127
|
+
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
1128
|
+
line-height: 1.4;
|
|
1129
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/* nile-chart-empty.ts sets an inline line-clamp when it must cut the text; otherwise no clamp (3 lines in fit mode). */
|
|
1133
|
+
.nile-chart-empty__description {
|
|
1134
|
+
display: -webkit-box;
|
|
1135
|
+
-webkit-box-orient: vertical;
|
|
1136
|
+
-webkit-line-clamp: none;
|
|
1137
|
+
line-clamp: none;
|
|
1138
|
+
overflow: hidden;
|
|
1139
|
+
overflow-wrap: anywhere;
|
|
1140
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
1141
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
1142
|
+
line-height: 1.5;
|
|
1143
|
+
color: var(--nile-colors-neutral-500, var(--ng-colors-text-tertiary-600));
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1023
1146
|
@media (prefers-reduced-motion: reduce) {
|
|
1024
1147
|
.nile-chart-skeleton-line-area,
|
|
1025
1148
|
.nile-chart-skeleton-line-stroke,
|
|
@@ -186,7 +186,14 @@ export declare class NileChart extends NileElement {
|
|
|
186
186
|
/** Resolve { chart, aq } input to flat NileChartConfig. */
|
|
187
187
|
private resolveConfig;
|
|
188
188
|
private resolvedConfig;
|
|
189
|
+
private gridLineStrengthFromConfig;
|
|
190
|
+
/** Sets the gridline strength variable from the config (number → %, or a `%` string). Only a value set here is ever removed, so a CSS variable set in markup is left alone. */
|
|
191
|
+
private applyGridLineStrength;
|
|
189
192
|
protected updated(changedProperties: PropertyValues): void;
|
|
193
|
+
private _emptyEl;
|
|
194
|
+
private _emptyObs;
|
|
195
|
+
/** Keeps the empty state's truncation tooltips in step with its size and slotted text. */
|
|
196
|
+
private _syncEmptyState;
|
|
190
197
|
private closeMenu;
|
|
191
198
|
private toggleChat;
|
|
192
199
|
/** Push an AI response into the chat panel. Call this from your AI handler. */
|
|
@@ -262,6 +269,7 @@ export declare class NileChart extends NileElement {
|
|
|
262
269
|
private _initEcharts;
|
|
263
270
|
private renderChartContent;
|
|
264
271
|
private renderSkeleton;
|
|
272
|
+
private renderEmptyState;
|
|
265
273
|
render(): TemplateResult;
|
|
266
274
|
}
|
|
267
275
|
declare global {
|
|
@@ -8,6 +8,7 @@ import { styles, tooltipCss, injectGlobalChartMenuOverrides } from './nile-chart
|
|
|
8
8
|
import { HIGHCHARTS_PASSTHROUGH_KEYS } from '../internal/types/index.js';
|
|
9
9
|
import { nileChartConfig } from './nile-chart-config-builder.js';
|
|
10
10
|
import { renderChartSkeleton } from './nile-chart-skeleton.js';
|
|
11
|
+
import { isChartEmpty, renderChartEmptyState, syncChartEmptyTruncation } from './nile-chart-empty.js';
|
|
11
12
|
import { convertConfig } from '../internal/utils/chart-adapters.js';
|
|
12
13
|
import { deepMerge } from '../internal/utils/deep-merge.js';
|
|
13
14
|
import { initNileChartExporting, getHighcharts } from '../internal/utils/highcharts-provider.js';
|
|
@@ -284,6 +285,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
284
285
|
}
|
|
285
286
|
};
|
|
286
287
|
this.resolvedConfig = null;
|
|
288
|
+
this.gridLineStrengthFromConfig = false;
|
|
289
|
+
this._emptyEl = null;
|
|
290
|
+
this._emptyObs = null;
|
|
287
291
|
// The tooltip is fixed to the viewport and placed once, so any scroll (including a touch-drag while the
|
|
288
292
|
// finger is still down, when no leave/blur fires) would strand it away from its anchor. Hide it instead.
|
|
289
293
|
this._onViewportMove = () => this._hideHeaderTip();
|
|
@@ -394,6 +398,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
394
398
|
this._headerTipEl = null;
|
|
395
399
|
this._headerResizeObs?.disconnect();
|
|
396
400
|
this._headerResizeObs = null;
|
|
401
|
+
this._emptyObs?.disconnect();
|
|
402
|
+
this._emptyObs = null;
|
|
403
|
+
this._emptyEl = null;
|
|
397
404
|
this._teardownExtremesEvents();
|
|
398
405
|
this._disposeEcharts();
|
|
399
406
|
this._readyResolvers = [];
|
|
@@ -414,6 +421,18 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
414
421
|
}
|
|
415
422
|
return this.mergeChartTypeFromAttr({ ...input });
|
|
416
423
|
}
|
|
424
|
+
/** Sets the gridline strength variable from the config (number → %, or a `%` string). Only a value set here is ever removed, so a CSS variable set in markup is left alone. */
|
|
425
|
+
applyGridLineStrength(value) {
|
|
426
|
+
const pct = typeof value === 'number' ? `${value}%` : typeof value === 'string' ? value.trim() : '';
|
|
427
|
+
if (/^\d+(\.\d+)?%$/.test(pct) && parseFloat(pct) <= 100) {
|
|
428
|
+
this.style.setProperty('--nile-chart-grid-line-strength', pct);
|
|
429
|
+
this.gridLineStrengthFromConfig = true;
|
|
430
|
+
}
|
|
431
|
+
else if (this.gridLineStrengthFromConfig) {
|
|
432
|
+
this.style.removeProperty('--nile-chart-grid-line-strength');
|
|
433
|
+
this.gridLineStrengthFromConfig = false;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
417
436
|
updated(changedProperties) {
|
|
418
437
|
if (changedProperties.has('engine')) {
|
|
419
438
|
this._echartsFallback = false; // re-evaluate on every engine flip
|
|
@@ -439,6 +458,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
439
458
|
this.noBorder = resolved.noBorder === true;
|
|
440
459
|
if (resolved.appearance && this.appearance !== resolved.appearance)
|
|
441
460
|
this.appearance = resolved.appearance;
|
|
461
|
+
this.applyGridLineStrength(resolved.gridLineStrength);
|
|
442
462
|
}
|
|
443
463
|
if (this.activeType) {
|
|
444
464
|
this.setAttribute('data-active-type', this.activeType);
|
|
@@ -453,6 +473,27 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
453
473
|
this.toggleAttribute('data-has-date-picker', hasDatePicker);
|
|
454
474
|
// Keep truncated-title focusability in sync after any re-render.
|
|
455
475
|
this._syncHeaderTruncationA11y();
|
|
476
|
+
this._syncEmptyState();
|
|
477
|
+
}
|
|
478
|
+
/** Keeps the empty state's truncation tooltips in step with its size and slotted text. */
|
|
479
|
+
_syncEmptyState() {
|
|
480
|
+
const el = this.shadowRoot?.querySelector('.nile-chart-empty') ?? null;
|
|
481
|
+
if (el !== this._emptyEl) {
|
|
482
|
+
this._emptyObs?.disconnect();
|
|
483
|
+
this._emptyEl = el;
|
|
484
|
+
if (el) {
|
|
485
|
+
if (!this._emptyObs) {
|
|
486
|
+
this._emptyObs = new ResizeObserver(() => {
|
|
487
|
+
if (this._emptyEl)
|
|
488
|
+
syncChartEmptyTruncation(this._emptyEl);
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
this._emptyObs.observe(el);
|
|
492
|
+
el.addEventListener('slotchange', () => syncChartEmptyTruncation(el));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
if (el)
|
|
496
|
+
syncChartEmptyTruncation(el);
|
|
456
497
|
}
|
|
457
498
|
closeMenu() {
|
|
458
499
|
const dropdown = this.shadowRoot?.querySelector('.nile-chart-menu-anchor');
|
|
@@ -2310,19 +2351,32 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
2310
2351
|
renderSkeleton() {
|
|
2311
2352
|
return renderChartSkeleton(this.activeConfig?.type);
|
|
2312
2353
|
}
|
|
2354
|
+
renderEmptyState() {
|
|
2355
|
+
const cfg = this.activeConfig;
|
|
2356
|
+
return renderChartEmptyState({
|
|
2357
|
+
type: cfg?.type,
|
|
2358
|
+
ghost: cfg?.emptyGhost !== false,
|
|
2359
|
+
height: this.hasAttribute('fit') ? undefined : cfg?.height,
|
|
2360
|
+
minHeight: cfg?.chartMinHeight,
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2313
2363
|
render() {
|
|
2314
2364
|
const isLoading = this.loading || (this.activeConfig?.loading ?? false);
|
|
2365
|
+
// Loading always wins over empty.
|
|
2366
|
+
const isEmpty = !isLoading && isChartEmpty(this.activeConfig);
|
|
2315
2367
|
const isGrid = this.activeConfig?.type === 'grid';
|
|
2316
2368
|
return html `
|
|
2317
|
-
<div class="nile-chart-card ${isGrid ? 'nile-chart-card--grid' : ''} ${isLoading ? 'nile-chart-card--loading' : ''} ${this.activeConfig?.type === 'kpi' ? 'nile-chart-card--kpi' : ''}" part="chart-card">
|
|
2369
|
+
<div class="nile-chart-card ${isGrid ? 'nile-chart-card--grid' : ''} ${isLoading ? 'nile-chart-card--loading' : ''} ${isEmpty ? 'nile-chart-card--empty' : ''} ${this.activeConfig?.type === 'kpi' ? 'nile-chart-card--kpi' : ''}" part="chart-card">
|
|
2318
2370
|
${this.renderHeader()}
|
|
2319
2371
|
<div class="nile-chart-wrapper" part="chart-body">
|
|
2320
2372
|
<div class="nile-chart-inner ${this.activeConfig?.type === 'kpi' ? 'nile-chart-inner--kpi' : ''} ${this.activeConfig?.type === 'filter' ? 'nile-chart-inner--filter' : ''}" part="chart-inner">
|
|
2321
2373
|
${isLoading
|
|
2322
2374
|
? this.renderSkeleton()
|
|
2323
|
-
:
|
|
2324
|
-
? this.
|
|
2325
|
-
:
|
|
2375
|
+
: isEmpty
|
|
2376
|
+
? this.renderEmptyState()
|
|
2377
|
+
: this.activeConfig
|
|
2378
|
+
? this.renderChartContent()
|
|
2379
|
+
: html `<slot></slot>`}
|
|
2326
2380
|
${isGrid ? nothing : this.renderAiPanel()}
|
|
2327
2381
|
</div>
|
|
2328
2382
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aquera/nile-visualization",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.39",
|
|
4
4
|
"description": "A visualization Library for the Nile Design System",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aquera Inc",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"echarts": "^6.1.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"highcharts": "
|
|
71
|
+
"highcharts": "13.1.1",
|
|
72
72
|
"@aquera/nile-data-grid": ">=0.1.0",
|
|
73
73
|
"@aquera/nile-elements": ">=0.1.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@aquera/nile-glyph": "^1.0.
|
|
76
|
+
"@aquera/nile-glyph": "^1.0.13",
|
|
77
77
|
"@rollup/plugin-babel": "^6.0.3",
|
|
78
78
|
"@rollup/plugin-commonjs": "^25.0.3",
|
|
79
79
|
"@rollup/plugin-node-resolve": "^15.0.1",
|