@aquera/nile-visualization 2.9.19 → 2.9.21
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 +8 -0
- package/dist/src/index.d.ts +8 -2
- package/dist/src/index.js +3 -0
- package/dist/src/internal/color-palettes/color-palettes-data.d.ts +15 -0
- package/dist/src/internal/color-palettes/color-palettes-data.js +111 -0
- package/dist/src/internal/color-palettes/index.d.ts +3 -0
- package/dist/src/internal/color-palettes/index.js +43 -0
- package/dist/src/internal/types/chart-color-palette.type.d.ts +13 -0
- package/dist/src/internal/types/chart-color-palette.type.js +2 -0
- package/dist/src/internal/types/chart-config.type.d.ts +3 -1
- package/dist/src/internal/types/chart-list-config.type.d.ts +25 -0
- package/dist/src/internal/types/chart-list-config.type.js +2 -0
- package/dist/src/internal/types/chart-master-detail-config.type.d.ts +38 -0
- package/dist/src/internal/types/chart-master-detail-config.type.js +2 -0
- package/dist/src/internal/types/chart-message-config.type.d.ts +9 -0
- package/dist/src/internal/types/chart-message-config.type.js +2 -0
- package/dist/src/internal/types/index.d.ts +2 -0
- package/dist/src/internal/types/primitive-chart-config.type.d.ts +2 -1
- package/dist/src/nile-chart/index.d.ts +2 -2
- package/dist/src/nile-chart/nile-chart-config.d.ts +48 -1
- package/dist/src/nile-chart/nile-chart-skeleton.js +1 -1
- package/dist/src/nile-chart/nile-chart.css.js +1 -0
- package/dist/src/nile-chart/nile-chart.d.ts +9 -0
- package/dist/src/nile-chart/nile-chart.js +110 -2
- package/dist/src/nile-chart-list/index.d.ts +2 -0
- package/dist/src/nile-chart-list/index.js +2 -0
- package/dist/src/nile-chart-list/nile-chart-list.css.d.ts +12 -0
- package/dist/src/nile-chart-list/nile-chart-list.css.js +126 -0
- package/dist/src/nile-chart-list/nile-chart-list.d.ts +61 -0
- package/dist/src/nile-chart-list/nile-chart-list.js +188 -0
- package/dist/src/nile-chart-message/index.d.ts +2 -0
- package/dist/src/nile-chart-message/index.js +2 -0
- package/dist/src/nile-chart-message/nile-chart-message.css.d.ts +12 -0
- package/dist/src/nile-chart-message/nile-chart-message.css.js +108 -0
- package/dist/src/nile-chart-message/nile-chart-message.d.ts +36 -0
- package/dist/src/nile-chart-message/nile-chart-message.js +117 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.d.ts +1 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +76 -12
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +6 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +78 -10
- package/dist/src/nile-master-detail-chart/index.d.ts +2 -0
- package/dist/src/nile-master-detail-chart/index.js +2 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.css.d.ts +1 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.css.js +95 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +93 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.js +604 -0
- package/package.json +6 -3
|
@@ -8,6 +8,7 @@ import { renderChartSkeleton } from './nile-chart-skeleton.js';
|
|
|
8
8
|
import { convertConfig } from '../internal/chart-adapters.js';
|
|
9
9
|
import { deepMerge } from '../internal/utils.js';
|
|
10
10
|
import { initNileChartExporting, getHighcharts } from '../internal/highcharts-provider.js';
|
|
11
|
+
import { resolveColorPaletteColors } from '../internal/color-palettes/index.js';
|
|
11
12
|
// Start loading exporting/offline-exporting/export-data at module import time.
|
|
12
13
|
// `chart.fullscreen` is attached via a `beforeRender` hook installed by the exporting module's
|
|
13
14
|
// compose step, so if a chart is constructed before the module applies, that instance will have
|
|
@@ -35,6 +36,7 @@ import '../nile-histogram-chart/index.js';
|
|
|
35
36
|
import '../nile-bellcurve-chart/index.js';
|
|
36
37
|
import '../nile-boxplot-chart/index.js';
|
|
37
38
|
import '../nile-timeline-chart/index.js';
|
|
39
|
+
import '../nile-master-detail-chart/index.js';
|
|
38
40
|
import '../nile-dumbbell-chart/index.js';
|
|
39
41
|
import '../nile-dumbbell-lower-chart/index.js';
|
|
40
42
|
import '../nile-dumbbell-upper-chart/index.js';
|
|
@@ -61,7 +63,10 @@ import '../nile-vector-chart/index.js';
|
|
|
61
63
|
import '../nile-xrange-chart/index.js';
|
|
62
64
|
import '../nile-kpi-chart/index.js';
|
|
63
65
|
import '../nile-filter-chart/index.js';
|
|
66
|
+
import '../nile-chart-message/nile-chart-message.js';
|
|
67
|
+
import '../nile-chart-list/nile-chart-list.js';
|
|
64
68
|
import '../nile-ai-panel/index.js';
|
|
69
|
+
import '@aquera/nile-elements/nile-tooltip';
|
|
65
70
|
const CORE_CHART_LABELS = {
|
|
66
71
|
bar: 'Bar',
|
|
67
72
|
pie: 'Pie',
|
|
@@ -84,6 +89,7 @@ const CORE_CHART_LABELS = {
|
|
|
84
89
|
bellcurve: 'Bell curve',
|
|
85
90
|
boxplot: 'Box plot',
|
|
86
91
|
timeline: 'Timeline',
|
|
92
|
+
'master-detail': 'Master / detail',
|
|
87
93
|
dumbbell: 'Dumbbell',
|
|
88
94
|
fan: 'Fan',
|
|
89
95
|
funnel: 'Funnel',
|
|
@@ -173,6 +179,9 @@ let NileChart = class NileChart extends NileElement {
|
|
|
173
179
|
this.hasHeaderSlotContent = false;
|
|
174
180
|
/** True when elements are projected into `header-actions` (used to show the header row). */
|
|
175
181
|
this.hasHeaderActionsSlot = false;
|
|
182
|
+
/** True while the inner master-detail chart is zoomed — drives the header
|
|
183
|
+
* "Reset zoom" button. Reflected from the chart's `nile-master-detail-zoom`. */
|
|
184
|
+
this.masterZoomed = false;
|
|
176
185
|
this.handleOutsideClick = (e) => {
|
|
177
186
|
const path = e.composedPath();
|
|
178
187
|
if (!path.includes(this)) {
|
|
@@ -207,6 +216,9 @@ let NileChart = class NileChart extends NileElement {
|
|
|
207
216
|
this._showHeaderTip(el.textContent ?? '', rect.left + rect.width / 2, rect.top);
|
|
208
217
|
};
|
|
209
218
|
}
|
|
219
|
+
onMasterZoom(e) {
|
|
220
|
+
this.masterZoomed = !!e.detail?.zoomed;
|
|
221
|
+
}
|
|
210
222
|
get effectiveSummary() {
|
|
211
223
|
return this.resolvedConfig?.summary ?? this.summary;
|
|
212
224
|
}
|
|
@@ -299,6 +311,8 @@ let NileChart = class NileChart extends NileElement {
|
|
|
299
311
|
const converted = convertConfig(this.resolvedConfig, toType);
|
|
300
312
|
this.activeType = toType;
|
|
301
313
|
this.activeConfig = converted;
|
|
314
|
+
// Leaving master-detail drops any active zoom (and its header button).
|
|
315
|
+
this.masterZoomed = false;
|
|
302
316
|
this.closeMenu();
|
|
303
317
|
this.emit('nile-chart-type-change', {
|
|
304
318
|
fromType,
|
|
@@ -394,7 +408,8 @@ let NileChart = class NileChart extends NileElement {
|
|
|
394
408
|
this.hasHeaderActionsSlot ||
|
|
395
409
|
this.lightDomHasSlot('header') ||
|
|
396
410
|
this.lightDomHasSlot('header-actions') ||
|
|
397
|
-
hasBuiltinActions
|
|
411
|
+
hasBuiltinActions ||
|
|
412
|
+
this.masterZoomed);
|
|
398
413
|
}
|
|
399
414
|
buildExportingOptions() {
|
|
400
415
|
return { exporting: { enabled: true, buttons: { contextButton: { enabled: false } } } };
|
|
@@ -566,6 +581,19 @@ let NileChart = class NileChart extends NileElement {
|
|
|
566
581
|
</div>
|
|
567
582
|
<div class="nile-chart-header-actions">
|
|
568
583
|
<slot name="header-actions" @slotchange=${this.onHeaderActionsSlotChange}></slot>
|
|
584
|
+
${this.masterZoomed && (this.activeType ?? this.resolvedConfig?.type) === 'master-detail'
|
|
585
|
+
? html `<nile-tooltip content="Reset zoom" placement="top">
|
|
586
|
+
<button
|
|
587
|
+
type="button"
|
|
588
|
+
class="nile-chart-menu-trigger nile-chart-reset-zoom"
|
|
589
|
+
part="reset-zoom"
|
|
590
|
+
aria-label="Reset zoom"
|
|
591
|
+
@click=${() => this.masterDetailChart?.resetZoom()}
|
|
592
|
+
>
|
|
593
|
+
<nile-glyph name="refresh" size="16"></nile-glyph>
|
|
594
|
+
</button>
|
|
595
|
+
</nile-tooltip>`
|
|
596
|
+
: nothing}
|
|
569
597
|
${this.renderAiTrigger()}
|
|
570
598
|
${this.renderActionsMenu()}
|
|
571
599
|
</div>
|
|
@@ -604,7 +632,16 @@ let NileChart = class NileChart extends NileElement {
|
|
|
604
632
|
const { show, ...rest } = config.legend;
|
|
605
633
|
legendOptions.legend = { enabled: show ?? true, ...rest };
|
|
606
634
|
}
|
|
607
|
-
const
|
|
635
|
+
const cfgData = config.data;
|
|
636
|
+
const dataCount = Array.isArray(cfgData) ? cfgData.length : undefined;
|
|
637
|
+
// Apply the built-in 'default' palette automatically when no colorPalette is
|
|
638
|
+
// given — so charts use Nile colors out of the box with no config needed. A
|
|
639
|
+
// consumer who supplies their own `options.colors` opts out (not clobbered).
|
|
640
|
+
const hasExplicitColors = Array.isArray(config.options?.colors);
|
|
641
|
+
const paletteCfg = config.colorPalette ?? (hasExplicitColors ? undefined : { theme: 'default' });
|
|
642
|
+
const paletteColors = resolveColorPaletteColors(paletteCfg, dataCount);
|
|
643
|
+
const paletteOptions = paletteColors ? { colors: paletteColors } : {};
|
|
644
|
+
const mergedOptions = deepMerge(deepMerge(deepMerge(deepMerge(config.options ?? {}, legendOptions), paletteOptions), noTitle), this.buildExportingOptions());
|
|
608
645
|
switch (config.type) {
|
|
609
646
|
case 'bar':
|
|
610
647
|
return html `<nile-bar-chart
|
|
@@ -1093,6 +1130,44 @@ let NileChart = class NileChart extends NileElement {
|
|
|
1093
1130
|
.loadingFontFamily=${config.loadingFontFamily ?? ''}
|
|
1094
1131
|
.loadingBg=${config.loadingBg ?? ''}
|
|
1095
1132
|
></nile-timeline-chart>`;
|
|
1133
|
+
case 'master-detail':
|
|
1134
|
+
return html `<nile-master-detail-chart
|
|
1135
|
+
.data=${config.data}
|
|
1136
|
+
.height=${this.hasAttribute('fit') ? null : (config.height ?? '100%')}
|
|
1137
|
+
.seriesName=${config.seriesName ?? ''}
|
|
1138
|
+
.seriesColor=${config.seriesColor ?? ''}
|
|
1139
|
+
.detailType=${config.detailType ?? 'area'}
|
|
1140
|
+
.masterType=${config.masterType ?? 'area'}
|
|
1141
|
+
.masterOnly=${config.masterOnly ?? false}
|
|
1142
|
+
.xAxisType=${config.xAxisType ?? 'datetime'}
|
|
1143
|
+
.xAxisMin=${config.xAxisMin ?? null}
|
|
1144
|
+
.xAxisMax=${config.xAxisMax ?? null}
|
|
1145
|
+
.yAxisMin=${config.yAxisMin ?? null}
|
|
1146
|
+
.yAxisMax=${config.yAxisMax ?? null}
|
|
1147
|
+
.masterHeight=${config.masterHeight ?? 100}
|
|
1148
|
+
.selectionMin=${config.selectionMin ?? null}
|
|
1149
|
+
.selectionMax=${config.selectionMax ?? null}
|
|
1150
|
+
.detailTitle=${config.detailTitle ?? ''}
|
|
1151
|
+
.masterTitle=${config.masterTitle ?? ''}
|
|
1152
|
+
.maskFill=${config.maskFill ?? 'rgba(0,0,0,0.2)'}
|
|
1153
|
+
.options=${mergedOptions}
|
|
1154
|
+
.masterOptions=${config.masterOptions ?? {}}
|
|
1155
|
+
.legend=${config.legend ?? null}
|
|
1156
|
+
.loading=${config.loading ?? false}
|
|
1157
|
+
.chartBg=${config.chartBg ?? ''}
|
|
1158
|
+
.chartBorderRadius=${config.chartBorderRadius ?? ''}
|
|
1159
|
+
.chartBorder=${config.chartBorder ?? ''}
|
|
1160
|
+
.chartShadow=${config.chartShadow ?? ''}
|
|
1161
|
+
.chartPadding=${config.chartPadding ?? ''}
|
|
1162
|
+
.chartMinHeight=${config.chartMinHeight ?? ''}
|
|
1163
|
+
.loadingText=${config.loadingText ?? 'Loading...'}
|
|
1164
|
+
.loadingColor=${config.loadingColor ?? ''}
|
|
1165
|
+
.loadingFontSize=${config.loadingFontSize ?? ''}
|
|
1166
|
+
.loadingFontFamily=${config.loadingFontFamily ?? ''}
|
|
1167
|
+
.loadingBg=${config.loadingBg ?? ''}
|
|
1168
|
+
@nile-chart-selection=${(e) => this.emit('nile-chart-selection', e.detail)}
|
|
1169
|
+
@nile-master-detail-zoom=${(e) => this.onMasterZoom(e)}
|
|
1170
|
+
></nile-master-detail-chart>`;
|
|
1096
1171
|
case 'dumbbell':
|
|
1097
1172
|
return html `<nile-dumbbell-chart
|
|
1098
1173
|
.data=${config.data}
|
|
@@ -1784,6 +1859,33 @@ let NileChart = class NileChart extends NileElement {
|
|
|
1784
1859
|
?hide-control-headers=${promote}
|
|
1785
1860
|
@nile-change="${(e) => this.emit('nile-change', e.detail)}"
|
|
1786
1861
|
></nile-filter-chart>`;
|
|
1862
|
+
}
|
|
1863
|
+
case 'message': {
|
|
1864
|
+
return html `<nile-chart-message
|
|
1865
|
+
variant=${config.variant ?? 'info'}
|
|
1866
|
+
heading=${config.heading ?? ''}
|
|
1867
|
+
description=${config.description ?? ''}
|
|
1868
|
+
?statusLight=${config.statusLight ?? true}
|
|
1869
|
+
.statusLightConfig=${config.statusLightConfig ?? {}}
|
|
1870
|
+
></nile-chart-message>`;
|
|
1871
|
+
}
|
|
1872
|
+
case 'list': {
|
|
1873
|
+
return html `<nile-chart-list
|
|
1874
|
+
.config=${{
|
|
1875
|
+
list: {
|
|
1876
|
+
variant: config.variant,
|
|
1877
|
+
items: config.items ?? [],
|
|
1878
|
+
iconName: config.iconName,
|
|
1879
|
+
iconSize: config.iconSize,
|
|
1880
|
+
marker: config.marker,
|
|
1881
|
+
markerSize: config.markerSize,
|
|
1882
|
+
markerColor: config.markerColor,
|
|
1883
|
+
allowHtml: config.allowHtml,
|
|
1884
|
+
},
|
|
1885
|
+
}}
|
|
1886
|
+
@nile-click=${(e) => this.emit('nile-click', e.detail)}
|
|
1887
|
+
@nile-change=${(e) => this.emit('nile-change', e.detail)}
|
|
1888
|
+
></nile-chart-list>`;
|
|
1787
1889
|
}
|
|
1788
1890
|
default: {
|
|
1789
1891
|
const _exhaustive = config;
|
|
@@ -1862,6 +1964,12 @@ __decorate([
|
|
|
1862
1964
|
__decorate([
|
|
1863
1965
|
query('nile-ai-panel')
|
|
1864
1966
|
], NileChart.prototype, "aiPanel", void 0);
|
|
1967
|
+
__decorate([
|
|
1968
|
+
query('nile-master-detail-chart')
|
|
1969
|
+
], NileChart.prototype, "masterDetailChart", void 0);
|
|
1970
|
+
__decorate([
|
|
1971
|
+
state()
|
|
1972
|
+
], NileChart.prototype, "masterZoomed", void 0);
|
|
1865
1973
|
NileChart = __decorate([
|
|
1866
1974
|
customElement('nile-chart')
|
|
1867
1975
|
], NileChart);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Chart List CSS
|
|
9
|
+
*/
|
|
10
|
+
export declare const styles: import("lit").CSSResult;
|
|
11
|
+
declare const _default: import("lit").CSSResult[];
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
/**
|
|
9
|
+
* Chart List CSS
|
|
10
|
+
*/
|
|
11
|
+
export const styles = css `
|
|
12
|
+
:host {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
-webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
|
|
16
|
+
-moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));
|
|
17
|
+
text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.list {
|
|
21
|
+
list-style: none;
|
|
22
|
+
margin: var(--nile-spacing-none, var(--ng-spacing-none));
|
|
23
|
+
padding: var(--nile-spacing-none, var(--ng-spacing-none));
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.item {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: flex-start;
|
|
32
|
+
gap: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
33
|
+
padding: var(--nile-spacing-sm, var(--ng-spacing-sm))
|
|
34
|
+
var(--nile-spacing-md, var(--ng-spacing-md));
|
|
35
|
+
border-radius: var(--nile-radius-radius-md, var(--ng-radius-md));
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-fg-primary-900));
|
|
38
|
+
transition: background-color
|
|
39
|
+
var(--nile-transition-duration-default, var(--ng-transition-duration-fast))
|
|
40
|
+
ease;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.item:hover {
|
|
44
|
+
background-color: var(
|
|
45
|
+
--nile-colors-neutral-100,
|
|
46
|
+
var(--ng-colors-bg-secondary)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.item--disabled {
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
opacity: var(--nile-opacity-50, var(--ng-opacity-50));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.item--disabled:hover {
|
|
56
|
+
background-color: transparent;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.item__content {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
min-width: var(--nile-width-none, var(--ng-width-0));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.item__label {
|
|
66
|
+
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
67
|
+
line-height: var(--nile-line-height-small, var(--ng-line-height-text-sm));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.item__sub-label {
|
|
71
|
+
font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
|
|
72
|
+
line-height: var(--nile-line-height-xsmall, var(--ng-line-height-text-xs));
|
|
73
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-fg-secondary-700));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.item__description {
|
|
77
|
+
font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
|
|
78
|
+
line-height: var(--nile-line-height-xsmall, var(--ng-line-height-text-xs));
|
|
79
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-fg-secondary-700));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.marker {
|
|
83
|
+
flex: 0 0 auto;
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
min-height: var(--nile-line-height-small, var(--ng-line-height-text-sm));
|
|
88
|
+
line-height: var(--nile-line-height-small, var(--ng-line-height-text-sm));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Bullet/number variants rely on the native <ul>/<ol> list markers */
|
|
92
|
+
.list--bullet,
|
|
93
|
+
.list--number {
|
|
94
|
+
padding-inline-start: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.list--bullet .item,
|
|
98
|
+
.list--number .item {
|
|
99
|
+
display: list-item;
|
|
100
|
+
list-style-position: outside;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.list--bullet .item {
|
|
104
|
+
list-style-type: disc;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.list--number .item {
|
|
108
|
+
list-style-type: decimal;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.list--bullet .item::marker,
|
|
112
|
+
.list--number .item::marker {
|
|
113
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-fg-primary-900));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.list--bullet .item::marker {
|
|
117
|
+
font-size: var(--nile-type-scale-5, var(--ng-font-size-text-lg));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.list--number .item::marker {
|
|
121
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
122
|
+
font-variant-numeric: tabular-nums;
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
125
|
+
export default [styles];
|
|
126
|
+
//# sourceMappingURL=nile-chart-list.css.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
|
8
|
+
import NileElement from '../internal/nile-element.js';
|
|
9
|
+
import '@aquera/nile-elements/nile-checkbox';
|
|
10
|
+
export type ChartListVariant = 'plain' | 'bullet' | 'number' | 'icon' | 'checkbox';
|
|
11
|
+
export interface ChartListItem {
|
|
12
|
+
label: string;
|
|
13
|
+
subLabel?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
iconName?: string;
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
value?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
color?: string;
|
|
20
|
+
allowHtml?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ChartListMarker {
|
|
23
|
+
size?: number;
|
|
24
|
+
color?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ChartListConfig {
|
|
27
|
+
list: {
|
|
28
|
+
variant?: ChartListVariant;
|
|
29
|
+
items: ChartListItem[];
|
|
30
|
+
iconName?: string;
|
|
31
|
+
iconSize?: number;
|
|
32
|
+
marker?: ChartListMarker;
|
|
33
|
+
markerSize?: number;
|
|
34
|
+
markerColor?: string;
|
|
35
|
+
allowHtml?: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare class NileChartList extends NileElement {
|
|
39
|
+
static get styles(): CSSResultArray;
|
|
40
|
+
variant: ChartListVariant;
|
|
41
|
+
items: ChartListItem[];
|
|
42
|
+
iconName: string;
|
|
43
|
+
iconSize: number;
|
|
44
|
+
markerSize?: number;
|
|
45
|
+
markerColor?: string;
|
|
46
|
+
allowHtml: boolean;
|
|
47
|
+
set config(value: ChartListConfig | undefined);
|
|
48
|
+
private handleSlotClick;
|
|
49
|
+
private handleItemClick;
|
|
50
|
+
private handleCheckboxChange;
|
|
51
|
+
private renderMarker;
|
|
52
|
+
private renderContent;
|
|
53
|
+
private renderItem;
|
|
54
|
+
render(): TemplateResult;
|
|
55
|
+
}
|
|
56
|
+
export default NileChartList;
|
|
57
|
+
declare global {
|
|
58
|
+
interface HTMLElementTagNameMap {
|
|
59
|
+
'nile-chart-list': NileChartList;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { __decorate } from "tslib";
|
|
8
|
+
import { html, nothing, } from 'lit';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
11
|
+
import { styles } from './nile-chart-list.css';
|
|
12
|
+
import NileElement from '../internal/nile-element.js';
|
|
13
|
+
import '@aquera/nile-elements/nile-checkbox';
|
|
14
|
+
let NileChartList = class NileChartList extends NileElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.variant = 'plain';
|
|
18
|
+
this.items = [];
|
|
19
|
+
this.iconName = '';
|
|
20
|
+
this.iconSize = 16;
|
|
21
|
+
this.allowHtml = false;
|
|
22
|
+
}
|
|
23
|
+
static get styles() {
|
|
24
|
+
return [styles];
|
|
25
|
+
}
|
|
26
|
+
set config(value) {
|
|
27
|
+
const list = value?.list;
|
|
28
|
+
if (!list)
|
|
29
|
+
return;
|
|
30
|
+
if (list.variant !== undefined)
|
|
31
|
+
this.variant = list.variant;
|
|
32
|
+
if (list.items !== undefined)
|
|
33
|
+
this.items = list.items;
|
|
34
|
+
if (list.iconName !== undefined)
|
|
35
|
+
this.iconName = list.iconName;
|
|
36
|
+
if (list.iconSize !== undefined)
|
|
37
|
+
this.iconSize = list.iconSize;
|
|
38
|
+
const size = list.marker?.size ?? list.markerSize;
|
|
39
|
+
const color = list.marker?.color ?? list.markerColor;
|
|
40
|
+
if (size !== undefined)
|
|
41
|
+
this.markerSize = size;
|
|
42
|
+
if (color !== undefined)
|
|
43
|
+
this.markerColor = color;
|
|
44
|
+
if (list.allowHtml !== undefined)
|
|
45
|
+
this.allowHtml = list.allowHtml;
|
|
46
|
+
}
|
|
47
|
+
handleSlotClick(e) {
|
|
48
|
+
const path = e.composedPath();
|
|
49
|
+
const listItem = path.find((n) => n?.tagName?.toLowerCase() === 'nile-list-item');
|
|
50
|
+
if (!listItem)
|
|
51
|
+
return;
|
|
52
|
+
const value = listItem.getAttribute('heading') ||
|
|
53
|
+
listItem.innerText ||
|
|
54
|
+
'';
|
|
55
|
+
this.emit('nile-click', { value });
|
|
56
|
+
}
|
|
57
|
+
handleItemClick(item, index) {
|
|
58
|
+
if (item.disabled)
|
|
59
|
+
return;
|
|
60
|
+
if (this.variant === 'checkbox')
|
|
61
|
+
return;
|
|
62
|
+
this.emit('nile-click', {
|
|
63
|
+
value: item.value ?? item.label,
|
|
64
|
+
label: item.label,
|
|
65
|
+
index,
|
|
66
|
+
checked: item.checked,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
handleCheckboxChange(item, index, e) {
|
|
70
|
+
if (item.disabled)
|
|
71
|
+
return;
|
|
72
|
+
item.checked = Boolean(e.detail?.checked ?? e.target?.checked);
|
|
73
|
+
this.requestUpdate();
|
|
74
|
+
this.emit('nile-change', {
|
|
75
|
+
value: item.value ?? item.label,
|
|
76
|
+
label: item.label,
|
|
77
|
+
index,
|
|
78
|
+
checked: item.checked,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
renderMarker(item, index) {
|
|
82
|
+
const color = item.color ?? this.markerColor;
|
|
83
|
+
switch (this.variant) {
|
|
84
|
+
case 'bullet':
|
|
85
|
+
return html `${nothing}`;
|
|
86
|
+
case 'number':
|
|
87
|
+
return html `${nothing}`;
|
|
88
|
+
case 'icon':
|
|
89
|
+
return html `<nile-glyph
|
|
90
|
+
class="marker marker--icon"
|
|
91
|
+
part="marker"
|
|
92
|
+
name="${item.iconName || this.iconName}"
|
|
93
|
+
size="${this.markerSize ?? this.iconSize}"
|
|
94
|
+
color="${color || nothing}"
|
|
95
|
+
method="stroke"
|
|
96
|
+
></nile-glyph>`;
|
|
97
|
+
case 'checkbox':
|
|
98
|
+
return html `<nile-checkbox
|
|
99
|
+
class="marker marker--checkbox"
|
|
100
|
+
part="marker"
|
|
101
|
+
?checked="${item.checked}"
|
|
102
|
+
?disabled="${item.disabled}"
|
|
103
|
+
@nile-change="${(e) => this.handleCheckboxChange(item, index, e)}"
|
|
104
|
+
></nile-checkbox>`;
|
|
105
|
+
case 'plain':
|
|
106
|
+
default:
|
|
107
|
+
return html `${nothing}`;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
renderContent(value, item) {
|
|
111
|
+
return (item.allowHtml ?? this.allowHtml) ? unsafeHTML(value) : value;
|
|
112
|
+
}
|
|
113
|
+
renderItem(item, index) {
|
|
114
|
+
return html `
|
|
115
|
+
<li
|
|
116
|
+
class="item ${item.disabled ? 'item--disabled' : ''}"
|
|
117
|
+
part="item"
|
|
118
|
+
@click="${() => this.handleItemClick(item, index)}"
|
|
119
|
+
>
|
|
120
|
+
${this.renderMarker(item, index)}
|
|
121
|
+
<span class="item__content" part="item-content">
|
|
122
|
+
<span class="item__label" part="label"
|
|
123
|
+
>${this.renderContent(item.label, item)}</span
|
|
124
|
+
>
|
|
125
|
+
${item.subLabel
|
|
126
|
+
? html `<span class="item__sub-label" part="sub-label"
|
|
127
|
+
>${this.renderContent(item.subLabel, item)}</span
|
|
128
|
+
>`
|
|
129
|
+
: nothing}
|
|
130
|
+
${item.description
|
|
131
|
+
? html `<span class="item__description" part="description"
|
|
132
|
+
>${this.renderContent(item.description, item)}</span
|
|
133
|
+
>`
|
|
134
|
+
: nothing}
|
|
135
|
+
</span>
|
|
136
|
+
</li>
|
|
137
|
+
`;
|
|
138
|
+
}
|
|
139
|
+
render() {
|
|
140
|
+
if (this.items && this.items.length > 0) {
|
|
141
|
+
const items = this.items.map((item, index) => this.renderItem(item, index));
|
|
142
|
+
return this.variant === 'number'
|
|
143
|
+
? html `
|
|
144
|
+
<ol class="list list--${this.variant}" part="list">
|
|
145
|
+
${items}
|
|
146
|
+
</ol>
|
|
147
|
+
`
|
|
148
|
+
: html `
|
|
149
|
+
<ul class="list list--${this.variant}" part="list" role="list">
|
|
150
|
+
${items}
|
|
151
|
+
</ul>
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
return html `
|
|
155
|
+
<slot @click="${this.handleSlotClick}"> </slot>
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
__decorate([
|
|
160
|
+
property({ type: String, reflect: true })
|
|
161
|
+
], NileChartList.prototype, "variant", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
property({ attribute: false })
|
|
164
|
+
], NileChartList.prototype, "items", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
property({ type: String, attribute: true })
|
|
167
|
+
], NileChartList.prototype, "iconName", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
property({ type: Number, attribute: true })
|
|
170
|
+
], NileChartList.prototype, "iconSize", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
property({ type: Number, attribute: true })
|
|
173
|
+
], NileChartList.prototype, "markerSize", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
property({ type: String, attribute: true })
|
|
176
|
+
], NileChartList.prototype, "markerColor", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
property({ type: Boolean, attribute: true, reflect: true })
|
|
179
|
+
], NileChartList.prototype, "allowHtml", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
property({ attribute: false })
|
|
182
|
+
], NileChartList.prototype, "config", null);
|
|
183
|
+
NileChartList = __decorate([
|
|
184
|
+
customElement('nile-chart-list')
|
|
185
|
+
], NileChartList);
|
|
186
|
+
export { NileChartList };
|
|
187
|
+
export default NileChartList;
|
|
188
|
+
//# sourceMappingURL=nile-chart-list.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* ChartMessage CSS
|
|
9
|
+
*/
|
|
10
|
+
export declare const styles: import("lit").CSSResult;
|
|
11
|
+
declare const _default: import("lit").CSSResult[];
|
|
12
|
+
export default _default;
|