@microsoft/fabric-slicers 4.0.0 → 4.2.0
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/CHANGELOG +21 -0
- package/README.md +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +1351 -159
- package/package.json +6 -3
package/CHANGELOG
CHANGED
|
@@ -5,6 +5,27 @@ All notable changes to `@microsoft/fabric-slicers` will be documented in this fi
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 4.2.0 - 2026-11-05
|
|
9
|
+
|
|
10
|
+
- Update date slicer dropdown formatting and preset labels
|
|
11
|
+
- [Slicers] Use browser-style focus for controls and rows
|
|
12
|
+
- [Slicers] Bug fix for drop down slicer frameless prop
|
|
13
|
+
- Upgrade jsdom to 30.1.3 to resolve undici TLS renegotiation DoS
|
|
14
|
+
|
|
15
|
+
## 4.1.0 - 2026-10-28
|
|
16
|
+
|
|
17
|
+
- Add month and year range selection to DateSlicer
|
|
18
|
+
- Debounce range-slicer keyboard filter updates
|
|
19
|
+
- Add DateSlicer to DataGrid column filters
|
|
20
|
+
- Update slicer selection boundary
|
|
21
|
+
- Add optional DateSlicer preset sidebar
|
|
22
|
+
- Update slicer keyboard accessibility
|
|
23
|
+
- Support datetime columns in the date slicer
|
|
24
|
+
- [Slicers] Synchronize DateSlicer selections with the host
|
|
25
|
+
- [Slicers] Add DateSlicer range-calendar dropdown
|
|
26
|
+
- Add private DateSlicer calendar and harness preview
|
|
27
|
+
- [Slicers] Adding select only option
|
|
28
|
+
|
|
8
29
|
## 4.0.0 - 2026-10-21
|
|
9
30
|
|
|
10
31
|
- BREAKING: Emit `fieldId` and tagged `InteractionValue` objects instead of `name` and raw values from public interaction callbacks.
|
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ React slicer components for Fabric Apps - Analytics.
|
|
|
4
4
|
|
|
5
5
|
## Quick Reference
|
|
6
6
|
|
|
7
|
-
> **Use when**: You need categorical selection or a numeric range control.
|
|
8
|
-
> **Components**: `ListSlicer`, `DropdownSlicer`, `RangeSlicer`.
|
|
7
|
+
> **Use when**: You need categorical selection, calendar-date selection, or a numeric range control.
|
|
8
|
+
> **Components**: `ListSlicer`, `DropdownSlicer`, `DateSlicer`, `RangeSlicer`.
|
|
9
9
|
> **Selection**: Starts with all values or the full range selected unless supplied by the host. All slicers accept `selection` to restore or synchronize local state and emit interaction events for host-managed filtering.
|
|
10
10
|
> **Peer dependencies**: React 18 or 19, React DOM, and `@griffel/react`.
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ npm install @microsoft/fabric-slicers @microsoft/fabric-visuals-core @griffel/re
|
|
|
17
17
|
|
|
18
18
|
## Public API
|
|
19
19
|
|
|
20
|
-
Import components and types from `@microsoft/fabric-slicers`. All
|
|
20
|
+
Import components and types from `@microsoft/fabric-slicers`. All four components share these props:
|
|
21
21
|
|
|
22
22
|
| Prop | Type | Required | Description |
|
|
23
23
|
|------|------|----------|-------------|
|
|
@@ -108,6 +108,32 @@ import { DropdownSlicer } from '@microsoft/fabric-slicers';
|
|
|
108
108
|
|
|
109
109
|
Props type: `DropdownSlicerInputParams`. It accepts the same `selection` and `displayOptions` as List slicer.
|
|
110
110
|
|
|
111
|
+
## Date slicer
|
|
112
|
+
|
|
113
|
+
`DateSlicer` provides inclusive calendar-date range selection with period presets. It accepts a `DataTable` column containing ISO `YYYY-MM-DD` dates or ISO datetimes and compares their written calendar days without timezone conversion.
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { DateSlicer } from '@microsoft/fabric-slicers';
|
|
117
|
+
|
|
118
|
+
<DateSlicer
|
|
119
|
+
data={{
|
|
120
|
+
columns: [{ name: 'orderDate', displayName: 'Order date', format: 'yyyy-mm-dd' }],
|
|
121
|
+
rows: [['2026-01-01'], ['2026-01-15'], ['2026-01-31']],
|
|
122
|
+
}}
|
|
123
|
+
column="orderDate"
|
|
124
|
+
displayOptions={{ numberOfMonths: 1 }}
|
|
125
|
+
/>;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Props type: `DateSlicerInputParams`. Additional options:
|
|
129
|
+
|
|
130
|
+
| Prop | Default | Description |
|
|
131
|
+
|------|---------|-------------|
|
|
132
|
+
| `displayOptions.showPresets` | `true` | Show calendar-period shortcuts. |
|
|
133
|
+
| `displayOptions.numberOfMonths` | `3` | Positive number of calendar months shown at once. |
|
|
134
|
+
| `dataType` | `'date'` | Use `'datetime'` to emit whole-day datetime bounds for Interaction Manager. |
|
|
135
|
+
| `selection` | Unselected | Canonical inclusive `readonly [startDate, endDate]` bounds. |
|
|
136
|
+
|
|
111
137
|
## Range slicer
|
|
112
138
|
|
|
113
139
|
`RangeSlicer` provides a histogram, two-handle slider, and editable minimum/maximum inputs.
|
|
@@ -150,11 +176,13 @@ Keep selection arrays immutable and retain their reference on unrelated rerender
|
|
|
150
176
|
| Component | Selection type | Meaning |
|
|
151
177
|
|-----------|----------------|---------|
|
|
152
178
|
| `ListSlicer`, `DropdownSlicer` | `readonly SlicerValue[] \| null` | Raw selected values. `[]` selects none. |
|
|
179
|
+
| `DateSlicer` | `readonly [string, string] \| null` | Inclusive canonical `YYYY-MM-DD` bounds. |
|
|
153
180
|
| `RangeSlicer` | `SlicerRange \| null` | Inclusive `[minimum, maximum]` bounds. Infinities leave that side unbounded. |
|
|
154
181
|
|
|
155
182
|
```tsx
|
|
156
183
|
<ListSlicer data={['Action', 'Adventure', 'Role-playing']} column="genre" selection={['Action', 'Adventure']} />;
|
|
157
184
|
<DropdownSlicer data={['North', 'South', 'East', 'West']} column="region" selection={['North']} />;
|
|
185
|
+
<DateSlicer data={dateData} column="orderDate" selection={['2026-01-01', '2026-01-31']} />;
|
|
158
186
|
<RangeSlicer data={[0, 20, 80, 100]} column="revenue" selection={[20, Infinity]} />;
|
|
159
187
|
```
|
|
160
188
|
|
|
@@ -172,6 +200,9 @@ Manager requires semantic-model dates and datetimes as their original normalized
|
|
|
172
200
|
Range slicers emit `select` on drag release, keyboard changes, or valid input commits (Enter/blur).
|
|
173
201
|
Unchanged, invalid, or cancelled edits do not emit.
|
|
174
202
|
|
|
203
|
+
Date slicers emit an inclusive date `range` predicate after a completed two-day selection or preset. With
|
|
204
|
+
`dataType="datetime"`, they emit an inclusive start at midnight and an exclusive midnight after the selected end day.
|
|
205
|
+
|
|
175
206
|
Range selections contain one inclusive `range` predicate whose `fieldId` is `column`. Each bound is a
|
|
176
207
|
`RangeBoundary` (`{ kind: 'value', value }`). A bound at the data domain's edge is omitted to leave
|
|
177
208
|
that side unbounded.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { DataTable, VisualTheme, InteractionEventCallback } from '@microsoft/fabric-visuals-core';
|
|
2
|
+
import { CalendarDate, DataTable, VisualTheme, InteractionEventCallback } from '@microsoft/fabric-visuals-core';
|
|
3
3
|
|
|
4
4
|
/** Supported raw slicer values. Null and undefined share one blank entry in list and dropdown slicers. */
|
|
5
5
|
type SlicerValue = string | number | boolean | Date | null | undefined;
|
|
@@ -21,6 +21,7 @@ interface SlicerInputParams {
|
|
|
21
21
|
/** Visible title. Defaults to the DataTable column display name, then column. */
|
|
22
22
|
title?: string;
|
|
23
23
|
displayOptions?: SlicerDisplayOptions;
|
|
24
|
+
disabled?: boolean;
|
|
24
25
|
/** Callback for slicer selection and clear interaction events. */
|
|
25
26
|
onInteraction?: InteractionEventCallback;
|
|
26
27
|
}
|
|
@@ -35,6 +36,7 @@ interface ListSlicerInputParams extends SlicerInputParams {
|
|
|
35
36
|
/**
|
|
36
37
|
* Raw selected values to restore or synchronize without emitting events.
|
|
37
38
|
* Null resets to all, including future values. An empty array selects none.
|
|
39
|
+
* Selected values absent from refreshed data are retained until changed or cleared.
|
|
38
40
|
* Omitted leaves selection locally managed; supplying values does not disable local edits.
|
|
39
41
|
*/
|
|
40
42
|
selection?: readonly SlicerValue[] | null;
|
|
@@ -44,6 +46,34 @@ interface DropdownSlicerInputParams extends ListSlicerInputParams {
|
|
|
44
46
|
}
|
|
45
47
|
/** Lower and upper bounds, inclusive. */
|
|
46
48
|
type SlicerRange = [number, number];
|
|
49
|
+
/** Start and end calendar dates, with both dates included in the range. */
|
|
50
|
+
type CalendarDateRange = readonly [CalendarDate, CalendarDate];
|
|
51
|
+
/** Display options for the date slicer. */
|
|
52
|
+
interface DateSlicerDisplayOptions extends SlicerDisplayOptions {
|
|
53
|
+
/** Show calendar-period shortcuts beside the calendar. Defaults to true. */
|
|
54
|
+
showPresets?: boolean;
|
|
55
|
+
/** Months shown at once. Must be a positive safe integer; omitted or invalid values use three. */
|
|
56
|
+
numberOfMonths?: number;
|
|
57
|
+
}
|
|
58
|
+
/** Inputs for DateSlicer, which selects an inclusive date range with two clicks. */
|
|
59
|
+
interface DateSlicerInputParams extends SlicerInputParams {
|
|
60
|
+
data: DataTable;
|
|
61
|
+
displayOptions?: DateSlicerDisplayOptions;
|
|
62
|
+
/**
|
|
63
|
+
* Model field type used for interaction bounds. Defaults to date; the host should match its interaction-manager configuration.
|
|
64
|
+
* Datetime emits an inclusive midnight start and exclusive midnight after the selected end day.
|
|
65
|
+
* Selection and display remain date-only. At 9999-12-31, the upper bound is omitted because no later model day exists.
|
|
66
|
+
*/
|
|
67
|
+
dataType?: 'date' | 'datetime';
|
|
68
|
+
/**
|
|
69
|
+
* Host range to restore or synchronize without emitting events or disabling local edits.
|
|
70
|
+
* Values must be canonical YYYY-MM-DD dates in ascending order, not timestamps.
|
|
71
|
+
* Null clears; omitted leaves selection locally managed. Saved bounds survive data refreshes unchanged.
|
|
72
|
+
* Unchanged host values and echoes preserve local edits, including unfinished ranges.
|
|
73
|
+
* Changing column resets local selection and drafts, then restores any supplied selection.
|
|
74
|
+
*/
|
|
75
|
+
selection?: readonly [string, string] | null;
|
|
76
|
+
}
|
|
47
77
|
/** Display options for the numeric range slicer. */
|
|
48
78
|
interface RangeSlicerDisplayOptions extends SlicerDisplayOptions {
|
|
49
79
|
/** Show the value distribution above the slider. Defaults to true; false also skips histogram computation. */
|
|
@@ -65,16 +95,17 @@ interface RangeSlicerInputParams extends SlicerInputParams {
|
|
|
65
95
|
* restricted to whole-number increments when all finite data values are integers. Typed values are not restricted by the step.
|
|
66
96
|
*/
|
|
67
97
|
step?: number;
|
|
68
|
-
disabled?: boolean;
|
|
69
98
|
}
|
|
70
99
|
|
|
71
100
|
declare function ListSlicer(props: ListSlicerInputParams): ReactElement;
|
|
72
101
|
|
|
73
102
|
declare function DropdownSlicer(props: DropdownSlicerInputParams): ReactElement;
|
|
74
103
|
|
|
104
|
+
declare function DateSlicer(props: DateSlicerInputParams): ReactElement;
|
|
105
|
+
|
|
75
106
|
declare function RangeSlicer({ data, column, title, theme, step, disabled, displayOptions, onInteraction, selection, }: RangeSlicerInputParams): ReactElement;
|
|
76
107
|
|
|
77
108
|
/** Narrows unvalidated data cells and interaction values to supported slicer values. */
|
|
78
109
|
declare function isSlicerValue(value: DataTable['rows'][number][number]): value is SlicerValue;
|
|
79
110
|
|
|
80
|
-
export { DropdownSlicer, type DropdownSlicerInputParams, ListSlicer, type ListSlicerDisplayOptions, type ListSlicerInputParams, RangeSlicer, type RangeSlicerDisplayOptions, type RangeSlicerInputParams, type SlicerDisplayOptions, type SlicerInputParams, type SlicerRange, type SlicerValue, isSlicerValue };
|
|
111
|
+
export { type CalendarDateRange, DateSlicer, type DateSlicerDisplayOptions, type DateSlicerInputParams, DropdownSlicer, type DropdownSlicerInputParams, ListSlicer, type ListSlicerDisplayOptions, type ListSlicerInputParams, RangeSlicer, type RangeSlicerDisplayOptions, type RangeSlicerInputParams, type SlicerDisplayOptions, type SlicerInputParams, type SlicerRange, type SlicerValue, isSlicerValue };
|