@arcgis/map-components
Version:
ArcGIS Map Components
52 lines (51 loc) • 2.36 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as a } from "../../chunks/runtime.js";
import { LitElement as r } from "@arcgis/lumina";
import { css as n, html as c } from "lit";
import { usePropertyChange as l } from "@arcgis/lumina/controllers";
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)}`;
class h extends r {
constructor() {
super(...arguments), this.autoDestroyDisabled = !1, this.canNext = !1, this.canPlay = !1, this.canPrevious = !1, this.arcgisPropertyChange = l()("canNext", "canPlay", "canPrevious", "currentValue");
}
static {
this.properties = { autoDestroyDisabled: 5, items: 0, currentValue: 0, canNext: 5, canPlay: 5, canPrevious: 5 };
}
static {
this.styles = o;
}
async destroy() {
await this.manager.destroy();
}
reset() {
this.currentValue = this.items?.[0];
}
step(e) {
if (!this.items || !this.currentValue)
return;
const t = this.items.findIndex(({ value: s }) => s === this.currentValue?.value) + (e === "next" ? 1 : -1);
t >= this.items.length || t < 0 || (this.currentValue = this.items[t], this._checkState());
}
connectedCallback() {
super.connectedCallback(), this.el.hidden = !0;
}
willUpdate(e) {
(e.has("currentValue") || e.has("items")) && this.items?.length && !this.currentValue && (this.currentValue = this.items[0]), this.el.hidden = !this.items?.length, this._checkState();
}
_checkState() {
if (!this.items?.length) {
this.canPlay = !1, this.canNext = !1, this.canPrevious = !1;
return;
}
this.canPlay = !0;
const e = this.items.findIndex(({ value: i }) => i === this.currentValue?.value);
this.canNext = e < this.items.length - 1, this.canPrevious = e > 0;
}
render() {
return c`<div class="container"><div class="text">${this.currentValue?.label}</div></div>`;
}
}
a("arcgis-value-picker-label", h);
export {
h as ArcgisValuePickerLabel
};