UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 10.8 kB
import{_ as s}from"../chunks/tslib.es6.js";import t from"../core/Handles.js";import{watch as i}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{cast as e}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import"./support/widgetUtils.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as c}from"./support/jsxFactory.js";import r from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";const d={widgetBlockContent:"esri-un-associations__widget-block-content",widgetBlockActions:"esri-un-associations__widget-block-actions",widgetSettingsContainer:"esri-un-associations__widget-settings-container",widgetControlsLabelAndToggle:"esri-un-associations__controls-label-and-toggle",widgetControlsLabelAndSlider:"esri-un-associations__controls-label-and-slider",widgetControlsLabel:"esri-un-associations__controls-label",widgetControlsSlider:"esri-un-associations__controls-slider"},h={maxAllowableAssociationsSlider:!1};let A=class extends l{constructor(s,i){super(s,i),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._handles=new t,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this._warningMessage="",this.messages=null,this.showAssociationsEnabled=!1,this.viewModel=new r,this.visibleElements={...h}}initialize(){this._handles.add([i((()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations]),(()=>{!0===this.autoRefreshAssociations&&(!0===this.showAssociationsEnabled?this.viewModel.showAssociations():this.viewModel.removeAssociations())}))])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(s){this._autoRefreshAssociations=s}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(s){this.viewModel.connectivityAssociationsLineSymbol=s}get gdbVersion(){return this.viewModel.gdbVersion}set gdbVersion(s){this.viewModel.gdbVersion=s}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(s){this.viewModel.includeConnectivityAssociations=s}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(s){this.viewModel.includeStructuralAttachmentAssociations=s}get label(){return this.messages?.widgetLabel??""}set label(s){this._overrideIfSome("label",s)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(s){this.viewModel.maxAllowableAssociations=s}get maxAllowableAssociationsExceeded(){return this.viewModel.maxAllowableAssociationsExceeded}set maxAllowableAssociationsExceeded(s){this.viewModel.maxAllowableAssociationsExceeded=s}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(s){s<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=s)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(s){s<0||s>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=s)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(s){this._maxAllowableAssociationsSliderStep=s}get moment(){return this.viewModel.moment}set moment(s){this.viewModel.moment=s}get noAssociationsFound(){return this.viewModel.noAssociationsFound}set noAssociationsFound(s){this.viewModel.noAssociationsFound=s}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(s){this.viewModel.showArrowsConnectivity=s}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(s){this.viewModel.showArrowsStructuralAttachment=s}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(s){this.viewModel.structuralAttachmentAssociationsLineSymbol=s}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(s){this.viewModel.utilityNetwork=s}get view(){return this.viewModel.view}set view(s){this.viewModel.view=s}castVisibleElements(s){return{...h,...s}}render(){const{messages:s}=this;return c("div",null,c("calcite-block",{heading:s.widgetLabel,class:d.widgetBlockContent,collapsible:!0,open:!0},this.autoRefreshAssociations?this.renderShowAssociationsSwitch():this.renderRefreshAssociationsAction(),this.renderShowStatusIcon(),this.renderSettings()),this.autoRefreshAssociations?this.renderShowAssociationsSwitchTooltip():this.renderRefreshAssociationsActionTooltip(),this.renderShowStatusIconTooltip())}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-slider.js"),import("@esri/calcite-components/dist/components/calcite-switch.js"),import("@esri/calcite-components/dist/components/calcite-tooltip.js")])}renderConnectivityAssociationsToggle(){const{messages:{enableConnectivity:s}}=this;return c("div",{class:d.widgetControlsLabelAndToggle},c("calcite-label",{class:d.widgetControlsLabel},s),c("calcite-switch",{bind:this,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,checked:this.includeConnectivityAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}renderMaxAllowableAssociationsSlider(){const{messages:{maxAllowableAssociations:s},visibleElements:{maxAllowableAssociationsSlider:t}}=this;return t?c("div",{class:d.widgetControlsLabelAndSlider},c("calcite-label",{class:d.widgetControlsLabel},s),c("calcite-slider",{bind:this,class:d.widgetControlsSlider,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,min:this.maxAllowableAssociationsSliderMin,max:this.maxAllowableAssociationsSliderMax,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,labelTicks:!0,snap:!0,scale:"s",onCalciteSliderChange:this._maxAllowableAssociationsSliderChange})):null}renderRefreshAssociationsAction(){return c("div",{slot:"control",style:"--calcite-ui-icon-color: #077ac2"},c("calcite-action",{id:"refreshAssociations-action",bind:this,class:d.widgetBlockActions,icon:"refresh-",text:"",onclick:this._refreshAssociations}))}renderRefreshAssociationsActionTooltip(){const{messages:{enableAssociations:s}}=this;return c("calcite-tooltip",{label:"refreshAssociations-action-tooltip-label",referenceElement:"refreshAssociations-action"},c("span",null,s))}renderSettings(){return c("div",{class:d.widgetSettingsContainer},this.renderConnectivityAssociationsToggle(),this.renderStructuralAttachmentAssociationsToggle(),this.renderMaxAllowableAssociationsSlider())}renderShowAssociationsSwitch(){return c("calcite-switch",{id:"showAssociations-switch",bind:this,class:d.widgetBlockActions,checked:this.showAssociationsEnabled,onCalciteSwitchChange:this._showAssociationsSwitchChange,slot:"control"})}renderShowAssociationsSwitchTooltip(){const{messages:{enableAssociations:s}}=this;return c("calcite-tooltip",{label:"showAssociations-switch-tooltip-label",referenceElement:"showAssociations-switch"},c("span",null,s))}renderShowStatusIcon(){const{messages:{maxAllowableAssociationsExceededWarning:s,noAssociationsFoundWarning:t}}=this,i=()=>this.maxAllowableAssociationsExceeded?(this._warningMessage=s,"exclamation-mark-triangle"):this.noAssociationsFound?(this._warningMessage=t,"exclamation-mark-triangle"):"blank",o=()=>"blank"===i();return c("div",{slot:"control",style:"--calcite-ui-icon-color: #edd317"},c("calcite-action",{id:"statusIcon-action",class:d.widgetBlockActions,icon:i(),disabled:o(),text:"",slot:"control"}))}renderShowStatusIconTooltip(){return c("calcite-tooltip",{label:"statusIcon-action-tooltip-label",referenceElement:"statusIcon-action"},c("span",null,this._warningMessage))}renderStructuralAttachmentAssociationsToggle(){const{messages:{enableStructuralAttachment:s}}=this;return c("div",{class:d.widgetControlsLabelAndToggle},c("calcite-label",{class:d.widgetControlsLabel},s),c("calcite-switch",{bind:this,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,checked:this.includeStructuralAttachmentAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_connectivityAssociationsSwitchChange(s){this.includeConnectivityAssociations=s.target.checked}_maxAllowableAssociationsSliderChange(s){this.maxAllowableAssociations=Number(s.target.value)}_refreshAssociations(){this.viewModel.showAssociations()}_showAssociationsSwitchChange(s){this.showAssociationsEnabled=s.target.checked,this._associationsOptionsEnabled=s.target.checked}_structuralAttAssociationsSwitchChange(s){this.includeStructuralAttachmentAssociations=s.target.checked}};s([o()],A.prototype,"connectivityAssociationsLineSymbol",null),s([o()],A.prototype,"gdbVersion",null),s([o()],A.prototype,"includeConnectivityAssociations",null),s([o()],A.prototype,"includeStructuralAttachmentAssociations",null),s([o()],A.prototype,"label",null),s([o()],A.prototype,"maxAllowableAssociations",null),s([o()],A.prototype,"maxAllowableAssociationsExceeded",null),s([o()],A.prototype,"maxAllowableAssociationsSliderMax",null),s([o()],A.prototype,"maxAllowableAssociationsSliderMin",null),s([o()],A.prototype,"maxAllowableAssociationsSliderStep",null),s([o(),a("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations")],A.prototype,"messages",void 0),s([o()],A.prototype,"moment",null),s([o()],A.prototype,"noAssociationsFound",null),s([o()],A.prototype,"showArrowsConnectivity",null),s([o()],A.prototype,"showArrowsStructuralAttachment",null),s([o()],A.prototype,"showAssociationsEnabled",void 0),s([o()],A.prototype,"structuralAttachmentAssociationsLineSymbol",null),s([o()],A.prototype,"utilityNetwork",null),s([o()],A.prototype,"view",null),s([o({type:r})],A.prototype,"viewModel",void 0),s([o()],A.prototype,"visibleElements",void 0),s([e("visibleElements")],A.prototype,"castVisibleElements",null),A=s([n("esri.widgets.UtilityNetworkAssociations")],A);const w=A;export{w as default};