@aquera/nile-visualization 2.9.44 → 2.9.46

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 CHANGED
@@ -36,6 +36,16 @@ 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.46 (November 19, 2026)
40
+ - Nile Charts: Charts follow the page's light/dark colour scheme. Chart containers now inherit the page's `color-scheme` instead of always using light, so Highcharts' text, axis, legend and gridline colours go dark under `:root[data-theme="dark"]` (or `color-scheme: dark`) and switch live when the theme changes. Light-only pages look the same as before; a chart's own `palette.colorScheme` still wins (UIF-1429)
41
+ - Nile Heatmap: Default colours are theme-aware. With no `minColor` / `maxColor` set, the scale runs #ffffff → #1e40af in light mode (as before) and #1a2440 → #60a5fa in dark mode; the cell border is #e2e8f0 / #22262f. Re-theme from CSS with `--nile-heatmap-min-color`, `--nile-heatmap-max-color` and `--nile-heatmap-border-color`. Explicit `minColor` / `maxColor` are unchanged (UIF-1429)
42
+ - Nile Heatmap: Cell values are black or white, whichever is more readable on that cell in the current theme (at least 4.5:1 contrast), with no text outline. Apps that set their own data-label `format`, `formatter` or colour keep Highcharts' labels (UIF-1429)
43
+ - Nile Heatmap: The chart is created once on first render (it was created twice, and `nile-chart-ready` fired twice) (UIF-1429)
44
+ - Demo: new heatmap-only page (`demo/heatmap.html`) and a light/dark switch on both demo pages (UIF-1429)
45
+
46
+ #### Version 2.9.45 (November 19, 2026)
47
+ - Nile Chart: `type: 'grid'` charts take a `columnChooser` option (`true`, or `{ title, tooltip, icon, showCount, showReset, resetLabel, indicator, placement }`). It adds a column-settings icon to the chart header, after any `header-actions` content and before the built-in icons, that opens a `nile-floating-panel` of column checkboxes with a visible/total count and a Reset action; a dot on the icon shows while columns are hidden. Toggles fire the grid's `nile-column-visibility-change`, and a new `config.columnVisibility` re-seeds the panel. Needs `nile-floating-panel`, `nile-checkbox` and `nile-glyph` loaded on the page; column locks need `@aquera/nile-data-grid` 0.9.7. New CSS parts `column-chooser-trigger`, `column-chooser-glyph`, `column-chooser-indicator`. `ChartGridConfigType` and `NileChartColumnChooserConfig` are exported. Off unless set (UIF-1428)
48
+
39
49
  #### Version 2.9.44 (November 18, 2026)
40
50
  - Nile Charts: Long x-axis labels no longer rotate and shrink the plot. `xAxisLabelMode` (`truncate` by default, or `wrap`), `xAxisLabelMaxWidth` (default 80) and `xAxisLabelRotation` control how they fit, and a clipped label shows its full name in a tooltip (UIF-1426)
41
51
  - Nile Charts: Lite tooltips in the charts are capped at `--ng-width-64` (256px) wide and 250px tall and scroll beyond that; the chart header title and subtitle tooltips now use `nile-lite-tooltip`, so they need `@aquera/nile-elements` loaded on the page (UIF-1426)
@@ -6,7 +6,7 @@ export { NileBarChart } from './nile-bar-chart/index.js';
6
6
  export type { BarChartSeriesData } from './nile-bar-chart/index.js';
7
7
  export { NilePieChart } from './nile-pie-chart/index.js';
8
8
  export type { PieChartSeriesData } from './nile-pie-chart/index.js';
9
- export type { LegendConfig, LegendNavigationConfig, LegendTitleConfig, LegendAccessibilityConfig, ChartSpacingConfig, CSSObject, } from './internal/types/index.js';
9
+ export type { LegendConfig, LegendNavigationConfig, LegendTitleConfig, LegendAccessibilityConfig, ChartSpacingConfig, CSSObject, ChartGridConfigType, NileChartColumnChooserConfig, } from './internal/types/index.js';
10
10
  export { NileTrendlineChart } from './nile-trendline-chart/index.js';
