@aquera/nile-visualization 2.9.39 → 2.9.41

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,14 @@ 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.41 (November 18, 2026)
40
+ - Nile Charts: Opt-in pagination for all axis charts (bar, column, line, area, timeline, …) via `chart.pagination` — chevrons page the category axis when it overflows; `valueSpan` also pages the value axis (UIF-1423)
41
+ - Nile Charts: `chart.zoomType`, `chart.panning` and `chart.panKey` turn on Highcharts zoom and pan; panning moves a paginated chart's page (UIF-1423)
42
+ - Nile Charts: New `nile-chart-page-change` and `nile-chart-value-page-change` events, plus `pageChart()` / `pageChartValues()` (UIF-1423)
43
+
44
+ #### Version 2.9.40 (November 17, 2026)
45
+ - Nile KPI Chart: Added the `compact` variant (`variant: 'compact'`) with a full-bleed sparkline and header slots for buttons (UIF-1422)
46
+
39
47
  #### Version 2.9.39 (November 17, 2026)
40
48
  - Nile Chart: Charts with no data now show a "No data" empty state (customise via the `empty-title`, `empty-description` and `empty-ghost` slots; `emptyGhost: false` hides the ghost chart) (UIF-1417)
41
49
  - Nile Chart: Lighter gridlines, adjustable with the new `gridLineStrength` option (0–100 or `'12%'`; `0` hides them) (UIF-1417)
@@ -1,5 +1,7 @@
1
1
  export { NileChartEvents } from './internal/utils/chart-events.js';
2
2
  export type { NileChartEventName } from './internal/utils/chart-events.js';
3
+ export { pageChart, pageChartValues } from './internal/utils/chart-pagination.js';
4
+ export type { NileChartPaginationConfig, NileChartPageChangeDetail, NileChartValuePageChangeDetail, NileChartPageChangeSource, } from './internal/utils/chart-pagination.js';
3
5
  export { NileBarChart } from './nile-bar-chart/index.js';
4
6
  export type { BarChartSeriesData } from './nile-bar-chart/index.js';
5
7
  export { NilePieChart } from './nile-pie-chart/index.js';
package/dist/src/index.js CHANGED
@@ -3,6 +3,8 @@
3
3
  // /* eslint-enable no-console */
4
4
  // Names of all Highcharts-derived events forwarded as `nile-*` CustomEvents on charts.
5
5
  export { NileChartEvents } from './internal/utils/chart-events.js';
6
+ // Category-axis pagination (chip scroll) — applies to every cartesian chart.
7
+ export { pageChart, pageChartValues } from './internal/utils/chart-pagination.js';
6
8
  export { NileBarChart } from './nile-bar-chart/index.js';
7
9
  export { NilePieChart } from './nile-pie-chart/index.js';
8
10
  export { NileTrendlineChart } from './nile-trendline-chart/index.js';
