@aquera/nile-visualization 2.9.15 → 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 +6 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +6 -0
- package/dist/src/nile-chart/nile-chart.css.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart.css.js +54 -71
- package/dist/src/nile-chart/nile-chart.d.ts +1 -2
- package/dist/src/nile-chart/nile-chart.js +52 -47
- 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,12 @@ 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
|
+
|
|
42
|
+
#### Version 2.9.16 (June 03, 2026)
|
|
43
|
+
- Nile Chart: Added Portal Property in Menu. (UIF-1253)
|
|
44
|
+
|
|
39
45
|
#### Version 2.9.15 (June 02, 2026)
|
|
40
46
|
- Nile Filter Chart: Filter chip fixes (UIF-1250)
|
|
41
47
|
|
|
@@ -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';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
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: nowrap;\n z-index: 2147483647;\n box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));\n }\n .nile-chart-header-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 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
|
+
export declare function injectGlobalChartMenuOverrides(): void;
|
|
2
3
|
export declare const styles: import("lit").CSSResult;
|
|
@@ -28,6 +28,58 @@ export const tooltipCss = `
|
|
|
28
28
|
border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
|
+
const MENU_OVERRIDE_CSS = `
|
|
32
|
+
nile-menu.nile-chart-actions-menu {
|
|
33
|
+
min-width: var(--nile-width-140px, var(--ng-height-140px, 140px));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
nile-menu.nile-chart-actions-menu nile-menu-item.nile-chart-actions-menu-item::part(base) {
|
|
37
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
38
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
39
|
+
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
40
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
nile-menu.nile-chart-actions-menu nile-menu-item.nile-chart-actions-menu-item[active]::part(label) {
|
|
44
|
+
color: var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
nile-menu.nile-chart-actions-menu .nile-chart-actions-menu-glyph {
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-quaternary-500));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
nile-menu.nile-chart-actions-menu .nile-chart-actions-menu-separator {
|
|
55
|
+
height: var(--nile-border-width-1, var(--ng-stroke-width-1, 1px));
|
|
56
|
+
background: var(--nile-colors-neutral-200, var(--ng-colors-border-secondary));
|
|
57
|
+
margin: var(--nile-spacing-md, var(--ng-spacing-md, 8px));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
nile-menu.nile-chart-actions-menu .nile-chart-actions-menu-group-header {
|
|
61
|
+
display: block;
|
|
62
|
+
padding: var(--nile-spacing-md, var(--ng-spacing-md, 8px)) var(--nile-spacing-14px, var(--ng-spacing-3-5, 14px)) var(--nile-spacing-xs, var(--ng-spacing-xs, 4px));
|
|
63
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
64
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
65
|
+
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
66
|
+
color: var(--nile-colors-neutral-500, var(--ng-colors-text-tertiary-600));
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
user-select: none;
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
export function injectGlobalChartMenuOverrides() {
|
|
72
|
+
if (typeof document === 'undefined')
|
|
73
|
+
return;
|
|
74
|
+
const STYLE_ID = 'nile-chart-actions-menu-overrides';
|
|
75
|
+
if (document.getElementById(STYLE_ID))
|
|
76
|
+
return;
|
|
77
|
+
const style = document.createElement('style');
|
|
78
|
+
style.id = STYLE_ID;
|
|
79
|
+
style.textContent = MENU_OVERRIDE_CSS;
|
|
80
|
+
document.head?.appendChild(style);
|
|
81
|
+
}
|
|
82
|
+
injectGlobalChartMenuOverrides();
|
|
31
83
|
export const styles = css `
|
|
32
84
|
:host {
|
|
33
85
|
display: block;
|
|
@@ -321,7 +373,7 @@ export const styles = css `
|
|
|
321
373
|
/* ── Actions Menu (in header) ── */
|
|
322
374
|
|
|
323
375
|
.nile-chart-menu-anchor {
|
|
324
|
-
|
|
376
|
+
display: inline-flex;
|
|
325
377
|
}
|
|
326
378
|
|
|
327
379
|
.nile-chart-menu-trigger {
|
|
@@ -349,76 +401,7 @@ export const styles = css `
|
|
|
349
401
|
outline-offset: var(--nile-spacing-1px, var(--ng-outline-offset-1));
|
|
350
402
|
}
|
|
351
403
|
|
|
352
|
-
|
|
353
|
-
position: absolute;
|
|
354
|
-
top: 100%;
|
|
355
|
-
right: 0;
|
|
356
|
-
margin-top: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
357
|
-
min-width: var(--nile-width-140px, var(--ng-height-140px));
|
|
358
|
-
background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
359
|
-
border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
360
|
-
border-radius: var(--nile-radius-radius-xl, var(--ng-radius-md));
|
|
361
|
-
box-shadow: var(--nile-box-shadow-7, var(--ng-shadow-md));
|
|
362
|
-
padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) 0;
|
|
363
|
-
overflow: hidden;
|
|
364
|
-
z-index: 10;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.nile-chart-menu-item {
|
|
368
|
-
display: flex;
|
|
369
|
-
align-items: center;
|
|
370
|
-
gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
|
|
371
|
-
width: 100%;
|
|
372
|
-
padding: var(--nile-spacing-md, var(--ng-spacing-md)) var(--nile-spacing-14px, var(--ng-spacing-3-5));
|
|
373
|
-
border: none;
|
|
374
|
-
background: none;
|
|
375
|
-
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
376
|
-
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
377
|
-
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
378
|
-
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
379
|
-
text-align: left;
|
|
380
|
-
cursor: pointer;
|
|
381
|
-
transition: background var(--nile-transition-duration-short, var(--ng-transition-duration-fast)) ease;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.nile-chart-menu-item-glyph {
|
|
385
|
-
flex-shrink: 0;
|
|
386
|
-
color: var(--nile-colors-neutral-700, var(--ng-colors-text-quaternary-500));
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.nile-chart-menu-item:hover {
|
|
390
|
-
background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary));
|
|
391
|
-
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.nile-chart-menu-item.active {
|
|
395
|
-
color: var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
|
|
396
|
-
font-weight: 600;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
.nile-chart-menu-item:focus-visible {
|
|
400
|
-
outline: var(--nile-border-width-2, var(--ng-stroke-width-2)) solid var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
|
|
401
|
-
outline-offset: calc(var(--nile-spacing-2px, var(--ng-outline-offset-2)) * -1);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.nile-chart-menu-separator {
|
|
405
|
-
height: var(--nile-border-width-1, var(--ng-stroke-width-1));
|
|
406
|
-
background: var(--nile-colors-neutral-200, var(--ng-colors-border-secondary));
|
|
407
|
-
margin: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
.nile-chart-menu-group-header {
|
|
411
|
-
display: block;
|
|
412
|
-
padding: var(--nile-spacing-md, var(--ng-spacing-md)) var(--nile-spacing-14px, var(--ng-spacing-3-5)) var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
413
|
-
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
414
|
-
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
415
|
-
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
416
|
-
color: var(--nile-colors-neutral-500, var(--ng-colors-text-tertiary-600));
|
|
417
|
-
pointer-events: none;
|
|
418
|
-
user-select: none;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/* ── AI Chat Trigger (in header) ── */
|
|
404
|
+
|
|
422
405
|
|
|
423
406
|
.nile-ai-trigger {
|
|
424
407
|
display: inline-flex;
|
|
@@ -88,7 +88,6 @@ export declare class NileChart extends NileElement {
|
|
|
88
88
|
menu: NileChartMenuConfig | null;
|
|
89
89
|
private activeType;
|
|
90
90
|
private activeConfig;
|
|
91
|
-
private menuOpen;
|
|
92
91
|
private chatOpen;
|
|
93
92
|
private _hcChart;
|
|
94
93
|
/** True when elements are projected into the `header` slot (default title/subtitle hidden). */
|
|
@@ -108,7 +107,7 @@ export declare class NileChart extends NileElement {
|
|
|
108
107
|
private resolveConfig;
|
|
109
108
|
private resolvedConfig;
|
|
110
109
|
protected updated(changedProperties: PropertyValues): void;
|
|
111
|
-
private
|
|
110
|
+
private closeMenu;
|
|
112
111
|
private toggleChat;
|
|
113
112
|
/** Push an AI response into the chat panel. Call this from your AI handler. */
|
|
114
113
|
addAiResponse(text: string): void;
|
|
@@ -2,7 +2,7 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { html, nothing } from 'lit';
|
|
4
4
|
import NileElement from '../internal/nile-element.js';
|
|
5
|
-
import { styles, tooltipCss } from './nile-chart.css.js';
|
|
5
|
+
import { styles, tooltipCss, injectGlobalChartMenuOverrides } from './nile-chart.css.js';
|
|
6
6
|
import { nileChartConfig } from './nile-chart-config-builder.js';
|
|
7
7
|
import { renderChartSkeleton } from './nile-chart-skeleton.js';
|
|
8
8
|
import { convertConfig } from '../internal/chart-adapters.js';
|
|
@@ -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)
|
|
@@ -158,7 +160,6 @@ let NileChart = class NileChart extends NileElement {
|
|
|
158
160
|
this.menu = null;
|
|
159
161
|
this.activeType = null;
|
|
160
162
|
this.activeConfig = null;
|
|
161
|
-
this.menuOpen = false;
|
|
162
163
|
this.chatOpen = false;
|
|
163
164
|
this._hcChart = null;
|
|
164
165
|
/** True when elements are projected into the `header` slot (default title/subtitle hidden). */
|
|
@@ -168,7 +169,6 @@ let NileChart = class NileChart extends NileElement {
|
|
|
168
169
|
this.handleOutsideClick = (e) => {
|
|
169
170
|
const path = e.composedPath();
|
|
170
171
|
if (!path.includes(this)) {
|
|
171
|
-
this.menuOpen = false;
|
|
172
172
|
this.chatOpen = false;
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
@@ -210,6 +210,7 @@ let NileChart = class NileChart extends NileElement {
|
|
|
210
210
|
connectedCallback() {
|
|
211
211
|
super.connectedCallback();
|
|
212
212
|
ensureHeaderTooltipStyles();
|
|
213
|
+
injectGlobalChartMenuOverrides();
|
|
213
214
|
const tip = document.createElement('div');
|
|
214
215
|
tip.className = 'nile-chart-header-tooltip';
|
|
215
216
|
document.body.appendChild(tip);
|
|
@@ -262,9 +263,9 @@ let NileChart = class NileChart extends NileElement {
|
|
|
262
263
|
this.appearance = resolved.appearance;
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
closeMenu() {
|
|
267
|
+
const dropdown = this.shadowRoot?.querySelector('.nile-chart-menu-anchor');
|
|
268
|
+
dropdown?.hide?.();
|
|
268
269
|
}
|
|
269
270
|
toggleChat(e) {
|
|
270
271
|
e.stopPropagation();
|
|
@@ -291,7 +292,7 @@ let NileChart = class NileChart extends NileElement {
|
|
|
291
292
|
const converted = convertConfig(this.resolvedConfig, toType);
|
|
292
293
|
this.activeType = toType;
|
|
293
294
|
this.activeConfig = converted;
|
|
294
|
-
this.
|
|
295
|
+
this.closeMenu();
|
|
295
296
|
this.emit('nile-chart-type-change', {
|
|
296
297
|
fromType,
|
|
297
298
|
toType,
|
|
@@ -401,7 +402,7 @@ let NileChart = class NileChart extends NileElement {
|
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
404
|
async viewFullscreen() {
|
|
404
|
-
this.
|
|
405
|
+
this.closeMenu();
|
|
405
406
|
await this.ensureExporting();
|
|
406
407
|
if (this._hcChart?.fullscreen?.open) {
|
|
407
408
|
this._hcChart.fullscreen.open();
|
|
@@ -411,25 +412,26 @@ let NileChart = class NileChart extends NileElement {
|
|
|
411
412
|
target.requestFullscreen?.();
|
|
412
413
|
}
|
|
413
414
|
async printChart() {
|
|
414
|
-
this.
|
|
415
|
+
this.closeMenu();
|
|
415
416
|
await this.ensureExporting();
|
|
416
417
|
this._hcChart?.print?.();
|
|
417
418
|
}
|
|
418
419
|
async exportChart(type) {
|
|
419
|
-
this.
|
|
420
|
+
this.closeMenu();
|
|
420
421
|
await this.ensureExporting();
|
|
421
422
|
const filename = (this.headerTitle || 'chart').replace(/[^a-z0-9_-]+/gi, '_');
|
|
422
423
|
this._hcChart?.exportChartLocal?.({ type, filename, local: true });
|
|
423
424
|
}
|
|
424
425
|
async downloadCsv() {
|
|
425
|
-
this.
|
|
426
|
+
this.closeMenu();
|
|
426
427
|
await this.ensureExporting();
|
|
427
428
|
this._hcChart?.downloadCSV?.();
|
|
428
429
|
}
|
|
429
430
|
_renderMenuItem(item, hasChart) {
|
|
430
431
|
const glyph = item.glyph
|
|
431
432
|
? html `<nile-glyph
|
|
432
|
-
|
|
433
|
+
slot="prefix"
|
|
434
|
+
class="nile-chart-actions-menu-glyph"
|
|
433
435
|
name=${item.glyph}
|
|
434
436
|
method=${item.method ?? 'stroke'}
|
|
435
437
|
color=${item.color ?? 'var(--nile-colors-dark-500,var(--ng-colors-fg-secondary-700))'}
|
|
@@ -438,22 +440,22 @@ let NileChart = class NileChart extends NileElement {
|
|
|
438
440
|
: nothing;
|
|
439
441
|
if (item.type === 'custom') {
|
|
440
442
|
return html `
|
|
441
|
-
${item.divider ? html `<div class="nile-chart-menu-separator"></div>` : nothing}
|
|
442
|
-
<
|
|
443
|
-
@click=${() => { this.
|
|
443
|
+
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
|
|
444
|
+
<nile-menu-item class="nile-chart-actions-menu-item" value=${`custom:${item.id}`}
|
|
445
|
+
@click=${() => { this.closeMenu(); this.emit('nile-menu-change', { id: item.id }); }}>
|
|
444
446
|
${glyph}${item.label}
|
|
445
|
-
</
|
|
447
|
+
</nile-menu-item>
|
|
446
448
|
`;
|
|
447
449
|
}
|
|
448
450
|
if (!hasChart)
|
|
449
451
|
return nothing;
|
|
450
452
|
return html `
|
|
451
|
-
${item.divider ? html `<div class="nile-chart-menu-separator"></div>` : nothing}
|
|
452
|
-
${item.fullscreen ? html `<
|
|
453
|
-
${item.print ? html `<
|
|
454
|
-
${item.downloadPng ? html `<
|
|
455
|
-
${item.downloadSvg ? html `<
|
|
456
|
-
${item.downloadCsv ? html `<
|
|
453
|
+
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
|
|
454
|
+
${item.fullscreen ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="fullscreen" @click=${() => this.viewFullscreen()}>${glyph}${item.label ?? 'Fullscreen'}</nile-menu-item>` : nothing}
|
|
455
|
+
${item.print ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="print" @click=${() => this.printChart()}>${glyph}${item.label ?? 'Print'}</nile-menu-item>` : nothing}
|
|
456
|
+
${item.downloadPng ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-png" @click=${() => this.exportChart('image/png')}>${glyph}${item.label ?? 'Download PNG'}</nile-menu-item>` : nothing}
|
|
457
|
+
${item.downloadSvg ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-svg" @click=${() => this.exportChart('image/svg+xml')}>${glyph}${item.label ?? 'Download SVG'}</nile-menu-item>` : nothing}
|
|
458
|
+
${item.downloadCsv ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-csv" @click=${() => this.downloadCsv()}>${glyph}${item.label ?? 'Download CSV'}</nile-menu-item>` : nothing}
|
|
457
459
|
`;
|
|
458
460
|
}
|
|
459
461
|
renderActionsMenu() {
|
|
@@ -469,41 +471,44 @@ let NileChart = class NileChart extends NileElement {
|
|
|
469
471
|
];
|
|
470
472
|
const hasChart = !!this._hcChart;
|
|
471
473
|
const hasAnyItems = !!(types?.length || allItems.length);
|
|
474
|
+
if (!hasAnyItems) {
|
|
475
|
+
return html `
|
|
476
|
+
<button type="button" class="nile-chart-menu-trigger" aria-label="Chart actions">
|
|
477
|
+
<nile-glyph name="options" size="16"></nile-glyph>
|
|
478
|
+
</button>
|
|
479
|
+
`;
|
|
480
|
+
}
|
|
472
481
|
return html `
|
|
473
|
-
<
|
|
482
|
+
<nile-dropdown class="nile-chart-menu-anchor" placement="bottom-end" distance="4" portal>
|
|
474
483
|
<button
|
|
475
484
|
type="button"
|
|
485
|
+
slot="trigger"
|
|
476
486
|
class="nile-chart-menu-trigger"
|
|
477
|
-
aria-haspopup="true"
|
|
478
|
-
aria-expanded=${this.menuOpen ? 'true' : 'false'}
|
|
479
487
|
aria-label="Chart actions"
|
|
480
|
-
@click=${(e) => this.toggleMenu(e)}
|
|
481
488
|
>
|
|
482
489
|
<nile-glyph name="options" size="16"></nile-glyph>
|
|
483
490
|
</button>
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
${types
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
${allItems.map(item => {
|
|
491
|
+
<nile-menu class="nile-chart-actions-menu" part="dropdown">
|
|
492
|
+
${types?.length ? html `
|
|
493
|
+
${types.map(type => html `
|
|
494
|
+
<nile-menu-item class="nile-chart-actions-menu-item" value=${`type:${type}`} ?active=${type === this.activeType} @click=${() => this.switchType(type)}>
|
|
495
|
+
${chartTypeLabel(type)}
|
|
496
|
+
</nile-menu-item>
|
|
497
|
+
`)}
|
|
498
|
+
${allItems.length ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
|
|
499
|
+
` : nothing}
|
|
500
|
+
${allItems.map(item => {
|
|
495
501
|
if (item.type === 'group') {
|
|
496
502
|
return html `
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
503
|
+
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="seperator"></div>` : nothing}
|
|
504
|
+
<span class="nile-chart-actions-menu-group-header" role="presentation" part="header">${item.label}</span>
|
|
505
|
+
${item.items.map(child => this._renderMenuItem(child, hasChart))}
|
|
506
|
+
`;
|
|
501
507
|
}
|
|
502
508
|
return this._renderMenuItem(item, hasChart);
|
|
503
509
|
})}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
</div>
|
|
510
|
+
</nile-menu>
|
|
511
|
+
</nile-dropdown>
|
|
507
512
|
`;
|
|
508
513
|
}
|
|
509
514
|
renderAiTrigger() {
|
|
@@ -1729,6 +1734,9 @@ let NileChart = class NileChart extends NileElement {
|
|
|
1729
1734
|
.emptyMessage=${config.emptyMessage ?? 'No data'}
|
|
1730
1735
|
.loadingMessage=${config.loadingMessage ?? 'Loading…'}
|
|
1731
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}
|
|
1732
1740
|
style=${gridChrome}
|
|
1733
1741
|
></nile-data-grid>`;
|
|
1734
1742
|
}
|
|
@@ -1805,9 +1813,6 @@ __decorate([
|
|
|
1805
1813
|
__decorate([
|
|
1806
1814
|
state()
|
|
1807
1815
|
], NileChart.prototype, "activeConfig", void 0);
|
|
1808
|
-
__decorate([
|
|
1809
|
-
state()
|
|
1810
|
-
], NileChart.prototype, "menuOpen", void 0);
|
|
1811
1816
|
__decorate([
|
|
1812
1817
|
state()
|
|
1813
1818
|
], NileChart.prototype, "chatOpen", void 0);
|
|
@@ -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' },
|