UNPKG

@arcgis/map-components

Version:
435 lines (434 loc) • 31.8 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import { c as R } from "../../chunks/runtime.js"; import { css as O, html as a } from "lit"; import { keyed as V } from "lit/directives/keyed.js"; import L from "@arcgis/core/widgets/Features/FeaturesViewModel.js"; import { u as B } from "../../chunks/useT9n.js"; import { log as A } from "@arcgis/toolkit/log"; import { classes as x } from "@arcgis/toolkit/dom"; import { usePropertyChange as S, bypassReadOnly as y } from "@arcgis/lumina/controllers"; import { m as H } from "../../chunks/useViewModel.js"; import { LitElement as P, createEvent as I, renderElement as z, nothing as h, safeClassMap as T } from "@arcgis/lumina"; import { substitute as u, formatNumber as C } from "@arcgis/core/intl.js"; import { watch as r } from "@arcgis/core/core/reactiveUtils.js"; import { t as U, z as Z } from "../../chunks/action-utils.js"; import { stripHTML as k } from "@arcgis/core/applications/Components/stringUtils.js"; import E from "@arcgis/core/core/Collection.js"; import { g as j } from "../../chunks/feature-utils.js"; import { renderingSanitizer as _ } from "@arcgis/core/applications/Components/sanitizerUtils.js"; import { initializeProjection as G } from "@arcgis/core/applications/Components/featureUtils.js"; import K from "@arcgis/core/support/actions/ActionButton.js"; import { createRef as b, ref as m } from "lit/directives/ref.js"; const q = O`:host{display:flex;overflow:hidden;flex:1 1 auto}.root{--calcite-color-background: var(--calcite-color-foreground-1);display:flex;overflow:hidden;flex:1 1 auto;flex-direction:column}.root img{image-orientation:from-image}.flow-item-collapsed{--calcite-flow-item-header-border-block-end: none}.container{display:flex;flex:1 1 auto;background-color:var(--calcite-color-foreground-1)}.container calcite-list{width:100%}.container:not(:empty,.content-hidden){padding:var(--arcgis-internal-padding-md, var(--calcite-spacing-md))}.root .arcgis-feature,.root .arcgis-feature-relationship,.root .arcgis-feature-utility-network-associations{background-color:transparent}.heading{word-break:break-word;word-wrap:break-word}.header,.footer{display:flex;align-items:center;justify-content:flex-end;background-color:var(--calcite-color-foreground-1)}.footer{flex:1}.pagination-text{padding-inline:var(--calcite-spacing-sm);color:var(--calcite-color-text-3);font-size:var(--calcite-font-size-sm)}.loader{align-self:center;padding-inline:var(--calcite-spacing-lg)}.pagination-action-bar{flex:1}.pagination-menu-button{padding-inline:var(--calcite-spacing-xxs);border-inline-start:var(--calcite-border-width-sm) solid var(--calcite-color-border-3)}.icon{display:inline-block;flex:0 0 var(--calcite-spacing-lg);width:var(--calcite-spacing-lg);height:var(--calcite-spacing-lg)}.action-image{flex:0 0 var(--calcite-spacing-lg);background-position:50% 50%;background-repeat:no-repeat;background-size:contain;width:var(--calcite-spacing-lg);height:var(--calcite-spacing-lg)}.header{border-block-end:var(--calcite-border-width-sm) solid var(--calcite-color-border-3)}.content-feature{--calcite-flow-item-footer-padding: 0}.feature-menu-observer{position:relative;bottom:var(--calcite-spacing-xxl);z-index:2;text-align:center}.action-exit{transform:scaleX(-1)}`, W = new K({ icon: "magnifying-glass-plus", id: "zoom-to-feature", title: "{messages.zoom}" }), M = W.clone(); function X(D) { return D?.declaredClass.startsWith("esri.layers.") ?? !1; } const J = H(L); class Q extends P { constructor() { super(...arguments), this._fetchFeaturesController = null, this._featureMenuIntersectionObserverCallback = ([e]) => { e?.isIntersecting && this.viewModel.featurePage != null && this.viewModel.featurePage++; }, this._featureMenuIntersectionObserver = new IntersectionObserver(this._featureMenuIntersectionObserverCallback, { root: window.document }), this._featureMenuIntersectionObserverNode = null, this._rootFlowItemNode = b(), this._featureMenuViewportNode = b(), this._actionBarMenuNode = b(), this._flowContainerNode = b(), this.messages = B(), this._selectedFeatureComponent = b(), this._cancelOpenRelatedFeature = () => { const { _openRelatedFeatureAbortController: e } = this; e && e.abort(), this._openRelatedFeatureAbortController = null; }, this._openRelatedFeatureAbortController = null, this.flowItems = new E(), this.viewModel = J(this), this.actions = this.viewModel.actions, this.active = this.viewModel.active, this.autoDestroyDisabled = !1, this.collapsed = !1, this.content = this.viewModel.content, this.defaultPopupTemplateEnabled = this.viewModel.defaultPopupTemplateEnabled, this.featureCount = this.viewModel.featureCount, this.featureMenuOpen = this.viewModel.featureMenuOpen, this.featureMenuTitle = this.viewModel.featureMenuTitle, this.featureNavigationTop = !1, this.features = this.viewModel.features, this.featuresPerPage = this.viewModel.featuresPerPage, this.featureViewModelAbilities = this.viewModel.featureViewModelAbilities, this.goToOverride = this.viewModel.goToOverride, this.headerActions = new E(), this.heading = this.viewModel.title, this.headingLevel = 2, this.hideActionBar = !1, this.hideCloseButton = !1, this.hideFeatureMenuHeading = !1, this.hideFeatureNavigation = !1, this.hideFeatureListLayerTitle = !1, this.hideHeading = !1, this.hideSelectFeature = !1, this.hideSpinner = !1, this.hideContent = !1, this.hideExpressionContent = !1, this.hideLastEditedInfo = !1, this.highlightDisabled = this.viewModel.highlightEnabled, this.includeDefaultActionsDisabled = this.viewModel.includeDefaultActions, this.initialDisplayMode = this.viewModel.initialDisplayMode, this.location = this.viewModel.location, this.map = this.viewModel.map, this.open = this.viewModel.visible, this.promises = this.viewModel.promises, this.responsiveActionsEnabled = !1, this.selectedFeature = this.viewModel.selectedFeature, this.selectedFeatureIndex = this.viewModel.selectedFeatureIndex, this.showCollapseButton = !1, this.spatialReference = this.viewModel.spatialReference, this.state = this.viewModel.state, this.timeZone = this.viewModel.timeZone, this.updateLocationEnabled = this.viewModel.updateLocationEnabled, this.view = this.viewModel.view, this.arcgisPropertyChange = S()("active", "collapsed", "effectiveHeading", "featureCount", "featureMenuOpen", "features", "promises", "selectedDrillInFeature", "selectedFeature", "selectedFeatureComponent", "selectedFeatureIndex", "state", "open"), this.arcgisReady = I(), this.arcgisClose = I(), this.arcgisTriggerAction = I(); } static { this.properties = { _openRelatedFeatureAbortController: 16, flowItems: 16, _hideActionText: 16, _featureNavigationVisible: 16, _isCollapsed: 16, _collapseEnabled: 16, _featureFlowItemSelected: 16, viewModel: 0, actions: 0, active: 0, autoDestroyDisabled: 5, collapseDirection: 1, collapsed: 5, content: 1, defaultPopupTemplateEnabled: 5, effectiveHeading: 32, featureCount: 9, featureMenuOpen: 5, featureMenuTitle: 1, featureNavigationTop: 5, features: 0, featuresPerPage: 9, featureViewModelAbilities: 0, goToOverride: 0, headerActions: 0, heading: 1, headingLevel: 9, hideActionBar: 5, hideCloseButton: 5, hideFeatureMenuHeading: 5, hideFeatureNavigation: 5, hideFeatureListLayerTitle: 5, hideHeading: 5, hideSelectFeature: 5, hideSpinner: 5, hideContent: 5, chartAnimationDisabled: 5, hideAttachmentsContent: 5, hideCustomContent: 5, hideExpressionContent: 5, hideFieldsContent: 5, hideMediaContent: 5, hideRelationshipContent: 5, hideTextContent: 5, hideUtilityNetworkContent: 5, hideLastEditedInfo: 5, highlightDisabled: 5, icon: 1, includeDefaultActionsDisabled: 5, initialDisplayMode: 1, label: 1, location: 0, map: 0, messageOverrides: 0, open: 5, referenceElement: 1, promises: 0, responsiveActionsEnabled: 5, selectedDrillInFeature: 32, selectedFeature: 0, selectedFeatureComponent: 32, selectedFeatureIndex: 9, showCollapseButton: 5, spatialReference: 0, state: 32, timeZone: 1, updateLocationEnabled: 5, view: 0 }; } static { this.styles = q; } get _hideActionText() { if (!this.responsiveActionsEnabled) return !1; const e = this.viewModel.view?.widthBreakpoint; return e === "xsmall" || e === "small" || e === "medium"; } get _featureNavigationVisible() { return this.viewModel.active && this.viewModel.featureCount > 1 && !!this.viewModel.selectedFeature && !this.hideFeatureNavigation; } get _isCollapsed() { return this._collapseEnabled && this.collapsed; } get _collapseEnabled() { return this.showCollapseButton && (this.initialDisplayMode === "list" || !!(this.heading || this.viewModel.selectedFeatureViewModel?.title) && !!(this.content || this.viewModel.selectedFeatureViewModel?.content)); } get _featureFlowItemSelected() { return this.initialDisplayMode === "list" ? !!this.selectedFeature : !this.featureMenuOpen; } get chartAnimationDisabled() { return !(this.viewModel.featureViewModelAbilities?.chartAnimation ?? !0); } set chartAnimationDisabled(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.chartAnimation = !e; } get hideAttachmentsContent() { return !(this.viewModel.featureViewModelAbilities?.attachmentsContent ?? !0); } set hideAttachmentsContent(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.attachmentsContent = !e; } get hideCustomContent() { return !(this.viewModel.featureViewModelAbilities?.customContent ?? !0); } set hideCustomContent(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.customContent = !e; } get hideFieldsContent() { return !(this.viewModel.featureViewModelAbilities?.fieldsContent ?? !0); } set hideFieldsContent(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.fieldsContent = !e; } get hideMediaContent() { return !(this.viewModel.featureViewModelAbilities?.mediaContent ?? !0); } set hideMediaContent(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.mediaContent = !e; } get hideRelationshipContent() { return !(this.viewModel.featureViewModelAbilities?.relationshipContent ?? !0); } set hideRelationshipContent(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.relationshipContent = !e; } get hideTextContent() { return !(this.viewModel.featureViewModelAbilities?.textContent ?? !0); } set hideTextContent(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.textContent = !e; } get hideUtilityNetworkContent() { return !(this.viewModel.featureViewModelAbilities?.utilityNetworkAssociationsContent ?? !0); } set hideUtilityNetworkContent(e) { this.viewModel.featureViewModelAbilities ??= {}, this.viewModel.featureViewModelAbilities.utilityNetworkAssociationsContent = !e; } async clear() { return this.viewModel.clear(); } async close() { this.open = !1; } async destroy() { await this.manager.destroy(), this._removeSpinner(this.referenceElement), this._cancelOpenRelatedFeature(), this._removeFlowItems(), this._unobserveFeatureMenuObserver(), this._cancelFetchingFeatures(), this._featureMenuIntersectionObserver?.disconnect(); } async fetchFeatures(e, t) { this._cancelFetchingFeatures(); const { signal: s } = t ?? {}, i = new AbortController(), { signal: n } = i, o = s ? AbortSignal.any([n, s]) : n; if (this._fetchFeaturesController = i, !e && this.view && this.location && (await G(this.location.spatialReference, this.view.spatialReference, null, { signal: o }), e = this.view.toScreen(this.location) ?? void 0), !e) return; const l = await this.viewModel.fetchFeatures(e, { ...t, signal: o }); this.location = l.location, this.promises = l.pendingFeatures; } async next() { return A("warn", this, "The return type of FeaturesViewModel on the next() method is deprecated. At 6.0, this method will return void."), this.viewModel.next(); } async previous() { return A("warn", this, "The return type of FeaturesViewModel on the previous() method is deprecated. At 6.0, this method will return void."), this.viewModel.previous(); } async setFocus() { this._flowContainerNode.value?.setFocus(); } async triggerAction(e) { if (A("warn", this, "The triggerAction() method is deprecated since 5.1. Trigger actions with manual user interaction within the component.", { once: !0 }), !e.disabled) return e?.type === "toggle" && (e.value = !e.value), await U(e, this.viewModel); } connectedCallback() { super.connectedCallback(), this._createSpinner(); } disconnectedCallback() { super.disconnectedCallback(), this._removeSpinner(this.referenceElement); } loaded() { this.manager.onLifecycle(() => [ r(() => this.viewModel?.selectedFeatureIndex, (e, t) => this._selectedFeatureIndexUpdated(e, t)), r(() => this.viewModel?.view, (e, t) => t && this._viewChange()), r(() => this._spinnerEl?.screenLocation, () => this._closeOpenActionMenu()), r(() => this.selectedFeatureComponent?.viewModel, () => this._removeFlowItems()), r(() => this.viewModel?.featureViewModels, () => this._featureMenuViewportScrollTop()), r(() => this.flowItems.length, () => this._syncSelectedDrillInFeature()), r(() => [ this.viewModel?.title, this.viewModel?.selectedFeatureViewModel?.title, this.viewModel?.selectedFeatureViewModel?.state ], () => this._syncEffectiveHeading(), { initial: !0 }), r(() => [this.flowItems?.length, this.featureMenuOpen], () => { this.setFocus(); }), r(() => this.referenceElement, (e, t) => { this._removeSpinner(t), this._createSpinner(); }, { initial: !0 }), r(() => [ this.hideSpinner, this.viewModel?.view, this.viewModel?.location, this.viewModel?.waitingForResult, this.viewModel?.visible ], () => this._createSpinner(), { initial: !0 }) ]); } updated() { const e = this._selectedFeatureComponent.value ?? void 0; this.selectedFeatureComponent !== e && y(() => this.selectedFeatureComponent = e); } _syncSelectedDrillInFeature() { const e = this.flowItems.getItemAt(this.flowItems.length - 1); y(() => this.selectedDrillInFeature = e?.graphic ?? void 0); } _syncEffectiveHeading() { const e = this._calculateEffectiveHeading(); this.effectiveHeading !== e && y(() => this.effectiveHeading = e); } _cancelFetchingFeatures() { this._fetchFeaturesController?.abort(), this._fetchFeaturesController = null; } _handleClose() { this.close(), this.arcgisClose.emit(); } _groupResultsByLayer() { const { featureViewModels: e } = this.viewModel, t = /* @__PURE__ */ new Map(); return e.forEach((s) => { const i = s?.graphic; if (!i) return; const n = j(i), o = X(n) ? n : null, l = t.get(o) ?? []; t.set(o, [...l, s]); }), t; } _handleCollapseToggle() { this.collapsed = !this.collapsed; } async _openRelatedFeature(e) { this._cancelOpenRelatedFeature(); const t = new AbortController(); if (this._openRelatedFeatureAbortController = t, await e.updateGeometry(), this._openRelatedFeatureAbortController !== t) return; const s = e.graphic, i = s?.geometry; if (i == null || s == null) { this._openRelatedFeatureAbortController === t && (this._openRelatedFeatureAbortController = null); return; } if (this._removeFlowItems(), await this.viewModel.zoomTo({ target: i }), this._openRelatedFeatureAbortController !== t) return; const n = await import("@arcgis/core/geometry/operators/labelPointOperator.js"); if (this._openRelatedFeatureAbortController !== t) return; const o = n.execute(i); o != null && (this.location = o), this.features = [s], this.open = !0, await this.setFocus(), this._openRelatedFeatureAbortController === t && (this._openRelatedFeatureAbortController = null); } _handlePaginationMenuButton() { this._updateFeatureMenu(); } _openFeatureMenu() { this._updateFeatureMenu(!0); } _closeFeatureMenu() { this._updateFeatureMenu(!1); } _updateFeatureMenu(e = !this.featureMenuOpen) { this.featureMenuOpen = e; } _previousFeature() { this.viewModel.previous(); } _nextFeature() { this.viewModel.next(); } _handleFeatureBack() { this.initialDisplayMode === "list" ? (this.selectedFeatureIndex = -1, this.setFocus()) : this._openFeatureMenu(); } _handleFeatureMenuBack() { this.initialDisplayMode === "list" ? (this.selectedFeatureIndex = -1, this.setFocus()) : this.featureMenuOpen && this._closeFeatureMenu(); } _setActiveFeature(e) { const { viewModel: t } = this; t.activeFeature = t.features?.[e] || null; } _removeActiveFeature() { this.viewModel.activeFeature = null; } _selectFeature(e) { this.viewModel.selectedFeatureIndex = e, this.initialDisplayMode === "feature" ? this._handleFeatureMenuBack() : this.setFocus(); } _unobserveFeatureMenuObserver() { this._featureMenuIntersectionObserverNode && this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode); } _featureMenuIntersectionObserverCreated(e) { this._unobserveFeatureMenuObserver(), e && this._featureMenuIntersectionObserver.observe(e), this._featureMenuIntersectionObserverNode = e; } _getActionTitle(e) { const { messages: t, selectedFeature: s } = this, { id: i } = e, n = s?.attributes, o = e.title ?? "", l = i === "zoom-to-feature" ? u(o, { messages: t }) : i === "remove-selected-feature" ? u(o, { messages: t }) : i === "zoom-to-clustered-features" ? u(o, { messages: t }) : i === "browse-clustered-features" ? u(o, { messages: t }) : e.title; return l && n ? u(l, n) : l ?? ""; } _onMainKeydown(e) { const { key: t } = e; t === "ArrowLeft" && (e.stopPropagation(), this._handleFeatureMenuBack(), this.previous(), this.setFocus()), t === "ArrowRight" && (e.stopPropagation(), this._handleFeatureMenuBack(), this.next(), this.setFocus()); } _featureMenuViewportScrollTop() { this._featureMenuViewportNode.value?.scrollContentTo({ top: 0 }); } _selectedFeatureIndexUpdated(e, t) { const { featureCount: s, waitingForResult: i } = this.viewModel; i || !s || e === t || e === -1 || (this._removeFlowItems(), this._rootFlowItemNode.value?.scrollContentTo({ top: 0 })); } _triggerAction(e) { this.triggerAction(e), this.arcgisTriggerAction.emit({ action: e }); } _viewChange() { this.viewModel.clear(), this.open = !1; } _closeOpenActionMenu() { const { _actionBarMenuNode: e } = this; e.value && (e.value.menuOpen = !1); } _removeFlowItems() { this.flowItems?.destroyAll(); } _getDrillInFlowItemDescription(e) { switch (e.flowType) { case "feature": case "feature-association": case "feature-utility-network-associations": case "feature-utility-network-association-type": return e.description; case "feature-relationship": return e.allItemsDescription; } } _handleDrillInBackClick() { this.flowItems?.pop()?.destroy(); } _calculateEffectiveHeading() { const { title: e, selectedFeatureViewModel: t } = this.viewModel; return t ? t?.state === "error" ? this.messages?.errorMessage ?? "" : t?.title || "" : e ?? ""; } _getHeading() { return !this.hideHeading && this.effectiveHeading ? this.effectiveHeading : ""; } _removeSpinner(e) { e?.manager?.component?.extraContent?.remove(this._spinnerEl), this._spinnerEl = void 0; } _createSpinner() { const e = this.referenceElement; e && (this._removeSpinner(e), this._spinnerEl = z(a`<arcgis-spinner .label=${this.messages.loading ?? ""} .trackLocation=${!this.hideSpinner && this.viewModel.visible && this.viewModel?.waitingForResult} .location=${this.viewModel?.location ?? void 0} .view=${this.viewModel?.view ?? void 0}></arcgis-spinner>`), e.manager?.component?.extraContent?.add(this._spinnerEl)); } render() { return a`<div class="root" @keydown=${this._onMainKeydown}>${this._renderHeader()}${this._renderContentContainer()}</div>`; } _renderFeatureNavigation() { return [ this._renderPagination(), this.initialDisplayMode === "list" ? this._renderFeaturePaginationText() : this._renderFeatureMenuButton() ]; } _renderHeader() { return this.featureNavigationTop && this._featureNavigationVisible ? a`<div class="header">${this._renderFeatureNavigation()}</div>` : null; } _renderFooter() { return !this.featureNavigationTop && this._featureNavigationVisible ? a`<div class="footer" slot=footer>${this._renderFeatureNavigation()}</div>` : null; } _renderFeaturePaginationText() { const { messages: e, viewModel: t } = this, { featureCount: s, selectedFeatureIndex: i } = t; return a`<div class="pagination-text">${u(e.pageText ?? "", { index: C(i + 1), total: C(s) })}</div>`; } _renderFeatureMenuButton() { const { messages: e, viewModel: t } = this, { featureCount: s, selectedFeatureIndex: i, pendingPromisesCount: n } = t; return a`<calcite-action class="pagination-menu-button" icon=list .label=${e.selectFeature} .loading=${n > 0} @click=${this._handlePaginationMenuButton} .text=${u(e.pageText ?? "", { index: C(i + 1), total: C(s) })} text-enabled title=${e.selectFeature ?? h}></calcite-action>`; } _renderPagination() { const { previous: e, next: t } = this.messages; return a`<calcite-action-bar class="pagination-action-bar" expand-disabled layout=horizontal overflow-actions-disabled scale=s><calcite-action-group scale=s><calcite-action class="pagination-previous" icon=chevron-left icon-flip-rtl .label=${e ?? ""} @click=${this._previousFeature} .text=${e ?? ""} title=${e ?? "" ?? h}></calcite-action><calcite-action icon=chevron-right icon-flip-rtl .label=${t ?? ""} @click=${this._nextFeature} .text=${t ?? ""} title=${t ?? "" ?? h}></calcite-action></calcite-action-group></calcite-action-bar>`; } _renderFeatureMenuItem(e) { const { initialDisplayMode: t } = this, { selectedFeatureViewModel: s, featureViewModels: i } = this.viewModel, n = e === s, o = i.indexOf(e); return a`<calcite-list-item @blur=${this._removeActiveFeature} @focus=${() => this._setActiveFeature(o)} @mouseleave=${this._removeActiveFeature} @mouseover=${() => this._setActiveFeature(o)} .selected=${n} @calciteListItemSelect=${() => this._selectFeature(o)}><span .innerHTML=${(_.sanitize(e.title) || this.messages.untitled) ?? ""} slot=content></span>${t === "list" ? a`<calcite-icon flip-rtl icon=chevron-right scale=s slot=content-end></calcite-icon>` : null}</calcite-list-item>`; } _renderFeatureMenu() { const { messages: e, viewModel: t } = this, s = this._groupResultsByLayer(), i = this.initialDisplayMode === "list" ? "none" : "single"; return t.featureViewModels.length ? a`<calcite-list display-mode=flat .label=${e?.featuresList ?? ""} selection-appearance=icon .selectionMode=${i}>${Array.from(s.keys(), (n) => { const o = s.get(n)?.map((c) => this._renderFeatureMenuItem(c)), l = n ? n.title ?? this.messages.untitled : null; return !this.hideFeatureListLayerTitle && l !== null ? V(n ?? "map-graphics", a`<calcite-list-item-group .heading=${l}>${o}</calcite-list-item-group>`) : o; })}</calcite-list>` : null; } _renderHeaderAction(e) { const t = e.title || ""; return e.visible ? a`<calcite-action .active=${e.type === "toggle" ? e.value : !1} .disabled=${e.disabled} .icon=${e.icon ?? void 0} .indicator=${e.active} .loading=${e.active} @click=${() => this._triggerAction(e)} slot=header-actions-end .text=${t} title=${t ?? h}></calcite-action>` : null; } _renderHeaderActions() { return this.headerActions.map((e) => this._renderHeaderAction(e)).toArray(); } _renderContentFeature() { const { headingLevel: e, hideCloseButton: t, _isCollapsed: s, _collapseEnabled: i, _featureFlowItemSelected: n, featureNavigationTop: o, flowItems: l, initialDisplayMode: c, selectedFeature: f, hideHeading: v } = this, { active: g, selectedFeatureViewModel: p, content: w } = this.viewModel, d = this._getHeading(); if (c === "list" && !f) return null; const F = l.length === 0 && n, $ = p ? !p.content : !w; return a`<calcite-flow-item class=${T(x({ "content-feature": !0, "flow-item-collapsed": s }))} .closable=${!t} .closed=${!g} .collapsed=${s} .collapseDirection=${this.collapseDirection ?? (o ? "down" : "up")} .collapsible=${i} .headingLevel=${e} .selected=${F} @calciteFlowItemBack=${this._handleFeatureBack} .loading=${!!this._openRelatedFeatureAbortController} .messageOverrides=${{ collapse: this.messages.collapse, expand: this.messages.expand }} @calciteFlowItemClose=${this._handleClose} @calciteFlowItemToggle=${this._handleCollapseToggle} .heading=${!v && d ? k(d) : void 0} ${m(this._rootFlowItemNode)}>${!v && d ? a`<div slot=heading><div .innerHTML=${_.sanitize(d ?? "") ?? ""}></div></div>` : null}${this._renderHeaderActions()}${this._renderActionBar()}<div class=${T(x("container", "content-container", { "content-hidden": $ }))}>${this._renderContent()}</div>${this._renderFooter()}</calcite-flow-item>`; } _renderFeatureMenuContainer() { const { viewModel: e, hideCloseButton: t, featureMenuTitle: s, messages: i, initialDisplayMode: n, featureMenuOpen: o, _featureFlowItemSelected: l, _collapseEnabled: c, _isCollapsed: f, featureNavigationTop: v, headingLevel: g } = this, { active: p, featureViewModels: w, pendingPromisesCount: d } = e, F = s ?? i.selectFeature; if (n === "feature" && !o) return null; const $ = !l; return a`<calcite-flow-item class=${T(x({ "flow-item-collapsed": f }))} .closable=${n === "list" && !t} .closed=${!p} .collapsed=${n === "list" && f} .collapseDirection=${this.collapseDirection ?? (v ? "down" : "up")} .collapsible=${n === "list" && c} .messageOverrides=${{ collapse: this.messages.collapse, expand: this.messages.expand }} .description=${this.hideFeatureMenuHeading ? void 0 : u(i.total ?? "", { total: w.length })} .heading=${this.hideFeatureMenuHeading ? void 0 : F} .headingLevel=${g} .loading=${e.waitingForContents} .selected=${$} @calciteFlowItemBack=${(N) => { N.preventDefault(), this._handleFeatureMenuBack(); }} @calciteFlowItemClose=${this._handleClose} @calciteFlowItemToggle=${this._handleCollapseToggle} ${m(this._featureMenuViewportNode)}>${n === "list" ? this._renderHeaderActions() : null}${d > 0 ? a`<calcite-loader class="loader" inline .label=${i.loading ?? ""} slot=header-actions-end></calcite-loader>` : null}<div class="container">${this._renderFeatureMenu()}</div><div class="feature-menu-observer" ${m(this._featureMenuIntersectionObserverCreated)}></div>${n === "feature" ? a`<calcite-button appearance=transparent @click=${this._handleFeatureMenuBack} slot=footer-start width=full>${i.back}</calcite-button>` : null}</calcite-flow-item>`; } _renderFlowItem(e, t) { const { messages: s, hideCloseButton: i, hideSelectFeature: n, active: o, hideHeading: l } = this, c = "graphic" in e && "isFeatureFromTable" in e && !e.isFeatureFromTable, f = c && !n, v = e.flowType === "feature-association", g = s.returnToInitialFeature ?? "", p = s?.selectFeature, w = this._getActionTitle(M), d = !this.hideActionBar && v && c; return a`<calcite-flow-item .closable=${!i} .closed=${!o} .description=${k(this._getDrillInFlowItemDescription(e) ?? "")} .heading=${l ? void 0 : k(e.heading ?? "")} .selected=${t} @calciteFlowItemBack=${(F) => { F.preventDefault(), this._handleDrillInBackClick(); }} .loading=${!!this._openRelatedFeatureAbortController} @calciteFlowItemClose=${this._handleClose}>${l ? null : a`<div slot=heading><div .innerHTML=${_.sanitize(e.heading ?? "") ?? ""}></div></div>`}<div slot=description><div .innerHTML=${_.sanitize(this._getDrillInFlowItemDescription(e) ?? "") ?? ""}></div></div><calcite-action class="action-exit" icon=move-up @click=${this._removeFlowItems} slot=header-actions-start .text=${g ?? ""} title=${g ?? "" ?? h}></calcite-action>${f ? a`<calcite-action icon=zoom-to-object @click=${() => this._openRelatedFeature(e)} slot=header-actions-end .text=${p ?? ""} title=${p ?? h}></calcite-action>` : null}${d ? a`<calcite-action-bar expand-disabled expanded scale=s slot=action-bar><calcite-action-group overlay-positioning=fixed scale=s><calcite-action .disabled=${M.disabled} .icon=${M.icon ?? void 0} .loading=${M.active} scale=s text-enabled .text=${w} title=${w ?? h} @click=${() => Z(this.viewModel, M, e)}></calcite-action></calcite-action-group></calcite-action-bar>` : null}<div class="container">${e}</div></calcite-flow-item>`; } _renderContentContainer() { const e = this.flowItems?.toArray(), t = e?.map((i, n) => this._renderFlowItem(i, this._featureFlowItemSelected && n === e.length - 1)), s = this.initialDisplayMode === "list" ? [this._renderFeatureMenuContainer(), this._renderContentFeature(), t] : [this._renderContentFeature(), t, this._renderFeatureMenuContainer()]; return a`<calcite-flow ${m(this._flowContainerNode)}>${s}</calcite-flow>`; } _renderActionBar() { const t = this.viewModel.selectedFeatureViewModel?.isFeatureFromTable && !this.location ? this.viewModel.allActions.filter((s) => s.id !== M.id) : this.viewModel.allActions; return !this._isCollapsed && !this.hideActionBar && t.length ? a`<calcite-action-bar expand-disabled .expanded=${!this._hideActionText} scale=s slot=action-bar><calcite-action-group overlay-positioning=fixed scale=s ${m(this._actionBarMenuNode)}>${this._renderActions()}</calcite-action-group></calcite-action-bar>` : null; } _renderActions() { return this.viewModel.allActions.toArray().map((e) => { const t = this._getActionTitle(e); return a`<calcite-action .active=${e.type === "toggle" ? e.value : !1} .disabled=${e.disabled} .icon=${e.icon ?? void 0} .loading=${e.active} scale=s .textEnabled=${!this._hideActionText} .text=${t ?? ""} title=${t ?? h} .hidden=${!e.visible} @click=${() => this._triggerAction(e)}></calcite-action>`; }); } _renderContent() { const { content: e, selectedFeatureViewModel: t } = this.viewModel; return t ? a`<arcgis-feature .autoDestroyDisabled=${this.autoDestroyDisabled} .chartAnimationDisabled=${this.chartAnimationDisabled} .defaultPopupTemplateEnabled=${this.defaultPopupTemplateEnabled} .flowItems=${this.flowItems} .graphic=${t.graphic} .headingLevel=${this.headingLevel + 1} .hideAttachmentsContent=${this.hideAttachmentsContent} .hideContent=${this.hideContent} .hideCustomContent=${this.hideCustomContent} .hideExpressionContent=${this.hideExpressionContent} .hideFieldsContent=${this.hideFieldsContent} hide-heading .hideLastEditedInfo=${this.hideLastEditedInfo} .hideMediaContent=${this.hideMediaContent} .hideTextContent=${this.hideTextContent} .location=${this.location} .map=${this.map} .referenceElement=${this.referenceElement} .showRelationshipContent=${!this.hideRelationshipContent} .showUtilityNetworkContent=${!this.hideUtilityNetworkContent} .spatialReference=${this.spatialReference} .timeZone=${this.timeZone} ${m(this._selectedFeatureComponent)}></arcgis-feature>` : typeof e == "string" ? V(e, a`<div .innerHTML=${_.sanitize(e) ?? ""}></div>`) : e ?? null; } } R("arcgis-features", Q); export { Q as ArcgisFeatures };