@aquera/nile-visualization 2.9.26 → 2.9.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,6 +35,14 @@ To run a local development server that serves the basic demo located in `demo/in
35
35
  ## Release Notes
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
+
39
+ #### Version 2.9.28 (July 22, 2026)
40
+ - Nile Dashboard Builder: Added Nile Dashboard Builder Component (UIF-1309)
41
+
42
+ #### Version 2.9.27 (July 15, 2026)
43
+ - Nile Filter Chart: Added the `date-picker` control variant — set `variant: 'date-picker'` on a filter control to render a calendar field. Configurable via `selection` (`single` for one date, `multi` for a start/end range), `dateFormat` (default `MM/DD/YYYY`), `dateType` (`absolute` | `relative`), `hideDateTypes` (lock the absolute/relative switcher), `showClearButton`, and `hoist` (switch the popup to `position: fixed` to escape a clipping ancestor). The date-picker fills its container — size it by constraining the wrapping element. See `src/nile-filter-chart/date-picker.md` (UIF-1298)
44
+ - Nile Chart: Added the `noPadding` config option — set `noPadding: true` on the chart config to remove the chart body padding and drop the card's own border/shadow, so the content sits flush to the card edges (the card becomes a transparent, layout-only wrapper); reflected as the `no-padding` attribute (UIF-1298)
45
+
38
46
  #### Version 2.9.26 (July 14, 2026)
39
47
  - Nile Chart: Exposed CSS `part`s across the chart shell so consumers can style internals via `::part()` — the card (`chart-card`, `chart-body`, `chart-inner`), header (`header`, `header-titles`, `header-title`, `header-subtitle`, `header-actions`), reset-zoom control (`reset-zoom-tooltip`, `reset-zoom`, `reset-zoom-glyph`), AI affordances (`ai-trigger`, `ai-trigger-glyph`, `ai-panel`, `ai-panel-content`), and the actions menu (`menu-anchor`, `menu-trigger`, `menu-trigger-glyph`, `menu`, `menu-separator`, `menu-group-header`, `menu-item-glyph`, and `menu-item` with kind-specific sub-parts `type`, `custom`, `fullscreen`, `print`, `download-png`, `download-svg`, `download-csv`) (UIF-1304)
40
48
 
@@ -107,6 +107,8 @@ export { NileWidgetViewer } from './nile-widget-viewer/index.js';
107
107
  export type { NileWidgetConfig, NileWidgetChartConfig, NileWidgetKpiConfig, WidgetLayout, } from './nile-widget-viewer/index.js';
108
108
  export { NileDashboardViewer } from './nile-dashboard-viewer/index.js';
109
109
  export type { NileDashboardConfig } from './nile-dashboard-viewer/index.js';
110
+ export { NileDashboardBuilder } from './nile-dashboard-builder/index.js';
111
+ export { fromApiDashboardResponse } from './internal/dashboard-adapters.js';
110
112
  export { NileExecutiveSummary } from './nile-executive-summary/index.js';
111
113
  export type { NileExecutiveSummaryConfig } from './nile-executive-summary/index.js';
112
114
  export { NileChartList } from './nile-chart-list/index.js';
package/dist/src/index.js CHANGED
@@ -57,6 +57,8 @@ export { NileAiSender } from './nile-ai-sender/index.js';
57
57
  export { NileAiPanel } from './nile-ai-panel/index.js';
58
58
  export { NileWidgetViewer } from './nile-widget-viewer/index.js';
59
59
  export { NileDashboardViewer } from './nile-dashboard-viewer/index.js';
60
+ export { NileDashboardBuilder } from './nile-dashboard-builder/index.js';
61
+ export { fromApiDashboardResponse } from './internal/dashboard-adapters.js';
60
62
  export { NileExecutiveSummary } from './nile-executive-summary/index.js';
61
63
  export { NileChartList } from './nile-chart-list/index.js';
62
64
  //# sourceMappingURL=index.js.map
@@ -5,10 +5,14 @@ import type { NileDashboardConfig } from './types/dashboard-config.type.js';
5
5
  *
6
6
  * Handles:
7
7
  * - `widgetType` → `type` rename
8
+ * - `config` (data-visualizer-ui / angular-gridster2) → `nileConfig`
8
9
  * - Gridster-native layout keys (`cols`/`rows`) → canonical (`w`/`h`)
9
10
  * - API chart `series[].data[].value` → `data[].y` (pie/donut)
10
11
  * - Multi-series format for bar/line/column/area etc.
11
12
  * - KPI sub-object: adds the `type: 'kpi'` discriminator
12
13
  * - Nested `{ success, data: { ... } }` API envelope
14
+ *
15
+ * The result plugs straight into `<nile-dashboard-viewer>` or
16
+ * `<nile-dashboard-builder>` (`.config`).
13
17
  */
14
18
  export declare function fromApiDashboardResponse(apiResponse: unknown): NileDashboardConfig;
@@ -73,14 +73,16 @@ function normalizeLayout(raw) {
73
73
  function adaptWidget(apiWidget) {
74
74
  const layout = normalizeLayout(apiWidget.layout);
75
75
  const widgetType = apiWidget.widgetType ?? apiWidget.type;
76
- // Already in NileWidgetConfig shape — pass through
77
- if (apiWidget.nileConfig) {
76
+ // Already Nile-ready `{ chart, aq }` — under `nileConfig` (our shape) or
77
+ // `config` (data-visualizer-ui / angular-gridster2 shape). Pass through.
78
+ const nileConfig = apiWidget.nileConfig ?? apiWidget.config;
79
+ if (nileConfig) {
78
80
  return {
79
81
  id: apiWidget.id,
80
82
  title: apiWidget.title,
81
83
  type: widgetType,
82
84
  layout,
83
- nileConfig: apiWidget.nileConfig,
85
+ nileConfig,
84
86
  };
85
87
  }
86
88
  if (widgetType === 'chart' && apiWidget.chart) {
@@ -110,11 +112,15 @@ function adaptWidget(apiWidget) {
110
112
  *
111
113
  * Handles:
112
114
  * - `widgetType` → `type` rename
115
+ * - `config` (data-visualizer-ui / angular-gridster2) → `nileConfig`
113
116
  * - Gridster-native layout keys (`cols`/`rows`) → canonical (`w`/`h`)
114
117
  * - API chart `series[].data[].value` → `data[].y` (pie/donut)
115
118
  * - Multi-series format for bar/line/column/area etc.
116
119
  * - KPI sub-object: adds the `type: 'kpi'` discriminator
117
120
  * - Nested `{ success, data: { ... } }` API envelope
121
+ *
122
+ * The result plugs straight into `<nile-dashboard-viewer>` or
123
+ * `<nile-dashboard-builder>` (`.config`).
118
124
  */
119
125
  export function fromApiDashboardResponse(apiResponse) {
120
126
  const raw = apiResponse;
@@ -187,6 +187,7 @@ async function init() {
187
187
  }
188
188
  _Highcharts.setOptions({
189
189
  chart: {
190
+ backgroundColor: 'transparent',
190
191
  style: {
191
192
  fontFamily: 'var(--nile-font-family-body, var(--ng-font-family-body))',
192
193
  },
@@ -155,6 +155,7 @@ export interface NileChartConfigBase {
155
155
  /** Font size for the header subtitle (number → px, or any CSS length string). */
156
156
  subtitleFontSize?: string | number;
157
157
  noHeader?: boolean;
158
+ noPadding?: boolean;
158
159
  height?: string;
159
160
  loading?: boolean;
160
161
  options?: import('highcharts').Options;
@@ -87,6 +87,9 @@ export const styles = css `
87
87
  position: relative;
