@aquera/nile-visualization 2.9.28 → 2.9.30

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.
Files changed (136) hide show
  1. package/README.md +8 -0
  2. package/dist/src/index.d.ts +6 -1
  3. package/dist/src/index.js +3 -0
  4. package/dist/src/internal/chart-events.d.ts +92 -0
  5. package/dist/src/internal/chart-events.js +291 -0
  6. package/dist/src/internal/chart-runtime.d.ts +41 -0
  7. package/dist/src/internal/chart-runtime.js +30 -0
  8. package/dist/src/internal/highcharts-provider.js +2 -0
  9. package/dist/src/internal/nile-chart-base.d.ts +43 -0
  10. package/dist/src/internal/nile-chart-base.js +67 -0
  11. package/dist/src/internal/resolve-widget-kind.d.ts +10 -0
  12. package/dist/src/internal/resolve-widget-kind.js +16 -0
  13. package/dist/src/internal/responsive-defaults.d.ts +32 -0
  14. package/dist/src/internal/responsive-defaults.js +255 -0
  15. package/dist/src/internal/types/chart-forecast-config.type.d.ts +35 -0
  16. package/dist/src/internal/types/chart-forecast-config.type.js +2 -0
  17. package/dist/src/internal/types/highcharts-passthrough.type.d.ts +80 -0
  18. package/dist/src/internal/types/highcharts-passthrough.type.js +24 -0
  19. package/dist/src/internal/types/index.d.ts +3 -0
  20. package/dist/src/internal/types/index.js +1 -1
  21. package/dist/src/internal/types/primitive-chart-config.type.d.ts +2 -1
  22. package/dist/src/internal/types/widget-config.type.d.ts +14 -3
  23. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +2 -0
  24. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +8 -1
  25. package/dist/src/nile-area-chart/nile-area-chart.d.ts +1 -0
  26. package/dist/src/nile-area-chart/nile-area-chart.js +7 -1
  27. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +1 -0
  28. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.js +7 -1
  29. package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +1 -0
  30. package/dist/src/nile-area-range-chart/nile-area-range-chart.js +7 -1
  31. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +1 -0
  32. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.js +7 -1
  33. package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +2 -0
  34. package/dist/src/nile-bar-chart/nile-bar-chart.js +8 -1
  35. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.d.ts +1 -0
  36. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +7 -1
  37. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.d.ts +1 -0
  38. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.js +7 -1
  39. package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +1 -0
  40. package/dist/src/nile-bubble-chart/nile-bubble-chart.js +7 -1
  41. package/dist/src/nile-chart/index.d.ts +1 -1
  42. package/dist/src/nile-chart/nile-chart-config.d.ts +22 -83
  43. package/dist/src/nile-chart/nile-chart-skeleton.js +1 -1
  44. package/dist/src/nile-chart/nile-chart.css.js +3 -1
  45. package/dist/src/nile-chart/nile-chart.d.ts +68 -0
  46. package/dist/src/nile-chart/nile-chart.js +244 -7
  47. package/dist/src/nile-cluster-chart/nile-cluster-chart.d.ts +1 -0
  48. package/dist/src/nile-cluster-chart/nile-cluster-chart.js +7 -1
  49. package/dist/src/nile-column-chart/nile-column-chart.d.ts +1 -0
  50. package/dist/src/nile-column-chart/nile-column-chart.js +7 -1
  51. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +1 -0
  52. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +8 -1
  53. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +1 -0
  54. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.js +7 -1
  55. package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +1 -0
  56. package/dist/src/nile-column-range-chart/nile-column-range-chart.js +7 -1
  57. package/dist/src/nile-dashboard-builder/nile-dashboard-builder.css.js +24 -8
  58. package/dist/src/nile-dashboard-builder/nile-dashboard-builder.d.ts +111 -0
  59. package/dist/src/nile-dashboard-builder/nile-dashboard-builder.js +188 -6
  60. package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +1 -0
  61. package/dist/src/nile-donut-chart/nile-donut-chart.js +7 -1
  62. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.d.ts +1 -0
  63. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.js +7 -1
  64. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +1 -0
  65. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.js +7 -1
  66. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +1 -0
  67. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.js +7 -1
  68. package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +1 -0
  69. package/dist/src/nile-euler-chart/nile-euler-chart.js +7 -1
  70. package/dist/src/nile-fan-chart/nile-fan-chart.d.ts +1 -0
  71. package/dist/src/nile-fan-chart/nile-fan-chart.js +7 -1
  72. package/dist/src/nile-filter-chart/nile-filter-chart.d.ts +2 -0
  73. package/dist/src/nile-filter-chart/nile-filter-chart.js +14 -0
  74. package/dist/src/nile-filter-chart/utils/prompt.js +31 -6
  75. package/dist/src/nile-filter-chart/utils/types.d.ts +2 -0
  76. package/dist/src/nile-flame-chart/nile-flame-chart.d.ts +1 -0
  77. package/dist/src/nile-flame-chart/nile-flame-chart.js +7 -1
  78. package/dist/src/nile-forecast-chart/index.d.ts +2 -0
  79. package/dist/src/nile-forecast-chart/index.js +2 -0
  80. package/dist/src/nile-forecast-chart/nile-forecast-chart.css.d.ts +1 -0
  81. package/dist/src/nile-forecast-chart/nile-forecast-chart.css.js +46 -0
  82. package/dist/src/nile-forecast-chart/nile-forecast-chart.d.ts +90 -0
  83. package/dist/src/nile-forecast-chart/nile-forecast-chart.js +551 -0
  84. package/dist/src/nile-funnel-chart/nile-funnel-chart.d.ts +1 -0
  85. package/dist/src/nile-funnel-chart/nile-funnel-chart.js +7 -1
  86. package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +20 -0
  87. package/dist/src/nile-gauge-chart/nile-gauge-chart.js +80 -4
  88. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.d.ts +1 -0
  89. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.js +7 -1
  90. package/dist/src/nile-histogram-chart/nile-histogram-chart.d.ts +1 -0
  91. package/dist/src/nile-histogram-chart/nile-histogram-chart.js +7 -1
  92. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +1 -0
  93. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.js +7 -1
  94. package/dist/src/nile-line-chart/nile-line-chart.d.ts +1 -0
  95. package/dist/src/nile-line-chart/nile-line-chart.js +7 -1
  96. package/dist/src/nile-line-column-chart/nile-line-column-chart.d.ts +1 -0
  97. package/dist/src/nile-line-column-chart/nile-line-column-chart.js +7 -1
  98. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +1 -0
  99. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.js +7 -1
  100. package/dist/src/nile-map-chart/nile-map-chart.d.ts +23 -3
  101. package/dist/src/nile-map-chart/nile-map-chart.js +52 -12
  102. package/dist/src/nile-master-detail-chart/nile-master-detail-chart.css.js +13 -1
  103. package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +1 -0
  104. package/dist/src/nile-master-detail-chart/nile-master-detail-chart.js +48 -4
  105. package/dist/src/nile-organization-chart/nile-organization-chart.d.ts +1 -0
  106. package/dist/src/nile-organization-chart/nile-organization-chart.js +7 -1
  107. package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +2 -0
  108. package/dist/src/nile-pie-chart/nile-pie-chart.js +8 -1
  109. package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +1 -0
  110. package/dist/src/nile-polygon-chart/nile-polygon-chart.js +7 -1
  111. package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +1 -0
  112. package/dist/src/nile-radar-chart/nile-radar-chart.js +7 -1
  113. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +1 -0
  114. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.js +7 -1
  115. package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +1 -0
  116. package/dist/src/nile-scatter-chart/nile-scatter-chart.js +7 -1
  117. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.d.ts +1 -0
  118. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.js +7 -1
  119. package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +1 -0
  120. package/dist/src/nile-spline-chart/nile-spline-chart.js +7 -1
  121. package/dist/src/nile-stacked-chart/nile-stacked-chart.d.ts +1 -0
  122. package/dist/src/nile-stacked-chart/nile-stacked-chart.js +7 -1
  123. package/dist/src/nile-timeline-chart/nile-timeline-chart.d.ts +1 -0
  124. package/dist/src/nile-timeline-chart/nile-timeline-chart.js +7 -1
  125. package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +2 -0
  126. package/dist/src/nile-trendline-chart/nile-trendline-chart.js +8 -1
  127. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +1 -0
  128. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.js +7 -1
  129. package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +1 -0
  130. package/dist/src/nile-vector-chart/nile-vector-chart.js +7 -1
  131. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +1 -0
  132. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +7 -1
  133. package/dist/src/nile-widget-viewer/nile-widget-viewer.js +6 -6
  134. package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +1 -0
  135. package/dist/src/nile-xrange-chart/nile-xrange-chart.js +7 -1
  136. package/package.json +2 -1
