@arcgis/common-components 5.2.0-next.10 → 5.2.0-next.12
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/{232BH3SJ.js → 2XA6O2MP.js} +1 -1
- package/dist/cdn/3P53QRGS.js +2 -0
- package/dist/cdn/{6XE5JNJ7.js → 3V5M7OHL.js} +1 -1
- package/dist/cdn/4W7JZPB6.js +2 -0
- package/dist/cdn/{YG4PY2H3.js → 5KS7T5BY.js} +1 -1
- package/dist/cdn/5U5NQ3F5.js +2 -0
- package/dist/cdn/77HZGUSC.js +2 -0
- package/dist/cdn/{OOBX2C2L.js → AFBKMYU6.js} +1 -1
- package/dist/cdn/GVOQ2CB7.js +2 -0
- package/dist/cdn/{F45Q3BRT.js → IUJ4ILLQ.js} +1 -1
- package/dist/cdn/{WJ3TYWP2.js → JLPZ3OR2.js} +1 -1
- package/dist/cdn/JPD7Z3MB.js +2 -0
- package/dist/cdn/L2JNUMXB.js +2 -0
- package/dist/cdn/L5RMOAO3.js +2 -0
- package/dist/cdn/LB7I345F.js +2 -0
- package/dist/cdn/LBD3GPSD.js +2 -0
- package/dist/cdn/LKUOAV7B.js +2 -0
- package/dist/cdn/MCH3WQ4X.js +2 -0
- package/dist/cdn/{YVCGEEMG.js → MCZBUYS5.js} +1 -1
- package/dist/cdn/N7C4DINF.js +2 -0
- package/dist/cdn/OBIWQRXY.js +2 -0
- package/dist/cdn/PSITQBDP.js +2 -0
- package/dist/cdn/{BDF4ZLUF.js → TXYPZ6MB.js} +1 -1
- package/dist/cdn/{MINFRX4Y.js → VQLI4IE7.js} +1 -1
- package/dist/cdn/WEKRF34E.js +2 -0
- package/dist/cdn/WLYFLEI6.js +2 -0
- package/dist/cdn/XRARFMJ7.js +2 -0
- package/dist/cdn/ZDMNUSIJ.js +2 -0
- package/dist/cdn/assets/value-picker/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.bs.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.zh-HK.json +1 -0
- package/dist/cdn/assets/value-picker/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.bs.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.zh-HK.json +1 -0
- package/dist/cdn/assets/value-picker-combobox/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/components/arcgis-color-input/customElement.js +5 -5
- package/dist/components/arcgis-field-pick-list/customElement.js +43 -51
- package/dist/components/arcgis-picker-input/customElement.d.ts +6 -2
- package/dist/components/arcgis-picker-input/customElement.js +7 -7
- package/dist/components/arcgis-value-picker/customElement.d.ts +377 -0
- package/dist/components/arcgis-value-picker/customElement.js +87 -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 +69 -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 +8 -3
- 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 +3 -3
- package/dist/cdn/2MN6S2HH.js +0 -2
- package/dist/cdn/4NANIXN7.js +0 -2
- package/dist/cdn/5I5ODGDD.js +0 -2
- package/dist/cdn/AGGCAE6P.js +0 -2
- package/dist/cdn/D3WBDGDH.js +0 -2
- package/dist/cdn/HWEOBUAY.js +0 -2
- package/dist/cdn/OTXMT4H5.js +0 -2
- package/dist/cdn/OUUS7VKS.js +0 -2
- package/dist/cdn/OYXJA2QF.js +0 -2
- package/dist/cdn/QS7JRY4H.js +0 -2
- package/dist/cdn/SKYXMBD4.js +0 -2
- package/dist/cdn/UEGSIUVY.js +0 -2
- package/dist/cdn/YVWFGK4M.js +0 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as o } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as n, createEvent as i, nothing as l, safeClassMap as h } from "@arcgis/lumina";
|
|
4
|
+
import { getSlotAssignedElements as r } from "@arcgis/toolkit/dom";
|
|
5
|
+
import { css as c, 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 = c`: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}`;
|
|
9
|
+
class u extends n {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this.messages = d({ blocking: !0 }), this._isPlaying = !1, this.autoDestroyDisabled = !1, 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, disabled: 5, hideNextButton: 5, hidePlayButton: 5, hidePreviousButton: 5, icon: 1, label: 1, layout: 3, loop: 5, playRate: 9, 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), this._isElementWithComponentOnReady(e) && e.componentOnReady().then(() => {
|
|
46
|
+
this._slottedElement === e && this.requestUpdate();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
_isElementWithComponentOnReady(t) {
|
|
50
|
+
return !!t && "componentOnReady" in t;
|
|
51
|
+
}
|
|
52
|
+
_isElementWithLayout(t) {
|
|
53
|
+
return !!t && "layout" in t;
|
|
54
|
+
}
|
|
55
|
+
_isElementWithDisabled(t) {
|
|
56
|
+
return !!t && "disabled" in t;
|
|
57
|
+
}
|
|
58
|
+
_startPlayRate(t) {
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
if (this._isPlaying) {
|
|
61
|
+
if (!this._slottedElement?.canNext && this.loop)
|
|
62
|
+
this._slottedElement?.reset();
|
|
63
|
+
else if (this._slottedElement?.step("next"), this._slottedElement && !this._slottedElement?.canNext && !this.loop) {
|
|
64
|
+
this.pause();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.arcgisAnimate.emit({ first: t }), this._startPlayRate(!1);
|
|
68
|
+
}
|
|
69
|
+
}, this.playRate);
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
const t = !!this._slottedElement && !this._slottedElement.hidden, e = this.state === "playing";
|
|
73
|
+
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) ?? l} @click=${() => {
|
|
74
|
+
if (this._slottedElement && !this._slottedElement.canNext && !this.loop) {
|
|
75
|
+
this._slottedElement.reset(), this.play();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
e ? this.pause() : this.play();
|
|
79
|
+
}}></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 ?? l} @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 ?? l} @click=${this.next}></calcite-action>` || ""}</calcite-action-bar>${t && s`<div class="separator"></div>` || ""}<slot @slotchange=${({ currentTarget: a }) => {
|
|
80
|
+
this._handleSlotChange(a);
|
|
81
|
+
}} class=${h(t ? "component-slot" : "empty")}></slot></div></div>`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
o("arcgis-value-picker", u);
|
|
85
|
+
export {
|
|
86
|
+
u as ArcgisValuePicker
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Icon as Icon } from "@esri/calcite-components/components/calcite-icon";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @since
|
|
5
|
+
* 5.2
|
|
6
|
+
*
|
|
7
|
+
* The minimum API required for components being slotted into [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/). Value Picker will automatically
|
|
8
|
+
* create an internal reference to the slotted component, so the properties on this interface can be directly referenced without requiring
|
|
9
|
+
* 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
|
|
10
|
+
* determines that `slottedComponent.canNext` is false but [arcgis-value-picker.loop](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/#loop) is true, Value Picker will call `slottedComponent.reset()`
|
|
11
|
+
* to reset the slotted component's current value to the first index of its dataset. This will allow playback to continue looping seamlessly.
|
|
12
|
+
*/
|
|
13
|
+
export interface ArcgisValuePickerSubcomponent extends HTMLElement {
|
|
14
|
+
/**
|
|
15
|
+
* Indicates whether the component may advance to the next index of its data set. This value is recalculated after the component is interacted with
|
|
16
|
+
* so the [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/) buttons give the user immediate feedback regarding what interactions are permitted next.
|
|
17
|
+
*/
|
|
18
|
+
canNext: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Indicates whether the component may begin playing. This value is recalculated after the component is interacted with
|
|
21
|
+
* so the [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/) buttons give the user immediate feedback regarding what interactions are permitted next.
|
|
22
|
+
*/
|
|
23
|
+
canPlay: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 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
|
|
26
|
+
* so the [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/) buttons give the user immediate feedback regarding what interactions are permitted next.
|
|
27
|
+
*/
|
|
28
|
+
canPrevious: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 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").
|
|
31
|
+
*
|
|
32
|
+
* @param direction - Indicates whether the next element selected by [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/)
|
|
33
|
+
* should be the next or previous index of the slotted component's dataset.
|
|
34
|
+
*/
|
|
35
|
+
step: (direction: "next" | "previous") => void;
|
|
36
|
+
/**
|
|
37
|
+
* Function used to reset the currently selected value to the first element of the slotted component's dataset. This method is called automatically
|
|
38
|
+
* when [arcgis-value-picker.loop](https://developers.arcgis.com/javascript/latest/references/common-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/common-components/components/arcgis-value-picker/#loop)
|
|
39
|
+
* 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
|
|
40
|
+
* and play through all elements once.
|
|
41
|
+
*/
|
|
42
|
+
reset: () => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface AnimateEvent {
|
|
46
|
+
/** Denotes whether the event is firing for the first time since the play button was pressed. */
|
|
47
|
+
first: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Object used to define the label items. */
|
|
51
|
+
export interface LabelItem {
|
|
52
|
+
/** The value of the item. */
|
|
53
|
+
value: string;
|
|
54
|
+
/** The label users will see for this item. */
|
|
55
|
+
label: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Object used to define the combobox items. */
|
|
59
|
+
export interface ComboboxItem {
|
|
60
|
+
/** The value of the item. */
|
|
61
|
+
value: string;
|
|
62
|
+
/** The label users will see for this item. */
|
|
63
|
+
label: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Indicates the axis the component should be oriented along. */
|
|
67
|
+
export type Layout = "horizontal" | "vertical";
|
|
68
|
+
|
|
69
|
+
export type IconName = Icon["icon"];
|
|
@@ -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/common-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/common-components/components/arcgis-value-picker-collection/#currentValue) matches the last index of
|
|
19
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/common-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/common-components/components/arcgis-value-picker-collection/#currentValue) matches the first index of
|
|
50
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/common-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/common-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/common-components/components/arcgis-value-picker/) can iterate over. */
|
|
105
|
+
accessor items: Collection | undefined;
|
|
106
|
+
/** Permanently destroys the component. */
|
|
107
|
+
destroy(): Promise<void>;
|
|
108
|
+
/** @copyDoc */
|
|
109
|
+
readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "canNext" | "canPlay" | "canPrevious" | "currentValue"; }>;
|
|
110
|
+
readonly "@eventTypes": {
|
|
111
|
+
arcgisPropertyChange: ArcgisValuePickerCollection["arcgisPropertyChange"]["detail"];
|
|
112
|
+
};
|
|
113
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as s } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as i } from "@arcgis/lumina";
|
|
4
|
+
import { usePropertyChange as a } from "@arcgis/lumina/controllers";
|
|
5
|
+
class r extends i {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.autoDestroyDisabled = !1, this.canNext = !1, this.canPlay = !1, this.canPrevious = !1, this.arcgisPropertyChange = a()("canNext", "canPlay", "canPrevious", "currentValue");
|
|
8
|
+
}
|
|
9
|
+
static {
|
|
10
|
+
this.properties = { autoDestroyDisabled: 5, items: 0, currentValue: 0, canNext: 5, canPlay: 5, canPrevious: 5 };
|
|
11
|
+
}
|
|
12
|
+
async destroy() {
|
|
13
|
+
await this.manager.destroy();
|
|
14
|
+
}
|
|
15
|
+
reset() {
|
|
16
|
+
this.currentValue = this.items?.at(0);
|
|
17
|
+
}
|
|
18
|
+
step(t) {
|
|
19
|
+
if (!this.items || !this.currentValue)
|
|
20
|
+
return;
|
|
21
|
+
const e = this.items.indexOf(this.currentValue) + (t === "next" ? 1 : -1);
|
|
22
|
+
e >= this.items.length || e < 0 || (this.currentValue = this.items.at(e), this._checkState());
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback(), this.el.hidden = !0;
|
|
26
|
+
}
|
|
27
|
+
willUpdate(t) {
|
|
28
|
+
(t.has("currentValue") || t.has("items")) && this.items?.length && (this.currentValue ??= this.items.at(0)), this._checkState();
|
|
29
|
+
}
|
|
30
|
+
_checkState() {
|
|
31
|
+
if (!this.items?.length) {
|
|
32
|
+
this.canPlay = !1, this.canNext = !1, this.canPrevious = !1;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.canPlay = !0;
|
|
36
|
+
const t = this.items.indexOf(this.currentValue);
|
|
37
|
+
this.canNext = t >= 0 && t < this.items.length - 1, this.canPrevious = t > 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
s("arcgis-value-picker-collection", r);
|
|
41
|
+
export {
|
|
42
|
+
r as ArcgisValuePickerCollection
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
+
import type { ComboboxItem } from "../arcgis-value-picker/types.js";
|
|
4
|
+
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
5
|
+
|
|
6
|
+
export abstract class ArcgisValuePickerCombobox extends LitElement {
|
|
7
|
+
/**
|
|
8
|
+
* If true, the component will not be destroyed automatically when it is
|
|
9
|
+
* disconnected from the document. This is useful when you want to move the
|
|
10
|
+
* component to a different place on the page, or temporarily hide it. If this
|
|
11
|
+
* is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker-combobox/#destroy) method when you are done to
|
|
12
|
+
* prevent memory leaks.
|
|
13
|
+
*
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
accessor autoDestroyDisabled: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Determines whether the user can interact with the next button.
|
|
19
|
+
* This property is automatically set to `false` when [currentValue](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker-combobox/#currentValue) matches the last index of
|
|
20
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker-combobox/#items).
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
* @example
|
|
24
|
+
* ```js
|
|
25
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
26
|
+
* const valuePickerCombobox = document.querySelector("arcgis-value-picker-combobox");
|
|
27
|
+
*
|
|
28
|
+
* valuePickerCombobox.items = [
|
|
29
|
+
* { value: "ind", label: "Industrial" },
|
|
30
|
+
* { value: "res", label: "Residential" },
|
|
31
|
+
* { value: "com", label: "Commercial" }
|
|
32
|
+
* ];
|
|
33
|
+
* valuePickerCombobox.currentValue = valuePickerCombobox.items[0];
|
|
34
|
+
* if (valuePickerCombobox.canNext === true) {
|
|
35
|
+
* valuePicker.next();
|
|
36
|
+
* console.log(valuePickerCombobox.currentValue.label); // "Residential"
|
|
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/common-components/components/arcgis-value-picker-combobox/#currentValue) matches the first index of
|
|
50
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker-combobox/#items).
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
53
|
+
* @example
|
|
54
|
+
* ```js
|
|
55
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
56
|
+
* const valuePickerCombobox = document.querySelector("arcgis-value-picker-combobox");
|
|
57
|
+
*
|
|
58
|
+
* valuePickerCombobox.items = [
|
|
59
|
+
* { value: "ind", label: "Industrial" },
|
|
60
|
+
* { value: "res", label: "Residential" },
|
|
61
|
+
* { value: "com", label: "Commercial" }
|
|
62
|
+
* ];
|
|
63
|
+
* valuePickerCombobox.currentValue = valuePickerCombobox.items[1];
|
|
64
|
+
* if (valuePickerCombobox.canPrevious === true) {
|
|
65
|
+
* valuePicker.previous();
|
|
66
|
+
* console.log(valuePickerCombobox.currentValue.label); // "Industrial"
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
accessor canPrevious: boolean;
|
|
71
|
+
/** The currently selected combobox item rendered by the component. */
|
|
72
|
+
accessor currentValue: ComboboxItem | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* When true, the component is visually withdrawn and cannot receive user interaction.
|
|
75
|
+
*
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
accessor disabled: boolean;
|
|
79
|
+
/** The array of combobox items that [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/) can iterate over. */
|
|
80
|
+
accessor items: ComboboxItem[] | undefined;
|
|
81
|
+
/** @internal */
|
|
82
|
+
protected messages: { comboboxLabel: string; } & T9nMeta<{ comboboxLabel: string; }>;
|
|
83
|
+
/** Permanently destroys the component. */
|
|
84
|
+
destroy(): Promise<void>;
|
|
85
|
+
/** @copyDoc */
|
|
86
|
+
readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "canNext" | "canPlay" | "canPrevious" | "currentValue"; }>;
|
|
87
|
+
readonly "@eventTypes": {
|
|
88
|
+
arcgisPropertyChange: ArcgisValuePickerCombobox["arcgisPropertyChange"]["detail"];
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as l } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as r } from "@arcgis/lumina";
|
|
4
|
+
import { css as n, html as a } from "lit";
|
|
5
|
+
import { usePropertyChange as o } from "@arcgis/lumina/controllers";
|
|
6
|
+
import { u as h } from "../../chunks/useT9n.js";
|
|
7
|
+
const u = n`:host{align-items:center;display:flex;flex:auto;min-width:300px;padding-inline:var(--calcite-space-sm);--calcite-color-border-input: var(--calcite-color-border-3)}calcite-combobox{flex:auto;width:var(--calcite-space-none)}`;
|
|
8
|
+
class m extends r {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.messages = h({ blocking: !0 }), this.autoDestroyDisabled = !1, this.disabled = !1, this.canNext = !1, this.canPlay = !1, this.canPrevious = !1, this.arcgisPropertyChange = o()("canNext", "canPlay", "canPrevious", "currentValue");
|
|
11
|
+
}
|
|
12
|
+
static {
|
|
13
|
+
this.properties = { autoDestroyDisabled: 5, disabled: 5, items: 0, currentValue: 0, canNext: 5, canPlay: 5, canPrevious: 5 };
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.styles = u;
|
|
17
|
+
}
|
|
18
|
+
async destroy() {
|
|
19
|
+
await this.manager.destroy();
|
|
20
|
+
}
|
|
21
|
+
reset() {
|
|
22
|
+
this.currentValue = this.items?.[0];
|
|
23
|
+
}
|
|
24
|
+
step(e) {
|
|
25
|
+
if (!this.items || !this.currentValue)
|
|
26
|
+
return;
|
|
27
|
+
const s = this.items.findIndex(({ value: c }) => c === this.currentValue?.value) + (e === "next" ? 1 : -1);
|
|
28
|
+
s >= this.items.length || s < 0 || (this.currentValue = this.items[s], this._checkState());
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
super.connectedCallback(), this.el.hidden = !0;
|
|
32
|
+
}
|
|
33
|
+
willUpdate(e) {
|
|
34
|
+
(e.has("currentValue") || e.has("items")) && this.items?.length && (this.currentValue ??= this.items[0]), this.el.hidden = !this.items?.length, this._checkState();
|
|
35
|
+
}
|
|
36
|
+
_checkState() {
|
|
37
|
+
if (!this.items?.length) {
|
|
38
|
+
this.canPlay = !1, this.canNext = !1, this.canPrevious = !1;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.canPlay = !0;
|
|
42
|
+
const e = this.items.findIndex(({ value: t }) => t === this.currentValue?.value);
|
|
43
|
+
this.canNext = e < this.items.length - 1, this.canPrevious = e > 0;
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return a`<calcite-combobox .disabled=${this.disabled} selection-mode=single .label=${this.messages.comboboxLabel} @calciteComboboxChange=${({ currentTarget: e }) => {
|
|
47
|
+
const t = e.selectedItems[0]?.value;
|
|
48
|
+
this.currentValue = this.items?.find(({ value: i }) => i === t), this._checkState();
|
|
49
|
+
}}>${this.items?.map((e) => a`<calcite-combobox-item .value=${e.value} .heading=${e.label} .selected=${e.value === this.currentValue?.value}></calcite-combobox-item>`)}</calcite-combobox>`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
l("arcgis-value-picker-combobox", m);
|
|
53
|
+
export {
|
|
54
|
+
m as ArcgisValuePickerCombobox
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
+
import type { LabelItem } from "../arcgis-value-picker/types.js";
|
|
4
|
+
|
|
5
|
+
export abstract class ArcgisValuePickerLabel 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/common-components/components/arcgis-value-picker-label/#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/common-components/components/arcgis-value-picker-label/#currentValue) matches the last index of
|
|
19
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker-label/#items).
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
* @example
|
|
23
|
+
* ```js
|
|
24
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
25
|
+
* const valuePickerLabel = document.querySelector("arcgis-value-picker-label");
|
|
26
|
+
*
|
|
27
|
+
* valuePickerLabel.items = [
|
|
28
|
+
* { value: "90606", label: "Whittier, CA (90606)" },
|
|
29
|
+
* { value: "76001", label: "Arlington, TX (76001)" },
|
|
30
|
+
* { value: "92335", label: "Fontana, CA (92335)" }
|
|
31
|
+
* ];
|
|
32
|
+
* valuePickerLabel.currentValue = valuePickerLabel.items[0];
|
|
33
|
+
* if (valuePickerLabel.canNext === true) {
|
|
34
|
+
* valuePicker.next();
|
|
35
|
+
* console.log(valuePickerLabel.currentValue.label); // "Arlington, TX (76001)"
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
accessor canNext: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Determines whether the user can interact with the play/pause button.
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
accessor canPlay: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Determines whether the user can interact with the previous button.
|
|
48
|
+
* This property is automatically set to `false` when [currentValue](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker-label/#currentValue) matches the first index of
|
|
49
|
+
* [items](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker-label/#items).
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
* @example
|
|
53
|
+
* ```js
|
|
54
|
+
* const valuePicker = document.querySelector("arcgis-value-picker");
|
|
55
|
+
* const valuePickerLabel = document.querySelector("arcgis-value-picker-label");
|
|
56
|
+
*
|
|
57
|
+
* valuePickerLabel.items = [
|
|
58
|
+
* { value: "90606", label: "Whittier, CA (90606)" },
|
|
59
|
+
* { value: "76001", label: "Arlington, TX (76001)" },
|
|
60
|
+
* { value: "92335", label: "Fontana, CA (92335)" }
|
|
61
|
+
* ];
|
|
62
|
+
* valuePickerLabel.currentValue = valuePickerLabel.items[1];
|
|
63
|
+
* if (valuePickerLabel.canPrevious === true) {
|
|
64
|
+
* valuePicker.previous();
|
|
65
|
+
* console.log(valuePickerLabel.currentValue.label); // "Whittier, CA (90606)"
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
accessor canPrevious: boolean;
|
|
70
|
+
/** The currently selected label item rendered by the component. */
|
|
71
|
+
accessor currentValue: LabelItem | undefined;
|
|
72
|
+
/** The array of label items that [arcgis-value-picker](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-value-picker/) can iterate over. */
|
|
73
|
+
accessor items: LabelItem[] | undefined;
|
|
74
|
+
/** Permanently destroys the component. */
|
|
75
|
+
destroy(): Promise<void>;
|
|
76
|
+
/** @copyDoc */
|
|
77
|
+
readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "canNext" | "canPlay" | "canPrevious" | "currentValue"; }>;
|
|
78
|
+
readonly "@eventTypes": {
|
|
79
|
+
arcgisPropertyChange: ArcgisValuePickerLabel["arcgisPropertyChange"]["detail"];
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as a } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as r } from "@arcgis/lumina";
|
|
4
|
+
import { css as n, html as c } from "lit";
|
|
5
|
+
import { usePropertyChange as l } from "@arcgis/lumina/controllers";
|
|
6
|
+
const o = n`:host{display:flex;flex:auto;min-width:300px;padding:var(--calcite-space-sm)}.container{align-items:center;border:solid 1px var(--calcite-color-border-3);display:flex;flex:auto;padding-inline:var(--calcite-space-sm)}.text{color:var(--calcite-color-text-1);flex:auto;font-family:inherit;font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-normal);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--calcite-space-none)}`;
|
|
7
|
+
class h extends r {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments), this.autoDestroyDisabled = !1, this.canNext = !1, this.canPlay = !1, this.canPrevious = !1, this.arcgisPropertyChange = l()("canNext", "canPlay", "canPrevious", "currentValue");
|
|
10
|
+
}
|
|
11
|
+
static {
|
|
12
|
+
this.properties = { autoDestroyDisabled: 5, items: 0, currentValue: 0, canNext: 5, canPlay: 5, canPrevious: 5 };
|
|
13
|
+
}
|
|
14
|
+
static {
|
|
15
|
+
this.styles = o;
|
|
16
|
+
}
|
|
17
|
+
async destroy() {
|
|
18
|
+
await this.manager.destroy();
|
|
19
|
+
}
|
|
20
|
+
reset() {
|
|
21
|
+
this.currentValue = this.items?.[0];
|
|
22
|
+
}
|
|
23
|
+
step(e) {
|
|
24
|
+
if (!this.items || !this.currentValue)
|
|
25
|
+
return;
|
|
26
|
+
const t = this.items.findIndex(({ value: s }) => s === this.currentValue?.value) + (e === "next" ? 1 : -1);
|
|
27
|
+
t >= this.items.length || t < 0 || (this.currentValue = this.items[t], this._checkState());
|
|
28
|
+
}
|
|
29
|
+
connectedCallback() {
|
|
30
|
+
super.connectedCallback(), this.el.hidden = !0;
|
|
31
|
+
}
|
|
32
|
+
willUpdate(e) {
|
|
33
|
+
(e.has("currentValue") || e.has("items")) && this.items?.length && !this.currentValue && (this.currentValue = this.items[0]), this.el.hidden = !this.items?.length, this._checkState();
|
|
34
|
+
}
|
|
35
|
+
_checkState() {
|
|
36
|
+
if (!this.items?.length) {
|
|
37
|
+
this.canPlay = !1, this.canNext = !1, this.canPrevious = !1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.canPlay = !0;
|
|
41
|
+
const e = this.items.findIndex(({ value: i }) => i === this.currentValue?.value);
|
|
42
|
+
this.canNext = e < this.items.length - 1, this.canPrevious = e > 0;
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return c`<div class="container"><div class="text">${this.currentValue?.label}</div></div>`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
a("arcgis-value-picker-label", h);
|
|
49
|
+
export {
|
|
50
|
+
h as ArcgisValuePickerLabel
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|