88
88
  container-type: inline-size;
89
89
  }
90
+ :host([data-active-type='filter'][data-has-date-picker]) {
91
+ container-type: normal;
92
+ }
90
93
 
91
94
  :host([hidden]) {
92
95
  display: none;
@@ -114,6 +117,10 @@ export const styles = css `
114
117
  height: 100%;
115
118
  }
116
119
 
120
+ :host([fit]) .nile-chart-inner > * {
121
+ --nile-chart-min-height: 0;
122
+ }
123
+
117
124
  /* ── Unified Card Container ── */
118
125
 
119
126
  .nile-chart-card {
@@ -234,6 +241,17 @@ export const styles = css `
234
241
  padding-top: 0;
235
242
  }
236
243
 
244
+ :host([no-padding]) .nile-chart-inner {
245
+ padding: 0;
246
+ }
247
+
248
+ :host([no-padding]) .nile-chart-card,
249
+ :host([no-padding]) .nile-chart-card:hover {
250
+ border: none;
251
+ box-shadow: none;
252
+ border-radius: 0;
253
+ }
254
+
237
255
  /* Grid layout:
238
256
  - card uses clip-path (not overflow:hidden) so position:sticky on the header is not broken
239
257
  - height goes on nile-data-grid itself so .scroll-container inside shadow DOM scrolls,
@@ -100,6 +100,7 @@ export declare class NileChart extends NileElement {
100
100
  */
101
101
  loading: boolean;
102
102
  noHeader: boolean;
103
+ noPadding: boolean;
103
104
  appearance: string | null;
104
105
  /**
105
106
  * When set, fills `chart.type` if the config omits it (same values as `chart.type`, e.g. `stacked`, `pie`).
@@ -151,8 +152,6 @@ export declare class NileChart extends NileElement {
151
152
  addAiResponse(text: string): void;
152
153
  private handleAiSend;
153
154
  private switchType;
154
- /** Single-control filter chart where the in-body label should be promoted to the chart header. */
155
- private get isPromotableFilter();
156
155
  private get headerTitle();
157
156
  private get headerSubtitle();
158
157
  /** Normalize a numeric (→px) or string dimension to a CSS length. */
@@ -177,6 +177,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
177
177
  */
178
178
  this.loading = false;
179
179
  this.noHeader = false;
180
+ this.noPadding = false;
180
181
  this.appearance = null;
181
182
  /**
182
183
  * When set, fills `chart.type` if the config omits it (same values as `chart.type`, e.g. `stacked`, `pie`).
@@ -301,9 +302,22 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
301
302
  const cfgNoHeader = resolved.noHeader === true || minimalFilter;
302
303
  if (cfgNoHeader && !this.noHeader)
303
304
  this.noHeader = true;
305
+ if (this.noPadding !== (resolved.noPadding === true))
306
+ this.noPadding = resolved.noPadding === true;
304
307
  if (resolved.appearance && this.appearance !== resolved.appearance)
305
308
  this.appearance = resolved.appearance;
306
309
  }
310
+ if (this.activeType) {
311
+ this.setAttribute('data-active-type', this.activeType);
312
+ }
313
+ else {
314
+ this.removeAttribute('data-active-type');
315
+ }
316
+ const cfg = this.activeConfig;
317
+ const hasDatePicker = this.activeType === 'filter'
318
+ && Array.isArray(cfg?.controls)
319
+ && cfg.controls.some(c => c?.variant === 'date-picker');
320
+ this.toggleAttribute('data-has-date-picker', hasDatePicker);
307
321
  // Keep truncated-title focusability in sync after any re-render.
308
322
  this._syncHeaderTruncationA11y();
309
323
  }
@@ -345,32 +359,11 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
345
359
  config: converted,
346
360
  });
347
361
  }
348
- /** Single-control filter chart where the in-body label should be promoted to the chart header. */
349
- get isPromotableFilter() {
350
- const cfg = (this.activeConfig ?? this.resolvedConfig);
351
- return cfg?.type === 'filter'
352
- && Array.isArray(cfg?.controls)
353
- && cfg.controls.length === 1;
354
- }
355
362
  get headerTitle() {
356
- const explicit = this.activeConfig?.chartTitle ?? this.resolvedConfig?.chartTitle;
357
- if (explicit)
358
- return explicit;
359
- if (this.isPromotableFilter) {
360
- const cfg = (this.activeConfig ?? this.resolvedConfig);
361
- return cfg.controls[0]?.label ?? '';
362
- }
363
- return '';
363
+ return this.activeConfig?.chartTitle ?? this.resolvedConfig?.chartTitle ?? '';
364
364
  }
365
365
  get headerSubtitle() {
366
- const explicit = this.activeConfig?.chartSubtitle ?? this.resolvedConfig?.chartSubtitle;
367
- if (explicit)
368
- return explicit;
369
- if (this.isPromotableFilter) {
370
- const cfg = (this.activeConfig ?? this.resolvedConfig);
371
- return cfg.controls[0]?.description ?? '';
372
- }
373
- return '';
366
+ return this.activeConfig?.chartSubtitle ?? this.resolvedConfig?.chartSubtitle ?? '';
374
367
  }
375
368
  /** Normalize a numeric (→px) or string dimension to a CSS length. */
