@arcgis/map-components 5.1.0-next.112 → 5.1.0-next.113
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/dist/cdn/{DXJGJIPP.js → 6OHXFH4A.js} +1 -1
- package/dist/cdn/A5EVICJ5.js +2 -0
- package/dist/cdn/CHCD2OBT.js +2 -0
- package/dist/cdn/DC3AKQM4.js +2 -0
- package/dist/cdn/GQJFJL7W.js +2 -0
- package/dist/cdn/IHM2BEQ6.js +2 -0
- package/dist/cdn/JV3MKZ3R.js +2 -0
- package/dist/cdn/KHXBLOZ3.js +2 -0
- package/dist/cdn/NKGIMPY4.js +2 -0
- package/dist/cdn/{TFFF4SV3.js → T5S7VN6B.js} +1 -1
- package/dist/cdn/{6FNGCBCG.js → UXIPFY72.js} +1 -1
- package/dist/cdn/W4TMIOKN.js +2 -0
- package/dist/cdn/YPOCQLIU.js +2 -0
- package/dist/cdn/assets/paste/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/print/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/value-picker/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/print-exports-panel-item-popover.js +39 -0
- package/dist/components/arcgis-coordinate-conversion/customElement.js +10 -10
- package/dist/components/arcgis-directions/customElement.js +30 -29
- package/dist/components/arcgis-oriented-imagery-viewer/customElement.js +12 -11
- package/dist/components/arcgis-paste/commands/PasteCommand.d.ts +4 -0
- package/dist/components/arcgis-paste/commands/PasteCustomCommand.d.ts +2 -0
- package/dist/components/arcgis-paste/customElement.d.ts +2 -0
- package/dist/components/arcgis-paste/customElement.js +1 -1
- package/dist/components/arcgis-print/customElement.d.ts +6 -0
- package/dist/components/arcgis-print-exports-panel/customElement.js +21 -38
- package/dist/components/arcgis-print-exports-panel/index.js +1 -1
- package/dist/components/arcgis-print-exports-panel-item-popover/customElement.js +10 -0
- package/dist/components/arcgis-print-exports-panel-item-popover/index.js +5 -0
- package/dist/components/arcgis-print-scale-section/customElement.js +1 -1
- package/dist/components/arcgis-value-picker/customElement.d.ts +383 -0
- package/dist/components/arcgis-value-picker/customElement.js +82 -0
- package/dist/components/arcgis-value-picker/index.d.ts +1 -0
- package/dist/components/arcgis-value-picker/index.js +3 -0
- package/dist/components/arcgis-value-picker/types.d.ts +65 -0
- package/dist/components/arcgis-value-picker-collection/customElement.d.ts +113 -0
- package/dist/components/arcgis-value-picker-collection/customElement.js +43 -0
- package/dist/components/arcgis-value-picker-collection/index.d.ts +1 -0
- package/dist/components/arcgis-value-picker-collection/index.js +1 -0
- package/dist/components/arcgis-value-picker-combobox/customElement.d.ts +90 -0
- package/dist/components/arcgis-value-picker-combobox/customElement.js +55 -0
- package/dist/components/arcgis-value-picker-combobox/index.d.ts +1 -0
- package/dist/components/arcgis-value-picker-combobox/index.js +3 -0
- package/dist/components/arcgis-value-picker-label/customElement.d.ts +81 -0
- package/dist/components/arcgis-value-picker-label/customElement.js +51 -0
- package/dist/components/arcgis-value-picker-label/index.d.ts +1 -0
- package/dist/components/arcgis-value-picker-label/index.js +1 -0
- package/dist/components/arcgis-value-picker-slider/customElement.d.ts +173 -0
- package/dist/components/arcgis-value-picker-slider/customElement.js +60 -0
- package/dist/components/arcgis-value-picker-slider/index.d.ts +1 -0
- package/dist/components/arcgis-value-picker-slider/index.js +3 -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/index.d.ts +50 -0
- package/dist/loader.js +6 -0
- package/dist/types/lumina.d.ts +36 -0
- package/dist/types/preact.d.ts +41 -0
- package/dist/types/react.d.ts +46 -0
- package/dist/types/stencil.d.ts +36 -0
- package/package.json +4 -4
- package/dist/cdn/6KMHCO4F.js +0 -2
- package/dist/cdn/BRX2TSCS.js +0 -2
- package/dist/cdn/JRO53TBV.js +0 -2
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
+
import type { ArcgisReferenceElement, IconName } from "../types.js";
|
|
4
|
+
import type { AnimateEvent, ArcgisValuePickerSubcomponent, Layout } from "./types.js";
|
|
5
|
+
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The Value Picker component allows users to step or play through an iterable set of data. The component alone acts as a shell, consisting
|
|
9
|
+
* of a play/pause button, a next button, a previous button, and a slot for adding a component to Value Picker. Value Picker is not associated with a
|
|
10
|
+
* [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) nor does it require that the dataset adheres to a specific structure
|
|
11
|
+
* for it to function. The [arcgis-value-picker-label](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-label/), [arcgis-value-picker-slider](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-slider/),
|
|
12
|
+
* [arcgis-value-picker-combobox](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-combobox/), and [arcgis-value-picker-collection](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/) components provide the user with a few different options
|
|
13
|
+
* for placing their data into a Value Picker with minimal configuration. Value Picker handles the different shapes of these components automatically by asserting
|
|
14
|
+
* that all slotted components will extend the
|
|
15
|
+
* [ArcgisValuePickerSubcomponent](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/types/#ArcgisValuePickerSubcomponent)
|
|
16
|
+
* interface, which allows Value picker to send and receive generic sets of instructions that are interpreted by the slotted component.
|
|
17
|
+
*
|
|
18
|
+
* ### Configuring Value Picker
|
|
19
|
+
*
|
|
20
|
+
* #### Configuring Value Picker without slotted components
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* <arcgis-map itemId="462c629e8e604c15baf45627c4f337d6">
|
|
24
|
+
* <arcgis-value-picker slot="top-right"></arcgis-value-picker>
|
|
25
|
+
* </arcgis-map>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* If a user wishes to use Value Picker with a component or dataset that can't be accurately represented by the slottable components, the component may be placed
|
|
29
|
+
* adjacent to the empty Value Picker, and events fired by Value Picker can be used to orchestrate the behavior of the adjacent component.
|
|
30
|
+
* For example, when the user clicks the play button, Value Picker will emit [@arcgisAnimate](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#event-arcgisAnimate) each time
|
|
31
|
+
* [playRate](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#playRate) ms have elapsed since the button was clicked, which the user could listen to and iterate the index of
|
|
32
|
+
* their dataset on an interval as a result.
|
|
33
|
+
*
|
|
34
|
+
* ```js
|
|
35
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
36
|
+
* const basemapGallery = document.querySelector("arcgis-basemap-gallery");
|
|
37
|
+
*
|
|
38
|
+
* const basemaps = new Collection([
|
|
39
|
+
* Basemap.fromId("topo-vector"),
|
|
40
|
+
* Basemap.fromId("hybrid"),
|
|
41
|
+
* Basemap.fromId("streets"),
|
|
42
|
+
* Basemap.fromId("satellite"),
|
|
43
|
+
* Basemap.fromId("oceans"),
|
|
44
|
+
* ]);
|
|
45
|
+
*
|
|
46
|
+
* basemapGallery.source = new LocalBasemapsSource({ basemaps });
|
|
47
|
+
* basemapGallery.activeBasemap = basemaps.getItemAt(0);
|
|
48
|
+
*
|
|
49
|
+
* valuePicker.addEventListener("arcgisAnimate", () => {
|
|
50
|
+
* const currentIndex = basemaps.indexOf(basemapGallery.activeBasemap);
|
|
51
|
+
* basemapGallery.activeBasemap = basemaps.getItemAt(currentIndex + 1);
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* #### Configuring Value Picker with slotted components
|
|
56
|
+
*
|
|
57
|
+
* A single component may be placed into the Value Picker slot by placing one element inside of the other:
|
|
58
|
+
*
|
|
59
|
+
* ```html
|
|
60
|
+
* <arcgis-value-picker>
|
|
61
|
+
* <arcgis-value-picker-slider></arcgis-value-picker-slider>
|
|
62
|
+
* </arcgis-value-picker>
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* #### 1. Using a label component to step through a list of items
|
|
66
|
+
*
|
|
67
|
+
* Consider using the [arcgis-value-picker-label](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-label/) component to step through a small, fixed list of predefined values. This component provides a strict
|
|
68
|
+
* interface that steps back and forth, so it's a good option for temporal data, or data that shows progression dependent on the element's position in the list.
|
|
69
|
+
*
|
|
70
|
+
* ```js
|
|
71
|
+
* const mapElement = document.querySelector("arcgis-map");
|
|
72
|
+
* const valuePickerLabel = document.querySelector("arcgis-value-picker-label");
|
|
73
|
+
*
|
|
74
|
+
* const labelItems = [
|
|
75
|
+
* { value: "2017", label: "Tree cover in 2017" },
|
|
76
|
+
* { value: "2018", label: "Tree cover in 2018" },
|
|
77
|
+
* { value: "2019", label: "Tree cover in 2019" },
|
|
78
|
+
* { value: "2020", label: "Tree cover in 2020" },
|
|
79
|
+
* { value: "2021", label: "Tree cover in 2021" }
|
|
80
|
+
* ];
|
|
81
|
+
*
|
|
82
|
+
* valuePickerLabel.items = labelItems;
|
|
83
|
+
*
|
|
84
|
+
* valuePickerLabel.currentValue = labelItems[0];
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* The user's interaction can be handled by monitoring the [arcgis-value-picker-label.currentValue](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-label/#currentValue) property.
|
|
88
|
+
*
|
|
89
|
+
* ```js
|
|
90
|
+
* valuePickerLabel.addEventListener("arcgisPropertyChange", () => {
|
|
91
|
+
* const year = Number(valuePickerLabel.currentValue.value);
|
|
92
|
+
* mapElement.view.timeExtent = {
|
|
93
|
+
* start: new Date(year, 0, 1),
|
|
94
|
+
* end: new Date(year + 1, 0, 1),
|
|
95
|
+
* };
|
|
96
|
+
* console.log("The current year is: ", valuePickerLabel.currentValue.value);
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* #### 2. Using a slider component to traverse a list of items
|
|
101
|
+
*
|
|
102
|
+
* Consider using the [arcgis-value-picker-slider](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-slider/) component to quickly traverse through a set of data
|
|
103
|
+
* that can be represented along a fixed numeric range. This is a good option for sets of elements spaced along an interval, or mutating
|
|
104
|
+
* a continuous parameter such as layer opacity.
|
|
105
|
+
*
|
|
106
|
+
* ```js
|
|
107
|
+
* const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");
|
|
108
|
+
*
|
|
109
|
+
* valuePickerSlider.steps = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
|
110
|
+
* valuePickerSlider.labels = [0, 20, 40, 60, 80, 100];
|
|
111
|
+
* valuePickerSlider.majorTicks = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
|
112
|
+
* valuePickerSlider.minorTicks = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95];
|
|
113
|
+
* valuePickerSlider.currentValue = 100;
|
|
114
|
+
* valuePickerSlider.labelFormatter = (value) => `${value}%`;
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* The user's interaction can be handled by monitoring the [arcgis-value-picker-slider.currentValue](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-slider/#currentValue) property.
|
|
118
|
+
*
|
|
119
|
+
* ```js
|
|
120
|
+
* valuePickerSlider.addEventListener("arcgisPropertyChange", () => {
|
|
121
|
+
* layer.opacity = valuePickerSlider.currentValue / 100;
|
|
122
|
+
* console.log("The current layer opacity is: ", valuePickerSlider.currentValue / 100);
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* Note that [arcgis-value-picker-slider.labels](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-slider/#labels), [arcgis-value-picker-slider.majorTicks](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-slider/#majorTicks), and [arcgis-value-picker-slider.minorTicks](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-slider/#minorTicks)
|
|
127
|
+
* are all independent of each other and optional.
|
|
128
|
+
*
|
|
129
|
+
* #### 3. Using a combobox component to select from a list of items
|
|
130
|
+
*
|
|
131
|
+
* Consider using the [arcgis-value-picker-combobox](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-combobox/) component to step through a longer list of items that cannot be clicked through
|
|
132
|
+
* one by one. The combobox component allows the user to open the list as a dropdown and make a selection, or narrow the size of the list by searching for an element or keyword.
|
|
133
|
+
*
|
|
134
|
+
* ```js
|
|
135
|
+
* const valuePickerCombobox = document.querySelector("arcgis-value-picker-combobox");
|
|
136
|
+
*
|
|
137
|
+
* const comboboxItems = [
|
|
138
|
+
* { value: "Bare", label: "Isolate Bare Ground Areas" },
|
|
139
|
+
* { value: "Built", label: "Isolate Built Areas" },
|
|
140
|
+
* { value: "Trees", label: "Isolate Trees" },
|
|
141
|
+
* { value: "Water", label: "Isolate Water Areas" },
|
|
142
|
+
* { value: "Crops", label: "Isolate Crop Areas" },
|
|
143
|
+
* ];
|
|
144
|
+
*
|
|
145
|
+
* valuePickerCombobox.items = comboboxItems;
|
|
146
|
+
*
|
|
147
|
+
* valuePickerCombobox.currentValue = comboboxItems[0];
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* The user's interaction can be handled by monitoring the [arcgis-value-picker-combobox.currentValue](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-combobox/#currentValue) property.
|
|
151
|
+
*
|
|
152
|
+
* ```js
|
|
153
|
+
* valuePickerCombobox.addEventListener("arcgisPropertyChange", () => {
|
|
154
|
+
* layer.rasterFunction = {
|
|
155
|
+
* functionName: valuePickerCombobox.currentValue.value,
|
|
156
|
+
* };
|
|
157
|
+
* console.log("The current land cover category is: ", valuePickerCombobox.currentValue.value);
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* #### 4. Using a collection component to step through an arbitrary set of data
|
|
162
|
+
*
|
|
163
|
+
* Consider using the [arcgis-value-picker-collection](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/) component when a visual representation for the dataset is not necessary.
|
|
164
|
+
* This is also a good option for datasets already in the form of a [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/).
|
|
165
|
+
*
|
|
166
|
+
* ```js
|
|
167
|
+
* const Collection = (await import("@arcgis/core/core/Collection.js")).default;
|
|
168
|
+
*
|
|
169
|
+
* const mapElement = document.querySelector("arcgis-map");
|
|
170
|
+
* const valuePickerCollection = document.querySelector("arcgis-value-picker-collection");
|
|
171
|
+
*
|
|
172
|
+
* const basemapCollection = new Collection(["topo-vector", "streets", "osm"]);
|
|
173
|
+
*
|
|
174
|
+
* valuePickerCollection.items = basemapCollection;
|
|
175
|
+
*
|
|
176
|
+
* valuePickerCollection.currentValue = "topo-vector";
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* The user's interaction can be handled by monitoring the [arcgis-value-picker-collection.currentValue](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/#currentValue) property.
|
|
180
|
+
*
|
|
181
|
+
* ```js
|
|
182
|
+
* valuePickerCollection.addEventListener("arcgisPropertyChange", () => {
|
|
183
|
+
* mapElement.basemap = valuePickerCollection.currentValue;
|
|
184
|
+
* console.log("The current basemap is: ", valuePickerCollection.currentValue);
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @slot - Default slot for adding a component to value-picker. User is responsible for positioning the content via CSS.
|
|
189
|
+
* @since 5.1
|
|
190
|
+
*/
|
|
191
|
+
export abstract class ArcgisValuePicker extends LitElement {
|
|
192
|
+
/**
|
|
193
|
+
* If true, the component will not be destroyed automatically when it is
|
|
194
|
+
* disconnected from the document. This is useful when you want to move the
|
|
195
|
+
* component to a different place on the page, or temporarily hide it. If this
|
|
196
|
+
* is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#destroy) method when you are done to
|
|
197
|
+
* prevent memory leaks.
|
|
198
|
+
*
|
|
199
|
+
* @default false
|
|
200
|
+
*/
|
|
201
|
+
accessor autoDestroyDisabled: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* An optional caption that renders under the Value Picker component to give context for the user. This is particularly
|
|
204
|
+
* useful when an application is using more than one Value Picker instance.
|
|
205
|
+
*
|
|
206
|
+
* @default ""
|
|
207
|
+
*/
|
|
208
|
+
accessor caption: string | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* When true, the component is visually withdrawn and cannot be interacted with. If the slotted component also has a `disabled` property,
|
|
211
|
+
* it will be kept in sync with this property.
|
|
212
|
+
*
|
|
213
|
+
* @default false
|
|
214
|
+
*/
|
|
215
|
+
accessor disabled: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* When set to `true`, the next button is not displayed.
|
|
218
|
+
*
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
accessor hideNextButton: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* When set to `true`, the play/pause button is not displayed.
|
|
224
|
+
*
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
accessor hidePlayButton: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* When set to `true`, the previous button is not displayed.
|
|
230
|
+
*
|
|
231
|
+
* @default false
|
|
232
|
+
*/
|
|
233
|
+
accessor hidePreviousButton: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Icon which represents the component.
|
|
236
|
+
* Typically used when the component is controlled by another component (e.g. by the Expand component).
|
|
237
|
+
*
|
|
238
|
+
* @default "list-rectangle"
|
|
239
|
+
* @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/)
|
|
240
|
+
*/
|
|
241
|
+
accessor icon: IconName;
|
|
242
|
+
/**
|
|
243
|
+
* The component's default label.
|
|
244
|
+
*
|
|
245
|
+
* @default ""
|
|
246
|
+
*/
|
|
247
|
+
accessor label: string | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* Indicates the axis that the Value Picker buttons should be oriented along.
|
|
250
|
+
*
|
|
251
|
+
* Horizontal layouts are best for wider components that don't require a lot of vertical space,
|
|
252
|
+
* or components that iterate from left to right over a dataset. Some examples of these are
|
|
253
|
+
* horizontal sliders, collapsable dropdowns, or label components.
|
|
254
|
+
*
|
|
255
|
+
* Vertical layouts are best for taller components or components that should iterate vertically.
|
|
256
|
+
* Some examples include vertical sliders or list components that require a larger space to allow the user to scroll through the list.
|
|
257
|
+
*
|
|
258
|
+
* @default "horizontal"
|
|
259
|
+
*/
|
|
260
|
+
accessor layout: Layout;
|
|
261
|
+
/**
|
|
262
|
+
* When set to `true`, playback will restart from the first element of the slotted component's dataset
|
|
263
|
+
* once it reaches the end. Note that this will not allow the Value Picker buttons to be used to manually loop back to the first element.
|
|
264
|
+
*
|
|
265
|
+
* @default false
|
|
266
|
+
*/
|
|
267
|
+
accessor loop: boolean;
|
|
268
|
+
/** @internal */
|
|
269
|
+
protected messages: {
|
|
270
|
+
componentLabel: string;
|
|
271
|
+
next: string;
|
|
272
|
+
previous: string;
|
|
273
|
+
play: string;
|
|
274
|
+
pause: string;
|
|
275
|
+
} & T9nMeta<{
|
|
276
|
+
componentLabel: string;
|
|
277
|
+
next: string;
|
|
278
|
+
previous: string;
|
|
279
|
+
play: string;
|
|
280
|
+
pause: string;
|
|
281
|
+
}>;
|
|
282
|
+
/**
|
|
283
|
+
* Specifies the interval, in milliseconds, on which the component will call `step("next")` on the slotted component.
|
|
284
|
+
*
|
|
285
|
+
* @default 1000
|
|
286
|
+
*/
|
|
287
|
+
accessor playRate: number;
|
|
288
|
+
/**
|
|
289
|
+
* By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
|
|
290
|
+
*
|
|
291
|
+
* @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component)
|
|
292
|
+
*/
|
|
293
|
+
accessor referenceElement: ArcgisReferenceElement | string | undefined;
|
|
294
|
+
/** The current state of the component. */
|
|
295
|
+
get state(): "playing" | "ready";
|
|
296
|
+
/** Permanently destroy the component. */
|
|
297
|
+
destroy(): Promise<void>;
|
|
298
|
+
/**
|
|
299
|
+
* Selects the next index from the slotted component's dataset.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```js
|
|
303
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
304
|
+
* const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");
|
|
305
|
+
*
|
|
306
|
+
* valuePickerSlider.steps = [1, 2, 3, 4, 5];
|
|
307
|
+
* valuePickerSlider.currentValue = 1;
|
|
308
|
+
*
|
|
309
|
+
* console.log(`Current value: ${valuePickerSlider.currentValue}`); // "Current value: 1"
|
|
310
|
+
* valuePicker.next();
|
|
311
|
+
* console.log(`Current value: ${valuePickerSlider.currentValue}`); // "Current value: 2"
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
next(): void;
|
|
315
|
+
/** Stops the component from playing. */
|
|
316
|
+
pause(): void;
|
|
317
|
+
/**
|
|
318
|
+
* Start playing. Value Picker will call `step("next")` on the slotted component at an interval defined by [playRate](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#playRate).
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```js
|
|
322
|
+
* // Start a continuously looping ValuePicker.
|
|
323
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
324
|
+
* const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");
|
|
325
|
+
*
|
|
326
|
+
* valuePickerSlider.steps = [1, 2, 3];
|
|
327
|
+
* valuePickerSlider.currentValue = 1;
|
|
328
|
+
* valuePicker.loop = true;
|
|
329
|
+
*
|
|
330
|
+
* valuePickerSlider.addEventListener("arcgisPropertyChange", () => {
|
|
331
|
+
* console.log(valuePickerSlider.currentValue);
|
|
332
|
+
* });
|
|
333
|
+
*
|
|
334
|
+
* valuePicker.play();
|
|
335
|
+
* // output: 1, 2, 3, 1, 2, 3, 1...
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
play(): void;
|
|
339
|
+
/**
|
|
340
|
+
* Selects the previous index from the slotted component's dataset.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```js
|
|
344
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
345
|
+
* const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");
|
|
346
|
+
*
|
|
347
|
+
* valuePickerSlider.steps = [1, 2, 3, 4, 5];
|
|
348
|
+
* valuePickerSlider.currentValue = 3;
|
|
349
|
+
*
|
|
350
|
+
* console.log(`Current value: ${valuePickerSlider.currentValue}`); // "Current value: 3"
|
|
351
|
+
* valuePicker.previous();
|
|
352
|
+
* console.log(`Current value: ${valuePickerSlider.currentValue}`); // "Current value: 2"
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
previous(): void;
|
|
356
|
+
/**
|
|
357
|
+
* Fires on each playback tick after the user presses the play button. The event payload contains `{ first: boolean }` and fires for
|
|
358
|
+
* the first time after [playRate](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#playRate) ms have elapsed since the user pressed the play button. Users should
|
|
359
|
+
* listen to this event to manually iterate an external dataset on an interval.
|
|
360
|
+
*/
|
|
361
|
+
readonly arcgisAnimate: import("@arcgis/lumina").TargetedEvent<this, AnimateEvent>;
|
|
362
|
+
/** Fires when the Value Picker's next button is pressed or when the [next()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#next) method is invoked. */
|
|
363
|
+
readonly arcgisNext: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
364
|
+
/** Fires when the Value Picker's pause button is pressed or when the [pause()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#pause) method is invoked. */
|
|
365
|
+
readonly arcgisPause: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
366
|
+
/** Fires when the Value Picker's play button is pressed or when the [play()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#play) method is invoked. */
|
|
367
|
+
readonly arcgisPlay: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
368
|
+
/** Fires when the Value Picker's previous button is pressed or when the [previous()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#previous) method is invoked. */
|
|
369
|
+
readonly arcgisPrevious: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
370
|
+
/** Emitted when the value of a property is changed. Use this to listen to changes to properties. */
|
|
371
|
+
readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "layout" | "loop" | "playRate" | "state"; }>;
|
|
372
|
+
/** Fires when the contents of Value Picker's slot changes. */
|
|
373
|
+
readonly arcgisSlottedElementChange: import("@arcgis/lumina").TargetedEvent<this, { slottedElement: ArcgisValuePickerSubcomponent | undefined; }>;
|
|
374
|
+
readonly "@eventTypes": {
|
|
375
|
+
arcgisAnimate: ArcgisValuePicker["arcgisAnimate"]["detail"];
|
|
376
|
+
arcgisNext: ArcgisValuePicker["arcgisNext"]["detail"];
|
|
377
|
+
arcgisPause: ArcgisValuePicker["arcgisPause"]["detail"];
|
|
378
|
+
arcgisPlay: ArcgisValuePicker["arcgisPlay"]["detail"];
|
|
379
|
+
arcgisPrevious: ArcgisValuePicker["arcgisPrevious"]["detail"];
|
|
380
|
+
arcgisPropertyChange: ArcgisValuePicker["arcgisPropertyChange"]["detail"];
|
|
381
|
+
arcgisSlottedElementChange: ArcgisValuePicker["arcgisSlottedElementChange"]["detail"];
|
|
382
|
+
};
|
|
383
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import { c as o } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as n, createEvent as i, nothing as a, safeClassMap as c } from "@arcgis/lumina";
|
|
4
|
+
import { getSlotAssignedElements as r } from "@arcgis/toolkit/dom";
|
|
5
|
+
import { css as h, html as s } from "lit";
|
|
6
|
+
import { u as d } from "../../chunks/useT9n.js";
|
|
7
|
+
import { usePropertyChange as m } from "@arcgis/lumina/controllers";
|
|
8
|
+
const p = h`:host{display:inline-flex;max-inline-size:100%}:host([layout="horizontal"]) slot{min-inline-size:300px;min-block-size:48px}:host([layout="vertical"]) slot{min-inline-size:300px;min-block-size:144px}slot{display:flex}slot.empty{display:none}.container{display:flex;flex-direction:column;background-color:var(--calcite-color-foreground-1)}.root{display:flex;flex-direction:row;align-items:stretch}calcite-action{width:var(--calcite-font-line-height-fixed-4xl);height:var(--calcite-font-line-height-fixed-4xl)}calcite-action-bar{--calcite-action-bar-items-space: var(--calcite-space-none);--calcite-spacing-sm: var(--calcite-space-none);background-color:var(--calcite-color-foreground-1)}.separator{border-inline-end:solid 1px var(--calcite-color-border-3);width:1px}.caption{border-block-start:solid 1px var(--calcite-color-border-3);border-block-end:solid 1px var(--calcite-color-border-3);padding-block:var(--calcite-space-sm);padding-inline:var(--calcite-space-md);inline-size:var(--calcite-space-none);min-inline-size:100%;box-sizing:border-box}.caption-text{font-family:inherit;font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);line-height:var(--calcite-font-line-height);color:var(--calcite-color-text-2);overflow-wrap:anywhere}`;
|
|
9
|
+
class u extends n {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this.messages = d({ blocking: !0 }), this._isPlaying = !1, this.autoDestroyDisabled = !1, this.caption = "", this.disabled = !1, this.hideNextButton = !1, this.hidePlayButton = !1, this.hidePreviousButton = !1, this.icon = "list-rectangle", this.label = "", this.layout = "horizontal", this.loop = !1, this.playRate = 1e3, this.arcgisPropertyChange = m()("layout", "loop", "playRate", "state"), this.arcgisAnimate = i(), this.arcgisNext = i(), this.arcgisPrevious = i(), this.arcgisPlay = i(), this.arcgisPause = i(), this.arcgisSlottedElementChange = i(), this.listen("arcgisPropertyChange", () => this.requestUpdate());
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
this.properties = { _isPlaying: 16, _slottedElement: 16, autoDestroyDisabled: 5, caption: 1, disabled: 5, hideNextButton: 5, hidePlayButton: 5, hidePreviousButton: 5, icon: 1, label: 1, layout: 3, loop: 5, playRate: 9, referenceElement: 1, state: 32 };
|
|
15
|
+
}
|
|
16
|
+
static {
|
|
17
|
+
this.styles = p;
|
|
18
|
+
}
|
|
19
|
+
get state() {
|
|
20
|
+
return this._isPlaying ? "playing" : "ready";
|
|
21
|
+
}
|
|
22
|
+
async destroy() {
|
|
23
|
+
await this.manager.destroy();
|
|
24
|
+
}
|
|
25
|
+
next() {
|
|
26
|
+
this.arcgisNext.emit(), this._slottedElement?.canNext && this._slottedElement.step("next");
|
|
27
|
+
}
|
|
28
|
+
pause() {
|
|
29
|
+
this._isPlaying = !1, this.arcgisPause.emit();
|
|
30
|
+
}
|
|
31
|
+
play() {
|
|
32
|
+
this._isPlaying || (this._isPlaying = !0, this.arcgisPlay.emit(), this._startPlayRate(!0));
|
|
33
|
+
}
|
|
34
|
+
previous() {
|
|
35
|
+
this.arcgisPrevious.emit(), this._slottedElement?.canPrevious && this._slottedElement.step("previous");
|
|
36
|
+
}
|
|
37
|
+
disconnectedCallback() {
|
|
38
|
+
super.disconnectedCallback(), this._isPlaying && this.pause();
|
|
39
|
+
}
|
|
40
|
+
willUpdate(t) {
|
|
41
|
+
t.has("layout") && this._isElementWithLayout(this._slottedElement) && (this._slottedElement.layout = this.layout), t.has("disabled") && this._isElementWithDisabled(this._slottedElement) && (this._slottedElement.disabled = this.disabled);
|
|
42
|
+
}
|
|
43
|
+
_handleSlotChange(t) {
|
|
44
|
+
const [e] = r(t);
|
|
45
|
+
this._slottedElement = e, this.arcgisSlottedElementChange.emit({ slottedElement: e }), !e && this._isPlaying && this.pause(), this._isElementWithLayout(e) && (e.layout = this.layout), this._isElementWithDisabled(e) && (e.disabled = this.disabled);
|
|
46
|
+
}
|
|
47
|
+
_isElementWithLayout(t) {
|
|
48
|
+
return !!t && "layout" in t;
|
|
49
|
+
}
|
|
50
|
+
_isElementWithDisabled(t) {
|
|
51
|
+
return !!t && "disabled" in t;
|
|
52
|
+
}
|
|
53
|
+
_startPlayRate(t) {
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
if (this._isPlaying) {
|
|
56
|
+
if (!this._slottedElement?.canNext && this.loop)
|
|
57
|
+
this._slottedElement?.reset();
|
|
58
|
+
else if (this._slottedElement?.step("next"), this._slottedElement && !this._slottedElement?.canNext && !this.loop) {
|
|
59
|
+
this.pause();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.arcgisAnimate.emit({ first: t }), this._startPlayRate(!1);
|
|
63
|
+
}
|
|
64
|
+
}, this.playRate);
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const t = !!this._slottedElement && !this._slottedElement.hidden, e = this.state === "playing";
|
|
68
|
+
return s`<div class="container"><div class="root"><calcite-action-bar expand-disabled .layout=${this.layout}>${!this.hidePlayButton && s`<calcite-action alignment=center .disabled=${this.disabled || this._slottedElement && !this._slottedElement.canPlay} .icon=${e ? "pause" : "play"} .text=${e ? this.messages.pause : this.messages.play} title=${(e ? this.messages.pause : this.messages.play) ?? a} @click=${() => {
|
|
69
|
+
if (this._slottedElement && !this._slottedElement.canNext && !this.loop) {
|
|
70
|
+
this._slottedElement.reset(), this.play();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
e ? this.pause() : this.play();
|
|
74
|
+
}}></calcite-action>` || ""}${!this.hidePreviousButton && s`<calcite-action alignment=center .disabled=${this.disabled || e || this._slottedElement && !this._slottedElement.canPrevious} .icon=${this.layout === "horizontal" ? "chevron-left" : "chevron-up"} .text=${this.messages.previous} title=${this.messages.previous ?? a} @click=${this.previous}></calcite-action>` || ""}${!this.hideNextButton && s`<calcite-action alignment=center .disabled=${this.disabled || e || this._slottedElement && !this._slottedElement.canNext} .icon=${this.layout === "horizontal" ? "chevron-right" : "chevron-down"} .text=${this.messages.next} title=${this.messages.next ?? a} @click=${this.next}></calcite-action>` || ""}</calcite-action-bar>${t && s`<div class="separator"></div>` || ""}<slot @slotchange=${({ currentTarget: l }) => {
|
|
75
|
+
this._handleSlotChange(l);
|
|
76
|
+
}} class=${c(t ? "component-slot" : "empty")}></slot></div>${this.caption && s`<div class="caption"><div class="caption-text">${this.caption}</div></div>` || ""}</div>`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
o("arcgis-value-picker", u);
|
|
80
|
+
export {
|
|
81
|
+
u as ArcgisValuePicker
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since
|
|
3
|
+
* 5.1
|
|
4
|
+
*
|
|
5
|
+
* The minimum API required for components being slotted into [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/). Value Picker will automatically
|
|
6
|
+
* create an internal reference to the slotted component, so the properties on this interface can be directly referenced without requiring
|
|
7
|
+
* the the Value Picker component to be aware of the slotted component's unique API. For example, if the user presses play and eventually Value Picker
|
|
8
|
+
* determines that `slottedComponent.canNext` is false but [arcgis-value-picker.loop](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#loop) is true, Value Picker will call `slottedComponent.reset()`
|
|
9
|
+
* to reset the slotted component's current value to the first index of its dataset. This will allow playback to continue looping seamlessly.
|
|
10
|
+
*/
|
|
11
|
+
export interface ArcgisValuePickerSubcomponent extends HTMLElement {
|
|
12
|
+
/**
|
|
13
|
+
* Indicates whether the component may advance to the next index of its data set. This value is recalculated after the component is interacted with
|
|
14
|
+
* so the [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/) buttons give the user immediate feedback regarding what interactions are permitted next.
|
|
15
|
+
*/
|
|
16
|
+
canNext: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates whether the component may begin playing. This value is recalculated after the component is interacted with
|
|
19
|
+
* so the [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/) buttons give the user immediate feedback regarding what interactions are permitted next.
|
|
20
|
+
*/
|
|
21
|
+
canPlay: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates whether the component may step backwards to the previous index of its data set. This value is recalculated after the component is interacted with
|
|
24
|
+
* so the [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/) buttons give the user immediate feedback regarding what interactions are permitted next.
|
|
25
|
+
*/
|
|
26
|
+
canPrevious: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Function used to change the currently selected value. Pressing the next button will call step("next"), and pressing the previous button will call step("previous").
|
|
29
|
+
*
|
|
30
|
+
* @param direction - Indicates whether the next element selected by [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/)
|
|
31
|
+
* should be the next or previous index of the slotted component's dataset.
|
|
32
|
+
*/
|
|
33
|
+
step: (direction: "next" | "previous") => void;
|
|
34
|
+
/**
|
|
35
|
+
* Function used to reset the currently selected value to the first element of the slotted component's dataset. This method is called automatically
|
|
36
|
+
* when [arcgis-value-picker.loop](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#loop) is `true` and the selected value index reaches the end of the dataset. Additionally, if [arcgis-value-picker.loop](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/#loop)
|
|
37
|
+
* is `false` and the play button is clicked while the index is at the last element of the slotted component's dataset, Value Picker will call `reset()` on the slotted component
|
|
38
|
+
* and play through all elements once.
|
|
39
|
+
*/
|
|
40
|
+
reset: () => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AnimateEvent {
|
|
44
|
+
/** Denotes whether the event is firing for the first time since the play button was pressed. */
|
|
45
|
+
first: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Object used to define the label items. */
|
|
49
|
+
export interface LabelItem {
|
|
50
|
+
/** The value of the item. */
|
|
51
|
+
value: string;
|
|
52
|
+
/** The label users will see for this item. */
|
|
53
|
+
label: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Object used to define the combobox items. */
|
|
57
|
+
export interface ComboboxItem {
|
|
58
|
+
/** The value of the item. */
|
|
59
|
+
value: string;
|
|
60
|
+
/** The label users will see for this item. */
|
|
61
|
+
label: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Indicates the axis the component should be oriented along. */
|
|
65
|
+
export type Layout = "horizontal" | "vertical";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type Collection from "@arcgis/core/core/Collection.js";
|
|
3
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
4
|
+
|
|
5
|
+
export abstract class ArcgisValuePickerCollection extends LitElement {
|
|
6
|
+
/**
|
|
7
|
+
* If true, the component will not be destroyed automatically when it is
|
|
8
|
+
* disconnected from the document. This is useful when you want to move the
|
|
9
|
+
* component to a different place on the page, or temporarily hide it. If this
|
|
10
|
+
* is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/#destroy) method when you are done to
|
|
11
|
+
* prevent memory leaks.
|
|
12
|
+
*
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
accessor autoDestroyDisabled: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether the user can interact with the next button.
|
|
18
|
+
* This property is automatically set to `false` when [currentValue](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/#currentValue) matches the last index of
|
|
19
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/#items).
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
* @example
|
|
23
|
+
* ```js
|
|
24
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
25
|
+
* const valuePickerCollection = document.querySelector("arcgis-value-picker-collection");
|
|
26
|
+
*
|
|
27
|
+
* const collection = new Collection([
|
|
28
|
+
* { name: "Isaac Newton", dob: new Date(1643, 0, 4)},
|
|
29
|
+
* { name: "Albert Einstein", dob: new Date(1879, 2, 14)},
|
|
30
|
+
* { name: "Ernest Rutherford", dob: new Date(1871, 7, 20)}
|
|
31
|
+
* ]);
|
|
32
|
+
* valuePickerCollection.items = collection;
|
|
33
|
+
* valuePickerCollection.currentValue = valuePickerCollection.items.at(0);
|
|
34
|
+
* if (valuePickerCollection.canNext === true) {
|
|
35
|
+
* valuePicker.next();
|
|
36
|
+
* console.log(valuePickerCollection.currentValue.name); // "Albert Einstein"
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
accessor canNext: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Determines whether the user can interact with the play/pause button.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
accessor canPlay: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Determines whether the user can interact with the previous button.
|
|
49
|
+
* This property is automatically set to `false` when [currentValue](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/#currentValue) matches the first index of
|
|
50
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/#items).
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
53
|
+
* @example
|
|
54
|
+
* ```js
|
|
55
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
56
|
+
* const valuePickerCollection = document.querySelector("arcgis-value-picker-collection");
|
|
57
|
+
*
|
|
58
|
+
* const collection = new Collection([
|
|
59
|
+
* { name: "Isaac Newton", dob: new Date(1643, 0, 4)},
|
|
60
|
+
* { name: "Albert Einstein", dob: new Date(1879, 2, 14)},
|
|
61
|
+
* { name: "Ernest Rutherford", dob: new Date(1871, 7, 20)}
|
|
62
|
+
* ]);
|
|
63
|
+
* valuePickerCollection.items = collection;
|
|
64
|
+
* valuePickerCollection.currentValue = valuePickerCollection.items.at(1);
|
|
65
|
+
* if (valuePickerCollection.canPrevious === true) {
|
|
66
|
+
* valuePicker.previous();
|
|
67
|
+
* console.log(valuePickerCollection.currentValue.name); // "Isaac Newton"
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
accessor canPrevious: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The currently selected collection item. Note that because the type of [items](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker-collection/#items) is a
|
|
74
|
+
* [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of any shape, this component
|
|
75
|
+
* identifies `currentValue` by reference rather than matching a field that may not always be present. Ensure that `currentValue` is always
|
|
76
|
+
* assigned from an existing element within `items`.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```js
|
|
80
|
+
* const valuePickerCollection = document.querySelector("arcgis-value-picker-collection");
|
|
81
|
+
*
|
|
82
|
+
* const collection = new Collection([
|
|
83
|
+
* { name: "Isaac Newton", dob: new Date(1643, 0, 4)},
|
|
84
|
+
* { name: "Albert Einstein", dob: new Date(1879, 2, 14)},
|
|
85
|
+
* { name: "Ernest Rutherford", dob: new Date(1871, 7, 20)}
|
|
86
|
+
* ]);
|
|
87
|
+
* valuePickerCollection.items = collection;
|
|
88
|
+
*
|
|
89
|
+
* // 3 different approaches to setting currentValue
|
|
90
|
+
*
|
|
91
|
+
* // Acceptable. currentValue is a reference to items
|
|
92
|
+
* valuePickerCollection.currentValue = valuePickerCollection.items.at(0);
|
|
93
|
+
*
|
|
94
|
+
* // Acceptable. currentValue is assigned to the element at the index of items returned by find()
|
|
95
|
+
* valuePickerCollection.currentValue = valuePickerCollection.items.find(
|
|
96
|
+
* ({ name }) => name === "Albert Einstein"
|
|
97
|
+
* );
|
|
98
|
+
*
|
|
99
|
+
* // Invalid. The component has no mechanism to predict which field should be used to match this property to an index.
|
|
100
|
+
* valuePickerCollection.currentValue = { name: "Isaac Newton", dob: new Date(1643, 0, 4) };
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
accessor currentValue: unknown | undefined;
|
|
104
|
+
/** The collection of arbitrary items that [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-value-picker/) can iterate over. */
|
|
105
|
+
accessor items: Collection | undefined;
|
|
106
|
+
/** Permanently destroy the component. */
|
|
107
|
+
destroy(): Promise<void>;
|
|
108
|
+
/** Emitted when the value of a property is changed. Use this to listen to changes to properties. */
|
|
109
|
+
readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "canNext" | "canPlay" | "canPrevious" | "currentValue"; }>;
|
|
110
|
+
readonly "@eventTypes": {
|
|
111
|
+
arcgisPropertyChange: ArcgisValuePickerCollection["arcgisPropertyChange"]["detail"];
|
|
112
|
+
};
|
|
113
|
+
}
|