@@ -0,0 +1,32 @@
1
+ import type { NileChartPaginationConfig } from '../utils/chart-pagination.js';
2
+ /**
3
+ * The `pagination` field every cartesian chart config accepts under `chart`:
4
+ *
5
+ * el.config = { chart: { type: 'bar', categories, data, pagination: { pageSize: 8, chips: 'always', valueSpan: 400 } } };
6
+ *
7
+ * Category / value-axis pagination (chevron "chip scroll"). OPT-IN: off unless set.
8
+ * Any value turns it on (`'auto'` mode by default — page only when categories
9
+ * overflow) unless `enabled: false`. Shorthand `true | false | 'auto' | 'on' | 'off'`,
10
+ * or the full object. Attributes on the element (`pagination`, `page-size`, …)
11
+ * override it; it overrides `chart.options.pagination`.
12
+ */
13
+ export interface ChartPaginationField {
14
+ pagination?: NileChartPaginationConfig | boolean | 'auto' | 'on' | 'off';
15
+ /**
16
+ * Drag-to-zoom on the plot (Highcharts `chart.zooming.type`). Opt-in; off unless set.
17
+ * On a paginated chart a zoom pauses pagination until "Reset zoom".
18
+ */
19
+ zoomType?: 'x' | 'y' | 'xy';
20
+ /**
21
+ * Drag to pan the plot (Highcharts `chart.panning`). Opt-in; off unless set.
22
+ * `true` pans along x (x and y when `pagination.valueSpan` is set), or pass
23
+ * `{ enabled, type }`. With `zoomType` also set, hold `panKey` to pan instead of zoom.
24
+ * On a paginated chart, panning moves the page and snaps to whole categories on release.
25
+ */
26
+ panning?: boolean | {
27
+ enabled?: boolean;
28
+ type?: 'x' | 'y' | 'xy';
29
+ };
30
+ /** Key that switches a drag from zooming to panning when both are on (Highcharts `chart.panKey`). */
31
+ panKey?: 'alt' | 'ctrl' | 'meta' | 'shift';
32
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chart-pagination-config.type.js.map
@@ -1,4 +1,5 @@
1
1
  import type { ChartConfigType } from './chart-config.type.js';
2
+ import type { ChartPaginationField } from './chart-pagination-config.type.js';
2
3
  import type { AqConfigType } from './aq-config.type.js';
3
4
  import type { NileChartConfigBase } from '../../nile-chart/nile-chart-config.js';
4
5
  /**
@@ -6,6 +7,6 @@ import type { NileChartConfigBase } from '../../nile-chart/nile-chart-config.js'
6
7
  * Card-level fields may sit on chart, in aq, or on the root (merged: root, then chart, then aq).
7
8
  */
8
9
  export interface NileChartConfigInputType extends Partial<NileChartConfigBase> {
9
- chart: ChartConfigType;
10
+ chart: ChartConfigType & ChartPaginationField;
10
11
  aq?: AqConfigType;
11
12
  }
@@ -1,7 +1,8 @@
1
1
  import type { AqConfigType } from './aq-config.type.js';
2
2
  import type { PrimitiveChartConfigType } from './primitive-chart-config.type.js';
3
+ import type { ChartPaginationField } from './chart-pagination-config.type.js';
3
4
  /** Input for primitive `<nile-*-chart>` tags that use `el.config = { chart, aq }`. */
4
5
  export interface SeparatedChartConfigInputType {
5
- chart: PrimitiveChartConfigType;
6
+ chart: PrimitiveChartConfigType & ChartPaginationField;
6
7
  aq?: AqConfigType;
7
8
  }
@@ -85,6 +85,9 @@ export declare const NileChartEvents: {
85
85
  readonly axisPointBreak: "nile-axis-point-break";
86
86
  readonly axisPointInBreak: "nile-axis-point-in-break";
87
87
  readonly axisAfterBreaks: "nile-axis-after-breaks";
88
+ readonly pageChange: "nile-chart-page-change";
89
+ /** Value-axis pagination window moved (only when `valueSpan` is set). */
90
+ readonly valuePageChange: "nile-chart-value-page-change";
88
91
  };
89
92
  export type NileChartEventName = (typeof NileChartEvents)[keyof typeof NileChartEvents];
90
93
  export declare function registerNileChartEvents(H: {
@@ -91,6 +91,10 @@ export const NileChartEvents = {
91
91
  axisPointBreak: 'nile-axis-point-break',
92
92
  axisPointInBreak: 'nile-axis-point-in-break',
93
93
  axisAfterBreaks: 'nile-axis-after-breaks',
94
+ // Category-axis pagination (chart-pagination.ts) — fired when the visible page changes.
95
+ pageChange: 'nile-chart-page-change',
96
+ /** Value-axis pagination window moved (only when `valueSpan` is set). */
97
+ valuePageChange: 'nile-chart-value-page-change',
94
98
  };
95
99
  function fire(container, name, detail, cancelable = false) {
96
100
  if (!container || typeof container.dispatchEvent !== 'function')
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Category-axis pagination ("chip scroll") for every cartesian Nile chart.
3
+ *
4
+ * HOW IT REACHES EVERY CHART WITHOUT PER-CHART CODE
5
+ * -------------------------------------------------
6
+ * Like `chart-events.ts`, this is registered ONCE on the shared Highcharts
7
+ * instance (`highcharts-provider.ts`). It hooks the Chart class's `render`
8
+ * event, so every chart created through that instance — `<nile-chart>` and
9
+ * every `<nile-*-chart>` — is checked after each render/redraw.
10
+ *
11
+ * WHAT IT DOES
12
+ * ------------
13
+ * When the category axis holds more categories than fit (each category needs
14
+ * at least `minBand` px), the axis is windowed to one "page" via
15
+ * `axis.setExtremes()`. Highcharts keeps drawing the axes, grid, tooltip and
16
+ * legend exactly as before — only the visible category range changes.
17
+ *
18
+ * On top of the chart it overlays:
19
+ * - soft fades over the category labels, only on a side where data is hidden;
20
+ * - round chevron buttons (the hidden count is in their tooltip/aria-label), shown on hover of the
21
+ * category axis (always on touch devices, or with `chips: 'always'`):
22
+ * horizontal axis (column/line/area…): ‹ › at the two ends of the label row;
23
+ * vertical axis (bar/dumbbell…): ▲ above the label block, ▼ on the
24
+ * value-axis label line beneath it.
25
+ * Clicking a chip moves a full page. The mouse wheel over the category labels
26
+ * (or over the plot, in the axis's own direction) moves one category at a time
27
+ * and only captures the wheel while there is somewhere left to go.
28
+ *
29
+ * The value axis stays fixed across pages (`getExtremesFromAll`), so bars
30
+ * don't change scale as you page.
31
+ *
32
+ * NEVER APPLIES TO
33
+ * ----------------
34
+ * Polar charts (radar, spiderweb, radial bar) and non-axis types (pie, donut,
35
+ * variable pie, funnel, gauge, organization, timeline, euler/venn, flame,
36
+ * map…). Numeric/datetime x-axes (scatter, histogram, time series) are only
37
+ * paginated when explicitly turned on.
38
+ *
39
+ * CONFIGURATION (highest priority first)
40
+ * --------------------------------------
41
+ * 1. Attributes on the chart element:
42
+ * pagination="auto|on|off" page-size="12" page-start="0" pagination-chips="hover|always"
43
+ * 2. `config.chart.pagination` — the Nile-native way:
44
+ * el.config = { chart: { type: 'bar', categories, data, pagination: { pageSize: 8, chips: 'always', valueSpan: 400 } } }
45
+ * 3. `options.pagination` (the Highcharts `options` passthrough).
46
+ * See {@link NileChartPaginationConfig} for every field.
47
+ * OPT-IN: with no pagination config at all, nothing happens (upgrading changes no chart).
48
+ * Passing ANY pagination setting — `chart.pagination`, `options.pagination`, or one of
49
+ * the `pagination` / `page-size` / `page-start` / `value-span` / `value-start`
50
+ * attributes — turns it on in `auto` mode (page only when categories overflow),
51
+ * unless `enabled` says otherwise.
52
+ *
53
+ * Value axis (opt-in): `value-span="400"` (+ optional `value-start`) or
54
+ * `options.pagination.valueSpan` pages the value axis too — see the section
55
+ * at the end of this file.
56
+ *
57
+ * Emits `nile-chart-page-change` (bubbling, composed) from the chart container
58
+ * whenever the visible window changes.
59
+ */
60
+ export interface NileChartPaginationConfig {
61
+ /**
62
+ * `'auto'`: page only when categories overflow — the default once any pagination
63
+ * setting is given. `true`/`'on'`: always page (also numeric x-axes). `false`/`'off'`: never.
64
+ * With no pagination config at all, pagination is off.
65
+ */
66
+ enabled?: boolean | 'auto' | 'on' | 'off';
67
+ /** Categories per page. Default: as many as fit at `minBand` px each. */
68
+ pageSize?: number;
69
+ /** Index of the first category shown when the chart first paginates. Default 0. */
70
+ start?: number;
71
+ /** Minimum px per category before auto mode starts paginating. Default 36 for column/bar-like series, 24 otherwise. */
72
+ minBand?: number;
73
+ /** `'hover'` (default): chips appear while hovering the category axis. `'always'`: chips always visible while data is hidden. */
74
+ chips?: 'hover' | 'always';
75
+ /**
76
+ * Opt-in value-axis paging: how much of the value axis (in data units) is visible
77
+ * at once, e.g. `400` shows 0–400 with chevrons to reach higher values. Off unless set.
78
+ */
79
+ valueSpan?: number;
80
+ /** First visible value when value-axis paging starts. Default: the bottom of the data range. */
81
+ valueStart?: number;
82
+ /** Keep the value axis scaled to ALL data, so it doesn't jump between pages. Default true. */
83
+ fixedValueAxis?: boolean;
84
+ }
85
+ /**
86
+ * What moved the window:
87
+ * - `'chip'` — a chevron was clicked (or pressed with Enter/Space)
88
+ * - `'wheel'` — mouse wheel / trackpad scroll
89
+ * - `'pan'` — Highcharts panning (`chart.panning`) dragged the window
90
+ * - `'api'` — `pageChart()` / `pageChartValues()` from code
91
+ * - `'init'` — pagination just switched on (first page shown)
92
+ * - `'auto'` — re-fit after a resize, data change or setting change
93
+ */
94
+ export type NileChartPageChangeSource = 'chip' | 'wheel' | 'pan' | 'api' | 'init' | 'auto';
95
+ /** Detail of `nile-chart-page-change` — the category window moved. */
96
+ export interface NileChartPageChangeDetail {
97
+ chart: unknown;
98
+ /** Index of the first visible category (0-based). */
99
+ start: number;
100
+ /** Index one past the last visible category. */
101
+ end: number;
102
+ pageSize: number;
103
+ total: number;
104
+ /** Visible category labels (or x values on a numeric/timeline axis). */
105
+ categories: Array<string | number>;
106
+ source: NileChartPageChangeSource;
107
+ /** Which way it moved; absent for `init` / `auto`. */
108
+ direction?: 'previous' | 'next';
109
+ /** True when there is more before / after the window. */
110
+ hasPrevious: boolean;
111
+ hasNext: boolean;
112
+ }
113
+ /** Detail of `nile-chart-value-page-change` — the value-axis window moved (value paging only). */
114
+ export interface NileChartValuePageChangeDetail {
115
+ chart: unknown;
116
+ /** Visible value range. */
117
+ min: number;
118
+ max: number;
119
+ /** `max - min` — the configured `valueSpan`. */
120
+ span: number;
121
+ /** Full data range the window moves within. */
122
+ dataMin: number;
123
+ dataMax: number;
124
+ source: NileChartPageChangeSource;
125
+ direction?: 'lower' | 'higher';
126
+ hasLower: boolean;
127
+ hasHigher: boolean;
128
+ }
129
+ declare module 'highcharts' {
130
+ interface Options {
131
+ /** Nile category-axis pagination — see `NileChartPaginationConfig`. */
132
+ pagination?: NileChartPaginationConfig | boolean | 'auto' | 'on' | 'off';
133
+ }
134
+ }
135
+ export declare const NILE_CHART_PAGE_CHANGE = "nile-chart-page-change";
136
+ export declare const NILE_CHART_VALUE_PAGE_CHANGE = "nile-chart-value-page-change";
137
+ /**
138
+ * Register category-axis pagination on a Highcharts instance. Idempotent.
139
+ * Called once from `highcharts-provider.ts`.
140
+ */
141
+ export declare function registerNileChartPagination(H: any): void;
142
+ /** Programmatic paging for a live chart (e.g. from a component method). */
143
+ export declare function pageChart(chart: unknown, delta: number): void;
144
+ /** Programmatic value-axis paging: move the value window by `delta` data units. */
145
+ export declare function pageChartValues(chart: unknown, delta: number): void;