376
369
  static toCssSize(value) {
@@ -1927,13 +1920,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
1927
1920
  ></nile-data-grid>`;
1928
1921
  }
1929
1922
  case 'filter': {
1930
- const promote = this.isPromotableFilter;
1931
1923
  const filterConfig = this.aiBorder
1932
1924
  ? { ...config, controls: config.controls.map(c => ({ ...c, aiBorder: c.aiBorder ?? true })) }
1933
1925
  : config;
1934
1926
  return html `<nile-filter-chart
1935
1927
  .config=${{ chart: filterConfig }}
1936
- ?hide-control-headers=${promote}
1928
+ ?no-padding=${this.noPadding}
1937
1929
  @nile-change="${(e) => this.emit('nile-change', e.detail)}"
1938
1930
  ></nile-filter-chart>`;
1939
1931
  }
@@ -2005,6 +1997,9 @@ __decorate([
2005
1997
  __decorate([
2006
1998
  property({ type: Boolean, reflect: true, attribute: 'no-header' })
2007
1999
  ], NileChart.prototype, "noHeader", void 0);
2000
+ __decorate([
2001
+ property({ type: Boolean, reflect: true, attribute: 'no-padding' })
2002
+ ], NileChart.prototype, "noPadding", void 0);
2008
2003
  __decorate([
2009
2004
  property({ type: String, reflect: true })
2010
2005
  ], NileChart.prototype, "appearance", void 0);
@@ -0,0 +1 @@
1
+ export declare const gridstackCss: import("lit").CSSResult;
@@ -0,0 +1,6 @@
1
+ // gridstack CSS inlined so it can be injected into the component's shadow root.
2
+ // Source: gridstack@12.6.0 dist/gridstack.min.css
3
+ // Re-paste from node_modules/gridstack/dist/gridstack.min.css when bumping the gridstack version.
4
+ import { unsafeCSS } from 'lit';
5
+ export const gridstackCss = unsafeCSS(`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:rgba(0,0,0,.1);margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack:not(.grid-stack-rtl)>.grid-stack-item{left:0}.grid-stack.grid-stack-rtl>.grid-stack-item{right:0}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,right,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px rgba(0,0,0,.2);opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,right .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,right 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack:not(.grid-stack-rtl)>.grid-stack-item[gs-x="0"]{left:0}.grid-stack.grid-stack-rtl>.grid-stack-item[gs-x="0"]{right:0}`);
6
+ //# sourceMappingURL=gridstack-css.js.map
@@ -0,0 +1 @@
1
+ export { NileDashboardBuilder } from './nile-dashboard-builder.js';
@@ -0,0 +1,2 @@
1
+ export { NileDashboardBuilder } from './nile-dashboard-builder.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,80 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: block;
5
+ width: 100%;
6
+ }
7
+
8
+ :host([hidden]) {
9
+ display: none;
10
+ }
11
+
12
+ .grid-stack {
13
+ width: 100%;
14
+ min-height: var(--nile-dashboard-builder-min-height, var(--ng-spacing-20));
15
+ }
16
+
17
+ /* Grid-line overlay: one continuous line per cell boundary, using gridstack's
18
+ own layout variables so lines track the actual cells at any columns /
19
+ cell-height / gap. Shown when the gridlines attribute is present. */
20
+ :host([gridlines]) .grid-stack {
21
+ --_gl: var(--nile-dashboard-builder-grid-line, var(--ng-color-blue-200));
22
+ --_bw: var(--ng-border-width-1);
23
+ background-image:
24
+ linear-gradient(to right, var(--_gl) var(--_bw), transparent var(--_bw)),
25
+ linear-gradient(to bottom, var(--_gl) var(--_bw), transparent var(--_bw));
26
+ background-size: var(--gs-column-width) 100%, 100% var(--gs-cell-height);
27
+ background-repeat: repeat;
28
+ /* Close the right/bottom edges (the repeating lines only mark cell starts). */
29
+ box-shadow: inset 0 0 0 var(--_bw) var(--_gl);
30
+ }
31
+
32
+ /* Resize handles: keep the full hit areas and resize cursors, but render no
33
+ arrow icons — resizing works by grabbing an edge/corner directly. */
34
+ .grid-stack-item > .ui-resizable-handle {
35
+ background-image: none;
36
+ }
37
+
38
+ /* The cell wrapper hosts the widget viewer + the remove control. */
39
+ .nile-builder-cell {
40
+ position: relative;
41
+ width: 100%;
42
+ height: 100%;
43
+ }
44
+
45
+ /* Widgets fill the cell (gridstack absolutely-positions the content box). */
46
+ .nile-builder-cell > nile-widget-viewer {
47
+ display: block;
48
+ width: 100%;
49
+ height: 100%;
50
+ }
51
+
52
+ .nile-builder-remove {
53
+ position: absolute;
54
+ top: var(--ng-spacing-1);
55
+ right: var(--ng-spacing-1);
56
+ z-index: 2;
57
+ width: var(--ng-spacing-6);
58
+ height: var(--ng-spacing-6);
59
+ padding: var(--ng-spacing-0);
60
+ line-height: 1;
61
+ border: var(--ng-border-width-1) var(--ng-border-style-solid)
62
+ var(--ng-color-base-transparent);
63
+ border-radius: var(--ng-radius-xs);
64
+ 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);
68
+ transition: background var(--ng-transition-duration-fast) ease;
69
+ }
70
+
71
+ .nile-builder-remove:hover {
72
+ background: var(--ng-colors-bg-error-solid-hover);
73
+ }
74
+
75
+ /* Hide the remove affordance when the builder is locked. */
76
+ :host(:not([editable])) .nile-builder-remove {
77
+ display: none;
78
+ }
79
+ `;
80
+ //# sourceMappingURL=nile-dashboard-builder.css.js.map
@@ -0,0 +1,66 @@
1
+ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
+ import NileElement from '../internal/nile-element.js';
3
+ import type { NileDashboardConfig } from '../internal/types/dashboard-config.type.js';
4
+ import '../nile-widget-viewer/index.js';
5
+ export declare class NileDashboardBuilder extends NileElement {
6
+ static styles: CSSResultGroup;
7
+ /** Dashboard configuration. Widgets without an `id` are assigned one. */
8
+ config: NileDashboardConfig | null;
9
+ /** Number of grid columns. Default: 12. */
10
+ columns: number;
11
+ /** Row height in pixels. Default: 72 (matches gridster `fixedRowHeight`). */
12
+ cellHeight: number;
13
+ /** Gap between cells in pixels. Default: 8. */
14
+ gap: number;
15
+ minRows: number;
16
+ /** Minimum widget width in columns (gridster `minItemCols`). Default: 2. */
17
+ minW: number;
18
+ /** Minimum widget height in rows (gridster `minItemRows`). Default: 2. */
19
+ minH: number;
20
+ resizeHandles: string;
21
+ float: boolean;
22
+ editable: boolean;
23
+ gridLines: boolean;
24
+ gridLineColor: string;
25
+ private gridEl;
26
+ private grid?;
27
+ /** id -> the `.grid-stack-item` element hosting that widget. */
28
+ private itemEls;
29
+ /** id -> the latest widget config (used to rebuild config on layout change). */
30
+ private widgetById;
31
+ /** Guards against re-emitting while we apply config programmatically. */
32
+ private applying;
33
+ /** Signature of the last layout we applied/emitted, to suppress echoes. */
34
+ private lastSig;
35
+ private idCounter;
36
+ /** True when a config change came from a component method and should be emitted. */
37
+ private internalChange;
38
+ firstUpdated(): void;
39
+ updated(changed: PropertyValues<this>): void;
40
+ disconnectedCallback(): void;
41
+ /**
42
+ * Applies the current `config` to the grid (add/remove/update items). When the
43
+ * change originated from a component method (`internalChange`), emits the
44
+ * resulting config *after* the grid is updated — this avoids a race where
45
+ * emitting before the grid mutation would discard the add/remove.
46
+ */
47
+ private reconcile;
48
+ /** Builds a `.grid-stack-item` hosting the widget viewer plus a remove control. */
49
+ private createItem;
50
+ /** Adds a starter chart or KPI widget at the bottom of the grid. */
51
+ addWidget(type: 'chart' | 'kpi'): void;
52
+ removeWidget(id: string): void;
53
+ requestRemoveWidget(id: string): boolean;
54
+ /** Reads the true layout back from gridstack and emits the updated config. */
55
+ private emitFromGrid;
56
+ /** Ensures every widget has a stable id (assigned in place if missing). */
57
+ private normalizeWidgets;
58
+ /** Order-independent signature of the current layout + content. */
59
+ private signature;
60
+ render(): TemplateResult;
61
+ }
62
+ declare global {
63
+ interface HTMLElementTagNameMap {
64
+ 'nile-dashboard-builder': NileDashboardBuilder;
65
+ }
66
+ }
@@ -0,0 +1,317 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement, property, query } from 'lit/decorators.js';
3
+ import { html } from 'lit';
4
+ import { GridStack } from 'gridstack';
5
+ import NileElement from '../internal/nile-element.js';
6
+ import { styles } from './nile-dashboard-builder.css.js';
7
+ import { gridstackCss } from './gridstack-css.js';
8
+ import '../nile-widget-viewer/index.js';
9
+ let NileDashboardBuilder = class NileDashboardBuilder extends NileElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ /** Dashboard configuration. Widgets without an `id` are assigned one. */
13
+ this.config = null;
14
+ /** Number of grid columns. Default: 12. */
15
+ this.columns = 12;
16
+ /** Row height in pixels. Default: 72 (matches gridster `fixedRowHeight`). */
17
+ this.cellHeight = 72;
18
+ /** Gap between cells in pixels. Default: 8. */
19
+ this.gap = 8;
20
+ this.minRows = 4;
21
+ /** Minimum widget width in columns (gridster `minItemCols`). Default: 2. */
22
+ this.minW = 2;
23
+ /** Minimum widget height in rows (gridster `minItemRows`). Default: 2. */
24
+ this.minH = 2;
25
+ this.resizeHandles = 'n,e,s,w,se,sw,nw';
26
+ this.float = true;
27
+ this.editable = true;
28
+ this.gridLines = true;
29
+ this.gridLineColor = '';
30
+ /** id -> the `.grid-stack-item` element hosting that widget. */
31
+ this.itemEls = new Map();
32
+ /** id -> the latest widget config (used to rebuild config on layout change). */
33
+ this.widgetById = new Map();
34
+ /** Guards against re-emitting while we apply config programmatically. */
35
+ this.applying = false;
36
+ /** Signature of the last layout we applied/emitted, to suppress echoes. */
37
+ this.lastSig = '';
38
+ this.idCounter = 0;
39
+ /** True when a config change came from a component method and should be emitted. */
40
+ this.internalChange = false;
41
+ }
42
+ firstUpdated() {
43
+ this.grid = GridStack.init({
44
+ column: this.columns,
45
+ cellHeight: this.cellHeight,
46
+ margin: this.gap,
47
+ float: this.float,
48
+ staticGrid: !this.editable,
49
+ minRow: this.minRows || undefined,
50
+ // Resize handles (configurable via `resize-handles`); default is 8-way,
51
+ // matching gridster's `resizable.handles`.
52
+ resizable: { handles: this.resizeHandles },
53
+ }, this.gridEl);
54
+ this.grid.on('change', () => {
55
+ if (!this.applying)
56
+ this.emitFromGrid();
57
+ });
58
+ // Nudge chart libraries (Highcharts) that reflow on window resize.
59
+ this.grid.on('resizestop', () => window.dispatchEvent(new Event('resize')));
60
+ void this.reconcile();
61
+ }
62
+ updated(changed) {
63
+ if (this.grid) {
64
+ if (changed.has('columns'))
65
+ this.grid.column(this.columns);
66
+ if (changed.has('cellHeight'))
67
+ this.grid.cellHeight(this.cellHeight);
68
+ if (changed.has('gap'))
69
+ this.grid.margin(this.gap);
70
+ if (changed.has('float'))
71
+ this.grid.float(this.float);
72
+ if (changed.has('editable'))
73
+ this.grid.setStatic(!this.editable);
74
+ }
75
+ if (changed.has('gridLineColor')) {
76
+ if (this.gridLineColor) {
77
+ this.gridEl.style.setProperty('--nile-dashboard-builder-grid-line', this.gridLineColor);
78
+ }
79
+ else {
80
+ this.gridEl.style.removeProperty('--nile-dashboard-builder-grid-line');
81
+ }
82
+ }
83
+ if (changed.has('config'))
84
+ void this.reconcile();
85
+ }
86
+ disconnectedCallback() {
87
+ super.disconnectedCallback();
88
+ this.grid?.destroy(false);
89
+ this.grid = undefined;
90
+ }
91
+ /**
92
+ * Applies the current `config` to the grid (add/remove/update items). When the
93
+ * change originated from a component method (`internalChange`), emits the
94
+ * resulting config *after* the grid is updated — this avoids a race where
95
+ * emitting before the grid mutation would discard the add/remove.
96
+ */
97
+ async reconcile() {
98
+ await this.updateComplete;
99
+ const grid = this.grid;
100
+ if (!grid)
101
+ return;
102
+ const widgets = this.normalizeWidgets(this.config);
103
+ const sig = this.signature(widgets);
104
+ if (sig === this.lastSig) {
105
+ this.internalChange = false;
106
+ return; // no change / our own echo
107
+ }
108
+ this.lastSig = sig;
109
+ const desiredIds = new Set(widgets.map((w) => w.id));
110
+ this.applying = true;
111
+ grid.batchUpdate(true);
112
+ try {
113
+ // Remove widgets that are gone.
114
+ for (const [id, el] of [...this.itemEls]) {
115
+ if (!desiredIds.has(id)) {
116
+ grid.removeWidget(el);
117
+ this.itemEls.delete(id);
118
+ this.widgetById.delete(id);
119
+ }
120
+ }
121
+ // Add new widgets / update existing ones in place.
122
+ for (const w of widgets) {
123
+ const id = w.id;
124
+ this.widgetById.set(id, w);
125
+ const existing = this.itemEls.get(id);
126
+ if (existing) {
127
+ grid.update(existing, {
128
+ x: w.layout.x,
129
+ y: w.layout.y,
130
+ w: w.layout.w,
131
+ h: w.layout.h,
132
+ minW: this.minW,
133
+ minH: this.minH,
134
+ });
135
+ const viewer = existing.querySelector('nile-widget-viewer');
136
+ if (viewer)
137
+ viewer.config = w;
138
+ }
139
+ else {
140
+ const el = this.createItem(w);
141
+ this.gridEl.appendChild(el);
142
+ grid.makeWidget(el, {
143
+ x: w.layout.x,
144
+ y: w.layout.y,
145
+ w: w.layout.w,
146
+ h: w.layout.h,
147
+ minW: this.minW,
148
+ minH: this.minH,
149
+ id,
150
+ });
151
+ this.itemEls.set(id, el);
152
+ }
153
+ }
154
+ }
155
+ finally {
156
+ grid.batchUpdate(false);
157
+ this.applying = false;
158
+ }
159
+ if (this.internalChange) {
160
+ this.internalChange = false;
161
+ this.emitFromGrid();
162
+ }
163
+ }
164
+ /** Builds a `.grid-stack-item` hosting the widget viewer plus a remove control. */
165
+ createItem(widget) {
166
+ const item = document.createElement('div');
167
+ item.className = 'grid-stack-item';
168
+ const content = document.createElement('div');
169
+ content.className = 'grid-stack-item-content';
170
+ item.appendChild(content);
171
+ const wrapper = document.createElement('div');
172
+ wrapper.className = 'nile-builder-cell';
173
+ content.appendChild(wrapper);
174
+ const viewer = document.createElement('nile-widget-viewer');
175
+ viewer.config = widget;
176
+ wrapper.appendChild(viewer);
177
+ const remove = document.createElement('button');
178
+ remove.className = 'nile-builder-remove';
179
+ remove.type = 'button';
180
+ remove.textContent = '✕';
181
+ remove.title = 'Remove widget';
182
+ remove.addEventListener('click', (e) => {
183
+ e.stopPropagation();
184
+ this.requestRemoveWidget(widget.id);
185
+ });
186
+ wrapper.appendChild(remove);
187
+ return item;
188
+ }
189
+ /** Adds a starter chart or KPI widget at the bottom of the grid. */
190
+ addWidget(type) {
191
+ const widgets = this.normalizeWidgets(this.config);
192
+ const maxY = widgets.reduce((m, w) => Math.max(m, w.layout.y + w.layout.h), 0);
193
+ const id = `nile-w-${++this.idCounter}`;
194
+ const widget = type === 'kpi'
195
+ ? {
196
+ id,
197
+ type: 'kpi',
198
+ layout: { x: 0, y: maxY, w: 3, h: 2 },
199
+ nileConfig: { chart: { type: 'kpi', variant: 'card', label: 'New KPI', value: '0' } },
200
+ }
201
+ : {
202
+ id,
203
+ type: 'chart',
204
+ layout: { x: 0, y: maxY, w: 6, h: 3 },
205
+ nileConfig: {
206
+ chart: {
207
+ type: 'bar',
208
+ data: [{ name: 'Series 1', data: [5, 3, 8, 6] }],
209
+ categories: ['A', 'B', 'C', 'D'],
210
+ },
211
+ aq: { chartTitle: 'New chart' },
212
+ },
213
+ };
214
+ this.internalChange = true;
215
+ this.config = { ...(this.config ?? {}), widgets: [...widgets, widget] };
216
+ }
217
+ removeWidget(id) {
218
+ const widgets = this.normalizeWidgets(this.config).filter((w) => w.id !== id);
219
+ this.internalChange = true;
220
+ this.config = { ...(this.config ?? {}), widgets };
221
+ }
222
+ requestRemoveWidget(id) {
223
+ const widget = this.widgetById.get(id) ??
224
+ this.normalizeWidgets(this.config).find((w) => w.id === id) ??
225
+ null;
226
+ const ev = this.emit('nile-widget-remove', { id, widget }, undefined, undefined, true);
227
+ if (ev.defaultPrevented)
228
+ return false;
229
+ this.removeWidget(id);
230
+ return true;
231
+ }
232
+ /** Reads the true layout back from gridstack and emits the updated config. */
233
+ emitFromGrid() {
234
+ const grid = this.grid;
235
+ if (!grid)
236
+ return;
237
+ const layout = grid.save(false);
238
+ const widgets = [];
239
+ for (const node of layout) {
240
+ const base = this.widgetById.get(String(node.id));
241
+ if (!base)
242
+ continue;
243
+ widgets.push({
244
+ ...base,
245
+ id: String(node.id),
246
+ layout: { x: node.x ?? 0, y: node.y ?? 0, w: node.w ?? 1, h: node.h ?? 1 },
247
+ });
248
+ }
249
+ const config = { ...(this.config ?? {}), widgets };
250
+ this.lastSig = this.signature(widgets); // prevent this emit from re-applying
251
+ this.config = config;
252
+ this.emit('nile-dashboard-change', { config });
253
+ }
254
+ /** Ensures every widget has a stable id (assigned in place if missing). */
255
+ normalizeWidgets(cfg) {
256
+ const widgets = cfg?.widgets ?? [];
257
+ for (const w of widgets) {
258
+ if (!w.id)
259
+ w.id = `nile-w-${++this.idCounter}`;
260
+ }
261
+ return widgets;
262
+ }
263
+ /** Order-independent signature of the current layout + content. */
264
+ signature(widgets) {
265
+ return JSON.stringify([...widgets]
266
+ .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]));
268
+ }
269
+ render() {
270
+ return html `<div class="grid-stack"></div>`;
271
+ }
272
+ };
273
+ NileDashboardBuilder.styles = [gridstackCss, styles];
274
+ __decorate([
275
+ property({ type: Object })
276
+ ], NileDashboardBuilder.prototype, "config", void 0);
277
+ __decorate([
278
+ property({ type: Number })
279
+ ], NileDashboardBuilder.prototype, "columns", void 0);
280
+ __decorate([
281
+ property({ type: Number, attribute: 'cell-height' })
282
+ ], NileDashboardBuilder.prototype, "cellHeight", void 0);
283
+ __decorate([
284
+ property({ type: Number })
285
+ ], NileDashboardBuilder.prototype, "gap", void 0);
286
+ __decorate([
287
+ property({ type: Number, attribute: 'min-rows' })
288
+ ], NileDashboardBuilder.prototype, "minRows", void 0);
289
+ __decorate([
290
+ property({ type: Number, attribute: 'min-w' })
291
+ ], NileDashboardBuilder.prototype, "minW", void 0);
292
+ __decorate([
293
+ property({ type: Number, attribute: 'min-h' })
294
+ ], NileDashboardBuilder.prototype, "minH", void 0);
295
+ __decorate([
296
+ property({ attribute: 'resize-handles' })
297
+ ], NileDashboardBuilder.prototype, "resizeHandles", void 0);
298
+ __decorate([
299
+ property({ type: Boolean })
300
+ ], NileDashboardBuilder.prototype, "float", void 0);
301
+ __decorate([
302
+ property({ type: Boolean, reflect: true })
303
+ ], NileDashboardBuilder.prototype, "editable", void 0);
304
+ __decorate([
305
+ property({ type: Boolean, reflect: true })
306
+ ], NileDashboardBuilder.prototype, "gridLines", void 0);
307
+ __decorate([
308
+ property({ attribute: 'grid-line-color' })
309
+ ], NileDashboardBuilder.prototype, "gridLineColor", void 0);
310
+ __decorate([
311
+ query('.grid-stack')
312
+ ], NileDashboardBuilder.prototype, "gridEl", void 0);
313
+ NileDashboardBuilder = __decorate([
314
+ customElement('nile-dashboard-builder')
315
+ ], NileDashboardBuilder);
316
+ export { NileDashboardBuilder };
317
+ //# sourceMappingURL=nile-dashboard-builder.js.map
@@ -84,7 +84,11 @@ export const styles = css `
84
84
  }
85
85
 
86
86
  :host([appearance="minimal"]) .fc-control {
87
- padding: var(--nile-spacing-6px, var(--ng-spacing-sm));
87
+ padding: var(--nile-spacing-sm, var(--ng-spacing-sm));
88
+ }
89
+
90
+ :host([no-padding]) .fc-control {
91
+ padding: 0;
88
92
  }
89
93
 
90
94
  .fc-control__label {
@@ -116,13 +120,13 @@ export const styles = css `
116
120
  .fc-badge-group {
117
121
  display: flex;
118
122
  flex-wrap: wrap;
119
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
123
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
120
124
  }
