@aquera/nile-visualization 2.9.49 → 2.9.50
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/internal/types/chart-master-detail-config.type.d.ts +4 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +4 -0
- package/dist/src/nile-chart/nile-chart.js +2 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.css.js +60 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +20 -2
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.js +92 -6
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.test.js +61 -0
- 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.50 (November 20, 2026)
|
|
40
|
+
- Nile Master-Detail Chart: the window slider and the ‹ / › pan buttons are back as independent opt-in properties, separate from the + / − control: `navigator-slider` and `navigator-pan-buttons` (`navigatorSlider` / `navigatorPanButtons` in `<nile-chart>` config). Either renders a bar under the master pane (‹ slider ›, each piece only when its property is on); use any combination with `navigator-controls`, which is unchanged. `navigator-default-window` now applies when any of the three is on. The slider is a `nile-slider`, so apps register `@aquera/nile-elements`. New CSS parts `navigator-bar`, `navigator-slider`, `navigator-pan-button` (UIF-1433)
|
|
41
|
+
|
|
39
42
|
#### Version 2.9.49 (November 20, 2026)
|
|
40
43
|
- Nile Master-Detail Chart: `navigator-controls` is now map-style. The control bar under the master (pan buttons, window slider, zoom) is replaced by + / − zoom buttons over the chart's top-right corner; drag the zoomed chart (or focus it and use ← / →) to pan, + / − keys zoom. The chart keeps 48 px clear on the right for the control, which stays opaque when a button is disabled. The range caption under the master is removed, and with it `navigator-hint` and the `navigator-caption` / `navigator-hint` parts; build a readout from `nile-chart-selection { min, max }` if you need one. `navigator-default-window` is unchanged. New CSS part `navigator-button` (UIF-1433)
|
|
41
44
|
|
|
@@ -15,6 +15,10 @@ export interface ChartMasterDetailConfigType {
|
|
|
15
15
|
masterOnly?: boolean;
|
|
16
16
|
masterCollapsible?: boolean;
|
|
17
17
|
navigatorControls?: boolean;
|
|
18
|
+
/** Slider under the master pane that positions the visible window. Independent of `navigatorControls`. */
|
|
19
|
+
navigatorSlider?: boolean;
|
|
20
|
+
/** ‹ / › pan buttons under the master pane. Independent of `navigatorControls`. */
|
|
21
|
+
navigatorPanButtons?: boolean;
|
|
18
22
|
/** Opening window with navigator controls: a fraction (`0.25`) or a duration (`7d`, `12h`, `30m`, `2w`). */
|
|
19
23
|
navigatorDefaultWindow?: string;
|
|
20
24
|
xAxisType?: MasterDetailXAxisType;
|
|
@@ -423,6 +423,10 @@ export interface NileMasterDetailChartConfig extends NileChartConfigBase {
|
|
|
423
423
|
masterOnly?: boolean;
|
|
424
424
|
masterCollapsible?: boolean;
|
|
425
425
|
navigatorControls?: boolean;
|
|
426
|
+
/** Slider under the master pane that positions the visible window. Independent of `navigatorControls`. */
|
|
427
|
+
navigatorSlider?: boolean;
|
|
428
|
+
/** ‹ / › pan buttons under the master pane. Independent of `navigatorControls`. */
|
|
429
|
+
navigatorPanButtons?: boolean;
|
|
426
430
|
/** Opening window with navigator controls: a fraction (`0.25`) or a duration (`7d`, `12h`, `30m`, `2w`). */
|
|
427
431
|
navigatorDefaultWindow?: string;
|
|
428
432
|
xAxisType?: 'datetime' | 'linear' | 'logarithmic' | 'category';
|
|
@@ -1643,6 +1643,8 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
1643
1643
|
.masterOnly=${config.masterOnly ?? false}
|
|
1644
1644
|
.masterCollapsible=${config.masterCollapsible ?? false}
|
|
1645
1645
|
.navigatorControls=${config.navigatorControls ?? false}
|
|
1646
|
+
.navigatorSlider=${config.navigatorSlider ?? false}
|
|
1647
|
+
.navigatorPanButtons=${config.navigatorPanButtons ?? false}
|
|
1646
1648
|
.navigatorDefaultWindow=${config.navigatorDefaultWindow ?? ''}
|
|
1647
1649
|
.xAxisType=${config.xAxisType ?? 'datetime'}
|
|
1648
1650
|
.xAxisMin=${config.xAxisMin ?? null}
|
|
@@ -155,6 +155,66 @@ export const styles = css `
|
|
|
155
155
|
cursor: not-allowed;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
/* Slider / pan-button bar under the master pane (navigator-slider, navigator-pan-buttons). */
|
|
159
|
+
.navigator-bar {
|
|
160
|
+
flex: 0 0 auto;
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-wrap: nowrap;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: var(--nile-spacing-2, var(--ng-spacing-2, 8px));
|
|
165
|
+
padding-top: var(--nile-spacing-2, var(--ng-spacing-2, 8px));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.navigator-bar-spacer {
|
|
169
|
+
flex: 1 1 auto;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* Half the thumb plus a gap, so the thumb at either end clears the buttons. */
|
|
173
|
+
.navigator-slider {
|
|
174
|
+
flex: 1 1 160px;
|
|
175
|
+
min-width: 120px;
|
|
176
|
+
margin-inline: calc(
|
|
177
|
+
var(--nile-spacing-lg, var(--ng-spacing-2xl, 24px)) / 2 + var(--nile-spacing-xs, var(--ng-spacing-xs, 4px))
|
|
178
|
+
);
|
|
179
|
+
--nile-slider-width: 100%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.navigator-pan-button {
|
|
183
|
+
flex: 0 0 auto;
|
|
184
|
+
display: flex;
|
|
185
|
+
align-items: center;
|
|
186
|
+
justify-content: center;
|
|
187
|
+
box-sizing: border-box;
|
|
188
|
+
width: var(--nile-height-32px, var(--ng-height-32px, 32px));
|
|
189
|
+
height: var(--nile-height-32px, var(--ng-height-32px, 32px));
|
|
190
|
+
padding: 0;
|
|
191
|
+
margin: 0;
|
|
192
|
+
background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, Canvas));
|
|
193
|
+
border: var(--nile-border-width-1, var(--ng-stroke-width-1, 1px)) solid
|
|
194
|
+
var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
195
|
+
border-radius: var(--nile-radius-sm, var(--ng-radius-md, 8px));
|
|
196
|
+
box-shadow: var(--nile-box-shadow-1, var(--ng-shadow-xs));
|
|
197
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
transition: background 150ms ease, color 150ms ease;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.navigator-pan-button:hover:not(:disabled) {
|
|
203
|
+
background: var(--nile-colors-dark-200, var(--ng-colors-bg-secondary-hover));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.navigator-pan-button:focus-visible {
|
|
207
|
+
outline: var(--nile-border-width-2, var(--ng-stroke-width-2, 2px)) solid
|
|
208
|
+
var(--nile-colors-primary-600, var(--ng-colors-border-brand));
|
|
209
|
+
outline-offset: 2px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.navigator-pan-button:disabled {
|
|
213
|
+
background: var(--nile-colors-neutral-100, var(--ng-colors-bg-tertiary, color-mix(in srgb, CanvasText 6%, Canvas)));
|
|
214
|
+
color: var(--nile-colors-neutral-400, var(--ng-colors-fg-disabled, GrayText));
|
|
215
|
+
cursor: not-allowed;
|
|
216
|
+
}
|
|
217
|
+
|
|
158
218
|
/* Drag-to-pan on the detail pane once zoomed in; vertical touch scroll still scrolls the page. */
|
|
159
219
|
.detail-container--pannable {
|
|
160
220
|
cursor: grab;
|
|
@@ -54,15 +54,28 @@ export declare class NileMasterDetailChart extends NileElement {
|
|
|
54
54
|
masterType: MasterDetailSeriesType;
|
|
55
55
|
masterOnly: boolean;
|
|
56
56
|
masterCollapsible: boolean;
|
|
57
|
+
/** Map-style + / − zoom over the chart's top-right corner, drag-to-pan and keyboard pan / zoom. */
|
|
57
58
|
navigatorControls: boolean;
|
|
58
59
|
/**
|
|
59
|
-
*
|
|
60
|
+
* A slider under the master pane that moves the visible window along the data. Independent of
|
|
61
|
+
* `navigator-controls` and `navigator-pan-buttons`; disabled while the window covers the full range.
|
|
62
|
+
*/
|
|
63
|
+
navigatorSlider: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* ‹ / › buttons under the master pane that pan the window by 25% of its width. Independent of
|
|
66
|
+
* `navigator-controls` and `navigator-slider`.
|
|
67
|
+
*/
|
|
68
|
+
navigatorPanButtons: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Opening window when any navigator feature (`navigator-controls`, `navigator-slider`, `navigator-pan-buttons`) is on and no `selection-min` / `selection-max` is set:
|
|
60
71
|
* a fraction of the range (`0.25`) or, on a datetime axis, a duration (`30m`, `12h`, `7d`, `2w`),
|
|
61
72
|
* ending at the latest data. Empty opens on the full range.
|
|
62
73
|
*/
|
|
63
74
|
navigatorDefaultWindow: string;
|
|
64
75
|
private _window;
|
|
65
|
-
/**
|
|
76
|
+
/** True when any navigator feature is on. */
|
|
77
|
+
private get _anyNavigator();
|
|
78
|
+
/** Re-renders only when a navigator is shown, so plain charts skip the extra update. */
|
|
66
79
|
private _trackWindow;
|
|
67
80
|
height: string;
|
|
68
81
|
masterHeight: string | number;
|
|
@@ -138,6 +151,8 @@ export declare class NileMasterDetailChart extends NileElement {
|
|
|
138
151
|
/** Scale the window around its centre: `0.5` zooms in, `2` zooms out; at least one data point per step. */
|
|
139
152
|
zoomBy(factor: number): void;
|
|
140
153
|
private get _navState();
|
|
154
|
+
/** Slider (0–1000) maps to where the window's left edge sits in the free room; the width is kept. */
|
|
155
|
+
private _onSliderChange;
|
|
141
156
|
/** Drag-to-pan on the detail pane: the window follows the pointer, keeping its width. */
|
|
142
157
|
private get _canDragPan();
|
|
143
158
|
private _onPanStart;
|
|
@@ -150,6 +165,9 @@ export declare class NileMasterDetailChart extends NileElement {
|
|
|
150
165
|
* chart never shows through, and the cluster keeps a single border with a hairline divider.
|
|
151
166
|
*/
|
|
152
167
|
private _navButton;
|
|
168
|
+
private _panButton;
|
|
169
|
+
/** Bar under the master pane: optional ‹ pan, slider, › pan — each part on its own property. */
|
|
170
|
+
private _renderNavigatorBar;
|
|
153
171
|
/** Map-style + / − zoom buttons, overlaid on the top-right corner of the chart. */
|
|
154
172
|
private _renderZoomControls;
|
|
155
173
|
private initCharts;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { html, nothing } from 'lit';
|
|
4
|
+
import { keyed } from 'lit/directives/keyed.js';
|
|
4
5
|
import { getHighcharts } from '../internal/utils/highcharts-provider.js';
|
|
5
6
|
import NileElement from '../internal/base/nile-element.js';
|
|
6
7
|
import { applySeparatedChartConfig } from '../internal/utils/separated-chart-config.js';
|
|
@@ -30,6 +31,12 @@ export const MASTER_DETAIL_X_AXIS_TYPES = ['datetime', 'linear', 'logarithmic',
|
|
|
30
31
|
* @csspart master-toggle - The show/hide button for the master strip (`master-collapsible`).
|
|
31
32
|
* @csspart navigator - The map-style zoom buttons (+ / −) over the top-right corner of the chart (`navigator-controls`).
|
|
32
33
|
* @csspart navigator-button - Each zoom button (`Zoom in`, `Zoom out`) inside the `navigator` control.
|
|
34
|
+
* @csspart navigator-bar - The bar under the master pane holding the slider and / or pan buttons
|
|
35
|
+
* (`navigator-slider`, `navigator-pan-buttons`).
|
|
36
|
+
* @csspart navigator-slider - The `nile-slider` that positions the window (`navigator-slider`).
|
|
37
|
+
* @csspart navigator-pan-button - Each pan button (`Pan back`, `Pan forward`) in the bar (`navigator-pan-buttons`).
|
|
38
|
+
*
|
|
39
|
+
* @dependency nile-slider - `navigator-slider` renders a `nile-slider` from `@aquera/nile-elements`; register it in the app.
|
|
33
40
|
*/
|
|
34
41
|
/** Right spacing (px) reserved on the chart under the zoom control: 32px control + 8px offset + 8px gap. */
|
|
35
42
|
const NAV_CONTROL_GUTTER = 48;
|
|
@@ -63,9 +70,20 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
63
70
|
this.masterType = 'area';
|
|
64
71
|
this.masterOnly = false;
|
|
65
72
|
this.masterCollapsible = false;
|
|
73
|
+
/** Map-style + / − zoom over the chart's top-right corner, drag-to-pan and keyboard pan / zoom. */
|
|
66
74
|
this.navigatorControls = false;
|
|
67
75
|
/**
|
|
68
|
-
*
|
|
76
|
+
* A slider under the master pane that moves the visible window along the data. Independent of
|
|
77
|
+
* `navigator-controls` and `navigator-pan-buttons`; disabled while the window covers the full range.
|
|
78
|
+
*/
|
|
79
|
+
this.navigatorSlider = false;
|
|
80
|
+
/**
|
|
81
|
+
* ‹ / › buttons under the master pane that pan the window by 25% of its width. Independent of
|
|
82
|
+
* `navigator-controls` and `navigator-slider`.
|
|
83
|
+
*/
|
|
84
|
+
this.navigatorPanButtons = false;
|
|
85
|
+
/**
|
|
86
|
+
* Opening window when any navigator feature (`navigator-controls`, `navigator-slider`, `navigator-pan-buttons`) is on and no `selection-min` / `selection-max` is set:
|
|
69
87
|
* a fraction of the range (`0.25`) or, on a datetime axis, a duration (`30m`, `12h`, `7d`, `2w`),
|
|
70
88
|
* ending at the latest data. Empty opens on the full range.
|
|
71
89
|
*/
|
|
@@ -113,10 +131,14 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
113
131
|
this.masterChart?.reflow();
|
|
114
132
|
}
|
|
115
133
|
}
|
|
116
|
-
/**
|
|
134
|
+
/** True when any navigator feature is on. */
|
|
135
|
+
get _anyNavigator() {
|
|
136
|
+
return this.navigatorControls || this.navigatorSlider || this.navigatorPanButtons;
|
|
137
|
+
}
|
|
138
|
+
/** Re-renders only when a navigator is shown, so plain charts skip the extra update. */
|
|
117
139
|
_trackWindow(min, max) {
|
|
118
140
|
this._window = { min, max };
|
|
119
|
-
if (this.
|
|
141
|
+
if (this._anyNavigator)
|
|
120
142
|
this.requestUpdate();
|
|
121
143
|
}
|
|
122
144
|
_cssLength(val) {
|
|
@@ -204,6 +226,8 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
204
226
|
'selectionMax',
|
|
205
227
|
'navigatorDefaultWindow',
|
|
206
228
|
'navigatorControls',
|
|
229
|
+
'navigatorSlider',
|
|
230
|
+
'navigatorPanButtons',
|
|
207
231
|
'detailTitle',
|
|
208
232
|
'masterTitle',
|
|
209
233
|
'maskFill',
|
|
@@ -375,7 +399,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
375
399
|
}
|
|
376
400
|
defaultSelection() {
|
|
377
401
|
const { dataMin, dataMax } = this.dataExtremes();
|
|
378
|
-
if (this.
|
|
402
|
+
if (this._anyNavigator && this.selectionMin == null && this.selectionMax == null) {
|
|
379
403
|
const win = this._defaultWindow();
|
|
380
404
|
if (win)
|
|
381
405
|
return win;
|
|
@@ -695,11 +719,33 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
695
719
|
const xs = this._allXs();
|
|
696
720
|
const last = xs.length - 1;
|
|
697
721
|
const cur = this._windowIndices() ?? { lo: 0, hi: last };
|
|
722
|
+
const sMin = this._toScale(xs[0]);
|
|
723
|
+
const room = this._toScale(xs[last]) - sMin - (this._toScale(xs[cur.hi]) - this._toScale(xs[cur.lo]));
|
|
724
|
+
const atStart = cur.lo <= 0;
|
|
725
|
+
const atEnd = cur.hi >= last;
|
|
698
726
|
return {
|
|
699
|
-
full:
|
|
727
|
+
full: atStart && atEnd,
|
|
728
|
+
atStart,
|
|
729
|
+
atEnd,
|
|
700
730
|
atMinWidth: cur.hi - cur.lo <= 1,
|
|
731
|
+
sliderValue: room > 0 ? Math.round(((this._toScale(xs[cur.lo]) - sMin) / room) * 1000) : 0,
|
|
701
732
|
};
|
|
702
733
|
}
|
|
734
|
+
/** Slider (0–1000) maps to where the window's left edge sits in the free room; the width is kept. */
|
|
735
|
+
_onSliderChange(event) {
|
|
736
|
+
const cur = this._windowIndices();
|
|
737
|
+
if (!cur)
|
|
738
|
+
return;
|
|
739
|
+
const xs = this._allXs();
|
|
740
|
+
const sMin = this._toScale(xs[0]);
|
|
741
|
+
const width = this._toScale(xs[cur.hi]) - this._toScale(xs[cur.lo]);
|
|
742
|
+
const room = this._toScale(xs[xs.length - 1]) - sMin - width;
|
|
743
|
+
if (room <= 0)
|
|
744
|
+
return;
|
|
745
|
+
const value = Number(event.detail.value) || 0;
|
|
746
|
+
const a = sMin + room * (value / 1000);
|
|
747
|
+
this._setWindow(this._fromScale(a), this._fromScale(a + width));
|
|
748
|
+
}
|
|
703
749
|
/** Drag-to-pan on the detail pane: the window follows the pointer, keeping its width. */
|
|
704
750
|
get _canDragPan() {
|
|
705
751
|
return this.navigatorControls && !this.masterOnly && this._allXs().length >= 2;
|
|
@@ -777,6 +823,37 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
777
823
|
@click=${onClick}
|
|
778
824
|
><nile-glyph name=${icon} method="stroke" size="16" color="currentColor"></nile-glyph></button>`;
|
|
779
825
|
}
|
|
826
|
+
_panButton(icon, label, disabled, direction) {
|
|
827
|
+
return html `<button
|
|
828
|
+
type="button"
|
|
829
|
+
class="navigator-pan-button"
|
|
830
|
+
part="navigator-pan-button"
|
|
831
|
+
aria-label=${label}
|
|
832
|
+
title=${label}
|
|
833
|
+
?disabled=${disabled}
|
|
834
|
+
@click=${() => this.panBy(direction)}
|
|
835
|
+
><nile-glyph name=${icon} method="stroke" size="16" color="currentColor"></nile-glyph></button>`;
|
|
836
|
+
}
|
|
837
|
+
/** Bar under the master pane: optional ‹ pan, slider, › pan — each part on its own property. */
|
|
838
|
+
_renderNavigatorBar() {
|
|
839
|
+
const nav = this._navState;
|
|
840
|
+
return html `<div class="navigator-bar" part="navigator-bar" role="toolbar" aria-label="Chart navigation">
|
|
841
|
+
${this.navigatorPanButtons ? this._panButton('ng-chevron-left', 'Pan back', nav.atStart, -1) : nothing}
|
|
842
|
+
${this.navigatorSlider
|
|
843
|
+
? keyed(`${nav.sliderValue}:${nav.full}`, html `<nile-slider
|
|
844
|
+
class="navigator-slider"
|
|
845
|
+
part="navigator-slider"
|
|
846
|
+
aria-label="Visible range position"
|
|
847
|
+
.minValue=${0}
|
|
848
|
+
.maxValue=${1000}
|
|
849
|
+
.value=${nav.sliderValue}
|
|
850
|
+
?disabled=${nav.full}
|
|
851
|
+
@nile-change-end=${this._onSliderChange}
|
|
852
|
+
></nile-slider>`)
|
|
853
|
+
: html `<span class="navigator-bar-spacer"></span>`}
|
|
854
|
+
${this.navigatorPanButtons ? this._panButton('ng-chevron-right', 'Pan forward', nav.atEnd, 1) : nothing}
|
|
855
|
+
</div>`;
|
|
856
|
+
}
|
|
780
857
|
/** Map-style + / − zoom buttons, overlaid on the top-right corner of the chart. */
|
|
781
858
|
_renderZoomControls() {
|
|
782
859
|
const nav = this._navState;
|
|
@@ -830,7 +907,9 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
830
907
|
if (!this._typesValid)
|
|
831
908
|
return nothing;
|
|
832
909
|
const masterHidden = !this.masterOnly && this.masterCollapsed;
|
|
833
|
-
const
|
|
910
|
+
const enoughData = this._allXs().length >= 2;
|
|
911
|
+
const showNav = this.navigatorControls && enoughData;
|
|
912
|
+
const showBar = (this.navigatorSlider || this.navigatorPanButtons) && enoughData;
|
|
834
913
|
const pannable = showNav && !this.masterOnly && !this._navState.full;
|
|
835
914
|
const navLabel = 'Chart. Arrow keys pan, plus and minus zoom.';
|
|
836
915
|
const detailClasses = [
|
|
@@ -877,6 +956,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
|
|
|
877
956
|
@keydown=${this.masterOnly ? this._onNavKeydown : nothing}
|
|
878
957
|
></div>
|
|
879
958
|
${showNav ? this._renderZoomControls() : nothing}
|
|
959
|
+
${showBar ? this._renderNavigatorBar() : nothing}
|
|
880
960
|
</div>`;
|
|
881
961
|
}
|
|
882
962
|
};
|
|
@@ -932,6 +1012,12 @@ __decorate([
|
|
|
932
1012
|
__decorate([
|
|
933
1013
|
property({ type: Boolean, reflect: true, attribute: 'navigator-controls' })
|
|
934
1014
|
], NileMasterDetailChart.prototype, "navigatorControls", void 0);
|
|
1015
|
+
__decorate([
|
|
1016
|
+
property({ type: Boolean, reflect: true, attribute: 'navigator-slider' })
|
|
1017
|
+
], NileMasterDetailChart.prototype, "navigatorSlider", void 0);
|
|
1018
|
+
__decorate([
|
|
1019
|
+
property({ type: Boolean, reflect: true, attribute: 'navigator-pan-buttons' })
|
|
1020
|
+
], NileMasterDetailChart.prototype, "navigatorPanButtons", void 0);
|
|
935
1021
|
__decorate([
|
|
936
1022
|
property({ type: String, attribute: 'navigator-default-window' })
|
|
937
1023
|
], NileMasterDetailChart.prototype, "navigatorDefaultWindow", void 0);
|
|
@@ -653,4 +653,65 @@ describe('NileMasterDetailChart — navigator snapping, log scale, categories, s
|
|
|
653
653
|
expect(navigatorPart(two)).to.not.be.null;
|
|
654
654
|
});
|
|
655
655
|
});
|
|
656
|
+
describe('NileMasterDetailChart — independent slider and pan buttons', () => {
|
|
657
|
+
const bar = (el) => el.shadowRoot.querySelector('[part~="navigator-bar"]');
|
|
658
|
+
const slider = (el) => el.shadowRoot.querySelector('[part~="navigator-bar"] nile-slider');
|
|
659
|
+
const panBtn = (el, label) => el.shadowRoot.querySelector(`[part~="navigator-bar"] [aria-label="${label}"]`);
|
|
660
|
+
const win = (el) => el._window;
|
|
661
|
+
it('S1. renders no bar by default, nor with navigator-controls alone', async () => {
|
|
662
|
+
expect(bar(await mount({ series: DT_SERIES }))).to.be.null;
|
|
663
|
+
expect(bar(await mount({ series: DT_SERIES, navigatorControls: true }))).to.be.null;
|
|
664
|
+
});
|
|
665
|
+
it('S2. navigator-slider alone: slider, no pan buttons, no + / − control', async () => {
|
|
666
|
+
const el = await mount({ series: DT_SERIES, navigatorSlider: true });
|
|
667
|
+
expect(slider(el)).to.not.be.null;
|
|
668
|
+
expect(panBtn(el, 'Pan back')).to.be.null;
|
|
669
|
+
expect(panBtn(el, 'Pan forward')).to.be.null;
|
|
670
|
+
expect(navigatorPart(el)).to.be.null;
|
|
671
|
+
});
|
|
672
|
+
it('S3. navigator-pan-buttons alone: ‹ › buttons, no slider, no + / − control', async () => {
|
|
673
|
+
const el = await mount({ series: DT_SERIES, navigatorPanButtons: true });
|
|
674
|
+
expect(panBtn(el, 'Pan back')).to.not.be.null;
|
|
675
|
+
expect(panBtn(el, 'Pan forward')).to.not.be.null;
|
|
676
|
+
expect(slider(el)).to.be.null;
|
|
677
|
+
expect(navigatorPart(el)).to.be.null;
|
|
678
|
+
});
|
|
679
|
+
it('S4. all three together: + / − overlay plus bar with ‹ slider ›, in that order', async () => {
|
|
680
|
+
const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorSlider: true, navigatorPanButtons: true });
|
|
681
|
+
expect(navigatorPart(el)).to.not.be.null;
|
|
682
|
+
const kids = [...bar(el).children].map((c) => c.getAttribute('aria-label'));
|
|
683
|
+
expect(kids).to.deep.equal(['Pan back', 'Visible range position', 'Pan forward']);
|
|
684
|
+
});
|
|
685
|
+
it('S5. full range: slider and both pan buttons disabled', async () => {
|
|
686
|
+
const el = await mount({ series: DT_SERIES, navigatorSlider: true, navigatorPanButtons: true });
|
|
687
|
+
expect(isDisabled(slider(el))).to.be.true;
|
|
688
|
+
expect(panBtn(el, 'Pan back').disabled).to.be.true;
|
|
689
|
+
expect(panBtn(el, 'Pan forward').disabled).to.be.true;
|
|
690
|
+
});
|
|
691
|
+
it('S6. navigator-default-window applies with only the slider on', async () => {
|
|
692
|
+
const el = await mount({ series: DT_SERIES, navigatorSlider: true, navigatorDefaultWindow: '2d' });
|
|
693
|
+
expect(win(el)).to.deep.equal({ min: DT_MAX - 2 * DAY, max: DT_MAX });
|
|
694
|
+
expect(isDisabled(slider(el))).to.be.false;
|
|
695
|
+
});
|
|
696
|
+
it('S7. pan back button moves the window earlier and enables pan forward', async () => {
|
|
697
|
+
const el = await mount({ series: DT_SERIES, navigatorPanButtons: true, navigatorDefaultWindow: '2d' });
|
|
698
|
+
expect(panBtn(el, 'Pan forward').disabled).to.be.true;
|
|
699
|
+
const seen = selectionSpy(el);
|
|
700
|
+
panBtn(el, 'Pan back').click();
|
|
701
|
+
await el.updateComplete;
|
|
702
|
+
expect(win(el)).to.deep.equal({ min: DT_MAX - 3 * DAY, max: DT_MAX - DAY });
|
|
703
|
+
expect(seen.length).to.equal(1);
|
|
704
|
+
expect(panBtn(el, 'Pan forward').disabled).to.be.false;
|
|
705
|
+
});
|
|
706
|
+
it('S8. moving the slider to 0 puts the window at the start, keeping its width', async () => {
|
|
707
|
+
const el = await mount({ series: DT_SERIES, navigatorSlider: true, navigatorDefaultWindow: '2d' });
|
|
708
|
+
slider(el).dispatchEvent(new CustomEvent('nile-change-end', { detail: { value: 0 } }));
|
|
709
|
+
await el.updateComplete;
|
|
710
|
+
expect(win(el)).to.deep.equal({ min: DT_MIN, max: DT_MIN + 2 * DAY });
|
|
711
|
+
});
|
|
712
|
+
it('S9. the bar shows in master-only mode', async () => {
|
|
713
|
+
const el = await mount({ series: DT_SERIES, masterOnly: true, navigatorSlider: true, navigatorPanButtons: true });
|
|
714
|
+
expect(bar(el)).to.not.be.null;
|
|
715
|
+
});
|
|
716
|
+
});
|
|
656
717
|
//# sourceMappingURL=nile-master-detail-chart.test.js.map
|