UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 4.62 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{_ as e}from"../chunks/tslib.es6.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as t}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import l from"./BuildingExplorer/BuildingExplorerViewModel.js";import{css as o}from"./BuildingExplorer/css.js";import n from"./BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js";import a from"./BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js";import d from"./BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{Heading as m}from"./support/Heading.js";import{classes as u}from"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as h}from"./support/jsxFactory.js";const v={levels:!0,phases:!0,disciplines:!0};let y=class extends r{constructor(e,i){super(e,i),this._defaultViewModel=new l,this.viewModel=this._defaultViewModel,this.visibleElements={...v},this.headingLevel=3,this.messages=null,this.messagesCommon=null,this.toggleSiblingsVisibility=!1}loadDependencies(){return p({loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}_castVisibleElements(e){return{...v,...e}}get icon(){return"organization"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}render(){const e=this.viewModel,i="disabled"===e.state||!e.isSupported;return h("div",{"aria-label":this.messages.widgetLabel,class:u(c.widget,o.base,c.panel,{[c.widgetDisabled]:i}),key:this},this._renderContent())}_renderContent(){const e=this.viewModel,i=this.messages;if(!e.isSupported)return h("p",{class:o.panelError},i.unsupported);if(!e.layers.length)return h("p",{class:o.panelError},i.noData);switch(e.state){case"loading":return this._renderLoadingIndicator();case"ready":return h("div",{class:o.content,key:"content"},this._renderLevelPickerSection(),this._renderPhasePickerSection(),this._renderDisciplinesSection());case"failed":return h("p",{class:o.panelError},i.failed);default:return null}}_renderLoadingIndicator(){const e=this.messagesCommon.loading;return h("div",{"aria-label":e,class:o.loadingContainer,key:"loading-container",role:"presentation",title:e},h("calcite-loader",{label:e,type:"indeterminate"}))}_renderLevelPickerSection(){const e=this.viewModel.level,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.levels||!i||!s)return null;const t=this.messages?.level;return h("div",{class:u(o.section,o.levels),key:"levels"},h(m,{level:this.headingLevel},t?.title),h(a,{messages:t,vm:e}))}_renderPhasePickerSection(){const e=this.viewModel.phase,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.phases||!i||!s)return null;const t=this.messages.phase;return h("div",{class:u(o.section,o.phases),key:"phases"},h(m,{level:this.headingLevel},t.title),h(d,{messages:t,vm:e}))}_renderDisciplinesSection(){const e=this.viewModel.disciplines,i="ready"===e.state,s=e.root.hasChildren;if(!this.visibleElements.disciplines||!i||!s)return null;const t=this.messages?.disciplines;return h("div",{class:u(o.section,o.disciplines),key:"disciplines"},h(m,{level:this.headingLevel},t.title),h(n,{messages:t,toggleSiblingsVisibility:this.toggleSiblingsVisibility,vm:e}))}};e([i({type:l})],y.prototype,"viewModel",void 0),e([i()],y.prototype,"view",null),e([i()],y.prototype,"layers",null),e([i()],y.prototype,"visibleElements",void 0),e([s("visibleElements")],y.prototype,"_castVisibleElements",null),e([i()],y.prototype,"headingLevel",void 0),e([i()],y.prototype,"icon",null),e([i()],y.prototype,"label",null),e([i(),g("esri/widgets/BuildingExplorer/t9n/BuildingExplorer")],y.prototype,"messages",void 0),e([i(),g("esri/t9n/common")],y.prototype,"messagesCommon",void 0),e([i({nonNullable:!0})],y.prototype,"toggleSiblingsVisibility",void 0),e([i()],y.prototype,"uiStrings",void 0),y=e([t("esri.widgets.BuildingExplorer")],y);const w=y;export{w as default};