@arcgis/map-components
Version:
ArcGIS Map Components
44 lines (43 loc) • 1.6 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as s } from "../../chunks/runtime.js";
import { LitElement as i } from "@arcgis/lumina";
import { usePropertyChange as a } from "@arcgis/lumina/controllers";
class r extends i {
constructor() {
super(...arguments), this.autoDestroyDisabled = !1, this.canNext = !1, this.canPlay = !1, this.canPrevious = !1, this.arcgisPropertyChange = a()("canNext", "canPlay", "canPrevious", "currentValue");
}
static {
this.properties = { autoDestroyDisabled: 5, items: 0, currentValue: 0, canNext: 5, canPlay: 5, canPrevious: 5 };
}
async destroy() {
await this.manager.destroy();
}
reset() {
this.currentValue = this.items?.at(0);
}
step(t) {
if (!this.items || !this.currentValue)
return;
const e = this.items.indexOf(this.currentValue) + (t === "next" ? 1 : -1);
e >= this.items.length || e < 0 || (this.currentValue = this.items.at(e), this._checkState());
}
connectedCallback() {
super.connectedCallback(), this.el.hidden = !0;
}
willUpdate(t) {
(t.has("currentValue") || t.has("items")) && this.items?.length && (this.currentValue ??= this.items.at(0)), this._checkState();
}
_checkState() {
if (!this.items?.length) {
this.canPlay = !1, this.canNext = !1, this.canPrevious = !1;
return;
}
this.canPlay = !0;
const t = this.items.indexOf(this.currentValue);
this.canNext = t >= 0 && t < this.items.length - 1, this.canPrevious = t > 0;
}
}
s("arcgis-value-picker-collection", r);
export {
r as ArcgisValuePickerCollection
};