@aquera/nile-visualization 2.9.25 → 2.9.27
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 +7 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart.css.js +14 -0
- package/dist/src/nile-chart/nile-chart.d.ts +30 -2
- package/dist/src/nile-chart/nile-chart.js +74 -47
- package/dist/src/nile-filter-chart/nile-filter-chart.css.js +32 -14
- package/dist/src/nile-filter-chart/nile-filter-chart.d.ts +1 -0
- package/dist/src/nile-filter-chart/nile-filter-chart.js +8 -0
- package/dist/src/nile-filter-chart/utils/date-picker.d.ts +3 -0
- package/dist/src/nile-filter-chart/utils/date-picker.js +95 -0
- package/dist/src/nile-filter-chart/utils/types.d.ts +5 -117
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,13 @@ 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
|
+
#### Version 2.9.27 (July 15, 2026)
|
|
39
|
+
- 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)
|
|
40
|
+
- 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)
|
|
41
|
+
|
|
42
|
+
#### Version 2.9.26 (July 14, 2026)
|
|
43
|
+
- 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)
|
|
44
|
+
|
|
38
45
|
#### Version 2.9.25 (July 10, 2026)
|
|
39
46
|
- Nile Filter Chart: Streamlined the prompt typewriter animation logic — introduced `_shouldAnimateTypewriter` and updated `_syncPromptAnimations` so animations run only for active prompt-like controls that have more than one placeholder phrase (UIF-1301)
|
|
40
47
|
- Nile Chart: Moved the shared legend and chart spacing types (`LegendConfig`, `LegendNavigationConfig`, `LegendTitleConfig`, `LegendAccessibilityConfig`, `CSSObject`) into a shared `internal/types` module and re-pointed all chart components' `legend` property to import from there (UIF-1302)
|
|
@@ -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;
|
|
@@ -234,6 +237,17 @@ export const styles = css `
|
|
|
234
237
|
padding-top: 0;
|
|
235
238
|
}
|
|
236
239
|
|
|
240
|
+
:host([no-padding]) .nile-chart-inner {
|
|
241
|
+
padding: 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
:host([no-padding]) .nile-chart-card,
|
|
245
|
+
:host([no-padding]) .nile-chart-card:hover {
|
|
246
|
+
border: none;
|
|
247
|
+
box-shadow: none;
|
|
248
|
+
border-radius: 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
237
251
|
/* Grid layout:
|
|
238
252
|
- card uses clip-path (not overflow:hidden) so position:sticky on the header is not broken
|
|
239
253
|
- height goes on nile-data-grid itself so .scroll-container inside shadow DOM scrolls,
|
|
@@ -53,6 +53,35 @@ import '../nile-filter-chart/index.js';
|
|
|
53
53
|
import '../nile-chart-message/nile-chart-message.js';
|
|
54
54
|
import '../nile-chart-list/nile-chart-list.js';
|
|
55
55
|
import '../nile-ai-panel/index.js';
|
|
56
|
+
/**
|
|
57
|
+
* Universal chart wrapper. Renders a card with an optional header (titles +
|
|
58
|
+
* actions) and the active chart type below.
|
|
59
|
+
*
|
|
60
|
+
* @csspart chart-card - The outer card wrapper.
|
|
61
|
+
* @csspart chart-body - The wrapper between the header and the chart body.
|
|
62
|
+
* @csspart chart-inner - The chart body region below the header.
|
|
63
|
+
* @csspart header - The header row (titles + actions).
|
|
64
|
+
* @csspart header-titles - The titles column (title + subtitle).
|
|
65
|
+
* @csspart header-title - The title text.
|
|
66
|
+
* @csspart header-subtitle - The subtitle text.
|
|
67
|
+
* @csspart header-actions - The actions column (reset-zoom, AI, menu).
|
|
68
|
+
* @csspart reset-zoom-tooltip - Tooltip wrapping the reset-zoom button (master-detail only).
|
|
69
|
+
* @csspart reset-zoom - The reset-zoom button (master-detail only).
|
|
70
|
+
* @csspart reset-zoom-glyph - Glyph inside the reset-zoom button.
|
|
71
|
+
* @csspart ai-trigger - The "Ask AI" button.
|
|
72
|
+
* @csspart ai-trigger-glyph - Glyph inside the "Ask AI" button.
|
|
73
|
+
* @csspart ai-panel - The AI chat panel overlay.
|
|
74
|
+
* @csspart ai-panel-content - The nile-ai-panel element inside the overlay.
|
|
75
|
+
* @csspart menu-anchor - The actions-menu dropdown anchor.
|
|
76
|
+
* @csspart menu-trigger - The actions-menu trigger button.
|
|
77
|
+
* @csspart menu-trigger-glyph - Glyph inside the actions-menu trigger.
|
|
78
|
+
* @csspart menu - The actions-menu popup (also matches `dropdown`).
|
|
79
|
+
* @csspart menu-group-header - A group heading inside the actions menu.
|
|
80
|
+
* @csspart menu-separator - A separator inside the actions menu.
|
|
81
|
+
* @csspart menu-item - Any actions-menu item (also carries a kind-specific
|
|
82
|
+
* sub-part: `type`, `custom`, `fullscreen`, `print`, `download-png`, `download-svg`, `download-csv`).
|
|
83
|
+
* @csspart menu-item-glyph - Glyph inside an actions-menu item.
|
|
84
|
+
*/
|
|
56
85
|
export declare class NileChart extends NileElement {
|
|
57
86
|
static styles: CSSResultGroup;
|
|
58
87
|
private _headerTipEl;
|
|
@@ -71,6 +100,7 @@ export declare class NileChart extends NileElement {
|
|
|
71
100
|
*/
|
|
72
101
|
loading: boolean;
|
|
73
102
|
noHeader: boolean;
|
|
103
|
+
noPadding: boolean;
|
|
74
104
|
appearance: string | null;
|
|
75
105
|
/**
|
|
76
106
|
* When set, fills `chart.type` if the config omits it (same values as `chart.type`, e.g. `stacked`, `pie`).
|
|
@@ -122,8 +152,6 @@ export declare class NileChart extends NileElement {
|
|
|
122
152
|
addAiResponse(text: string): void;
|
|
123
153
|
private handleAiSend;
|
|
124
154
|
private switchType;
|
|
125
|
-
/** Single-control filter chart where the in-body label should be promoted to the chart header. */
|
|
126
|
-
private get isPromotableFilter();
|
|
127
155
|
private get headerTitle();
|
|
128
156
|
private get headerSubtitle();
|
|
129
157
|
/** Normalize a numeric (→px) or string dimension to a CSS length. */
|
|
@@ -129,6 +129,35 @@ function ensureHeaderTooltipStyles() {
|
|
|
129
129
|
document.head.appendChild(style);
|
|
130
130
|
_headerTooltipStylesInjected = true;
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Universal chart wrapper. Renders a card with an optional header (titles +
|
|
134
|
+
* actions) and the active chart type below.
|
|
135
|
+
*
|
|
136
|
+
* @csspart chart-card - The outer card wrapper.
|
|
137
|
+
* @csspart chart-body - The wrapper between the header and the chart body.
|
|
138
|
+
* @csspart chart-inner - The chart body region below the header.
|
|
139
|
+
* @csspart header - The header row (titles + actions).
|
|
140
|
+
* @csspart header-titles - The titles column (title + subtitle).
|
|
141
|
+
* @csspart header-title - The title text.
|
|
142
|
+
* @csspart header-subtitle - The subtitle text.
|
|
143
|
+
* @csspart header-actions - The actions column (reset-zoom, AI, menu).
|
|
144
|
+
* @csspart reset-zoom-tooltip - Tooltip wrapping the reset-zoom button (master-detail only).
|
|
145
|
+
* @csspart reset-zoom - The reset-zoom button (master-detail only).
|
|
146
|
+
* @csspart reset-zoom-glyph - Glyph inside the reset-zoom button.
|
|
147
|
+
* @csspart ai-trigger - The "Ask AI" button.
|
|
148
|
+
* @csspart ai-trigger-glyph - Glyph inside the "Ask AI" button.
|
|
149
|
+
* @csspart ai-panel - The AI chat panel overlay.
|
|
150
|
+
* @csspart ai-panel-content - The nile-ai-panel element inside the overlay.
|
|
151
|
+
* @csspart menu-anchor - The actions-menu dropdown anchor.
|
|
152
|
+
* @csspart menu-trigger - The actions-menu trigger button.
|
|
153
|
+
* @csspart menu-trigger-glyph - Glyph inside the actions-menu trigger.
|
|
154
|
+
* @csspart menu - The actions-menu popup (also matches `dropdown`).
|
|
155
|
+
* @csspart menu-group-header - A group heading inside the actions menu.
|
|
156
|
+
* @csspart menu-separator - A separator inside the actions menu.
|
|
157
|
+
* @csspart menu-item - Any actions-menu item (also carries a kind-specific
|
|
158
|
+
* sub-part: `type`, `custom`, `fullscreen`, `print`, `download-png`, `download-svg`, `download-csv`).
|
|
159
|
+
* @csspart menu-item-glyph - Glyph inside an actions-menu item.
|
|
160
|
+
*/
|
|
132
161
|
let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
133
162
|
constructor() {
|
|
134
163
|
super(...arguments);
|
|
@@ -148,6 +177,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
148
177
|
*/
|
|
149
178
|
this.loading = false;
|
|
150
179
|
this.noHeader = false;
|
|
180
|
+
this.noPadding = false;
|
|
151
181
|
this.appearance = null;
|
|
152
182
|
/**
|
|
153
183
|
* When set, fills `chart.type` if the config omits it (same values as `chart.type`, e.g. `stacked`, `pie`).
|
|
@@ -272,9 +302,22 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
272
302
|
const cfgNoHeader = resolved.noHeader === true || minimalFilter;
|
|
273
303
|
if (cfgNoHeader && !this.noHeader)
|
|
274
304
|
this.noHeader = true;
|
|
305
|
+
if (this.noPadding !== (resolved.noPadding === true))
|
|
306
|
+
this.noPadding = resolved.noPadding === true;
|
|
275
307
|
if (resolved.appearance && this.appearance !== resolved.appearance)
|
|
276
308
|
this.appearance = resolved.appearance;
|
|
277
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);
|
|
278
321
|
// Keep truncated-title focusability in sync after any re-render.
|
|
279
322
|
this._syncHeaderTruncationA11y();
|
|
280
323
|
}
|
|
@@ -316,32 +359,11 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
316
359
|
config: converted,
|
|
317
360
|
});
|
|
318
361
|
}
|
|
319
|
-
/** Single-control filter chart where the in-body label should be promoted to the chart header. */
|
|
320
|
-
get isPromotableFilter() {
|
|
321
|
-
const cfg = (this.activeConfig ?? this.resolvedConfig);
|
|
322
|
-
return cfg?.type === 'filter'
|
|
323
|
-
&& Array.isArray(cfg?.controls)
|
|
324
|
-
&& cfg.controls.length === 1;
|
|
325
|
-
}
|
|
326
362
|
get headerTitle() {
|
|
327
|
-
|
|
328
|
-
if (explicit)
|
|
329
|
-
return explicit;
|
|
330
|
-
if (this.isPromotableFilter) {
|
|
331
|
-
const cfg = (this.activeConfig ?? this.resolvedConfig);
|
|
332
|
-
return cfg.controls[0]?.label ?? '';
|
|
333
|
-
}
|
|
334
|
-
return '';
|
|
363
|
+
return this.activeConfig?.chartTitle ?? this.resolvedConfig?.chartTitle ?? '';
|
|
335
364
|
}
|
|
336
365
|
get headerSubtitle() {
|
|
337
|
-
|
|
338
|
-
if (explicit)
|
|
339
|
-
return explicit;
|
|
340
|
-
if (this.isPromotableFilter) {
|
|
341
|
-
const cfg = (this.activeConfig ?? this.resolvedConfig);
|
|
342
|
-
return cfg.controls[0]?.description ?? '';
|
|
343
|
-
}
|
|
344
|
-
return '';
|
|
366
|
+
return this.activeConfig?.chartSubtitle ?? this.resolvedConfig?.chartSubtitle ?? '';
|
|
345
367
|
}
|
|
346
368
|
/** Normalize a numeric (→px) or string dimension to a CSS length. */
|
|
347
369
|
static toCssSize(value) {
|
|
@@ -466,6 +488,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
466
488
|
? html `<nile-glyph
|
|
467
489
|
slot="prefix"
|
|
468
490
|
class="nile-chart-actions-menu-glyph"
|
|
491
|
+
part="menu-item-glyph"
|
|
469
492
|
name=${item.glyph}
|
|
470
493
|
method=${item.method ?? 'stroke'}
|
|
471
494
|
color=${item.color ?? 'var(--nile-colors-dark-500,var(--ng-colors-fg-secondary-700))'}
|
|
@@ -474,8 +497,8 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
474
497
|
: nothing;
|
|
475
498
|
if (item.type === 'custom') {
|
|
476
499
|
return html `
|
|
477
|
-
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
|
|
478
|
-
<nile-menu-item class="nile-chart-actions-menu-item" value=${`custom:${item.id}`}
|
|
500
|
+
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
|
|
501
|
+
<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item custom" value=${`custom:${item.id}`}
|
|
479
502
|
@click=${() => { this.closeMenu(); this.emit('nile-menu-change', { id: item.id }); }}>
|
|
480
503
|
${glyph}${item.label}
|
|
481
504
|
</nile-menu-item>
|
|
@@ -484,12 +507,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
484
507
|
if (!hasChart)
|
|
485
508
|
return nothing;
|
|
486
509
|
return html `
|
|
487
|
-
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
|
|
488
|
-
${item.fullscreen ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="fullscreen" @click=${() => this.viewFullscreen()}>${glyph}${item.label ?? 'Fullscreen'}</nile-menu-item>` : nothing}
|
|
489
|
-
${item.print ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="print" @click=${() => this.printChart()}>${glyph}${item.label ?? 'Print'}</nile-menu-item>` : nothing}
|
|
490
|
-
${item.downloadPng ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-png" @click=${() => this.exportChart('image/png')}>${glyph}${item.label ?? 'Download PNG'}</nile-menu-item>` : nothing}
|
|
491
|
-
${item.downloadSvg ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-svg" @click=${() => this.exportChart('image/svg+xml')}>${glyph}${item.label ?? 'Download SVG'}</nile-menu-item>` : nothing}
|
|
492
|
-
${item.downloadCsv ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-csv" @click=${() => this.downloadCsv()}>${glyph}${item.label ?? 'Download CSV'}</nile-menu-item>` : nothing}
|
|
510
|
+
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
|
|
511
|
+
${item.fullscreen ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item fullscreen" value="fullscreen" @click=${() => this.viewFullscreen()}>${glyph}${item.label ?? 'Fullscreen'}</nile-menu-item>` : nothing}
|
|
512
|
+
${item.print ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item print" value="print" @click=${() => this.printChart()}>${glyph}${item.label ?? 'Print'}</nile-menu-item>` : nothing}
|
|
513
|
+
${item.downloadPng ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item download-png" value="download-png" @click=${() => this.exportChart('image/png')}>${glyph}${item.label ?? 'Download PNG'}</nile-menu-item>` : nothing}
|
|
514
|
+
${item.downloadSvg ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item download-svg" value="download-svg" @click=${() => this.exportChart('image/svg+xml')}>${glyph}${item.label ?? 'Download SVG'}</nile-menu-item>` : nothing}
|
|
515
|
+
${item.downloadCsv ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item download-csv" value="download-csv" @click=${() => this.downloadCsv()}>${glyph}${item.label ?? 'Download CSV'}</nile-menu-item>` : nothing}
|
|
493
516
|
`;
|
|
494
517
|
}
|
|
495
518
|
renderActionsMenu() {
|
|
@@ -507,35 +530,36 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
507
530
|
const hasAnyItems = !!(types?.length || allItems.length);
|
|
508
531
|
if (!hasAnyItems) {
|
|
509
532
|
return html `
|
|
510
|
-
<button type="button" class="nile-chart-menu-trigger" aria-label="Chart actions">
|
|
511
|
-
<nile-glyph name="options" size="16"></nile-glyph>
|
|
533
|
+
<button type="button" class="nile-chart-menu-trigger" part="menu-trigger" aria-label="Chart actions">
|
|
534
|
+
<nile-glyph name="options" size="16" part="menu-trigger-glyph"></nile-glyph>
|
|
512
535
|
</button>
|
|
513
536
|
`;
|
|
514
537
|
}
|
|
515
538
|
return html `
|
|
516
|
-
<nile-dropdown class="nile-chart-menu-anchor" placement="bottom-end" distance="4" portal>
|
|
539
|
+
<nile-dropdown class="nile-chart-menu-anchor" placement="bottom-end" distance="4" portal part="menu-anchor">
|
|
517
540
|
<button
|
|
518
541
|
type="button"
|
|
519
542
|
slot="trigger"
|
|
520
543
|
class="nile-chart-menu-trigger"
|
|
544
|
+
part="menu-trigger"
|
|
521
545
|
aria-label="Chart actions"
|
|
522
546
|
>
|
|
523
|
-
<nile-glyph name="options" size="16"></nile-glyph>
|
|
547
|
+
<nile-glyph name="options" size="16" part="menu-trigger-glyph"></nile-glyph>
|
|
524
548
|
</button>
|
|
525
|
-
<nile-menu class="nile-chart-actions-menu" part="dropdown">
|
|
549
|
+
<nile-menu class="nile-chart-actions-menu" part="dropdown menu">
|
|
526
550
|
${types?.length ? html `
|
|
527
551
|
${types.map(type => html `
|
|
528
|
-
<nile-menu-item class="nile-chart-actions-menu-item" value=${`type:${type}`} ?active=${type === this.activeType} @click=${() => this.switchType(type)}>
|
|
552
|
+
<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item type" value=${`type:${type}`} ?active=${type === this.activeType} @click=${() => this.switchType(type)}>
|
|
529
553
|
${chartTypeLabel(type)}
|
|
530
554
|
</nile-menu-item>
|
|
531
555
|
`)}
|
|
532
|
-
${allItems.length ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
|
|
556
|
+
${allItems.length ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
|
|
533
557
|
` : nothing}
|
|
534
558
|
${allItems.map(item => {
|
|
535
559
|
if (item.type === 'group') {
|
|
536
560
|
return html `
|
|
537
|
-
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="
|
|
538
|
-
<span class="nile-chart-actions-menu-group-header" role="presentation" part="header">${item.label}</span>
|
|
561
|
+
${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
|
|
562
|
+
<span class="nile-chart-actions-menu-group-header" role="presentation" part="menu-group-header">${item.label}</span>
|
|
539
563
|
${item.items.map(child => this._renderMenuItem(child, hasChart))}
|
|
540
564
|
`;
|
|
541
565
|
}
|
|
@@ -556,7 +580,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
556
580
|
@click=${this.toggleChat}
|
|
557
581
|
part="ai-trigger"
|
|
558
582
|
>
|
|
559
|
-
<nile-glyph name="smart-code" size="16"></nile-glyph>
|
|
583
|
+
<nile-glyph name="smart-code" size="16" part="ai-trigger-glyph"></nile-glyph>
|
|
560
584
|
</button>
|
|
561
585
|
<slot name="nile-ai-trigger-after"></slot>
|
|
562
586
|
`;
|
|
@@ -614,7 +638,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
614
638
|
<div class="nile-chart-header-actions" part="header-actions">
|
|
615
639
|
<slot name="header-actions" @slotchange=${this.onHeaderActionsSlotChange}></slot>
|
|
616
640
|
${this.masterZoomed && (this.activeType ?? this.resolvedConfig?.type) === 'master-detail'
|
|
617
|
-
? html `<nile-tooltip content="Reset zoom" placement="top">
|
|
641
|
+
? html `<nile-tooltip content="Reset zoom" placement="top" part="reset-zoom-tooltip">
|
|
618
642
|
<button
|
|
619
643
|
type="button"
|
|
620
644
|
class="nile-chart-menu-trigger nile-chart-reset-zoom"
|
|
@@ -622,7 +646,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
622
646
|
aria-label="Reset zoom"
|
|
623
647
|
@click=${() => this.masterDetailChart?.resetZoom()}
|
|
624
648
|
>
|
|
625
|
-
<nile-glyph name="refresh" size="16"></nile-glyph>
|
|
649
|
+
<nile-glyph name="refresh" size="16" part="reset-zoom-glyph"></nile-glyph>
|
|
626
650
|
</button>
|
|
627
651
|
</nile-tooltip>`
|
|
628
652
|
: nothing}
|
|
@@ -643,8 +667,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
643
667
|
const summaryMessage = summary;
|
|
644
668
|
const welcomeMessage = summary ? '' : (aiConfig?.welcomeMessage ?? '');
|
|
645
669
|
return html `
|
|
646
|
-
<div class="nile-ai-panel-overlay" ?data-open=${this.chatOpen}>
|
|
670
|
+
<div class="nile-ai-panel-overlay" part="ai-panel" ?data-open=${this.chatOpen}>
|
|
647
671
|
<nile-ai-panel
|
|
672
|
+
part="ai-panel-content"
|
|
648
673
|
.placeholder=${aiConfig?.placeholder ?? 'Ask about this chart...'}
|
|
649
674
|
.welcomeMessage=${welcomeMessage}
|
|
650
675
|
.summaryMessage=${summaryMessage}
|
|
@@ -1895,13 +1920,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
1895
1920
|
></nile-data-grid>`;
|
|
1896
1921
|
}
|
|
1897
1922
|
case 'filter': {
|
|
1898
|
-
const promote = this.isPromotableFilter;
|
|
1899
1923
|
const filterConfig = this.aiBorder
|
|
1900
1924
|
? { ...config, controls: config.controls.map(c => ({ ...c, aiBorder: c.aiBorder ?? true })) }
|
|
1901
1925
|
: config;
|
|
1902
1926
|
return html `<nile-filter-chart
|
|
1903
1927
|
.config=${{ chart: filterConfig }}
|
|
1904
|
-
?
|
|
1928
|
+
?no-padding=${this.noPadding}
|
|
1905
1929
|
@nile-change="${(e) => this.emit('nile-change', e.detail)}"
|
|
1906
1930
|
></nile-filter-chart>`;
|
|
1907
1931
|
}
|
|
@@ -1947,7 +1971,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
1947
1971
|
return html `
|
|
1948
1972
|
<div class="nile-chart-card ${isGrid ? 'nile-chart-card--grid' : ''} ${isLoading ? 'nile-chart-card--loading' : ''} ${this.activeConfig?.type === 'kpi' ? 'nile-chart-card--kpi' : ''}" part="chart-card">
|
|
1949
1973
|
${this.renderHeader()}
|
|
1950
|
-
<div class="nile-chart-wrapper">
|
|
1974
|
+
<div class="nile-chart-wrapper" part="chart-body">
|
|
1951
1975
|
<div class="nile-chart-inner ${this.activeConfig?.type === 'kpi' ? 'nile-chart-inner--kpi' : ''} ${this.activeConfig?.type === 'filter' ? 'nile-chart-inner--filter' : ''}" part="chart-inner">
|
|
1952
1976
|
${isLoading
|
|
1953
1977
|
? this.renderSkeleton()
|
|
@@ -1973,6 +1997,9 @@ __decorate([
|
|
|
1973
1997
|
__decorate([
|
|
1974
1998
|
property({ type: Boolean, reflect: true, attribute: 'no-header' })
|
|
1975
1999
|
], NileChart.prototype, "noHeader", void 0);
|
|
2000
|
+
__decorate([
|
|
2001
|
+
property({ type: Boolean, reflect: true, attribute: 'no-padding' })
|
|
2002
|
+
], NileChart.prototype, "noPadding", void 0);
|
|
1976
2003
|
__decorate([
|
|
1977
2004
|
property({ type: String, reflect: true })
|
|
1978
2005
|
], NileChart.prototype, "appearance", void 0);
|
|
@@ -84,7 +84,11 @@ export const styles = css `
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
:host([appearance="minimal"]) .fc-control {
|
|
87
|
-
padding: var(--nile-spacing-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
427
|
-
margin-top: var(--nile-spacing-
|
|
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-
|
|
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-
|
|
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-
|
|
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,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';
|