121
125
 
122
126
  .fc-badge {
123
127
  display: inline-flex;
124
128
  align-items: center;
125
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
129
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
126
130
  padding: var(--nile-spacing-4px, var(--ng-spacing-xs)) var(--nile-spacing-14px, var(--ng-spacing-lg-alt));
127
131
  border-radius: var(--nile-radius-full, var(--ng-radius-full));
128
132
  font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
@@ -157,6 +161,20 @@ export const styles = css `
157
161
  border: 1.5px solid var(--nile-colors-transparent, var(--ng-color-base-transparent));
158
162
  }
159
163
 
164
+ .fc-cal-dd {
165
+ display: block;
166
+ width: 100%;
167
+ }
168
+
169
+ .fc-cal-trigger {
170
+ width: 100%;
171
+ }
172
+
173
+ .fc-cal-trigger__icon {
174
+ color: var(--nile-colors-neutral-700, var(--ng-colors-text-quaternary-500));
175
+ flex-shrink: 0;
176
+ }
177
+
160
178
  /* ── Slider ─── */
161
179
  .fc-slider-wrap { display: flex; flex-direction: column; gap: var(--nile-spacing-10px, var(--ng-spacing-md-alt)); }
162
180
 
@@ -187,7 +205,7 @@ export const styles = css `
187
205
 
188
206
  nile-slider::part(range) {
189
207
  width: 100%;
190
- height: var(--nile-spacing-6px, var(--ng-spacing-sm));
208
+ height: var(--nile-spacing-sm, var(--ng-spacing-sm));
191
209
  }
192
210
 
193
211
  nile-slider::part(range-completed) {
@@ -242,7 +260,7 @@ export const styles = css `
242
260
  color: var(--nile-colors-white-base, var(--ng-color-base-white));
243
261
  background: var(--nile-colors-neutral-700, var(--ng-color-graylightmode-700));
244
262
  border-radius: var(--nile-radius-sm, var(--ng-radius-xs));
245
- padding: 3px var(--nile-spacing-6px, var(--ng-spacing-sm));
263
+ padding: 3px var(--nile-spacing-sm, var(--ng-spacing-sm));
246
264
  letter-spacing: 0.05em;
247
265
  }
248
266
 
@@ -269,7 +287,7 @@ export const styles = css `
269
287
  .fc-threshold-field {
270
288
  display: flex;
271
289
  flex-direction: column;
272
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
290
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
273
291
  }
274
292
 
275
293
  .fc-threshold-field-label {
@@ -287,7 +305,7 @@ export const styles = css `
287
305
  .fc-threshold-where {
288
306
  flex-shrink: 0;
289
307
  align-self: flex-end;
290
- margin-bottom: var(--nile-spacing-6px, var(--ng-spacing-sm));
308
+ margin-bottom: var(--nile-spacing-sm, var(--ng-spacing-sm));
291
309
  font-size: 11px;
292
310
  font-weight: var(--nile-font-weight-bold, var(--ng-font-weight-700));
293
311
  letter-spacing: 0.06em;
@@ -300,7 +318,7 @@ export const styles = css `
300
318
  .fc-threshold-preview {
301
319
  display: flex;
302
320
  align-items: center;
303
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
321
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
304
322
  padding: var(--nile-spacing-md, var(--ng-spacing-md)) var(--nile-spacing-lg, var(--ng-spacing-lg));
305
323
  border-radius: var(--nile-radius-radius-lg, var(--ng-radius-sm));
306
324
  background: var(--nile-colors-primary-100, var(--ng-colors-bg-brand-primary));
@@ -322,7 +340,7 @@ export const styles = css `
322
340
  .fc-preset-list {
323
341
  display: flex;
324
342
  flex-direction: column;
325
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
343
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
326
344
  }
327
345
 
328
346
  .fc-preset-item {
@@ -423,8 +441,8 @@ export const styles = css `
423
441
  .fc-prompt__error {
424
442
  display: flex;
425
443
  align-items: center;
426
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
427
- margin-top: var(--nile-spacing-6px, var(--ng-spacing-sm));
444
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
445
+ margin-top: var(--nile-spacing-sm, var(--ng-spacing-sm));
428
446
  padding: 0 var(--nile-spacing-2px, var(--ng-spacing-xxs));
429
447
  color: var(--ng-colors-text-error-primary-600);
430
448
  font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
@@ -504,7 +522,7 @@ export const styles = css `
504
522
  padding: 0 var(--nile-spacing-xl, var(--ng-spacing-xl));
505
523
  font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
506
524
  letter-spacing: 0.03em;
507
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
525
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
508
526
  }
509
527
 
510
528
  .fc-prompt__mode-icon {
@@ -572,7 +590,7 @@ export const styles = css `
572
590
  min-width: 0;
573
591
  display: flex;
574
592
  align-items: center;
575
- gap: var(--nile-spacing-6px, var(--ng-spacing-sm));
593
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
576
594
  width: 100%;
577
595
  }
578
596
  .fc-prompt__field-input {
@@ -752,7 +770,7 @@ export const styles = css `
752
770
  /* ── Clear icon — nile-button variant="ghost" sibling of the input. ─── */
753
771
  .fc-prompt__clear-icon {
754
772
  flex-shrink: 0;
755
- margin-right: var(--nile-spacing-6px, var(--ng-spacing-sm));
773
+ margin-right: var(--nile-spacing-sm, var(--ng-spacing-sm));
756
774
  line-height: 0;
757
775
  }
758
776
 
@@ -8,6 +8,7 @@ export declare class NileFilterChart extends NileElement implements FilterChartH
8
8
  /** When set, the host (e.g. nile-chart) is already rendering the control's label/description
9
9
  * in its own header — skip the in-body copies to avoid duplication. */
10
10
  hideControlHeaders: boolean;
11
+ noPadding: boolean;
11
12
  /**
12
13
  * Visual appearance. `'minimal'` collapses control padding to 6px for
13
14
  * compact layouts; default (`'default'` or omitted) keeps the standard
@@ -13,6 +13,7 @@ import { renderSearch } from './utils/search.js';
13
13
  import { renderComparison } from './utils/comparison.js';
14
14
  import { renderThreshold } from './utils/threshold.js';
15
15
  import { renderPreset } from './utils/preset.js';
16
+ import { renderDatePicker } from './utils/date-picker.js';
16
17
  import { renderPrompt, validatePromptExpression } from './utils/prompt.js';
17
18
  // Lowercase + ASCII-safe slug used to derive a control's `id` from its
18
19
  // `label` when the author hasn't provided one explicitly.
@@ -24,6 +25,7 @@ let NileFilterChart = NileFilterChart_1 = class NileFilterChart extends NileElem
24
25
  /** When set, the host (e.g. nile-chart) is already rendering the control's label/description
25
26
  * in its own header — skip the in-body copies to avoid duplication. */
26
27
  this.hideControlHeaders = false;
28
+ this.noPadding = false;
27
29
  /**
28
30
  * Visual appearance. `'minimal'` collapses control padding to 6px for
29
31
  * compact layouts; default (`'default'` or omitted) keeps the standard
@@ -515,6 +517,9 @@ let NileFilterChart = NileFilterChart_1 = class NileFilterChart extends NileElem
515
517
  case 'preset':
516
518
  body = renderPreset(this, ctrl);
517
519
  break;
520
+ case 'date-picker':
521
+ body = renderDatePicker(this, ctrl);
522
+ break;
518
523
  case 'prompt':
519
524
  body = renderPrompt(this, ctrl);
520
525
  break;
@@ -621,6 +626,9 @@ __decorate([
621
626
  __decorate([
622
627
  property({ type: Boolean, attribute: 'hide-control-headers', reflect: true })
623
628
  ], NileFilterChart.prototype, "hideControlHeaders", void 0);
629
+ __decorate([
630
+ property({ type: Boolean, attribute: 'no-padding', reflect: true })
631
+ ], NileFilterChart.prototype, "noPadding", void 0);
624
632
  __decorate([
625
633
  property({ type: String, reflect: true })
626
634
  ], NileFilterChart.prototype, "appearance", void 0);
@@ -0,0 +1,3 @@
1
+ import { TemplateResult } from 'lit';
2
+ import type { FilterChartHost, NormalizedFilterControl } from './types.js';
3
+ export declare function renderDatePicker(host: FilterChartHost, ctrl: NormalizedFilterControl): TemplateResult;
@@ -0,0 +1,95 @@
1
+ import { html } from 'lit';
2
+ function formatDate(v) {
3
+ if (v === null || v === undefined || v === '')
4
+ return '';
5
+ const d = v instanceof Date ? v : new Date(v);
6
+ if (Number.isNaN(d.getTime()))
7
+ return typeof v === 'string' ? v : '';
8
+ return `${d.getDate()} ${d.toLocaleString('en-US', { month: 'short' })}`;
9
+ }
10
+ const pad = (n) => String(n).padStart(2, '0');
11
+ function toLocalSeed(v) {
12
+ if (v instanceof Date) {
13
+ if (Number.isNaN(v.getTime()))
14
+ return '';
15
+ return `${v.getFullYear()}-${pad(v.getMonth() + 1)}-${pad(v.getDate())}T`
16
+ + `${pad(v.getHours())}:${pad(v.getMinutes())}:${pad(v.getSeconds())}`;
17
+ }
18
+ return typeof v === 'string' ? v : '';
19
+ }
20
+ function toSingleSeed(v) {
21
+ if (v === null || v === undefined || v === '')
22
+ return '';
23
+ if (typeof v === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(v.trim())) {
24
+ return `${v.trim()}T12:00:00`;
25
+ }
26
+ const d = v instanceof Date ? v : typeof v === 'string' ? new Date(v) : null;
27
+ if (!d || Number.isNaN(d.getTime()))
28
+ return '';
29
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T12:00:00`;
30
+ }
31
+ const hasRangeShape = (v) => !!v && typeof v === 'object' && ('startDate' in v || 'endDate' in v);
32
+ export function renderDatePicker(host, ctrl) {
33
+ const isRelative = ctrl.dateType === 'relative';
34
+ // relative windows need range=true so nile-calendar renders Apply (its emit path)
35
+ const isRange = ctrl.selection === 'multi' || isRelative;
36
+ const raw = host.selectedValues.get(ctrl.id);
37
+ const range = hasRangeShape(raw) ? raw : {};
38
+ let seed = '';
39
+ if (isRange) {
40
+ const s = toLocalSeed(range.startDate);
41
+ const e = toLocalSeed(range.endDate);
42
+ if (s && e)
43
+ seed = JSON.stringify({ startDate: s, endDate: e });
44
+ }
45
+ else if (!hasRangeShape(raw)) {
46
+ seed = toSingleSeed(raw);
47
+ }
48
+ const label = hasRangeShape(raw)
49
+ ? [formatDate(range.startDate), formatDate(range.endDate)].filter(Boolean).join(' - ')
50
+ : formatDate(raw);
51
+ const placeholder = ctrl.placeholders?.[0] ?? (isRange ? 'Select date range…' : 'Select date…');
52
+ const onChange = (e) => {
53
+ e.stopPropagation();
54
+ const d = e.detail ?? {};
55
+ if (isRange || hasRangeShape(d)) {
56
+ host.setValue(ctrl.id, { startDate: d.startDate ?? null, endDate: d.endDate ?? null });
57
+ }
58
+ else {
59
+ host.setValue(ctrl.id, d.value ?? '');
60
+ }
61
+ };
62
+ return html `
63
+ <nile-date-picker
64
+ part="date-picker"
65
+ class="fc-cal-dd"
66
+ .range="${isRange}"
67
+ .type="${ctrl.dateType ?? 'absolute'}"
68
+ ?hideTypes="${ctrl.hideDateTypes ?? false}"
69
+ .allowClear="${ctrl.showClearButton ?? true}"
70
+ .hoist="${ctrl.hoist ?? false}"
71
+ ?syncDatePicker="${!isRelative}"
72
+ value="${seed}"
73
+ .dateFormat="${ctrl.dateFormat ?? 'MM/DD/YYYY'}"
74
+ @nile-change="${onChange}"
75
+ @nile-clear="${(e) => {
76
+ e.stopPropagation();
77
+ host.setValue(ctrl.id, isRange ? { startDate: null, endDate: null } : '');
78
+ host.emit('nile-clear', { id: ctrl.id });
79
+ }}"
80
+ >
81
+ <nile-input
82
+ slot="trigger"
83
+ part="calendar-trigger"
84
+ class="fc-cal-trigger${label ? '' : ' fc-cal-trigger--empty'}"
85
+ size="small"
86
+ autocomplete="off"
87
+ .value="${label}"
88
+ placeholder="${placeholder}"
89
+ ?readonly="${isRelative}"
90
+ >
91
+ <nile-glyph slot="prefix" class="fc-cal-trigger__icon" name="ng-calendar" size="16" method="stroke" aria-hidden="true"></nile-glyph>
92
+ </nile-input>
93
+ </nile-date-picker>`;
94
+ }
95
+ //# sourceMappingURL=date-picker.js.map
@@ -90,34 +90,8 @@ export interface QueryLanguageConfig {
90
90
  validateOn?: 'change' | 'submit';
91
91
  /** Optional hint text shown beneath the input describing the syntax. */
92
92
  syntaxHint?: string;
93
- /**
94
- * Extra functions registered with filtrex on top of its built-in set
95
- * (`abs`, `ceil`, `floor`, `log`, `log2`, `log10`, `max`, `min`, `round`,
96
- * `sqrt`, `exists`, `empty`) and our project additions (`contains`,
97
- * `startsWith`, `endsWith`, `lower`, `upper`, `len`, `isEmpty`,
98
- * `isNotEmpty`, `between`, `year`, `month`, `day`, `daysAgo`, `matches`,
99
- * `coalesce`).
100
- *
101
- * Example: `{ daysAgo: (d) => (Date.now() - +new Date(d)) / 86400000 }`
102
- * Used in expressions like `daysAgo(lastSeen) < 7`.
103
- */
104
93
  extraFunctions?: Record<string, (...args: any[]) => unknown>;
105
- /**
106
- * Constants made available to expressions without polluting the data
107
- * object. `'pi'` (single-quoted in the expression) escapes the constant
108
- * to fall back to data access.
109
- *
110
- * Example: `{ pi: Math.PI, currentUser: 'Birat' }` →
111
- * `assignee == currentUser` resolves `currentUser` to `"Birat"`.
112
- */
113
94
  constants?: Record<string, unknown>;
114
- /**
115
- * Override comparison / arithmetic operators. Use this to localise
116
- * comparisons (e.g. case-insensitive string equality) or to plug in
117
- * a domain-specific arithmetic.
118
- *
119
- * Example: `{ '==': (a, b) => String(a).toLowerCase() === String(b).toLowerCase() }`
120
- */
121
95
  operators?: Partial<{
122
96
  '+': (a: unknown, b: unknown) => unknown;
123
97
  '-': (a: unknown, b?: unknown) => unknown;
@@ -133,37 +107,10 @@ export interface QueryLanguageConfig {
133
107
  '>': (a: unknown, b: unknown) => boolean;
134
108
  '~=': (a: unknown, b: unknown) => boolean;
135
109
  }>;
136
- /**
137
- * Optional value-getter for accessing row properties. Filtrex calls
138
- * this for every identifier reference. Default: dotted property
139
- * access (`row.foo.bar` works out of the box).
140
- *
141
- * Override when your data model uses a Map / class / proxy that
142
- * standard property access can't read. The fourth argument is the
143
- * lookup type (`'unescaped'` for bare identifiers, `'single-quoted'`
144
- * for `'foo-bar'` style).
145
- */
146
110
  customProp?: (name: string, get: (key: string) => unknown, obj: unknown, type?: 'unescaped' | 'single-quoted') => unknown;
147
- /**
148
- * Convenience flag — turn on filtrex's bundled `useDotAccessOperator`
149
- * customProp. Lets users type `foo.bar` instead of `bar of foo`.
150
- * Mutually exclusive with a custom `customProp`.
151
- */
152
111
  dotAccess?: boolean;
153
- /**
154
- * Convenience flag — turn on filtrex's bundled optional-chaining
155
- * customProp. `a of b` (or `b.a` with `dotAccess`) returns `null`
156
- * when the LHS is `null`/`undefined` instead of throwing.
157
- * Mutually exclusive with a custom `customProp`.
158
- */
159
112
  optionalChaining?: boolean;
160
113
  }
161
- /**
162
- * Recursive ESTree-shaped node returned by the AST parser. The shape
163
- * matches what `jsep` produces — a small, well-known JS-expression AST.
164
- * Pure JSON: every field is a string, number, boolean, null, or another
165
- * `QueryNode`, so `JSON.stringify` round-trips cleanly.
166
- */
167
114
  export type QueryNode = {
168
115
  type: 'Identifier';
169
116
  name: string;
@@ -203,104 +150,45 @@ export type QueryNode = {
203
150
  body: QueryNode[];
204
151
  };
205
152
  export type QueryJson = {
206
- /** The exact string the user typed, retained for display / serialization. */
207
153
  source: string;
208
154
  ast: QueryNode;
209
155
  };
210
- /**
211
- * Detail emitted with `nile-change`.
212
- *
213
- * `filters[id]` shape depends on the variant + (for prompts) the runtime mode:
214
- * - any non-prompt variant → the variant's natural value
215
- * - prompt in `'prompt'` mode → plain `string` (raw text)
216
- * - prompt in `'expression'` mode,
217
- * parse succeeded → `QueryJson` ({ source, ast }) — JSON-serializable
218
- * - prompt in `'expression'` mode,
219
- * pre-validation / parse fail → plain `string` (the typed text)
220
- *
221
- * `errors` and `evaluators` are populated for prompt controls in Expression mode.
222
- */
223
156
  export type FilterChangeDetail = {
224
157
  filters: Record<string, unknown>;
225
- /** Map of control id → human-readable validation message. Present when at least one control failed validation. */
226
158
  errors?: Record<string, string>;
227
- /** Map of control id → compiled filtrex predicate. Present for prompt controls whose expression validated. */
228
159
  evaluators?: Record<string, (row: unknown) => unknown>;
229
160
  };
230
161
  export interface FilterControl {
231
- /**
232
- * Unique key under which this control's value is emitted in
233
- * `nile-change.detail.filters`. Optional — when omitted the component
234
- * derives one from `label` (slugified) and appends a numeric suffix on
235
- * collision, falling back to `ctrl_<index>` if `label` is also missing.
236
- * Provide an explicit `id` when downstream code reads a stable key.
237
- */
238
162
  id?: string;
239
163
  label: string;
240
- /** Optional subtitle shown below the label. */
241
164
  description?: string;
242
165
  selection: 'single' | 'multi';
243
- variant: 'badge' | 'dropdown' | 'segmented' | 'radio' | 'toggle' | 'search' | 'comparison' | 'threshold' | 'preset' | 'prompt' | 'expression' | 'hybrid';
166
+ variant: 'badge' | 'dropdown' | 'segmented' | 'radio' | 'toggle' | 'search' | 'comparison' | 'threshold' | 'preset' | 'date-picker' | 'prompt' | 'expression' | 'hybrid';
244
167
  options?: FilterOption[];
245
168
  value?: string | string[] | number[] | boolean;
246
- /**
247
- * Placeholder text. Always an array — `placeholders[0]` is the initial /
248
- * static placeholder used by every variant (search, dropdown, prompt).
249
- * For the `prompt`, `hybrid`, and `expression` variants, additional
250
- * entries are cycled through with a typewriter effect.
251
- *
252
- * For `hybrid`, you can supply mode-specific overrides via
253
- * `promptPlaceholders` and `expressionPlaceholders`; when present they
254
- * take precedence over `placeholders` for that mode.
255
- */
256
169
  placeholders?: string[];
257
- /**
258
- * Hybrid variant only. Placeholder phrases used while the toggle is on
259
- * the Prompt side. Cycled with the typewriter effect when multiple
260
- * entries are provided. Falls back to `placeholders` when unset.
261
- */
262
170
  promptPlaceholders?: string[];
263
- /**
264
- * Hybrid variant only. Placeholder phrases used while the toggle is on
265
- * the Expression side. Cycled with the typewriter effect when multiple
266
- * entries are provided. Falls back to `placeholders` when unset.
267
- */
268
171
  expressionPlaceholders?: string[];
269
- /** Typewriter speed in ms per character (default 60). */
270
172
  typeSpeedMs?: number;
271
- /** Pause before deleting a typed phrase (default 1400). */
272
173
  pauseBeforeDeleteMs?: number;
273
- /** Pause between phrases after deletion (default 400). */
274
174
  pauseBetweenMs?: number;
275
175
  queryLanguage?: QueryLanguageConfig;
276
176
  gradientColors?: string[];
277
177
  gradientDirection?: string;
278
178
  gradientSpeedMs?: number;
279
179
  aiBorder?: boolean;
280
- /**
281
- * Prompt variant only. Shows the inline clear (×) icon inside the input
282
- * when the value is non-empty. Defaults to `false` (hidden). Set `true` to
283
- * opt in.
284
- */
285
180
  showClearIcon?: boolean;
286
- /**
287
- * Prompt variant only. Inline autocomplete suggestions shown below the
288
- * input when the prompt is focused (Basic mode). Items are filtered
289
- * client-side by case-insensitive substring match against the current
290
- * input text.
291
- */
292
181
  suggestions?: SuggestionItem[];
293
- /**
294
- * How a clicked suggestion is inserted into the input value.
295
- * - `'replace'` (default) → suggestion's `value` replaces the entire input
296
- * - `'append'` → appends the suggestion to the existing text (space-separated)
297
- */
298
182
  suggestionInsert?: 'replace' | 'append';
299
183
  suggestionTooltip?: boolean;
300
184
  showClearButton?: boolean;
301
185
  valueB?: string;
302
186
  operator?: string;
303
187
  thresholdValue?: number | string;
188
+ dateFormat?: string;
189
+ dateType?: 'absolute' | 'relative';
190
+ hideDateTypes?: boolean;
191
+ hoist?: boolean;
304
192
  }
305
193
  export interface FilterGroup {
306
194
  type: 'group';
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@aquera/nile-visualization",
3
- "version": "2.9.26",
3
+ "version": "2.9.28",
4
4
  "description": "A visualization Library for the Nile Design System",
5
5
  "license": "MIT",
6
6
  "author": "Aquera Inc",
7
7
  "type": "module",
8
8
  "main": "dist/src/index.js",
9
9
  "module": "dist/src/index.js",
10
-
11
10
  "exports": {
12
11
  ".": "./dist/src/index.js",
13
12
  "./nile-bar-chart": "./dist/src/nile-bar-chart/index.js",
@@ -45,6 +44,7 @@
45
44
  "./nile-chart": "./dist/src/nile-chart/index.js",
46
45
  "./nile-widget-viewer": "./dist/src/nile-widget-viewer/index.js",
47
46
  "./nile-dashboard-viewer": "./dist/src/nile-dashboard-viewer/index.js",
47
+ "./nile-dashboard-builder": "./dist/src/nile-dashboard-builder/index.js",
48
48
  "./nile-executive-summary": "./dist/src/nile-executive-summary/index.js",
49
49
  "./nile-chart-list": "./dist/src/nile-chart-list/index.js",
50
50
  "./nile-chart-message": "./dist/src/nile-chart-message/index.js"
@@ -60,14 +60,15 @@
60
60
  "clean": "rimraf dist/*"
61
61
  },
62
62
  "dependencies": {
63
- "lit": "^3.0.0",
64
63
  "filtrex": "^3.0.0",
65
- "jsep": "^1.3.9"
64
+ "gridstack": "12.6.0",
65
+ "jsep": "^1.3.9",
66
+ "lit": "^3.0.0"
66
67
  },
67
68
  "peerDependencies": {
68
69
  "highcharts": "12.5.0",
69
- "@aquera/nile-elements": ">=0.1.0",
70
- "@aquera/nile-data-grid": ">=0.1.0"
70
+ "@aquera/nile-data-grid": ">=0.1.0",
71
+ "@aquera/nile-elements": ">=0.1.0"
71
72
  },
72
73
  "devDependencies": {
73
74
  "@rollup/plugin-babel": "^6.0.3",