@aquera/nile-visualization 2.9.11 → 2.9.12
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.
|
@@ -82,7 +82,29 @@ export interface NileChartMenuItemCustom {
|
|
|
82
82
|
/** Show a divider line above this item. */
|
|
83
83
|
divider?: boolean;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
/**
|
|
86
|
+
* A group that renders a section header followed by its child items.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* {
|
|
90
|
+
* type: 'group',
|
|
91
|
+
* label: 'Export',
|
|
92
|
+
* items: [
|
|
93
|
+
* { type: 'default', downloadPng: true },
|
|
94
|
+
* { type: 'default', downloadCsv: true },
|
|
95
|
+
* ]
|
|
96
|
+
* }
|
|
97
|
+
*/
|
|
98
|
+
export interface NileChartMenuItemGroup {
|
|
99
|
+
type: 'group';
|
|
100
|
+
/** Text shown as the section header. */
|
|
101
|
+
label: string;
|
|
102
|
+
/** Items rendered under this group header. */
|
|
103
|
+
items: Array<NileChartMenuItemDefault | NileChartMenuItemCustom>;
|
|
104
|
+
/** Show a divider line above the group header. */
|
|
105
|
+
divider?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export type NileChartMenuItem = NileChartMenuItemDefault | NileChartMenuItemCustom | NileChartMenuItemGroup;
|
|
86
108
|
/**
|
|
87
109
|
* Controls the chart's actions menu.
|
|
88
110
|
*
|
|
@@ -370,7 +370,7 @@ export const styles = css `
|
|
|
370
370
|
padding: var(--nile-spacing-md, var(--ng-spacing-md)) var(--nile-spacing-14px, var(--ng-spacing-3-5));
|
|
371
371
|
border: none;
|
|
372
372
|
background: none;
|
|
373
|
-
color: var(--nile-colors-dark-
|
|
373
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
374
374
|
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
375
375
|
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
376
376
|
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
@@ -400,6 +400,17 @@ export const styles = css `
|
|
|
400
400
|
margin: var(--nile-spacing-xs, var(--ng-spacing-xs)) 0;
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
+
.nile-chart-menu-group-header {
|
|
404
|
+
display: block;
|
|
405
|
+
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));
|
|
406
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
407
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
408
|
+
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
409
|
+
color: var(--nile-colors-neutral-500, var(--ng-colors-text-tertiary-600));
|
|
410
|
+
pointer-events: none;
|
|
411
|
+
user-select: none;
|
|
412
|
+
}
|
|
413
|
+
|
|
403
414
|
/* ── AI Chat Trigger (in header) ── */
|
|
404
415
|
|
|
405
416
|
.nile-ai-trigger {
|
|
@@ -426,6 +426,27 @@ let NileChart = class NileChart extends NileElement {
|
|
|
426
426
|
await this.ensureExporting();
|
|
427
427
|
this._hcChart?.downloadCSV?.();
|
|
428
428
|
}
|
|
429
|
+
_renderMenuItem(item, hasChart) {
|
|
430
|
+
if (item.type === 'custom') {
|
|
431
|
+
return html `
|
|
432
|
+
${item.divider ? html `<div class="nile-chart-menu-separator"></div>` : nothing}
|
|
433
|
+
<button type="button" class="nile-chart-menu-item" role="menuitem"
|
|
434
|
+
@click=${() => { this.menuOpen = false; this.emit('nile-menu-change', { id: item.id }); }}>
|
|
435
|
+
${item.label}
|
|
436
|
+
</button>
|
|
437
|
+
`;
|
|
438
|
+
}
|
|
439
|
+
if (!hasChart)
|
|
440
|
+
return nothing;
|
|
441
|
+
return html `
|
|
442
|
+
${item.divider ? html `<div class="nile-chart-menu-separator"></div>` : nothing}
|
|
443
|
+
${item.fullscreen ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.viewFullscreen()}>${item.label ?? 'Fullscreen'}</button>` : nothing}
|
|
444
|
+
${item.print ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.printChart()}>${item.label ?? 'Print'}</button>` : nothing}
|
|
445
|
+
${item.downloadPng ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.exportChart('image/png')}>${item.label ?? 'Download PNG'}</button>` : nothing}
|
|
446
|
+
${item.downloadSvg ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.exportChart('image/svg+xml')}>${item.label ?? 'Download SVG'}</button>` : nothing}
|
|
447
|
+
${item.downloadCsv ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.downloadCsv()}>${item.label ?? 'Download CSV'}</button>` : nothing}
|
|
448
|
+
`;
|
|
449
|
+
}
|
|
429
450
|
renderActionsMenu() {
|
|
430
451
|
if (!this.resolvedConfig)
|
|
431
452
|
return nothing;
|
|
@@ -462,25 +483,14 @@ let NileChart = class NileChart extends NileElement {
|
|
|
462
483
|
${allItems.length ? html `<div class="nile-chart-menu-separator"></div>` : nothing}
|
|
463
484
|
` : nothing}
|
|
464
485
|
${allItems.map(item => {
|
|
465
|
-
if (item.type === '
|
|
486
|
+
if (item.type === 'group') {
|
|
466
487
|
return html `
|
|
467
488
|
${item.divider ? html `<div class="nile-chart-menu-separator"></div>` : nothing}
|
|
468
|
-
<
|
|
469
|
-
|
|
470
|
-
${item.label}
|
|
471
|
-
</button>
|
|
489
|
+
<span class="nile-chart-menu-group-header" role="presentation">${item.label}</span>
|
|
490
|
+
${item.items.map(child => this._renderMenuItem(child, hasChart))}
|
|
472
491
|
`;
|
|
473
492
|
}
|
|
474
|
-
|
|
475
|
-
return nothing;
|
|
476
|
-
return html `
|
|
477
|
-
${item.divider ? html `<div class="nile-chart-menu-separator"></div>` : nothing}
|
|
478
|
-
${item.fullscreen ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.viewFullscreen()}>${item.label ?? 'Fullscreen'}</button>` : nothing}
|
|
479
|
-
${item.print ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.printChart()}>${item.label ?? 'Print'}</button>` : nothing}
|
|
480
|
-
${item.downloadPng ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.exportChart('image/png')}>${item.label ?? 'Download PNG'}</button>` : nothing}
|
|
481
|
-
${item.downloadSvg ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.exportChart('image/svg+xml')}>${item.label ?? 'Download SVG'}</button>` : nothing}
|
|
482
|
-
${item.downloadCsv ? html `<button type="button" class="nile-chart-menu-item" role="menuitem" @click=${() => this.downloadCsv()}>${item.label ?? 'Download CSV'}</button>` : nothing}
|
|
483
|
-
`;
|
|
493
|
+
return this._renderMenuItem(item, hasChart);
|
|
484
494
|
})}
|
|
485
495
|
</div>
|
|
486
496
|
` : nothing}
|