11
11
  export type { TrendlineSeriesData, ForecastConfig } from './nile-trendline-chart/index.js';
12
12
  export { NileAnomalyChart } from './nile-anomaly-chart/index.js';
@@ -36,6 +36,28 @@ export interface ChartGridConfigType {
36
36
  columnVisibility?: VisibilityState;
37
37
  rowSelection?: RowSelectionState;
38
38
  columnOrder?: ColumnOrderState;
39
+ /** Adds a column-settings icon to the chart header that opens a show/hide panel for the columns. */
40
+ columnChooser?: boolean | NileChartColumnChooserConfig;
39
41
  height?: string;
40
42
  options?: Options;
41
43
  }
44
+ export interface NileChartColumnChooserConfig {
45
+ /** Defaults to true when the object is given. */
46
+ enabled?: boolean;
47
+ /** Panel heading. Defaults to 'Show columns'. */
48
+ title?: string;
49
+ /** Trigger tooltip and base of its aria-label. Defaults to 'Choose columns'. */
50
+ tooltip?: string;
51
+ /** nile-glyph name for the trigger. Defaults to 'ng-columns-3-cog'. */
52
+ icon?: string;
53
+ /** Shows "visible/total" next to the heading. Defaults to true. */
54
+ showCount?: boolean;
55
+ /** Shows the action that makes every column visible. Defaults to true. */
56
+ showReset?: boolean;
57
+ /** Defaults to 'Reset'. */
58
+ resetLabel?: string;
59
+ /** Shows a dot on the trigger while any column is hidden. Defaults to true. */
60
+ indicator?: boolean;
61
+ /** Defaults to 'bottom-end'. */
62
+ placement?: 'bottom-end' | 'bottom-start' | 'bottom';
63
+ }
@@ -9,7 +9,9 @@ export interface ChartHeatmapConfigType {
9
9
  seriesName?: string;
10
10
  colorMin?: number;
11
11
  colorMax?: number;
12
+ /** Colour of the lowest value. Default: theme-aware (`--nile-heatmap-min-color`, else #ffffff light / #1a2440 dark). */
12
13
  minColor?: string;
14
+ /** Colour of the highest value. Default: theme-aware (`--nile-heatmap-max-color`, else #1e40af light / #60a5fa dark). */
13
15
  maxColor?: string;
14
16
  colorAxisTitle?: string;
15
17
  showDataLabels?: boolean;
@@ -18,6 +18,7 @@ export type { ChartGaugeConfigType } from './chart-gauge-config.type.js';
18
18
  export type { ChartWaterfallConfigType } from './chart-waterfall-config.type.js';
19
19
  export type { ChartClusterConfigType } from './chart-cluster-config.type.js';
20
20
  export type { ChartStackedConfigType } from './chart-stacked-config.type.js';
21
+ export type { ChartGridConfigType, NileChartColumnChooserConfig, } from './chart-grid-config.type.js';
21
22
  export type { ChartHistogramConfigType } from './chart-histogram-config.type.js';
22
23
  export type { ChartBellcurveConfigType } from './chart-bellcurve-config.type.js';
23
24
  export type { ChartBoxplotConfigType } from './chart-boxplot-config.type.js';
@@ -21,7 +21,14 @@
21
21
  * roots, where `:root` matches nothing, so the variables are undefined and
22
22
  * fills fall back to black (map shading, legends, zoom buttons, timeline
23
23
  * labels, …). We widen the selector to `:root, :host` so it also matches
24
- * inside the chart's shadow root, and pin the container to the light colour
25
- * scheme (the 12.5.0 look) unless the chart sets `palette.colorScheme`.
24
+ * inside the chart's shadow root.
25
+ *
26
+ * The palette values are `light-dark()` pairs, so they resolve against the
27
+ * chart container's `color-scheme`. Highcharts sets that container to
28
+ * `light dark` (the OS preference) by default; we set it to `inherit` instead,
29
+ * so a chart follows the page it sits on: light on a light-only page (no
30
+ * `color-scheme`, the 12.5.0 look), dark under `:root[data-theme="dark"]` /
31
+ * `color-scheme: dark`, and switching live when the page theme changes. An
32
+ * explicit `palette.colorScheme` on the chart still wins.
26
33
  */
27
34
  export declare function applyHighchartsCompat(H: unknown): void;
@@ -21,8 +21,15 @@
21
21
  * roots, where `:root` matches nothing, so the variables are undefined and
22
22
  * fills fall back to black (map shading, legends, zoom buttons, timeline
23
23
  * labels, …). We widen the selector to `:root, :host` so it also matches
24
- * inside the chart's shadow root, and pin the container to the light colour
25
- * scheme (the 12.5.0 look) unless the chart sets `palette.colorScheme`.
24
+ * inside the chart's shadow root.
25
+ *
26
+ * The palette values are `light-dark()` pairs, so they resolve against the
27
+ * chart container's `color-scheme`. Highcharts sets that container to
28
+ * `light dark` (the OS preference) by default; we set it to `inherit` instead,
29
+ * so a chart follows the page it sits on: light on a light-only page (no
30
+ * `color-scheme`, the 12.5.0 look), dark under `:root[data-theme="dark"]` /
31
+ * `color-scheme: dark`, and switching live when the page theme changes. An
32
+ * explicit `palette.colorScheme` on the chart still wins.
26
33
  */
27
34
  const PATCHED = Symbol.for('nile.highcharts.matchPointsPatched');
28
35
  const ROOT_SELECTOR = ':root {';
@@ -68,7 +75,7 @@ function scopePaletteToShadowRoot(H) {
68
75
  style.textContent = css.split(ROOT_SELECTOR).join(SCOPED_SELECTOR);
69
76
  }
70
77
  if (this.container && !this.options?.palette?.colorScheme) {
71
- this.container.style.colorScheme = 'light';
78
+ this.container.style.colorScheme = 'inherit';
72
79
  }
73
80
  });
