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 o}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 s from"./Widget.js";import i from"./Locate/LocateViewModel.js";import{accessibleHandler as r}from"./support/decorators/accessibleHandler.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{vmEvent as l}from"./support/decorators/vmEvent.js";import{tsx as n}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const c={base:"esri-locate esri-widget--button esri-widget",text:"esri-icon-font-fallback-text",icon:"esri-icon",locate:"esri-icon-locate",loading:"esri-icon-loading-indicator",rotating:"esri-rotating",widgetIcon:"esri-icon-north-navigation",disabled:"esri-disabled",hidden:"esri-hidden"};let d=class extends s{constructor(e,o){super(e,o),this.iconClass=c.widgetIcon,this.messages=null,this.messagesCommon=null,this.viewModel=new i}get geolocationOptions(){return this.viewModel.geolocationOptions}set geolocationOptions(e){this.viewModel.geolocationOptions=e}get goToLocationEnabled(){return this.viewModel.goToLocationEnabled}set goToLocationEnabled(e){this.viewModel.goToLocationEnabled=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get scale(){return this.viewModel.scale}set scale(e){this.viewModel.scale=e}get useHeadingEnabled(){return this.viewModel.useHeadingEnabled}set useHeadingEnabled(e){this.viewModel.useHeadingEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}cancelLocate(){this.viewModel.cancelLocate()}locate(){return this.viewModel.locate()}render(){const e=this.get("viewModel.state"),o="locating"===e,t={[c.disabled]:"disabled"===e,[c.hidden]:"feature-unsupported"===e},s={[c.loading]:o,[c.rotating]:o,[c.locate]:!o},i="locating"===e?this.messagesCommon.cancel:this.messages.title;return n("div",{bind:this,class:this.classes(c.base,t),hidden:"feature-unsupported"===e,onclick:this._locate,onkeydown:this._locate,role:"button",tabIndex:0,"aria-label":i,title:i},n("span",{"aria-hidden":"true",class:this.classes(c.icon,s)}),n("span",{class:c.text},this.messages.title))}_locate(){const{viewModel:e}=this;"locating"===e.state?e.cancelLocate():e.locate()}};e([o()],d.prototype,"geolocationOptions",null),e([o()],d.prototype,"goToLocationEnabled",null),e([o()],d.prototype,"goToOverride",null),e([o()],d.prototype,"graphic",null),e([o()],d.prototype,"iconClass",void 0),e([o()],d.prototype,"label",null),e([o(),a("esri/widgets/Locate/t9n/Locate")],d.prototype,"messages",void 0),e([o(),a("esri/t9n/common")],d.prototype,"messagesCommon",void 0),e([o()],d.prototype,"popupEnabled",null),e([o()],d.prototype,"scale",null),e([o()],d.prototype,"useHeadingEnabled",null),e([o()],d.prototype,"view",null),e([o({type:i}),l(["locate","locate-error"])],d.prototype,"viewModel",void 0),e([r()],d.prototype,"_locate",null),d=e([t("esri.widgets.Locate")],d);const p=d;export{p as default};
|