Locate.js 3.2 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.24/esri/copyright.txt for details.
  4. */
  5. import{_ as o}from"../chunks/tslib.es6.js";import{aliasOf as e}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import a from"./Locate/LocateViewModel.js";import{accessibleHandler as r}from"./support/decorators/accessibleHandler.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import{vmEvent as c}from"./support/decorators/vmEvent.js";import{tsx as n}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const d={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 p=class extends i{constructor(o,e){super(o,e),this.geolocationOptions=null,this.goToLocationEnabled=null,this.goToOverride=null,this.graphic=null,this.iconClass=d.widgetIcon,this.label=void 0,this.messages=null,this.messagesCommon=null,this.popupEnabled=null,this.scale=null,this.useHeadingEnabled=null,this.view=null,this.viewModel=new a}cancelLocate(){}locate(){}render(){const o=this.get("viewModel.state"),e="locating"===o,t={[d.disabled]:"disabled"===o,[d.hidden]:"feature-unsupported"===o},s={[d.loading]:e,[d.rotating]:e,[d.locate]:!e},i="locating"===o?this.messagesCommon.cancel:this.messages.title;return n("div",{bind:this,class:this.classes(d.base,t),hidden:"feature-unsupported"===o,onclick:this._locate,onkeydown:this._locate,role:"button",tabIndex:0,"aria-label":i,title:i},n("span",{"aria-hidden":"true",class:this.classes(d.icon,s)}),n("span",{class:d.text},this.messages.title))}_locate(){const{viewModel:o}=this;"locating"===o.state?o.cancelLocate():o.locate()}};o([e("viewModel.geolocationOptions")],p.prototype,"geolocationOptions",void 0),o([e("viewModel.goToLocationEnabled")],p.prototype,"goToLocationEnabled",void 0),o([e("viewModel.goToOverride")],p.prototype,"goToOverride",void 0),o([e("viewModel.graphic")],p.prototype,"graphic",void 0),o([t()],p.prototype,"iconClass",void 0),o([t({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],p.prototype,"label",void 0),o([t(),l("esri/widgets/Locate/t9n/Locate")],p.prototype,"messages",void 0),o([t(),l("esri/t9n/common")],p.prototype,"messagesCommon",void 0),o([e("viewModel.popupEnabled")],p.prototype,"popupEnabled",void 0),o([e("viewModel.scale")],p.prototype,"scale",void 0),o([e("viewModel.useHeadingEnabled")],p.prototype,"useHeadingEnabled",void 0),o([e("viewModel.view")],p.prototype,"view",void 0),o([t({type:a}),c(["locate","locate-error"])],p.prototype,"viewModel",void 0),o([e("viewModel.cancelLocate")],p.prototype,"cancelLocate",null),o([e("viewModel.locate")],p.prototype,"locate",null),o([r()],p.prototype,"_locate",null),p=o([s("esri.widgets.Locate")],p);const u=p;export{u as default};