@aquera/nile-visualization 2.9.16 → 2.9.17
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 +3 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +6 -0
- package/dist/src/nile-chart/nile-chart.js +5 -0
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +11 -0
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +165 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,9 @@ 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.17 (June 04, 2026)
|
|
40
|
+
- Nile Chart: Fixed the drilldown navigation issue and added pagination in nile-chart data-grid (UIF-1255)
|
|
41
|
+
|
|
39
42
|
#### Version 2.9.16 (June 03, 2026)
|
|
40
43
|
- Nile Chart: Added Portal Property in Menu. (UIF-1253)
|
|
41
44
|
|
|
@@ -273,6 +273,12 @@ export interface NileGridChartConfig extends NileChartConfigBase {
|
|
|
273
273
|
emptyMessage?: string;
|
|
274
274
|
loadingMessage?: string;
|
|
275
275
|
noMatchMessage?: string;
|
|
276
|
+
paginationEnabled?: boolean;
|
|
277
|
+
pagination?: {
|
|
278
|
+
pageIndex: number;
|
|
279
|
+
pageSize: number;
|
|
280
|
+
};
|
|
281
|
+
pageSizeOptions?: number[];
|
|
276
282
|
}
|
|
277
283
|
export interface NileTrendlineChartConfig extends NileChartConfigBase {
|
|
278
284
|
type: 'trendline';
|
|
@@ -100,6 +100,8 @@ const CORE_CHART_LABELS = {
|
|
|
100
100
|
kpi: 'KPI',
|
|
101
101
|
grid: 'Grid',
|
|
102
102
|
};
|
|
103
|
+
const DEFAULT_GRID_PAGINATION = { pageIndex: 0, pageSize: 10 };
|
|
104
|
+
const DEFAULT_GRID_PAGE_SIZE_OPTIONS = [5, 10, 20, 50];
|
|
103
105
|
function chartTypeLabel(type) {
|
|
104
106
|
const hit = CORE_CHART_LABELS[type];
|
|
105
107
|
if (hit)
|
|
@@ -1732,6 +1734,9 @@ let NileChart = class NileChart extends NileElement {
|
|
|
1732
1734
|
.emptyMessage=${config.emptyMessage ?? 'No data'}
|
|
1733
1735
|
.loadingMessage=${config.loadingMessage ?? 'Loading…'}
|
|
1734
1736
|
.noMatchMessage=${config.noMatchMessage ?? 'No matching rows'}
|
|
1737
|
+
.paginationEnabled=${config.paginationEnabled ?? false}
|
|
1738
|
+
.pagination=${config.pagination ?? DEFAULT_GRID_PAGINATION}
|
|
1739
|
+
.pageSizeOptions=${config.pageSizeOptions ?? DEFAULT_GRID_PAGE_SIZE_OPTIONS}
|
|
1735
1740
|
style=${gridChrome}
|
|
1736
1741
|
></nile-data-grid>`;
|
|
1737
1742
|
}
|
|
@@ -21,6 +21,13 @@ export declare class NileColumnDrilldownChart extends NileElement {
|
|
|
21
21
|
private _hc;
|
|
22
22
|
private chart;
|
|
23
23
|
private resizeObserver;
|
|
24
|
+
private _bcCollapsed;
|
|
25
|
+
private _bcTooltip;
|
|
26
|
+
private _bcLastText;
|
|
27
|
+
private _bcWidth;
|
|
28
|
+
private _bcPathKey;
|
|
29
|
+
private _bcExpandTimer;
|
|
30
|
+
private _bcMeasuring;
|
|
24
31
|
private chartContainer;
|
|
25
32
|
config: SeparatedChartConfigInputType | null;
|
|
26
33
|
chartTitle: string;
|
|
@@ -53,6 +60,10 @@ export declare class NileColumnDrilldownChart extends NileElement {
|
|
|
53
60
|
protected firstUpdated(): void;
|
|
54
61
|
protected updated(changedProperties: PropertyValues): void;
|
|
55
62
|
private setupResizeObserver;
|
|
63
|
+
private breadcrumbNames;
|
|
64
|
+
private syncBreadcrumbCollapse;
|
|
65
|
+
private ensureBcTooltip;
|
|
66
|
+
private applyBreadcrumbTooltips;
|
|
56
67
|
private buildOptions;
|
|
57
68
|
private initChart;
|
|
58
69
|
private destroyChart;
|
|
@@ -6,12 +6,29 @@ import { applySeparatedChartConfig } from '../internal/separated-chart-config.js
|
|
|
6
6
|
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
7
7
|
import { deepMerge } from '../internal/utils.js';
|
|
8
8
|
import { styles } from './nile-column-drilldown-chart.css.js';
|
|
9
|
+
import { tooltipCss } from '../nile-chart/nile-chart.css.js';
|
|
10
|
+
let _bcTooltipStylesInjected = false;
|
|
11
|
+
function ensureBcTooltipStyles() {
|
|
12
|
+
if (_bcTooltipStylesInjected || typeof document === 'undefined')
|
|
13
|
+
return;
|
|
14
|
+
const style = document.createElement('style');
|
|
15
|
+
style.dataset['nilechart'] = '';
|
|
16
|
+
style.textContent = tooltipCss;
|
|
17
|
+
document.head.appendChild(style);
|
|
18
|
+
_bcTooltipStylesInjected = true;
|
|
19
|
+
}
|
|
9
20
|
let NileColumnDrilldownChart = class NileColumnDrilldownChart extends NileElement {
|
|
10
21
|
constructor() {
|
|
11
22
|
super(...arguments);
|
|
12
23
|
this._hc = null;
|
|
13
24
|
this.chart = null;
|
|
14
25
|
this.resizeObserver = null;
|
|
26
|
+
this._bcCollapsed = false;
|
|
27
|
+
this._bcTooltip = null;
|
|
28
|
+
this._bcLastText = '';
|
|
29
|
+
this._bcWidth = 0;
|
|
30
|
+
this._bcPathKey = '';
|
|
31
|
+
this._bcMeasuring = false;
|
|
15
32
|
this.config = null;
|
|
16
33
|
this.chartTitle = '';
|
|
17
34
|
this.chartSubtitle = '';
|
|
@@ -73,6 +90,9 @@ let NileColumnDrilldownChart = class NileColumnDrilldownChart extends NileElemen
|
|
|
73
90
|
this.destroyChart();
|
|
74
91
|
this.resizeObserver?.disconnect();
|
|
75
92
|
this.resizeObserver = null;
|
|
93
|
+
this._bcTooltip?.remove();
|
|
94
|
+
this._bcTooltip = null;
|
|
95
|
+
clearTimeout(this._bcExpandTimer);
|
|
76
96
|
}
|
|
77
97
|
firstUpdated() {
|
|
78
98
|
this._syncCssVars();
|
|
@@ -120,6 +140,130 @@ let NileColumnDrilldownChart = class NileColumnDrilldownChart extends NileElemen
|
|
|
120
140
|
this.resizeObserver = new ResizeObserver(() => this.chart?.reflow());
|
|
121
141
|
this.resizeObserver.observe(this.chartContainer);
|
|
122
142
|
}
|
|
143
|
+
breadcrumbNames(chart) {
|
|
144
|
+
const list = chart.breadcrumbs?.list ?? [];
|
|
145
|
+
return list.map(b => b.levelOptions?.name || this.seriesName || 'Series');
|
|
146
|
+
}
|
|
147
|
+
syncBreadcrumbCollapse(chart) {
|
|
148
|
+
const bc = chart.breadcrumbs;
|
|
149
|
+
const list = bc?.list ?? [];
|
|
150
|
+
if (!bc || list.length < 2 || !bc.group)
|
|
151
|
+
return;
|
|
152
|
+
const names = this.breadcrumbNames(chart);
|
|
153
|
+
const fullLast = names[names.length - 1];
|
|
154
|
+
const pathKey = names.join('/');
|
|
155
|
+
const limit = chart.chartWidth - 8;
|
|
156
|
+
let collapsed = this._bcCollapsed;
|
|
157
|
+
let lastText = this._bcLastText || fullLast;
|
|
158
|
+
const widthGrew = chart.chartWidth > this._bcWidth;
|
|
159
|
+
const pathChanged = pathKey !== this._bcPathKey;
|
|
160
|
+
this._bcWidth = chart.chartWidth;
|
|
161
|
+
this._bcPathKey = pathKey;
|
|
162
|
+
if (pathChanged) {
|
|
163
|
+
collapsed = false;
|
|
164
|
+
lastText = fullLast;
|
|
165
|
+
}
|
|
166
|
+
else if (widthGrew) {
|
|
167
|
+
if (collapsed) {
|
|
168
|
+
clearTimeout(this._bcExpandTimer);
|
|
169
|
+
this._bcExpandTimer = setTimeout(() => {
|
|
170
|
+
const liveBc = this.chart === chart ? chart.breadcrumbs : null;
|
|
171
|
+
if (!liveBc || (liveBc.list?.length ?? 0) < 2 || !this._bcCollapsed)
|
|
172
|
+
return;
|
|
173
|
+
const liveNames = this.breadcrumbNames(chart);
|
|
174
|
+
this._bcMeasuring = true;
|
|
175
|
+
this._bcCollapsed = false;
|
|
176
|
+
this._bcLastText = liveNames[liveNames.length - 1];
|
|
177
|
+
liveBc.group?.attr({ opacity: 0 });
|
|
178
|
+
liveBc.update({});
|
|
179
|
+
chart.redraw(false);
|
|
180
|
+
}, 200);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
const box = bc.group.getBBox();
|
|
185
|
+
const right = (bc.group.translateX ?? 0) + box.x + box.width;
|
|
186
|
+
const overflow = right - limit;
|
|
187
|
+
if (overflow > 0) {
|
|
188
|
+
if (!collapsed) {
|
|
189
|
+
collapsed = true;
|
|
190
|
+
lastText = fullLast;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const levels = Object.keys(bc.elementList ?? {}).map(Number);
|
|
194
|
+
const lastButton = levels.length ? bc.elementList[Math.max(...levels)]?.button : null;
|
|
195
|
+
const buttonWidth = lastButton?.getBBox()?.width ?? 60;
|
|
196
|
+
const avgCharWidth = Math.max(4, buttonWidth / Math.max(1, lastText.length));
|
|
197
|
+
const removeCount = Math.ceil(overflow / avgCharWidth) + 1;
|
|
198
|
+
const base = lastText.endsWith('…') ? lastText.slice(0, -1) : lastText;
|
|
199
|
+
lastText = `${base.slice(0, Math.max(1, base.length - removeCount))}…`;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (collapsed === this._bcCollapsed && lastText === this._bcLastText) {
|
|
204
|
+
if (this._bcMeasuring) {
|
|
205
|
+
this._bcMeasuring = false;
|
|
206
|
+
bc.group.attr({ opacity: 1 });
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
this._bcCollapsed = collapsed;
|
|
211
|
+
this._bcLastText = lastText;
|
|
212
|
+
requestAnimationFrame(() => {
|
|
213
|
+
const liveBc = this.chart === chart ? chart.breadcrumbs : null;
|
|
214
|
+
if (!liveBc)
|
|
215
|
+
return;
|
|
216
|
+
liveBc.update({}); // marks breadcrumbs dirty → re-runs the formatter on redraw
|
|
217
|
+
chart.redraw(false);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
ensureBcTooltip() {
|
|
221
|
+
if (!this._bcTooltip || !this._bcTooltip.isConnected) {
|
|
222
|
+
ensureBcTooltipStyles();
|
|
223
|
+
const tip = document.createElement('div');
|
|
224
|
+
tip.className = 'nile-chart-header-tooltip';
|
|
225
|
+
document.body.appendChild(tip); // on body — never clipped by the chart card
|
|
226
|
+
this._bcTooltip = tip;
|
|
227
|
+
}
|
|
228
|
+
return this._bcTooltip;
|
|
229
|
+
}
|
|
230
|
+
applyBreadcrumbTooltips(chart) {
|
|
231
|
+
const bc = chart.breadcrumbs;
|
|
232
|
+
if (!bc || (bc.list?.length ?? 0) < 2 || !this._bcCollapsed) {
|
|
233
|
+
if (this._bcTooltip)
|
|
234
|
+
this._bcTooltip.style.display = 'none';
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
for (const key of Object.keys(bc.elementList ?? {})) {
|
|
238
|
+
const buttonEl = bc.elementList[key]?.button?.element;
|
|
239
|
+
if (!buttonEl || buttonEl.__nileBcTooltipBound)
|
|
240
|
+
continue;
|
|
241
|
+
buttonEl.__nileBcTooltipBound = true;
|
|
242
|
+
const level = Number(key);
|
|
243
|
+
buttonEl.addEventListener('mouseenter', () => {
|
|
244
|
+
if (!this._bcCollapsed || !this.chart)
|
|
245
|
+
return;
|
|
246
|
+
const list = this.chart.breadcrumbs?.list ?? [];
|
|
247
|
+
const idx = list.findIndex(b => b.level === level);
|
|
248
|
+
if (idx < 0)
|
|
249
|
+
return;
|
|
250
|
+
const name = this.breadcrumbNames(this.chart)[idx];
|
|
251
|
+
const isLast = idx === list.length - 1;
|
|
252
|
+
if (isLast && this._bcLastText === name)
|
|
253
|
+
return;
|
|
254
|
+
const tip = this.ensureBcTooltip();
|
|
255
|
+
const buttonRect = buttonEl.getBoundingClientRect();
|
|
256
|
+
tip.textContent = name;
|
|
257
|
+
tip.style.left = `${buttonRect.left + buttonRect.width / 2}px`;
|
|
258
|
+
tip.style.top = `${buttonRect.top}px`;
|
|
259
|
+
tip.style.display = 'block';
|
|
260
|
+
});
|
|
261
|
+
buttonEl.addEventListener('mouseleave', () => {
|
|
262
|
+
if (this._bcTooltip)
|
|
263
|
+
this._bcTooltip.style.display = 'none';
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
123
267
|
buildOptions() {
|
|
124
268
|
const self = this;
|
|
125
269
|
const drilldown = {
|
|
@@ -129,9 +273,29 @@ let NileColumnDrilldownChart = class NileColumnDrilldownChart extends NileElemen
|
|
|
129
273
|
name: ds.name,
|
|
130
274
|
data: ds.data.map(d => ({ name: d.name, y: d.y })),
|
|
131
275
|
})),
|
|
276
|
+
breadcrumbs: {
|
|
277
|
+
formatter(breadcrumb) {
|
|
278
|
+
const name = breadcrumb?.levelOptions?.name || self.seriesName || 'Series';
|
|
279
|
+
const list = self.chart?.breadcrumbs?.list ?? [];
|
|
280
|
+
const isLast = !list.length || breadcrumb.level === list[list.length - 1].level;
|
|
281
|
+
if (!self._bcCollapsed)
|
|
282
|
+
return name;
|
|
283
|
+
if (!isLast)
|
|
284
|
+
return '..';
|
|
285
|
+
const stored = self._bcLastText;
|
|
286
|
+
return stored && name.startsWith(stored.replace(/…$/, '')) ? stored : name;
|
|
287
|
+
},
|
|
288
|
+
},
|
|
132
289
|
};
|
|
133
290
|
return deepMerge({
|
|
134
|
-
chart: { type: 'column', ...(this.height ? { height: this.height } : {})
|
|
291
|
+
chart: { type: 'column', ...(this.height ? { height: this.height } : {}),
|
|
292
|
+
events: {
|
|
293
|
+
render() {
|
|
294
|
+
self.syncBreadcrumbCollapse(this);
|
|
295
|
+
self.applyBreadcrumbTooltips(this);
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
135
299
|
title: { text: this.chartTitle || undefined },
|
|
136
300
|
subtitle: { text: this.chartSubtitle || undefined },
|
|
137
301
|
xAxis: { type: 'category' },
|