@@ -5,6 +5,7 @@ import NileElement from '../internal/nile-element.js';
5
5
  import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
6
6
  import { getHighcharts } from '../internal/highcharts-provider.js';
7
7
  import { deepMerge } from '../internal/utils.js';
8
+ import { withResponsiveDefaults } from '../internal/responsive-defaults.js';
8
9
  import { styles } from './nile-column-drilldown-chart.css.js';
9
10
  import { tooltipCss } from '../nile-chart/nile-chart.css.js';
10
11
  let _bcTooltipStylesInjected = false;
@@ -38,6 +39,7 @@ let NileColumnDrilldownChart = class NileColumnDrilldownChart extends NileElemen
38
39
  this.seriesName = '';
39
40
  this.yAxisTitle = '';
40
41
  this.options = {};
42
+ this.noResponsive = false;
41
43
  this.loading = false;
42
44
  this.height = '400px';
43
45
  // ── Container styling ──
@@ -295,10 +297,11 @@ let NileColumnDrilldownChart = class NileColumnDrilldownChart extends NileElemen
295
297
  })),
296
298
  breadcrumbs: deepMerge(defaultBreadcrumbs, this.drilldown?.breadcrumbs ?? {}),
297
299
  };
298
- return deepMerge({
300
+ const merged = deepMerge({
299
301
  chart: { type: 'column', ...(this.height ? { height: this.height } : {}),
300
302
  events: {
301
303
  render() {
304
+ self.emit('nile-chart-render', { chart: this });
302
305
  self.syncBreadcrumbCollapse(this);
303
306
  self.applyBreadcrumbTooltips(this);
304
307
  },
@@ -339,6 +342,7 @@ let NileColumnDrilldownChart = class NileColumnDrilldownChart extends NileElemen
339
342
  drilldown,
340
343
  credits: { enabled: false },
341
344
  }, this.options);
345
+ return withResponsiveDefaults(merged, 'columnDrilldown', this.noResponsive);
342
346
  }
343
347
  async initChart() {
344
348
  if (this.loading || !this.chartContainer)
@@ -389,6 +393,9 @@ __decorate([
389
393
  __decorate([
390
394
  property({ type: Object })
391
395
  ], NileColumnDrilldownChart.prototype, "options", void 0);
396
+ __decorate([
397
+ property({ type: Boolean, attribute: 'no-responsive' })
398
+ ], NileColumnDrilldownChart.prototype, "noResponsive", void 0);
392
399
  __decorate([
393
400
  property({ type: Boolean, reflect: true })
394
401
  ], NileColumnDrilldownChart.prototype, "loading", void 0);
@@ -20,6 +20,7 @@ export declare class NileColumnPyramidChart extends NileElement {
20
20
  data: ColumnPyramidSeriesData[];
21
21
  categories: string[];
22
22
  options: Highcharts.Options;
23
+ noResponsive: boolean;
23
24
  loading: boolean;
24
25
  height: string;
25
26
  chartBg: string;
@@ -5,6 +5,7 @@ import NileElement from '../internal/nile-element.js';
5
5
  import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
6
6
  import { getHighcharts } from '../internal/highcharts-provider.js';
7
7
  import { deepMerge } from '../internal/utils.js';
8
+ import { withResponsiveDefaults } from '../internal/responsive-defaults.js';
8
9
  import { styles } from './nile-column-pyramid-chart.css.js';
9
10
  let NileColumnPyramidChart = class NileColumnPyramidChart extends NileElement {
10
11
  constructor() {
@@ -18,6 +19,7 @@ let NileColumnPyramidChart = class NileColumnPyramidChart extends NileElement {
18
19
  this.data = [];
19
20
  this.categories = [];
20
21
  this.options = {};
22
+ this.noResponsive = false;
21
23
  this.loading = false;
22
24
  this.height = '400px';
23
25
  // ── Container styling ──
@@ -110,7 +112,7 @@ let NileColumnPyramidChart = class NileColumnPyramidChart extends NileElement {
110
112
  }
111
113
  buildOptions() {
112
114
  const self = this;
113
- return deepMerge({
115
+ const merged = deepMerge({
114
116
  chart: { type: 'columnpyramid', ...(this.height ? { height: this.height } : {}) },
115
117
  title: { text: this.chartTitle || undefined },
116
118
  subtitle: { text: this.chartSubtitle || undefined },
@@ -143,6 +145,7 @@ let NileColumnPyramidChart = class NileColumnPyramidChart extends NileElement {
143
145
  legend: (() => { const { show, ...rest } = this.legend ?? {}; return { enabled: show ?? this.showLegend, ...rest }; })(),
144
146
  credits: { enabled: false },
145
147
  }, this.options);
148
+ return withResponsiveDefaults(merged, 'columnPyramid', this.noResponsive);
146
149
  }
147
150
  async initChart() {
148
151
  if (this.loading || !this.chartContainer)
@@ -187,6 +190,9 @@ __decorate([
187
190
  __decorate([
188
191
  property({ type: Object })
189
192
  ], NileColumnPyramidChart.prototype, "options", void 0);
193
+ __decorate([
194
+ property({ type: Boolean, attribute: 'no-responsive' })
195
+ ], NileColumnPyramidChart.prototype, "noResponsive", void 0);
190
196
  __decorate([
191
197
  property({ type: Boolean, reflect: true })
192
198
  ], NileColumnPyramidChart.prototype, "loading", void 0);
@@ -20,6 +20,7 @@ export declare class NileColumnRangeChart extends NileElement {
20
20
  data: ColumnRangeSeriesData[];
21
21
  categories: string[];
22
22
  options: Highcharts.Options;
23
+ noResponsive: boolean;
23
24
  loading: boolean;
24
25
  height: string;
25
26
  yAxisTitle: string;
@@ -5,6 +5,7 @@ import NileElement from '../internal/nile-element.js';
5
5
  import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
6
6
  import { getHighcharts } from '../internal/highcharts-provider.js';
7
7
  import { deepMerge } from '../internal/utils.js';
8
+ import { withResponsiveDefaults } from '../internal/responsive-defaults.js';
8
9
  import { styles } from './nile-column-range-chart.css.js';
9
10
  let NileColumnRangeChart = class NileColumnRangeChart extends NileElement {
10
11
  constructor() {
@@ -18,6 +19,7 @@ let NileColumnRangeChart = class NileColumnRangeChart extends NileElement {
18
19
  this.data = [];
19
20
  this.categories = [];
20
21
  this.options = {};
22
+ this.noResponsive = false;
21
23
  this.loading = false;
22
24
  this.height = '400px';
23
25
  this.yAxisTitle = '';
@@ -120,7 +122,7 @@ let NileColumnRangeChart = class NileColumnRangeChart extends NileElement {
120
122
  }
121
123
  buildOptions() {
122
124
  const self = this;
123
- return deepMerge({
125
+ const merged = deepMerge({
124
126
  chart: { ...(this.height ? { height: this.height } : {}) },
125
127
  title: { text: this.chartTitle || undefined },
126
128
  subtitle: { text: this.chartSubtitle || undefined },
@@ -154,6 +156,7 @@ let NileColumnRangeChart = class NileColumnRangeChart extends NileElement {
154
156
  legend: (() => { const { show, ...rest } = this.legend ?? {}; return { enabled: show ?? this.showLegend, ...rest }; })(),
155
157
  credits: { enabled: false },
156
158
  }, this.options);
159
+ return withResponsiveDefaults(merged, 'columnRange', this.noResponsive);
157
160
  }
158
161
  async initChart() {
159
162
  if (this.loading || !this.chartContainer)
@@ -198,6 +201,9 @@ __decorate([
198
201
  __decorate([
199
202
  property({ type: Object })
200
203
  ], NileColumnRangeChart.prototype, "options", void 0);
204
+ __decorate([
205
+ property({ type: Boolean, attribute: 'no-responsive' })
206
+ ], NileColumnRangeChart.prototype, "noResponsive", void 0);
201
207
  __decorate([
202
208
  property({ type: Boolean, reflect: true })
203
209
  ], NileColumnRangeChart.prototype, "loading", void 0);
@@ -48,31 +48,47 @@ export const styles = css `
48
48
  width: 100%;
49
49
  height: 100%;
50
50
  }
51
-
52
51
  .nile-builder-remove {
53
52
  position: absolute;
54
53
  top: var(--ng-spacing-1);
55
54
  right: var(--ng-spacing-1);
56
55
  z-index: 2;
56
+ display: inline-flex;
57
+ align-items: center;
58
+ justify-content: center;
57
59
  width: var(--ng-spacing-6);
58
60
  height: var(--ng-spacing-6);
59
61
  padding: var(--ng-spacing-0);
60
62
  line-height: 1;
61
- border: var(--ng-border-width-1) var(--ng-border-style-solid)
62
- var(--ng-color-base-transparent);
63
+ border: none;
63
64
  border-radius: var(--ng-radius-xs);
64
65
  cursor: pointer;
65
- background: var(--ng-colors-bg-error-solid);
66
- color: var(--ng-colors-text-white);
67
- font-size: var(--ng-font-size-text-xs);
66
+ background: var(--ng-color-base-transparent);
67
+ color: var(--ng-colors-fg-primary-900);
68
68
  transition: background var(--ng-transition-duration-fast) ease;
69
69
  }
70
70
 
71
71
  .nile-builder-remove:hover {
72
- background: var(--ng-colors-bg-error-solid-hover);
72
+ background: var(--ng-colors-bg-secondary);
73
+ }
74
+
75
+ @media (hover: hover) {
76
+ :host([remove-visibility='hover']) .nile-builder-remove {
77
+ opacity: 0;
78
+ transition:
79
+ opacity var(--ng-transition-duration-fast) ease,
80
+ background var(--ng-transition-duration-fast) ease;
81
+ }
82
+
83
+ :host([remove-visibility='hover']) .nile-builder-cell:hover .nile-builder-remove,
84
+ :host([remove-visibility='hover']) .nile-builder-remove:focus {
85
+ opacity: 1;
86
+ }
73
87
  }
74
88
 
75
- /* Hide the remove affordance when the builder is locked. */
89
+ /* Hide the remove affordance when the builder is locked. display:none also
90
+ takes it out of the focus order, so this wins over the hover mode above
91
+ regardless of pointer type. */
76
92
  :host(:not([editable])) .nile-builder-remove {
77
93
  display: none;
78
94
  }
@@ -1,7 +1,10 @@
1
1
  import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
+ import type { Responsive } from 'gridstack';
2
3
  import NileElement from '../internal/nile-element.js';
3
4
  import type { NileDashboardConfig } from '../internal/types/dashboard-config.type.js';
4
5
  import '../nile-widget-viewer/index.js';
6
+ /** When the per-widget remove control (✕) is shown. */
7
+ export type RemoveVisibility = 'hover' | 'always';
5
8
  export declare class NileDashboardBuilder extends NileElement {
6
9
  static styles: CSSResultGroup;
7
10
  /** Dashboard configuration. Widgets without an `id` are assigned one. */
@@ -12,16 +15,124 @@ export declare class NileDashboardBuilder extends NileElement {
12
15
  cellHeight: number;
13
16
  /** Gap between cells in pixels. Default: 8. */
14
17
  gap: number;
18
+ /**
19
+ * Minimum number of rows the grid keeps, so an empty or sparsely-filled
20
+ * dashboard still presents a drop target instead of collapsing. Set `0` to
21
+ * let the grid shrink to its content. Default: 4.
22
+ */
15
23
  minRows: number;
16
24
  /** Minimum widget width in columns (gridster `minItemCols`). Default: 2. */
17
25
  minW: number;
18
26
  /** Minimum widget height in rows (gridster `minItemRows`). Default: 2. */
19
27
  minH: number;
28
+ /**
29
+ * Comma-separated list of edges and corners a widget can be resized from,
30
+ * passed straight to gridstack's `resizable.handles`.
31
+ *
32
+ * The default is seven of the eight positions: `ne` is left out because the
33
+ * remove control (✕) sits in that corner and would compete with the handle
34
+ * for the same few pixels. Add it back if you set `remove-visibility` such
35
+ * that the corner is free.
36
+ *
37
+ * Default: `'n,e,s,w,se,sw,nw'`.
38
+ */
20
39
  resizeHandles: string;
40
+ /**
41
+ * Whether widgets stay where they are dropped rather than being pulled up to
42
+ * close vertical gaps (gridstack's float mode). `false` compacts the grid
43
+ * upward after every change. Default: `true`.
44
+ */
21
45
  float: boolean;
46
+ /**
47
+ * Whether the dashboard can be modified. `false` makes the grid static — no
48
+ * dragging or resizing — and hides every remove control regardless of
49
+ * `remove-visibility`. Reflected, so it can be styled via `:host([editable])`.
50
+ * Default: `true`.
51
+ */
22
52
  editable: boolean;
53
+ /**
54
+ * Whether to paint the cell-boundary overlay behind the widgets, which makes
55
+ * the drop targets legible while arranging. Reflected as the `gridlines`
56
+ * attribute. Default: `true`.
57
+ */
23
58
  gridLines: boolean;
59
+ /**
60
+ * Overrides the grid-line color with any CSS color. Empty means fall back to
61
+ * the `--nile-dashboard-builder-grid-line` custom property, and then to
62
+ * `--ng-color-blue-200`. Only has a visible effect while `gridLines` is on.
63
+ * Default: `''`.
64
+ */
24
65
  gridLineColor: string;
66
+ /**
67
+ * When the per-widget remove control (✕) is shown.
68
+ *
69
+ * - `'hover'` (default) — revealed when the pointer enters the widget, keeping
70
+ * the tiles clean at rest. It also appears on keyboard focus, and stays
71
+ * permanently visible on touch devices, which cannot hover.
72
+ * - `'always'` — always visible.
73
+ *
74
+ * Orthogonal to `editable`: a non-editable builder never shows the control,
75
+ * whatever this is set to.
76
+ */
77
+ removeVisibility: RemoveVisibility;
78
+ /**
79
+ * Maximum number of rows the grid will accept, capping how tall a dashboard
80
+ * can grow. `0` means unlimited, which is the default — widgets can be placed
81
+ * or dragged arbitrarily far down. Default: 0.
82
+ */
83
+ maxRow: number;
84
+ /**
85
+ * Responsive column behaviour: pick the column count from the available width
86
+ * instead of pinning it to `columns`. Either give a `columnWidth` to target,
87
+ * or explicit `breakpoints`.
88
+ *
89
+ * Note that gridstack requires matching CSS for column counts other than the
90
+ * default, so this needs styling support to be useful.
91
+ *
92
+ * Supplying only a `columnWidth` is safe here — the missing `breakpoints`
93
+ * array is filled in before it reaches gridstack, which would otherwise
94
+ * throw on that combination.
95
+ *
96
+ * Applied at initialization only — changing it later has no effect.
97
+ */
98
+ columnOpts: Responsive | null;
99
+ /**
100
+ * Only render widgets once they scroll into view. Worth turning on for
101
+ * dashboards with many widgets, since every widget otherwise mounts a live
102
+ * chart up front.
103
+ *
104
+ * Applied at initialization only — changing it later has no effect.
105
+ * Default: `false`.
106
+ */
107
+ lazyLoad: boolean;
108
+ /**
109
+ * Stops widgets animating to their new position when the layout reflows.
110
+ *
111
+ * Named for what it turns off rather than on, because `animate` is already
112
+ * `HTMLElement.prototype.animate` and cannot be shadowed by a property.
113
+ * Default: `false`.
114
+ */
115
+ disableAnimation: boolean;
116
+ /**
117
+ * Prevents widgets from being dragged while still allowing resize. Finer
118
+ * grained than `editable`, which disables both at once; when `editable` is
119
+ * `false` nothing is draggable regardless of this. Default: `false`.
120
+ */
121
+ disableDrag: boolean;
122
+ /**
123
+ * Prevents widgets from being resized while still allowing drag. Finer
124
+ * grained than `editable`, which disables both at once; when `editable` is
125
+ * `false` nothing is resizable regardless of this. Default: `false`.
126
+ */
127
+ disableResize: boolean;
128
+ /**
129
+ * Keeps resize handles permanently visible rather than revealing them on
130
+ * hover. Useful on touch devices, which cannot hover.
131
+ *
132
+ * Applied at initialization only — changing it later has no effect.
133
+ * Default: `false`.
134
+ */
135
+ alwaysShowResizeHandle: boolean;
25
136
  private gridEl;
26
137
  private grid?;
27
138
  /** id -> the `.grid-stack-item` element hosting that widget. */
@@ -5,6 +5,7 @@ import { GridStack } from 'gridstack';
5
5
  import NileElement from '../internal/nile-element.js';
6
6
  import { styles } from './nile-dashboard-builder.css.js';
7
7
  import { gridstackCss } from './gridstack-css.js';
8
+ import { resolveWidgetKind } from '../internal/resolve-widget-kind.js';
8
9
  import '../nile-widget-viewer/index.js';
9
10
  let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
10
11
  constructor() {
@@ -17,16 +18,124 @@ let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
17
18
  this.cellHeight = 72;
18
19
  /** Gap between cells in pixels. Default: 8. */
19
20
  this.gap = 8;
21
+ /**
22
+ * Minimum number of rows the grid keeps, so an empty or sparsely-filled
23
+ * dashboard still presents a drop target instead of collapsing. Set `0` to
24
+ * let the grid shrink to its content. Default: 4.
25
+ */
20
26
  this.minRows = 4;
21
27
  /** Minimum widget width in columns (gridster `minItemCols`). Default: 2. */
22
28
  this.minW = 2;
23
29
  /** Minimum widget height in rows (gridster `minItemRows`). Default: 2. */
24
30
  this.minH = 2;
31
+ /**
32
+ * Comma-separated list of edges and corners a widget can be resized from,
33
+ * passed straight to gridstack's `resizable.handles`.
34
+ *
35
+ * The default is seven of the eight positions: `ne` is left out because the
36
+ * remove control (✕) sits in that corner and would compete with the handle
37
+ * for the same few pixels. Add it back if you set `remove-visibility` such
38
+ * that the corner is free.
39
+ *
40
+ * Default: `'n,e,s,w,se,sw,nw'`.
41
+ */
25
42
  this.resizeHandles = 'n,e,s,w,se,sw,nw';
43
+ /**
44
+ * Whether widgets stay where they are dropped rather than being pulled up to
45
+ * close vertical gaps (gridstack's float mode). `false` compacts the grid
46
+ * upward after every change. Default: `true`.
47
+ */
26
48
  this.float = true;
49
+ /**
50
+ * Whether the dashboard can be modified. `false` makes the grid static — no
51
+ * dragging or resizing — and hides every remove control regardless of
52
+ * `remove-visibility`. Reflected, so it can be styled via `:host([editable])`.
53
+ * Default: `true`.
54
+ */
27
55
  this.editable = true;
56
+ /**
57
+ * Whether to paint the cell-boundary overlay behind the widgets, which makes
58
+ * the drop targets legible while arranging. Reflected as the `gridlines`
59
+ * attribute. Default: `true`.
60
+ */
28
61
  this.gridLines = true;
62
+ /**
63
+ * Overrides the grid-line color with any CSS color. Empty means fall back to
64
+ * the `--nile-dashboard-builder-grid-line` custom property, and then to
65
+ * `--ng-color-blue-200`. Only has a visible effect while `gridLines` is on.
66
+ * Default: `''`.
67
+ */
29
68
  this.gridLineColor = '';
69
+ /**
70
+ * When the per-widget remove control (✕) is shown.
71
+ *
72
+ * - `'hover'` (default) — revealed when the pointer enters the widget, keeping
73
+ * the tiles clean at rest. It also appears on keyboard focus, and stays
74
+ * permanently visible on touch devices, which cannot hover.
75
+ * - `'always'` — always visible.
76
+ *
77
+ * Orthogonal to `editable`: a non-editable builder never shows the control,
78
+ * whatever this is set to.
79
+ */
80
+ this.removeVisibility = 'hover';
81
+ /**
82
+ * Maximum number of rows the grid will accept, capping how tall a dashboard
83
+ * can grow. `0` means unlimited, which is the default — widgets can be placed
84
+ * or dragged arbitrarily far down. Default: 0.
85
+ */
86
+ this.maxRow = 0;
87
+ /**
88
+ * Responsive column behaviour: pick the column count from the available width
89
+ * instead of pinning it to `columns`. Either give a `columnWidth` to target,
90
+ * or explicit `breakpoints`.
91
+ *
92
+ * Note that gridstack requires matching CSS for column counts other than the
93
+ * default, so this needs styling support to be useful.
94
+ *
95
+ * Supplying only a `columnWidth` is safe here — the missing `breakpoints`
96
+ * array is filled in before it reaches gridstack, which would otherwise
97
+ * throw on that combination.
98
+ *
99
+ * Applied at initialization only — changing it later has no effect.
100
+ */
101
+ this.columnOpts = null;
102
+ /**
103
+ * Only render widgets once they scroll into view. Worth turning on for
104
+ * dashboards with many widgets, since every widget otherwise mounts a live
105
+ * chart up front.
106
+ *
107
+ * Applied at initialization only — changing it later has no effect.
108
+ * Default: `false`.
109
+ */
110
+ this.lazyLoad = false;
111
+ /**
112
+ * Stops widgets animating to their new position when the layout reflows.
113
+ *
114
+ * Named for what it turns off rather than on, because `animate` is already
115
+ * `HTMLElement.prototype.animate` and cannot be shadowed by a property.
116
+ * Default: `false`.
117
+ */
118
+ this.disableAnimation = false;
119
+ /**
120
+ * Prevents widgets from being dragged while still allowing resize. Finer
121
+ * grained than `editable`, which disables both at once; when `editable` is
122
+ * `false` nothing is draggable regardless of this. Default: `false`.
123
+ */
124
+ this.disableDrag = false;
125
+ /**
126
+ * Prevents widgets from being resized while still allowing drag. Finer
127
+ * grained than `editable`, which disables both at once; when `editable` is
128
+ * `false` nothing is resizable regardless of this. Default: `false`.
129
+ */
130
+ this.disableResize = false;
131
+ /**
132
+ * Keeps resize handles permanently visible rather than revealing them on
133
+ * hover. Useful on touch devices, which cannot hover.
134
+ *
135
+ * Applied at initialization only — changing it later has no effect.
136
+ * Default: `false`.
137
+ */
138
+ this.alwaysShowResizeHandle = false;
30
139
  /** id -> the `.grid-stack-item` element hosting that widget. */
31
140
  this.itemEls = new Map();
32
141
  /** id -> the latest widget config (used to rebuild config on layout change). */
@@ -47,8 +156,27 @@ let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
47
156
  float: this.float,
48
157
  staticGrid: !this.editable,
49
158
  minRow: this.minRows || undefined,
50
- // Resize handles (configurable via `resize-handles`); default is 8-way,
51
- // matching gridster's `resizable.handles`.
159
+ // 0 means "no cap" to us; gridstack wants the key absent for that.
160
+ maxRow: this.maxRow || undefined,
161
+ lazyLoad: this.lazyLoad,
162
+ animate: !this.disableAnimation,
163
+ disableDrag: this.disableDrag,
164
+ disableResize: this.disableResize,
165
+ alwaysShowResizeHandle: this.alwaysShowResizeHandle,
166
+ // Only forwarded when set — passing `columnOpts: undefined` would
167
+ // override gridstack's own default handling.
168
+ //
169
+ // `breakpoints` is always supplied, even empty: gridstack 13.0.0 tests
170
+ // `!columnWidth && !breakpoints?.length` but then reads
171
+ // `breakpoints.length` unguarded in the else branch, so a columnOpts
172
+ // carrying only a columnWidth — which its own docs call valid — throws
173
+ // inside the GridStack constructor.
174
+ ...(this.columnOpts
175
+ ? { columnOpts: { breakpoints: [], ...this.columnOpts } }
176
+ : {}),
177
+ // Resize handles (configurable via `resize-handles`); the default covers
178
+ // seven of the eight positions, omitting `ne` where the remove control
179
+ // sits. See the `resizeHandles` docs.
52
180
  resizable: { handles: this.resizeHandles },
53
181
  }, this.gridEl);
54
182
  this.grid.on('change', () => {
@@ -71,6 +199,22 @@ let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
71
199
  this.grid.float(this.float);
72
200
  if (changed.has('editable'))
73
201
  this.grid.setStatic(!this.editable);
202
+ if (changed.has('disableAnimation'))
203
+ this.grid.setAnimation(!this.disableAnimation);
204
+ if (changed.has('maxRow')) {
205
+ // gridstack exposes no setter for this, and the engine keeps its own
206
+ // copy, so both have to be updated to take effect live.
207
+ this.grid.opts.maxRow = this.maxRow || undefined;
208
+ this.grid.engine.maxRow = this.maxRow || 0;
209
+ }
210
+ // These run after `editable` on purpose: setStatic() re-enables move and
211
+ // resize wholesale, so it would otherwise clobber the finer-grained flags.
212
+ if (changed.has('disableDrag') || changed.has('editable')) {
213
+ this.grid.enableMove(this.editable && !this.disableDrag);
214
+ }
215
+ if (changed.has('disableResize') || changed.has('editable')) {
216
+ this.grid.enableResize(this.editable && !this.disableResize);
217
+ }
74
218
  }
75
219
  if (changed.has('gridLineColor')) {
76
220
  if (this.gridLineColor) {
@@ -177,8 +321,14 @@ let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
177
321
  const remove = document.createElement('button');
178
322
  remove.className = 'nile-builder-remove';
179
323
  remove.type = 'button';
180
- remove.textContent = '✕';
324
+ remove.setAttribute('aria-label', 'Remove widget');
181
325
  remove.title = 'Remove widget';
326
+ // The ✕ is the nile-glyph "close" icon (registered by the host app, as with
327
+ // the other nile-glyph usages in this package).
328
+ const removeIcon = document.createElement('nile-glyph');
329
+ removeIcon.setAttribute('name', 'close');
330
+ removeIcon.setAttribute('size', '16');
331
+ remove.appendChild(removeIcon);
182
332
  remove.addEventListener('click', (e) => {
183
333
  e.stopPropagation();
184
334
  this.requestRemoveWidget(widget.id);
@@ -191,16 +341,16 @@ let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
191
341
  const widgets = this.normalizeWidgets(this.config);
192
342
  const maxY = widgets.reduce((m, w) => Math.max(m, w.layout.y + w.layout.h), 0);
193
343
  const id = `nile-w-${++this.idCounter}`;
344
+ // The widget kind is carried by `nileConfig.chart.type` and inferred by the
345
+ // viewer (see `resolveWidgetKind`), so no top-level `type` is written here.
194
346
  const widget = type === 'kpi'
195
347
  ? {
196
348
  id,
197
- type: 'kpi',
198
349
  layout: { x: 0, y: maxY, w: 3, h: 2 },
199
350
  nileConfig: { chart: { type: 'kpi', variant: 'card', label: 'New KPI', value: '0' } },
200
351
  }
201
352
  : {
202
353
  id,
203
- type: 'chart',
204
354
  layout: { x: 0, y: maxY, w: 6, h: 3 },
205
355
  nileConfig: {
206
356
  chart: {
@@ -264,7 +414,15 @@ let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
264
414
  signature(widgets) {
265
415
  return JSON.stringify([...widgets]
266
416
  .sort((a, b) => a.id.localeCompare(b.id))
267
- .map((w) => [w.id, w.type, w.layout.x, w.layout.y, w.layout.w, w.layout.h, w.nileConfig]));
417
+ .map((w) => [
418
+ w.id,
419
+ resolveWidgetKind(w),
420
+ w.layout.x,
421
+ w.layout.y,
422
+ w.layout.w,
423
+ w.layout.h,
424
+ w.nileConfig,
425
+ ]));
268
426
  }
269
427
  render() {
270
428
  return html `<div class="grid-stack"></div>`;
@@ -307,6 +465,30 @@ __decorate([
307
465
  __decorate([
308
466
  property({ attribute: 'grid-line-color' })
309
467
  ], NileDashboardBuilder.prototype, "gridLineColor", void 0);
468
+ __decorate([
469
+ property({ type: String, reflect: true, attribute: 'remove-visibility' })
470
+ ], NileDashboardBuilder.prototype, "removeVisibility", void 0);
471
+ __decorate([
472
+ property({ type: Number, attribute: 'max-row' })
473
+ ], NileDashboardBuilder.prototype, "maxRow", void 0);
474
+ __decorate([
475
+ property({ type: Object, attribute: 'column-opts' })
476
+ ], NileDashboardBuilder.prototype, "columnOpts", void 0);
477
+ __decorate([
478
+ property({ type: Boolean, attribute: 'lazy-load' })
479
+ ], NileDashboardBuilder.prototype, "lazyLoad", void 0);
480
+ __decorate([
481
+ property({ type: Boolean, attribute: 'disable-animation' })
482
+ ], NileDashboardBuilder.prototype, "disableAnimation", void 0);
483
+ __decorate([
484
+ property({ type: Boolean, attribute: 'disable-drag' })
485
+ ], NileDashboardBuilder.prototype, "disableDrag", void 0);
486
+ __decorate([
487
+ property({ type: Boolean, attribute: 'disable-resize' })
488
+ ], NileDashboardBuilder.prototype, "disableResize", void 0);
489
+ __decorate([
490
+ property({ type: Boolean, attribute: 'always-show-resize-handle' })
491
+ ], NileDashboardBuilder.prototype, "alwaysShowResizeHandle", void 0);
310
492
  __decorate([
311
493
  query('.grid-stack')
312
494
  ], NileDashboardBuilder.prototype, "gridEl", void 0);
@@ -25,6 +25,7 @@ export declare class NileDonutChart extends NileElement {
25
25
  /** Renders a 180° arc (semi-circle) suitable for KPI-style gauges. */
26
26
  semiCircle: boolean;
27
27
  options: Highcharts.Options;
28
+ noResponsive: boolean;
28
29
  loading: boolean;
29
30
  height: string;
30
31
  showDataLabels: boolean;
@@ -4,6 +4,7 @@ import { html } from 'lit';
4
4
  import { getHighcharts } from '../internal/highcharts-provider.js';
5
5
  import NileElement from '../internal/nile-element.js';
6
6
  import { deepMerge } from '../internal/utils.js';
7
+ import { withResponsiveDefaults } from '../internal/responsive-defaults.js';
7
8
  import { styles } from './nile-donut-chart.css.js';
8
9
  let NileDonutChart = class NileDonutChart extends NileElement {
9
10
  constructor() {
@@ -21,6 +22,7 @@ let NileDonutChart = class NileDonutChart extends NileElement {
21
22
  /** Renders a 180° arc (semi-circle) suitable for KPI-style gauges. */
22
23
  this.semiCircle = false;
23
24
  this.options = {};
25
+ this.noResponsive = false;
24
26
  this.loading = false;
25
27
  this.height = '400px';
26
28
  this.showDataLabels = true;
@@ -162,7 +164,7 @@ let NileDonutChart = class NileDonutChart extends NileElement {
162
164
  }
163
165
  buildOptions() {
164
166
  const self = this;
165
- return deepMerge({
167
+ const merged = deepMerge({
166
168
  chart: { type: 'pie', ...(this.height ? { height: this.height } : {}) },
167
169
  title: { text: this.chartTitle || undefined },
168
170
  subtitle: { text: this.chartSubtitle || undefined },
@@ -190,6 +192,7 @@ let NileDonutChart = class NileDonutChart extends NileElement {
190
192
  legend: (() => { const { show, ...rest } = this.legend ?? {}; return { enabled: show ?? this.showLegend, ...rest }; })(),
191
193
  credits: { enabled: false },
192
194
  }, this.options);
195
+ return withResponsiveDefaults(merged, 'donut', this.noResponsive);
193
196
  }
194
197
  async initChart() {
195
198
  if (this.loading || !this.chartContainer)
@@ -237,6 +240,9 @@ __decorate([
237
240
  __decorate([
238
241
  property({ type: Object })
239
242
  ], NileDonutChart.prototype, "options", void 0);
243
+ __decorate([
244
+ property({ type: Boolean, attribute: 'no-responsive' })
245
+ ], NileDonutChart.prototype, "noResponsive", void 0);
240
246
  __decorate([
241
247
  property({ type: Boolean, reflect: true })
242
248
  ], NileDonutChart.prototype, "loading", void 0);
@@ -24,6 +24,7 @@ export declare class NileDumbbellChart extends NileElement {
24
24
  chartSubtitle: string;
25
25
  data: DumbbellPoint[];
26
26
  options: Highcharts.Options;
27
+ noResponsive: boolean;
27
28
  loading: boolean;
28
29
  height: string;
29
30
  yAxisTitle: string;