12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import o from"../Widget.js";import s from"./FeatureContent/FeatureContentViewModel.js";import{shouldOpenInNewTab as a}from"./support/featureUtils.js";import{isWidget as i}from"../support/widget.js";import{tsx as n}from"../support/jsxFactory.js";const d={base:"esri-feature-content",loaderContainer:"esri-feature-content__loader-container",loader:"esri-feature-content__loader"};let c=class extends o{constructor(e,r){super(e,r),this.viewModel=null,this._addTargetToAnchors=e=>{Array.from(e.querySelectorAll("a")).forEach((e=>{a(e.href)&&!e.hasAttribute("target")&&e.setAttribute("target","_blank")}))}}get creator(){return this.viewModel.creator}set creator(e){this.viewModel.creator=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}renderLoading(){return n("div",{class:d.loaderContainer,key:"loader"},n("div",{class:d.loader}))}renderCreated(){const e=this.viewModel?.created;return e?e instanceof HTMLElement?n("div",{key:e,bind:e,afterCreate:this._attachToNode}):i(e)?n("div",{key:e},!e.destroyed&&e.render()):n("div",{key:e,innerHTML:e,afterCreate:this._addTargetToAnchors}):null}render(){const e=this.viewModel?.state;return n("div",{class:d.base},"loading"===e?this.renderLoading():this.renderCreated())}_attachToNode(e){const r=this;e.appendChild(r)}};e([r()],c.prototype,"creator",null),e([r()],c.prototype,"graphic",null),e([r({type:s})],c.prototype,"viewModel",void 0),c=e([t("esri.widgets.Feature.FeatureContent")],c);const l=c;export{l as default};
|