74
81
  }
@@ -80,14 +80,14 @@ describe('highcharts-compat', () => {
80
80
  const container = document.createElement('div');
81
81
  return { chart: { renderer: { defs: { element: defs } }, container, options: { palette } }, style, container };
82
82
  }
83
- it('widens :root to :root, :host and pins the light colour scheme', () => {
83
+ it('widens :root to :root, :host and makes the container inherit the page colour scheme', () => {
84
84
  const { H, handlers } = fakeHighcharts();
85
85
  applyHighchartsCompat(H);
86
86
  const { chart, style, container } = chartWithPalette(':root {\n --a: 1;\n}\n@supports (x) {\n :root {\n --a: 2;\n }\n}');
87
87
  handlers.forEach(h => h.call(chart));
88
88
  expect(style.textContent).to.not.match(/(^|[^,]\s*):root \{/m);
89
89
  expect(style.textContent.match(/:root, :host \{/g)).to.have.length(2);
90
- expect(container.style.colorScheme).to.equal('light');
90
+ expect(container.style.colorScheme).to.equal('inherit');
91
91
  });
92
92
  it('is idempotent across redraws', () => {
93
93
  const { H, handlers } = fakeHighcharts();
@@ -0,0 +1,33 @@
1
+ import type { TemplateResult } from 'lit';
2
+ import type { NileChartColumnChooserConfig } from '../internal/types/chart-grid-config.type.js';
3
+ export type ColumnVisibility = Record<string, boolean>;
4
+ export interface ResolvedColumnChooser {
5
+ title: string;
6
+ tooltip: string;
7
+ icon: string;
8
+ showCount: boolean;
9
+ showReset: boolean;
10
+ resetLabel: string;
11
+ indicator: boolean;
12
+ placement: 'bottom-end' | 'bottom-start' | 'bottom';
13
+ }
14
+ export interface ChooserEntry {
15
+ id: string;
16
+ label: string;
17
+ locked: boolean;
18
+ group: string | null;
19
+ }
20
+ export declare const COLUMN_CHOOSER_PANEL_CLASS = "nile-chart-column-chooser";
21
+ export declare function resolveColumnChooser(option: boolean | NileChartColumnChooserConfig | undefined | null): ResolvedColumnChooser | null;
22
+ export declare function chooserEntries(columns: unknown[], columnOrder?: string[]): ChooserEntry[];
23
+ export declare function isColumnVisible(entry: ChooserEntry, visibility: ColumnVisibility): boolean;
24
+ export interface ColumnChooserRenderOptions {
25
+ chooser: ResolvedColumnChooser;
26
+ entries: ChooserEntry[];
27
+ visibility: ColumnVisibility;
28
+ onToggle: (id: string, visible: boolean) => void;
29
+ onReset: () => void;
30
+ onShow: (e: Event) => void;
31
+ onHide: (e: Event) => void;
32
+ }
33
+ export declare function renderColumnChooser(opts: ColumnChooserRenderOptions): TemplateResult;
@@ -0,0 +1,133 @@
1
+ import { html, nothing } from 'lit';
2
+ export const COLUMN_CHOOSER_PANEL_CLASS = 'nile-chart-column-chooser';
3
+ export function resolveColumnChooser(option) {
4
+ if (!option)
5
+ return null;
6
+ const o = option === true ? {} : option;
7
+ if (o.enabled === false)
8
+ return null;
9
+ return {
10
+ title: o.title ?? 'Show columns',
11
+ tooltip: o.tooltip ?? 'Choose columns',
12
+ icon: o.icon ?? 'ng-columns-3-cog',
13
+ showCount: o.showCount !== false,
14
+ showReset: o.showReset !== false,
15
+ resetLabel: o.resetLabel ?? 'Reset',
16
+ indicator: o.indicator !== false,
17
+ placement: o.placement ?? 'bottom-end',
18
+ };
19
+ }
20
+ function labelOf(col) {
21
+ if (typeof col.header === 'string' && col.header.trim())
22
+ return col.header;
23
+ if (col.chooserLabel)
24
+ return col.chooserLabel;
25
+ return col.id;
26
+ }
27
+ export function chooserEntries(columns, columnOrder = []) {
28
+ const entries = [];
29
+ const walk = (cols, group) => {
30
+ for (const col of cols) {
31
+ if (col.columns?.length) {
32
+ walk(col.columns, labelOf(col));
33
+ }
34
+ else if (col.type !== 'checkbox') {
35
+ entries.push({
36
+ id: col.id,
37
+ label: labelOf(col),
38
+ locked: col.enableHiding === false,
39
+ group,
40
+ });
41
+ }
42
+ }
43
+ };
44
+ walk((columns ?? []), null);
45
+ if (columnOrder.length === 0)
46
+ return entries;
47
+ const rank = new Map(columnOrder.map((id, i) => [id, i]));
48
+ return entries
49
+ .map((e, i) => ({ e, i }))
50
+ .sort((a, b) => (rank.get(a.e.id) ?? columnOrder.length + a.i) -
51
+ (rank.get(b.e.id) ?? columnOrder.length + b.i))
52
+ .map((x) => x.e);
53
+ }
54
+ export function isColumnVisible(entry, visibility) {
55
+ return entry.locked || visibility[entry.id] !== false;
56
+ }
57
+ export function renderColumnChooser(opts) {
58
+ const { chooser, entries, visibility } = opts;
59
+ const shown = entries.filter((e) => isColumnVisible(e, visibility)).length;
60
+ const total = entries.length;
61
+ const label = `${chooser.tooltip} (${shown} of ${total} shown)`;
62
+ const filtered = shown < total;
63
+ let lastGroup = null;
64
+ const rows = entries.map((entry) => {
65
+ const visible = isColumnVisible(entry, visibility);
66
+ const heading = entry.group && entry.group !== lastGroup
67
+ ? html `<div class="nile-chart-column-chooser-group" role="presentation">
68
+ ${entry.group}
69
+ </div>`
70
+ : nothing;
71
+ lastGroup = entry.group;
72
+ const disabled = entry.locked || (visible && shown <= 1);
73
+ return html `${heading}<nile-checkbox
74
+ class="nile-chart-column-chooser-option"
75
+ data-column-id=${entry.id}
76
+ .checked=${visible}
77
+ .disabled=${disabled}
78
+ @nile-change=${(e) => opts.onToggle(entry.id, e.detail.checked)}
79
+ >${entry.label}</nile-checkbox
80
+ >`;
81
+ });
82
+ // nile-floating-panel re-parents its children, so each direct child must be a static element.
83
+ return html `<nile-floating-panel
84
+ class="nile-chart-column-chooser-anchor"
85
+ placement=${chooser.placement}
86
+ arrow="none"
87
+ .distance=${6}
88
+ .panelClass=${COLUMN_CHOOSER_PANEL_CLASS}
89
+ @nile-after-show=${opts.onShow}
90
+ @nile-hide=${opts.onHide}
91
+ >
92
+ <button
93
+ type="button"
94
+ class="nile-chart-menu-trigger nile-chart-column-chooser-trigger"
95
+ part="column-chooser-trigger"
96
+ aria-label=${label}
97
+ title=${label}
98
+ >
99
+ <nile-glyph
100
+ name=${chooser.icon}
101
+ method="stroke"
102
+ size="16"
103
+ color="currentColor"
104
+ part="column-chooser-glyph"
105
+ ></nile-glyph>
106
+ ${chooser.indicator && filtered
107
+ ? html `<span
108
+ class="nile-chart-column-chooser-indicator"
109
+ part="column-chooser-indicator"
110
+ aria-hidden="true"
111
+ ></span>`
112
+ : nothing}
113
+ </button>
114
+ <span slot="title" class="nile-chart-column-chooser-title"
115
+ >${chooser.title}${chooser.showCount
116
+ ? html `<span class="nile-chart-column-chooser-count">${shown}/${total}</span>`
117
+ : nothing}</span
118
+ >
119
+ <button
120
+ type="button"
121
+ slot="action"
122
+ class="nile-chart-column-chooser-reset"
123
+ ?hidden=${!chooser.showReset}
124
+ @click=${opts.onReset}
125
+ >
126
+ ${chooser.resetLabel}
127
+ </button>
128
+ <div class="nile-chart-column-chooser-list" role="group" aria-label=${chooser.title}>
129
+ ${rows}
130
+ </div>
131
+ </nile-floating-panel>`;
132
+ }
133
+ //# sourceMappingURL=nile-chart-column-chooser.js.map
@@ -0,0 +1,2 @@
1
+ import './nile-chart';
2
+ import '@aquera/nile-data-grid';
@@ -0,0 +1,244 @@
1
+ var _a;
2
+ import { expect, fixture, aTimeout, html } from '@open-wc/testing';
3
+ import './nile-chart';
4
+ import '@aquera/nile-data-grid';
5
+ // TanStack Table reads process.env when it builds a table; the test browser has no process.
6
+ (_a = window).process ?? (_a.process = { env: { NODE_ENV: 'production' } });
7
+ const settle = async (el) => {
8
+ await el.updateComplete;
9
+ await el.updateComplete;
10
+ await new Promise(requestAnimationFrame);
11
+ };
12
+ const COLUMNS = [
13
+ { id: 'select', header: '', accessorKey: 'select', type: 'checkbox' },
14
+ { id: 'id', header: 'ID', accessorKey: 'id', enableHiding: false },
15
+ { id: 'name', header: 'Name', accessorKey: 'name', enableHiding: false },
16
+ { id: 'role', header: 'Role', accessorKey: 'role' },
17
+ { id: 'dept', header: 'Dept', accessorKey: 'dept' },
18
+ { id: 'email', header: 'Email', accessorKey: 'email' },
19
+ { id: 'phone', header: 'Phone', accessorKey: 'phone' },
20
+ { id: 'city', header: 'City', accessorKey: 'city' },
21
+ { id: 'status', header: 'Status', accessorKey: 'status' },
22
+ ];
23
+ const DATA = [
24
+ {
25
+ id: 1,
26
+ name: 'Ada',
27
+ role: 'Eng',
28
+ dept: 'R&D',
29
+ email: 'a@x.co',
30
+ phone: '1',
31
+ city: 'NY',
32
+ status: 'on',
33
+ },
34
+ {
35
+ id: 2,
36
+ name: 'Grace',
37
+ role: 'Adm',
38
+ dept: 'Navy',
39
+ email: 'g@x.co',
40
+ phone: '2',
41
+ city: 'DC',
42
+ status: 'off',
43
+ },
44
+ ];
45
+ const gridConfig = (extra = {}) => ({
46
+ type: 'grid',
47
+ data: DATA,
48
+ columns: COLUMNS,
49
+ columnChooser: true,
50
+ ...extra,
51
+ });
52
+ const make = async (config) => {
53
+ const el = await fixture(html `<nile-chart></nile-chart>`);
54
+ if (config)
55
+ el.config = config;
56
+ await settle(el);
57
+ return el;
58
+ };
59
+ const root = (el) => el.shadowRoot;
60
+ const trigger = (el) => root(el).querySelector('button[part~="column-chooser-trigger"]');
61
+ const innerGrid = (el) => root(el).querySelector('nile-data-grid');
62
+ const openPanel = async (el) => {
63
+ trigger(el).click();
64
+ await settle(el);
65
+ await aTimeout(50);
66
+ };
67
+ // nile-floating-panel re-parents its content to document.body on open; in the
68
+ // headless runner it may stay in the chart's shadow root — look in both.
69
+ const panelQueryAll = (el, sel) => {
70
+ const inBody = Array.from(document.querySelectorAll(sel));
71
+ return inBody.length ? inBody : Array.from(root(el).querySelectorAll(sel));
72
+ };
73
+ const panelQuery = (el, sel) => document.querySelector(sel) ?? root(el).querySelector(sel);
74
+ const listedCheckboxes = (el) => panelQueryAll(el, '.nile-chart-column-chooser-list nile-checkbox');
75
+ const checkboxFor = (el, id) => panelQuery(el, `.nile-chart-column-chooser-list nile-checkbox[data-column-id="${id}"]`);
76
+ describe('NileChart column chooser', () => {
77
+ describe('trigger presence', () => {
78
+ it('1. no trigger when columnChooser is absent', async () => {
79
+ const el = await make(gridConfig({ columnChooser: undefined }));
80
+ expect(trigger(el)).to.be.null;
81
+ });
82
+ it('2. no trigger when columnChooser is false', async () => {
83
+ const el = await make(gridConfig({ columnChooser: false }));
84
+ expect(trigger(el)).to.be.null;
85
+ });
86
+ it('3. renders a trigger with glyph when columnChooser is true', async () => {
87
+ const el = await make(gridConfig());
88
+ const btn = trigger(el);
89
+ expect(btn).to.exist;
90
+ expect(btn.querySelector('nile-glyph[part~="column-chooser-glyph"]')).to.exist;
91
+ });
92
+ it('4. ignored for non-grid types', async () => {
93
+ const el = await make({
94
+ type: 'line',
95
+ data: [{ name: 'A', data: [1, 2, 3] }],
96
+ categories: ['x', 'y', 'z'],
97
+ columnChooser: true,
98
+ });
99
+ expect(trigger(el)).to.be.null;
100
+ });
101
+ it('5. trigger lives in the header actions group', async () => {
102
+ const el = await make(gridConfig());
103
+ const actions = root(el).querySelector('.nile-chart-header-actions');
104
+ expect(actions).to.exist;
105
+ expect(actions.contains(trigger(el))).to.be.true;
106
+ });
107
+ it('6. trigger is positioned after the header-actions slot', async () => {
108
+ const el = await make(gridConfig());
109
+ const actions = root(el).querySelector('.nile-chart-header-actions');
110
+ const slot = actions.querySelector('slot[name="header-actions"]');
111
+ const btn = trigger(el);
112
+ expect(slot.compareDocumentPosition(btn) & Node.DOCUMENT_POSITION_FOLLOWING).to.be.greaterThan(0);
113
+ });
114
+ it('7. header renders for the chooser even with no title', async () => {
115
+ const el = await make(gridConfig());
116
+ expect(root(el).querySelector('.nile-chart-header')).to.exist;
117
+ });
118
+ it('8. slotting header-actions content keeps the trigger', async () => {
119
+ const el = await fixture(html `<nile-chart><button slot="header-actions">Export</button></nile-chart>`);
120
+ el.config = gridConfig();
121
+ await settle(el);
122
+ expect(trigger(el)).to.exist;
123
+ });
124
+ });
125
+ describe('floating panel', () => {
126
+ it('9. trigger is wrapped by a floating panel with the chooser panel-class', async () => {
127
+ const el = await make(gridConfig());
128
+ const panels = Array.from(root(el).querySelectorAll('nile-floating-panel'));
129
+ const panel = panels.find((p) => p.contains(trigger(el)));
130
+ expect(panel, 'floating panel wrapping the trigger').to.exist;
131
+ const panelClass = panel.panelClass ?? panel.getAttribute('panel-class');
132
+ expect(panelClass).to.equal('nile-chart-column-chooser');
133
+ });
134
+ it('10. opening lists one checkbox per hideable column', async () => {
135
+ const el = await make(gridConfig());
136
+ await openPanel(el);
137
+ const boxes = listedCheckboxes(el);
138
+ expect(boxes.length).to.equal(8);
139
+ });
140
+ it('11. row-selection (checkbox) columns are not listed', async () => {
141
+ const el = await make(gridConfig());
142
+ await openPanel(el);
143
+ expect(checkboxFor(el, 'select')).to.be.null;
144
+ });
145
+ });
146
+ describe('labels and locked state', () => {
147
+ it('12. function header falls back to chooserLabel', async () => {
148
+ const el = await make(gridConfig({
149
+ columns: [
150
+ { id: 'id', header: 'ID', accessorKey: 'id' },
151
+ { id: 'r', header: () => 'x', accessorKey: 'r', chooserLabel: 'Custom' },
152
+ ],
153
+ }));
154
+ await openPanel(el);
155
+ expect(checkboxFor(el, 'r').textContent).to.contain('Custom');
156
+ });
157
+ it('13. enableHiding:false columns are checked and disabled', async () => {
158
+ const el = await make(gridConfig());
159
+ await openPanel(el);
160
+ const idBox = checkboxFor(el, 'id');
161
+ expect(idBox.checked).to.be.true;
162
+ expect(idBox.disabled).to.be.true;
163
+ });
164
+ it('14. last visible column checkbox is disabled', async () => {
165
+ const el = await make(gridConfig({
166
+ columns: [
167
+ { id: 'only', header: 'Only', accessorKey: 'only' },
168
+ { id: 'b', header: 'B', accessorKey: 'b' },
169
+ ],
170
+ columnVisibility: { b: false },
171
+ }));
172
+ await openPanel(el);
173
+ expect(checkboxFor(el, 'only').disabled).to.be.true;
174
+ });
175
+ });
176
+ describe('count and indicator', () => {
177
+ it('15. count reflects visible / total', async () => {
178
+ const el = await make(gridConfig({ columnVisibility: { role: false, dept: false } }));
179
+ await openPanel(el);
180
+ const count = panelQuery(el, '.nile-chart-column-chooser-count');
181
+ expect(count.textContent.replace(/\s/g, '')).to.equal('6/8');
182
+ });
183
+ it('16. no indicator when nothing is hidden', async () => {
184
+ const el = await make(gridConfig());
185
+ expect(root(el).querySelector('[part~="column-chooser-indicator"]')).to.be.null;
186
+ });
187
+ it('17. indicator shown when a column is hidden', async () => {
188
+ const el = await make(gridConfig({ columnVisibility: { role: false } }));
189
+ expect(root(el).querySelector('[part~="column-chooser-indicator"]')).to.exist;
190
+ });
191
+ it('18. aria-label reports shown / total', async () => {
192
+ const el = await make(gridConfig({ columnVisibility: { role: false, dept: false } }));
193
+ expect(trigger(el).getAttribute('aria-label')).to.equal('Choose columns (6 of 8 shown)');
194
+ });
195
+ });
196
+ describe('toggling', () => {
197
+ it('19. unchecking hides exactly that column and fires one event', async () => {
198
+ const el = await make(gridConfig());
199
+ await openPanel(el);
200
+ let events = 0;
201
+ el.addEventListener('nile-column-visibility-change', () => (events += 1));
202
+ const box = checkboxFor(el, 'role');
203
+ box.checked = false;
204
+ box.dispatchEvent(new CustomEvent('nile-change', {
205
+ detail: { checked: false },
206
+ bubbles: true,
207
+ composed: true,
208
+ }));
209
+ await settle(el);
210
+ expect(innerGrid(el).columnVisibility.role).to.equal(false);
211
+ expect(events).to.equal(1);
212
+ });
213
+ it('20. reset shows all columns and fires one event', async () => {
214
+ const el = await make(gridConfig({ columnVisibility: { role: false, dept: false } }));
215
+ await openPanel(el);
216
+ let events = 0;
217
+ el.addEventListener('nile-column-visibility-change', () => (events += 1));
218
+ const reset = panelQuery(el, 'button.nile-chart-column-chooser-reset');
219
+ reset.click();
220
+ await settle(el);
221
+ const vis = innerGrid(el).columnVisibility;
222
+ expect(Object.values(vis).some((v) => v === false)).to.be.false;
223
+ expect(events).to.equal(1);
224
+ });
225
+ it('21. locked column cannot be hidden from the grid', async () => {
226
+ const el = await make(gridConfig({ columnVisibility: { id: false } }));
227
+ await settle(el);
228
+ expect(innerGrid(el).columnVisibility.id).to.not.equal(undefined);
229
+ await openPanel(el);
230
+ expect(checkboxFor(el, 'id').checked).to.be.true;
231
+ });
232
+ });
233
+ describe('re-seeding', () => {
234
+ it('22. replacing config columnVisibility re-seeds grid and checkboxes', async () => {
235
+ const el = await make(gridConfig());
236
+ el.config = gridConfig({ columnVisibility: { role: false } });
237
+ await settle(el);
238
+ expect(innerGrid(el).columnVisibility.role).to.equal(false);
239
+ await openPanel(el);
240
+ expect(checkboxFor(el, 'role').checked).to.be.false;
241
+ });
242
+ });
243
+ });
244
+ //# sourceMappingURL=nile-chart-column-chooser.test.js.map
@@ -466,7 +466,9 @@ export interface NileHeatmapChartConfig extends NileChartConfigBase {
466
466
  seriesName?: string;
467
467
  colorMin?: number;
468
468
  colorMax?: number;
469
+ /** Colour of the lowest value. Default: theme-aware (`--nile-heatmap-min-color`, else #ffffff light / #1a2440 dark). */
469
470
  minColor?: string;
471
+ /** Colour of the highest value. Default: theme-aware (`--nile-heatmap-max-color`, else #1e40af light / #60a5fa dark). */
470
472
  maxColor?: string;
471
473
  colorAxisTitle?: string;
472
474
  showDataLabels?: boolean;