UNPKG

@arcgis/map-components

Version:
99 lines (98 loc) 4.29 kB
import { c as l } from "../../chunks/runtime.js"; import { html as i } from "lit-html"; import { classes as n } from "@arcgis/components-utils"; import { g as e } from "../../chunks/globalCss.js"; import h from "@arcgis/core/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel.js"; import { usePropertyChange as d } from "@arcgis/components-controllers"; import { m } from "../../chunks/useViewModel.js"; import { u as g } from "../../chunks/useT9n.js"; import { reEmitEvent as u } from "@arcgis/components-controllers/accessor"; import { LitElement as p, createEvent as y, noShadowRoot as w, safeClassMap as a } from "@arcgis/lumina"; import { css as f } from "@lit/reactive-element/css-tag.js"; /*! All material copyright Esri, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. v4.32.13 */ const b = f`@layer{arcgis-link-chart-layout-switcher{display:block}}`, k = { basicLayoutCategory: [ "basic-grid" /* SIMPLE */ ], organicLayoutCategory: [ "organic-standard", "organic-community", "geographic-organic-standard" /* GEOGRAPHIC */ ], treeLayoutCategory: [ "tree-left-to-right", "radial-root-centric" /* RADIAL_TREE */ ], hierarchicalLayoutCategory: [ "hierarchical-bottom-to-top" /* HIERARCHICAL */ ], chronologicalLayoutCategory: [ "chronological-mono-timeline", "chronological-multi-timeline" /* CHRONOLOGICAL_MULTIPLE */ ] }, L = { "organic-standard": "force-directed-link-chart-layout", "organic-community": "community-link-chart-layout", "basic-grid": "simple-link-chart-layout", "hierarchical-bottom-to-top": "hierarchical-link-chart-layout", "radial-root-centric": "radial-tree-link-chart-layout", "tree-left-to-right": "smart-tree-link-chart-layout", "geographic-organic-standard": "geographic-link-chart-layout", "chronological-mono-timeline": "clock-forward", "chronological-multi-timeline": "clock-forward" }, v = { "organic-standard": "forceDirected", "organic-community": "community", "basic-grid": "simple", "hierarchical-bottom-to-top": "hierarchical", "radial-root-centric": "radialTree", "tree-left-to-right": "smartTree", "geographic-organic-standard": "geographic", "chronological-mono-timeline": "chronologicalSingle", "chronological-multi-timeline": "chronologicalMultiple" }, M = { base: "esri-link-chart-layout-switcher" }, C = m(h); class $ extends p { constructor() { super(...arguments), this.messages = g(), this.viewModel = C(this), this.autoDestroyDisabled = !1, this.icon = "nodes-link", this.layout = this.viewModel.layout, this.position = "top-left", this.preventExtentUpdate = this.viewModel.preventExtentUpdate, this.state = this.viewModel.state, this.arcgisSwitchLayout = u(() => this.viewModel, "switchLayout"), this.arcgisPropertyChange = d()("state"), this.arcgisReady = y(); } static { this.properties = { autoDestroyDisabled: 5, icon: 3, label: 1, layout: 32, position: 3, preventExtentUpdate: 5, referenceElement: 1, state: 3 }; } static { this.shadowRootOptions = w; } static { this.styles = b; } //#endregion //#region Public Methods /** Permanently destroy the component */ async destroy() { await this.manager.destroy(); } /** * Switches the layout of the link chart to the value provided. */ async switchLayout(t) { this.viewModel.switchLayout(t); } //#endregion //#region Rendering render() { const { messages: t, icon: r } = this; return i`<div class=${a(n(M.base, e.widget))}><calcite-dropdown scale=s width=m max-items=9><calcite-button class=${a(e.widgetButton)} slot=trigger kind=neutral .disabled=${this.viewModel.state === "disabled"} .iconStart=${r ?? void 0} .label=${t.layoutOptions ?? "Layout"}></calcite-button>${Object.entries(k).map(([c, s]) => i`<calcite-dropdown-group selection-mode=single .groupTitle=${this.messages[c]}>${s.map((o) => i`<calcite-dropdown-item .iconStart=${L[o]} .selected=${o === this.layout ? !0 : void 0} @click=${() => void this.switchLayout(o)}>${t[v[o]]}</calcite-dropdown-item>`)}</calcite-dropdown-group>`)}</calcite-dropdown></div>`; } } l("arcgis-link-chart-layout-switcher", $); export { $ as ArcgisLinkChartLayoutSwitcher };