@arcgis/common-components 5.1.0-next.2 → 5.1.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/cdn/23DDMSOB.js +2 -0
- package/dist/cdn/3O7GAC23.js +2 -0
- package/dist/cdn/4CW7U27R.js +2 -0
- package/dist/cdn/4DCAUWTC.js +2 -0
- package/dist/cdn/EKKJN7WZ.js +2 -0
- package/dist/cdn/GAR4QMLU.js +2 -0
- package/dist/cdn/JTRO7GRS.js +2 -0
- package/dist/cdn/ZLXAKPUH.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/commonFunctions.js +3 -13
- package/dist/components/arcgis-ckeditor5/customElement.d.ts +1 -0
- package/dist/components/arcgis-ckeditor5/types.d.ts +9 -0
- package/dist/components/arcgis-ckeditor5-popover/customElement.d.ts +1 -0
- package/dist/components/arcgis-color-input/customElement.d.ts +1 -0
- package/dist/components/arcgis-field-info/customElement.d.ts +1 -0
- package/dist/components/arcgis-field-info/customElement.js +10 -10
- package/dist/components/arcgis-field-info/utils/basic.d.ts +1 -0
- package/dist/components/arcgis-field-pick-list/customElement.d.ts +1 -0
- package/dist/components/arcgis-field-pick-list/utils/types.d.ts +5 -1
- package/dist/components/arcgis-histogram/customElement.d.ts +46 -28
- package/dist/components/arcgis-label-input/customElement.d.ts +5 -4
- package/dist/components/arcgis-picker-input/customElement.d.ts +1 -0
- package/dist/components/arcgis-ramp-color/customElement.d.ts +2 -0
- package/dist/components/arcgis-ramp-color-break/customElement.d.ts +2 -0
- package/dist/components/arcgis-ramp-opacity/customElement.d.ts +1 -0
- package/dist/components/arcgis-slider/customElement.d.ts +269 -73
- package/dist/components/arcgis-slider/customElement.js +318 -289
- package/dist/components/arcgis-slider-input/customElement.d.ts +1 -0
- package/dist/components/arcgis-ticks/customElement.d.ts +101 -13
- package/dist/components/arcgis-ticks/customElement.js +27 -27
- package/dist/components/arcgis-ticks/types.d.ts +23 -0
- package/dist/components/arcgis-unique-values-list/customElement.d.ts +8 -1
- package/dist/components/arcgis-unique-values-list/customElement.js +155 -149
- package/dist/components/arcgis-unique-values-list/utils/basic.d.ts +1 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/types.d.ts +24 -7
- package/package.json +3 -3
- package/dist/cdn/6MGBOM6S.js +0 -2
- package/dist/cdn/6NYYZIHB.js +0 -2
- package/dist/cdn/BAVGT3I5.js +0 -2
- package/dist/cdn/GQLKGVRX.js +0 -2
- package/dist/cdn/P45VPBNI.js +0 -2
- package/dist/cdn/S7T3XQPB.js +0 -2
- package/dist/cdn/ZP76EPVI.js +0 -2
|
@@ -5,31 +5,70 @@ import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
|
5
5
|
import type { Popover as Popover } from "@esri/calcite-components/components/calcite-popover";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* The Slider component is used to filter data or collect numeric input from users. It supports single or multiple thumbs, configured via the
|
|
9
|
+
* [values](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#values) property. The Slider can be displayed in horizontal or vertical [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout), supports snapping to defined [steps](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#steps),
|
|
10
|
+
* configurable value [precision](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#precision), and custom [labelFormatter](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#labelFormatter). It also includes keyboard interaction,
|
|
11
|
+
* optional editable labels, and customizable popover content.
|
|
12
|
+
*
|
|
13
|
+
* The slider component can be set up with the [arcgis-ticks](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-ticks/) component. See the example below:
|
|
14
|
+
* ```html
|
|
15
|
+
* <arcgis-slider min="0" max="100" show-range-labels value-labels-display="always" steps="1" value-labels-placement="start">
|
|
16
|
+
* <arcgis-ticks interactive slot="content-end" style="flex:1;" min="0" max="100" mode="count" values="11" show-labels>
|
|
17
|
+
* </arcgis-ticks>
|
|
18
|
+
* </arcgis-slider>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* > ### Which slider should you use: `arcgis-slider` or `calcite-slider`?
|
|
22
|
+
* >
|
|
23
|
+
* > It is recommended to use [`calcite-slider`](https://developers.arcgis.com/calcite-design-system/components/slider/) for most use cases, as the component
|
|
24
|
+
* > offers a consistent UI/UX and accommodates the majority of implementations.
|
|
25
|
+
* >
|
|
26
|
+
* > Use `arcgis-slider` for advanced use cases, where solutions seek the following:
|
|
27
|
+
* >
|
|
28
|
+
* > * [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout): configurations, where `arcgis-slider` offers a `layout` of `"vertical"`.
|
|
29
|
+
* > * Display more than two values in the component.
|
|
30
|
+
* > * A custom range display, where `arcgis-slider` supports [fullRangeMin](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMin) and
|
|
31
|
+
* > [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax) for displaying a wider range than the interactive range.
|
|
32
|
+
* > * Additional slot configurations for adding elements within or over the component, where `arcgis-slider` can slot
|
|
33
|
+
* > content using the `content-start`, `content-end`, and `popover` slots.
|
|
34
|
+
*
|
|
8
35
|
* @slot [content-start] - A slot for elements before the track.
|
|
9
36
|
* @slot [content-end] - A slot for elements after the track.
|
|
10
37
|
* @slot [popover] - A slot for custom content to be rendered in the popover.
|
|
38
|
+
* @since 5.0
|
|
11
39
|
*/
|
|
12
40
|
export abstract class ArcgisSlider extends LitElement {
|
|
13
41
|
/**
|
|
14
|
-
* The
|
|
42
|
+
* The active value of the slider, based on which thumb or range (segment) is active. This returns the stored value for the active thumb,
|
|
43
|
+
* so it may reflect the thumb’s last set position.
|
|
15
44
|
*
|
|
16
|
-
*
|
|
45
|
+
*
|
|
46
|
+
* It returns
|
|
17
47
|
* - `undefined` when no value is active
|
|
18
48
|
* - a `number` when a single value is active
|
|
19
|
-
* - `"all"` when the range is active
|
|
49
|
+
* - `"all"` when the range (segment) is active
|
|
20
50
|
*
|
|
21
|
-
* Listen to
|
|
51
|
+
* Listen to [@arcgisActiveValueChange](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisActiveValueChange) to be notified when a value becomes active or inactive.
|
|
22
52
|
*
|
|
23
|
-
* @see [arcgisActiveValueChange](
|
|
53
|
+
* @see [@arcgisActiveValueChange](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisActiveValueChange)
|
|
24
54
|
*/
|
|
25
55
|
get activeValue(): number | "all" | undefined;
|
|
26
56
|
/**
|
|
27
|
-
* When `true`, allows
|
|
57
|
+
* When `true`, allows multiple thumbs to overlap by sharing the same value.
|
|
58
|
+
* When `false`, thumbs are prevented from overlapping.
|
|
28
59
|
*
|
|
29
60
|
* @default false
|
|
30
61
|
*/
|
|
31
62
|
accessor allowValuesOverlap: boolean;
|
|
32
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* If true, the component will not be destroyed automatically when it is
|
|
65
|
+
* disconnected from the document. This is useful when you want to move the
|
|
66
|
+
* component to a different place on the page, or temporarily hide it. If this
|
|
67
|
+
* is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#destroy) method when you are done to
|
|
68
|
+
* prevent memory leaks.
|
|
69
|
+
*
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
33
72
|
accessor autoDestroyDisabled: boolean;
|
|
34
73
|
/**
|
|
35
74
|
* Indicates whether the slider is disabled.
|
|
@@ -38,63 +77,106 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
38
77
|
*/
|
|
39
78
|
accessor disabled: boolean;
|
|
40
79
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* Range mode will always display the fill between the min and max handles.
|
|
80
|
+
* Controls where the filled segment is displayed on the track for single-thumb sliders.
|
|
81
|
+
* Range sliders always display the fill between the min and max thumbs.
|
|
44
82
|
*
|
|
45
83
|
* @default "start"
|
|
46
84
|
*/
|
|
47
85
|
accessor fillPlacement: "end" | "none" | "start";
|
|
48
86
|
/**
|
|
49
|
-
*
|
|
87
|
+
* Sets the maximum value of the slider display full range.
|
|
88
|
+
* When specified, the slider track is scaled from [fullRangeMin](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMin) to `fullRangeMax`, while
|
|
89
|
+
* the thumbs remain constrained to the interactive range defined by [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max).
|
|
50
90
|
*
|
|
51
|
-
* The
|
|
91
|
+
* The `fullRangeMax` must be greater than or equal to [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) property of the slider.
|
|
52
92
|
*
|
|
53
|
-
* @see [fullRangeMin](
|
|
93
|
+
* @see [fullRangeMin](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMin)
|
|
54
94
|
* @example
|
|
55
|
-
* Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75.
|
|
56
95
|
* ```html
|
|
96
|
+
* <!-- Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75. -->
|
|
57
97
|
* <arcgis-slider full-range-min="0" full-range-max="100" min="25" max="75" values="50"></arcgis-slider>
|
|
58
98
|
* ```
|
|
59
99
|
*/
|
|
60
100
|
accessor fullRangeMax: number | undefined;
|
|
61
101
|
/**
|
|
62
|
-
*
|
|
102
|
+
* Sets the minimum value of the slider display full range.
|
|
103
|
+
* When specified, the slider track is scaled from `fullRangeMin` to [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax), while
|
|
104
|
+
* the thumbs remain constrained to the range defined by [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max).
|
|
63
105
|
*
|
|
64
|
-
* The
|
|
106
|
+
* The `fullRangeMin` must be less than or equal to [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) property of the slider.
|
|
65
107
|
*
|
|
66
|
-
* @see [fullRangeMax](
|
|
108
|
+
* @see [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax)
|
|
67
109
|
* @example
|
|
68
|
-
* Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75.
|
|
69
110
|
* ```html
|
|
111
|
+
* <!-- Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75. -->
|
|
70
112
|
* <arcgis-slider full-range-min="0" full-range-max="100" min="25" max="75" values="50"></arcgis-slider>
|
|
71
113
|
* ```
|
|
72
114
|
*/
|
|
73
115
|
accessor fullRangeMin: number | undefined;
|
|
74
116
|
/**
|
|
75
|
-
*
|
|
117
|
+
* Controls how many "small" keyboard increments are applied in order to move a thumb or range faster using the
|
|
118
|
+
* keyboard. The following keys are considered "large" increment keys:
|
|
119
|
+
*
|
|
120
|
+
* - PageUp/PageDown
|
|
121
|
+
* - Shift + Arrow keys
|
|
122
|
+
*
|
|
123
|
+
* @default 10
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
accessor keyboardLargeStep: number;
|
|
127
|
+
/**
|
|
128
|
+
* Allows customizing how slider labels are formatted for [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min), [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max), and thumb values.
|
|
129
|
+
* The formatted value is used for the visible labels and for the thumb’s accessible value text via `aria-valuetext`.
|
|
130
|
+
* Return `null` or `undefined` to use the default formatting.
|
|
76
131
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```js
|
|
134
|
+
* // Format labels to use "K" for thousands and "M" for millions
|
|
135
|
+
* // and use "start" and "end" for min and max labels respectively.
|
|
136
|
+
* slider.labelFormatter = (value, type, defaultFormatter) => {
|
|
137
|
+
* if (type === "min") return "start";
|
|
138
|
+
* if (type === "max") return "end";
|
|
139
|
+
* if (type !== "value") return defaultFormatter(value);
|
|
140
|
+
*
|
|
141
|
+
* const abs = Math.abs(value);
|
|
142
|
+
* if (abs >= 1_000_000) {
|
|
143
|
+
* const num = (value / 1_000_000).toLocaleString(undefined, { maximumSignificantDigits: 3 });
|
|
144
|
+
* return `${num} M`;
|
|
145
|
+
* }
|
|
146
|
+
*
|
|
147
|
+
* if (abs >= 1_000) {
|
|
148
|
+
* const num = (value / 1_000).toLocaleString(undefined, { maximumSignificantDigits: 3 });
|
|
149
|
+
* return `${num} K`;
|
|
150
|
+
* }
|
|
151
|
+
* return defaultFormatter(value);
|
|
152
|
+
* };
|
|
153
|
+
* ```
|
|
80
154
|
*/
|
|
81
155
|
accessor labelFormatter: ((value: number, type: "max" | "min" | "value", defaultFormatter: (value: number) => string) => nullish | string) | undefined;
|
|
82
156
|
/**
|
|
83
|
-
* Determines the layout/orientation of the Slider
|
|
157
|
+
* Determines the layout/orientation of the Slider component. By default, the slider will render horizontally with the min value on the left side
|
|
158
|
+
* of the track.
|
|
84
159
|
*
|
|
85
160
|
* @default "horizontal"
|
|
161
|
+
* @see [mirrored](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#mirrored)
|
|
86
162
|
*/
|
|
87
163
|
accessor layout: "horizontal" | "vertical";
|
|
88
164
|
/**
|
|
89
|
-
* The maximum
|
|
165
|
+
* The maximum value for the slider thumbs. Thumbs will not move past this value.
|
|
90
166
|
*
|
|
91
|
-
* To display the `max`
|
|
92
|
-
* To allow the end user to modify the max value, set [rangeLabelsEditingEnabled](
|
|
167
|
+
* To display the `max` label on the slider, set [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels) to `true`.
|
|
168
|
+
* To allow the end user to modify the `max` value, set [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled) to `true`.
|
|
93
169
|
*
|
|
94
|
-
* @see [rangeLabelsEditingEnabled](
|
|
95
|
-
* @see [showRangeLabels](
|
|
170
|
+
* @see [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled)
|
|
171
|
+
* @see [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels)
|
|
172
|
+
* @see [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax)
|
|
96
173
|
*/
|
|
97
174
|
accessor max: number;
|
|
175
|
+
/**
|
|
176
|
+
* Replace localized message strings with your own strings.
|
|
177
|
+
*
|
|
178
|
+
* _**Note**: Individual message keys may change between releases._
|
|
179
|
+
*/
|
|
98
180
|
accessor messageOverrides: {
|
|
99
181
|
componentLabel?: string | undefined;
|
|
100
182
|
maximumValue?: string | undefined;
|
|
@@ -120,33 +202,59 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
120
202
|
sliderValue: string;
|
|
121
203
|
}>;
|
|
122
204
|
/**
|
|
123
|
-
* The minimum
|
|
205
|
+
* The minimum value for the slider thumbs. Thumbs will not move past this value.
|
|
206
|
+
* To display the `min` label on the slider, set [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels) to `true`.
|
|
207
|
+
* To allow the end user to modify the `min` value, set [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled) to `true`.
|
|
124
208
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* @see [rangeLabelsEditingEnabled](#rangeLabelsEditingEnabled)
|
|
129
|
-
* @see [showRangeLabels](#showRangeLabels)
|
|
209
|
+
* @see [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled)
|
|
210
|
+
* @see [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels)
|
|
130
211
|
*/
|
|
131
212
|
accessor min: number;
|
|
132
213
|
/**
|
|
133
|
-
* When `true`, the slider will display values from high to low.
|
|
214
|
+
* When `true`, the slider will display values from high to low. This inverts the direction of the slider.
|
|
134
215
|
*
|
|
135
216
|
* @default false
|
|
217
|
+
* @see [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout)
|
|
136
218
|
*/
|
|
137
219
|
accessor mirrored: boolean;
|
|
138
220
|
/**
|
|
139
|
-
* The accessible label
|
|
221
|
+
* The accessible label for the popover. This label is used by assistive technologies and does not affect the visible UI.
|
|
140
222
|
*
|
|
141
223
|
* @default ""
|
|
224
|
+
* @see [Calcite popover](https://developers.arcgis.com/calcite-design-system/components/popover/#api-reference-properties-label)
|
|
142
225
|
*/
|
|
143
226
|
accessor popoverLabel: Popover["label"];
|
|
144
227
|
/**
|
|
145
|
-
* Determines
|
|
228
|
+
* Determines which side of the track the popover is placed on.
|
|
229
|
+
* The popover is the floating container that displays the content from the `popover` slot.
|
|
230
|
+
* * `"start"`: Positions the popover above a horizontal slider or to the left of a vertical slider.
|
|
231
|
+
* * `"end"`: Positions the popover below a horizontal slider or to the right of a vertical slider.
|
|
146
232
|
*
|
|
147
|
-
* @default "
|
|
233
|
+
* @default "start"
|
|
234
|
+
* @example
|
|
235
|
+
* ```js
|
|
236
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
237
|
+
* slider.popoverPlacement = "end";
|
|
238
|
+
*
|
|
239
|
+
* // Example: Dynamic popover content based on slider value
|
|
240
|
+
* const popover = document.getElementById("popover");
|
|
241
|
+
* const unitCost = 12.5;
|
|
242
|
+
* const numberFormatter = new Intl.NumberFormat();
|
|
243
|
+
* const usd = new Intl.NumberFormat(undefined, { style: "currency", currency: "USD" });
|
|
244
|
+
*
|
|
245
|
+
* const renderPopover = () => {
|
|
246
|
+
* const value = Number(slider.values?.[0] ?? 0); // 0-100
|
|
247
|
+
* const annualCost = (value / 100) * 800 * 365 * unitCost;
|
|
248
|
+
* popover.textContent = `Est. annual cost: ${usd.format(annualCost)} (at ${numberFormatter.format(value)}%)`;
|
|
249
|
+
* slider.popoverLabel = `Cost estimate ${usd.format(annualCost)} at ${numberFormatter.format(value)} percent`;
|
|
250
|
+
* };
|
|
251
|
+
*
|
|
252
|
+
* slider.addEventListener("arcgisInput", renderPopover);
|
|
253
|
+
* slider.addEventListener("arcgisChange", renderPopover);
|
|
254
|
+
* renderPopover();
|
|
255
|
+
* ```
|
|
148
256
|
*/
|
|
149
|
-
accessor popoverPlacement: "
|
|
257
|
+
accessor popoverPlacement: "end" | "start";
|
|
150
258
|
/**
|
|
151
259
|
* Defines how slider thumb values should be rounded. This number indicates the number
|
|
152
260
|
* of decimal places slider thumb _values_ should round to when they have been moved.
|
|
@@ -162,34 +270,36 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
162
270
|
* The labels of the thumbs will display two decimal places, but the precision of the actual
|
|
163
271
|
* thumb values will not be lost even when the user slides or moves the thumb.
|
|
164
272
|
*
|
|
165
|
-
* Keep in mind this property rounds thumb [values](
|
|
166
|
-
* for formatting purposes. To format thumb `labels`, use the [labelFormatter](
|
|
273
|
+
* Keep in mind this property rounds thumb [values](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#values) and shouldn't be used exclusively
|
|
274
|
+
* for formatting purposes. To format thumb `labels`, use the [labelFormatter](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#labelFormatter)
|
|
167
275
|
* property.
|
|
168
276
|
*
|
|
169
277
|
* @default 4
|
|
170
278
|
* @example
|
|
171
|
-
* // thumb label will display 50.43
|
|
172
|
-
* // thumb value will maintain precision, so value will remain at 50.4331
|
|
173
279
|
* ```html
|
|
280
|
+
* <!-- thumb label will display 50.43 -->
|
|
281
|
+
* <!-- thumb value will maintain precision, so value will remain at 50.4331 -->
|
|
174
282
|
* <arcgis-slider min="0" max="100" values="50.4331" precision="4"></arcgis-slider>
|
|
175
283
|
* ```
|
|
176
284
|
*/
|
|
177
285
|
accessor precision: number;
|
|
178
286
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* This allows the user to increase or decrease the data range of the slider.
|
|
287
|
+
* When `true`, users can edit the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels via keyboard input.
|
|
288
|
+
* Editing these labels updates the slider’s interactive range.
|
|
182
289
|
*
|
|
183
290
|
* @default false
|
|
184
291
|
*/
|
|
185
292
|
accessor rangeLabelsEditingEnabled: boolean;
|
|
186
293
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
294
|
+
* Controls where the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels are positioned relative to the track.
|
|
295
|
+
* This property only affects the slider when [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout) is `"horizontal"`.
|
|
296
|
+
*
|
|
297
|
+
* - `"center"` (default): Places the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) labels aligned with the track.
|
|
298
|
+
* - `"end"`: Places the range labels below the the track.
|
|
189
299
|
*
|
|
190
300
|
* @default "center"
|
|
191
301
|
*/
|
|
192
|
-
accessor rangeLabelsPlacement: "center" | "
|
|
302
|
+
accessor rangeLabelsPlacement: "center" | "end";
|
|
193
303
|
/**
|
|
194
304
|
* Indicates if the user can drag the segment between thumbs to update thumb positions.
|
|
195
305
|
*
|
|
@@ -197,7 +307,7 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
197
307
|
*/
|
|
198
308
|
accessor segmentsDraggingDisabled: boolean;
|
|
199
309
|
/**
|
|
200
|
-
* Indicates whether to min and max range labels are visible on the slider.
|
|
310
|
+
* Indicates whether to [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels are visible on the slider.
|
|
201
311
|
*
|
|
202
312
|
* @default false
|
|
203
313
|
*/
|
|
@@ -212,24 +322,24 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
212
322
|
* slider range at an interval of the provided value. In this scenario,
|
|
213
323
|
* the user may only slide the thumbs to values at the provided interval.
|
|
214
324
|
* For example, if a value of `0.5` is set here, and the slider
|
|
215
|
-
* [min](
|
|
325
|
+
* [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) is `0` and the slider [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) is `10`, then the user will
|
|
216
326
|
* only be able to update the thumbs to values of 0, 0.5, 1.0, 1.5, 2.0, etc.
|
|
217
327
|
*
|
|
218
328
|
* @example
|
|
219
329
|
* ```html
|
|
220
|
-
*
|
|
221
|
-
*
|
|
330
|
+
* <!-- set steps at an interval of 0.5. So the -->
|
|
331
|
+
* <!-- slider thumb snaps at values of 0.5, 1.0, 1.5, etc. -->
|
|
222
332
|
* <arcgis-slider min="0" max="10" steps="0.5" values="5"></arcgis-slider>
|
|
223
333
|
* ```
|
|
224
334
|
* @example
|
|
225
335
|
* ```html
|
|
226
|
-
*
|
|
336
|
+
* <!-- Set steps at specific slider positions -->
|
|
227
337
|
* <arcgis-slider min="0" max="100" steps="5, 10, 15, 20, 25, 30, 35, 40" values="15, 30"></arcgis-slider>
|
|
228
338
|
* ```
|
|
229
339
|
*/
|
|
230
340
|
accessor steps: number[] | number | undefined;
|
|
231
341
|
/**
|
|
232
|
-
*
|
|
342
|
+
* Controls when thumb value labels are displayed.
|
|
233
343
|
*
|
|
234
344
|
* This property can be set to one of the following values:
|
|
235
345
|
* - `"always"`: Always show the labels.
|
|
@@ -241,49 +351,135 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
241
351
|
accessor valueLabelsDisplay: "always" | "auto" | "hidden";
|
|
242
352
|
/**
|
|
243
353
|
* Indicates whether to enable editing input values via keyboard input
|
|
244
|
-
* when the user clicks a label. This allows the user to move the slider
|
|
354
|
+
* when the user clicks a thumb value label. This allows the user to move the slider
|
|
245
355
|
* thumb to precise values without sliding the thumbs.
|
|
246
356
|
*
|
|
247
|
-
* 
|
|
248
358
|
*
|
|
249
359
|
* @default false
|
|
250
360
|
*/
|
|
251
361
|
accessor valueLabelsEditingEnabled: boolean;
|
|
252
362
|
/**
|
|
253
|
-
* Determines whether the labels are placed before or after the track.
|
|
363
|
+
* Determines whether the thumb value labels are placed before or after the track.
|
|
254
364
|
*
|
|
255
|
-
* @default "
|
|
365
|
+
* @default "start"
|
|
256
366
|
*/
|
|
257
|
-
accessor valueLabelsPlacement: "
|
|
367
|
+
accessor valueLabelsPlacement: "end" | "start";
|
|
258
368
|
/** An array of numbers representing absolute thumb positions on the slider. */
|
|
259
369
|
accessor values: number[];
|
|
370
|
+
/** Permanently destroys the component. */
|
|
260
371
|
destroy(): Promise<void>;
|
|
261
372
|
/**
|
|
262
|
-
* Fires when the
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* This event does not fire when `values` changes.
|
|
266
|
-
* Use `arcgisInput` or `arcgisChange` instead.
|
|
373
|
+
* Fires when the [activeValue](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#activeValue) changes as a thumb or the range gains or loses focus.
|
|
374
|
+
* This event does not fire when [values](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#values) change. Use [@arcgisInput](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisInput) for continuous updates or
|
|
375
|
+
* [@arcgisChange](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisChange) when the interaction is committed.
|
|
267
376
|
*
|
|
268
|
-
* @
|
|
377
|
+
* @example
|
|
378
|
+
* ```js
|
|
379
|
+
* // Display the active value status of the slider in a div element
|
|
380
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
381
|
+
* const status = document.getElementById("slider-status");
|
|
382
|
+
*
|
|
383
|
+
* const renderActive = () => {
|
|
384
|
+
* const active = slider.activeValue;
|
|
385
|
+
* // active is: undefined (none), number (thumb value), or "all" (range segment)
|
|
386
|
+
* status.textContent =
|
|
387
|
+
* active === "all"
|
|
388
|
+
* ? "Editing range"
|
|
389
|
+
* : active == null
|
|
390
|
+
* ? "No active thumb"
|
|
391
|
+
* : `Editing value: ${active}`;
|
|
392
|
+
* };
|
|
393
|
+
*
|
|
394
|
+
* slider.addEventListener("arcgisActiveValueChange", renderActive);
|
|
395
|
+
* // Pair with these when you need value updates:
|
|
396
|
+
* slider.addEventListener("arcgisInput", () => console.log("values", slider.values));
|
|
397
|
+
* slider.addEventListener("arcgisChange", () => console.log("committed", slider.values));
|
|
398
|
+
*
|
|
399
|
+
* renderActive();
|
|
400
|
+
* ```
|
|
401
|
+
* @see [activeValue](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#activeValue)
|
|
269
402
|
*/
|
|
270
403
|
readonly arcgisActiveValueChange: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
271
404
|
/**
|
|
272
405
|
* Fires when the thumb or range is released on the component.
|
|
273
406
|
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
407
|
+
* Use [@arcgisInput](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisInput) for continuous updates during a drag.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```js
|
|
411
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
412
|
+
* slider.popoverPlacement = "end";
|
|
413
|
+
*
|
|
414
|
+
* // Example: Dynamic popover content based on slider value
|
|
415
|
+
* const popover = document.getElementById("popover");
|
|
416
|
+
* const unitCost = 12.5;
|
|
417
|
+
* const numberFormatter = new Intl.NumberFormat();
|
|
418
|
+
* const usd = new Intl.NumberFormat(undefined, { style: "currency", currency: "USD" });
|
|
419
|
+
*
|
|
420
|
+
* const renderPopover = () => {
|
|
421
|
+
* const value = Number(slider.values?.[0] ?? 0); // 0-100
|
|
422
|
+
* const annualCost = (value / 100) * 800 * 365 * unitCost;
|
|
423
|
+
* popover.textContent = `Est. annual cost: ${usd.format(annualCost)} (at ${numberFormatter.format(value)}%)`;
|
|
424
|
+
* slider.popoverLabel = `Cost estimate ${usd.format(annualCost)} at ${numberFormatter.format(value)} percent`;
|
|
425
|
+
* };
|
|
426
|
+
*
|
|
427
|
+
* slider.addEventListener("arcgisChange", renderPopover);
|
|
428
|
+
* renderPopover();
|
|
429
|
+
* ```
|
|
276
430
|
*/
|
|
277
431
|
readonly arcgisChange: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
278
432
|
/**
|
|
279
|
-
* Fires
|
|
433
|
+
* Fires continuously while the thumb or range is being dragged.
|
|
434
|
+
* This event can fire frequently; consider debouncing or throttling expensive work.
|
|
280
435
|
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```js
|
|
438
|
+
* import FeatureEffect from "@arcgis/core/layers/support/FeatureEffect";
|
|
439
|
+
* import FeatureFilter from "@arcgis/core/layers/support/FeatureFilter";
|
|
440
|
+
*
|
|
441
|
+
* slider.addEventListener("arcgisInput", () => {
|
|
442
|
+
* const value = slider.values[0] ?? 0;
|
|
443
|
+
* layer.featureEffect = new FeatureEffect({
|
|
444
|
+
* filter: new FeatureFilter({
|
|
445
|
+
* where: `FIELD <= ${value}`,
|
|
446
|
+
* }),
|
|
447
|
+
* includedEffect: "bloom(1.4, 0.2px, 0.1)",
|
|
448
|
+
* excludedEffect: "opacity(20%) grayscale(100%)",
|
|
449
|
+
* });
|
|
450
|
+
* });
|
|
451
|
+
* ```
|
|
284
452
|
*/
|
|
285
453
|
readonly arcgisInput: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
286
|
-
/**
|
|
454
|
+
/**
|
|
455
|
+
* Fires when the slider's [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range changes.
|
|
456
|
+
* This occurs when the user edits the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) or [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels (when enabled).
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```js
|
|
460
|
+
* // Example: Keep a "budget" value inside the editable min/max range
|
|
461
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
462
|
+
*
|
|
463
|
+
* const clamp = (val, min, max) => Math.min(max, Math.max(min, val));
|
|
464
|
+
*
|
|
465
|
+
* const render = () => {
|
|
466
|
+
* rangeText.textContent = `Allowed: ${slider.min}–${slider.max}`;
|
|
467
|
+
*
|
|
468
|
+
* // If your UI stores a single value, keep it inside the new range.
|
|
469
|
+
* const current = Number(slider.values?.[0] ?? slider.min);
|
|
470
|
+
* const next = clamp(current, slider.min, slider.max);
|
|
471
|
+
*
|
|
472
|
+
* if (next !== current) {
|
|
473
|
+
* slider.values = [next];
|
|
474
|
+
* }
|
|
475
|
+
*
|
|
476
|
+
* valueText.textContent = `Selected: ${next}`;
|
|
477
|
+
* };
|
|
478
|
+
*
|
|
479
|
+
* slider.addEventListener("arcgisRangeChange", render);
|
|
480
|
+
* render();
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
287
483
|
readonly arcgisRangeChange: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
288
484
|
readonly "@eventTypes": {
|
|
289
485
|
arcgisActiveValueChange: ArcgisSlider["arcgisActiveValueChange"]["detail"];
|