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{ignoreAbortErrors as t}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import r from"./Slice/SliceViewModel.js";import{Heading as o}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{tsx as c}from"./support/jsxFactory.js";const a="esri-slice",d={buttonDisabled:"esri-button--disabled",layerIncludeButton:"esri-slice__cross",widgetIcon:"esri-icon-slice",base:`${a} esri-widget esri-widget--panel`,layerList:`${a}__settings`,layerListHeading:"esri-slice__settings-title",layerItem:`${a}__layer-item`,layerItemTitle:`${a}__layer-item__title`,container:`${a}__container`,actionSection:"esri-slice__actions",hint:`${a}__hint`,hintText:`${a}__hint-text`,panelError:`${a}__panel--error`,newSliceButton:`${a}__clear-button esri-button esri-button--primary`,excludeButton:`${a}__exclude-button esri-button esri-button--secondary`,cancelButton:`${a}__cancel-button esri-button esri-button--secondary`};let u=class extends l{constructor(e,t){super(e,t),this.headingLevel=3,this.iconClass=d.widgetIcon,this.messages=null,this.viewModel=new r}loadDependencies(){return import("@esri/calcite-components/dist/components/calcite-button.js")}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const e=this.viewModel.supported,t=this.viewModel.active,s="disabled"===this.viewModel.state,i="ready"===this.viewModel.state,l="slicing"===this.viewModel.state||"sliced"===this.viewModel.state,r="exclude"===this.viewModel.layersMode,{messages:n}=this,a=s&&d.buttonDisabled,u=t&&!l||r?null:c("button",{disabled:s,class:this.classes(d.newSliceButton,a),bind:this,onclick:this._onNewSliceClick,key:"esri-slice__clear",type:"button"},n.newSlice),p=l&&!r?c("button",{class:this.classes(d.excludeButton,a),bind:this,onclick:()=>{this.viewModel.enterExcludeLayerMode()},key:"esri-slice__exclude",type:"button"},n.excludeLayer):null,y=t&&r?c("button",{class:this.classes(d.cancelButton,a),bind:this,onclick:()=>{this.viewModel.exitExcludeLayerMode()},key:"esri-slice__cancel-exclude",type:"button"},n.cancel):null;let h=null;t&&(r?h=n.excludeHint:i&&(h=n.hint));const v=h?c("div",{class:d.hint,key:"esri-slice__hint"},c("p",{class:d.hintText},h)):null,_=this.excludedLayers?this.excludedLayers.toArray().map((e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)}))):[];this.excludeGroundSurface&&_.push(this._renderLayerItem({uid:"ground",title:n.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)}));const b=!r&&l&&_.length>0?c("div",{class:d.layerList,key:"esri-slice__settings"},c(o,{class:d.layerListHeading,level:this.headingLevel},n.excludedLayers),c("ul",null,_)):null,m=c("div",{class:d.panelError,key:"esri-slice__unsupported"},c("p",null,n.unsupported)),w=c("div",{class:d.actionSection},p,y,u),g=this.visible?c("div",{class:d.container},e?[v,b,w]:m):null;return c("div",{class:d.base,role:"presentation"},g)}_renderLayerItem(e){return c("li",{class:d.layerItem,key:e.uid},c("calcite-button",{appearance:"transparent",class:d.layerIncludeButton,"icon-start":"x",scale:"s",title:this.messages.includeLayer,bind:this,onclick:e.onClick}),c("div",{class:d.layerItemTitle},e.title))}_onNewSliceClick(){t(this.viewModel.start())}};e([s()],u.prototype,"active",null),e([s({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",null),e([s()],u.prototype,"excludedLayers",null),e([s()],u.prototype,"excludeGroundSurface",null),e([s()],u.prototype,"headingLevel",void 0),e([s()],u.prototype,"iconClass",void 0),e([s()],u.prototype,"label",null),e([s(),n("esri/widgets/Slice/t9n/Slice")],u.prototype,"messages",void 0),e([s()],u.prototype,"view",null),e([s({type:r})],u.prototype,"viewModel",void 0),e([s()],u.prototype,"visible",null),u=e([i("esri.widgets.Slice")],u);const p=u;export{p as default};
|