@arcgis/map-components
Version:
ArcGIS Map Components
49 lines (48 loc) • 2.29 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as d } from "../../chunks/runtime.js";
import { repeat as p } from "lit/directives/repeat.js";
import { css as f, html as l } from "lit";
import u from "@arcgis/core/core/Collection.js";
import { LitElement as g } from "@arcgis/lumina";
import { getElementLocale as b } from "@arcgis/toolkit/intl";
import { c as o } from "../../chunks/time-utils.js";
import { V as m } from "../../chunks/visible-element.js";
const v = f`:host{--calcite-label-margin-bottom: 0;gap:var(--calcite-spacing-md);flex-direction:column;display:flex}calcite-label{display:block}`;
class $ extends g {
constructor() {
super(...arguments), this.scale = "s", this.hideColorPicker = !1, this.hideInterval = !1;
}
static {
this.properties = { options: 0, scale: 1, hideColorPicker: 5, hideInterval: 5, messages: 0 };
}
static {
this.styles = v;
}
render() {
const { options: t, scale: s } = this, { color: c, interval: r } = t, a = this.messages?.discrete;
return l`${m({ hidden: this.hideInterval, children: l`<calcite-label .scale=${s}>${a?.intervalLabel}<calcite-select .label=${a?.intervalLabel ?? ""} .scale=${s} @calciteSelectChange=${(e) => {
const h = e.target.value, n = Number.parseInt(h, 10);
Number.isFinite(n) && (this.options.interval = n);
}}>${p(L, (e) => e, (e) => l`<calcite-option .selected=${e === r} .value=${String(e)} .label=${C(e, b(this.el).t9nLocale)}></calcite-option>`)}</calcite-select></calcite-label>` })}${m({ hidden: this.hideColorPicker, children: l`<arcgis-color-select .color=${c} .label=${a?.colorLabel} @arcgisColorChanged=${(e) => {
this.options.color = e.detail;
}}></arcgis-color-select>` })}`;
}
}
function C(i, t) {
return new Intl.DurationFormat(t, { style: "long" }).format(I(i));
}
function I(i) {
const t = Math.floor(i / 1e3), s = Math.floor(t / 3600), c = Math.floor(t % 3600 / 60), r = t % 60;
return { hours: s, minutes: c, seconds: r };
}
const L = new u([
o(15, "minutes", "milliseconds"),
o(30, "minutes", "milliseconds"),
o(1, "hours", "milliseconds"),
o(2, "hours", "milliseconds"),
o(3, "hours", "milliseconds")
]);
d("arcgis-shadow-cast-discrete-config", $);
export {
$ as ArcgisShadowCastDiscreteConfig
};