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 t}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import{accessibleHandler as s}from"./support/decorators/accessibleHandler.js";import{messageBundle as r}from"./support/decorators/messageBundle.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as n}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import l from"./Track/TrackViewModel.js";const d={base:"esri-track esri-widget--button esri-widget",text:"esri-icon-font-fallback-text",icon:"esri-icon",loading:"esri-icon-loading-indicator",rotating:"esri-rotating",startTrackingIcon:"esri-icon-tracking",stopTrackingIcon:"esri-icon-pause",widgetIcon:"esri-icon-tracking",disabled:"esri-disabled",hidden:"esri-hidden"};let c=class extends i{constructor(e,t){super(e,t),this.iconClass=d.widgetIcon,this.messages=null,this.viewModel=new l}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 scale(){return this.viewModel.scale}set scale(e){this.viewModel.scale=e}get tracking(){return this.viewModel.tracking}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}start(){this.viewModel.start()}stop(){this.viewModel.stop()}render(){const e=this.get("viewModel.state"),t={[d.disabled]:"disabled"===e,[d.hidden]:"feature-unsupported"===e},o="tracking"===e,i={[d.startTrackingIcon]:!o&&"waiting"!==e,[d.stopTrackingIcon]:o,[d.rotating]:"waiting"===e,[d.loading]:"waiting"===e},{messages:s}=this,r=o?s.stopTracking:s.startTracking;return n("div",{bind:this,class:this.classes(d.base,t),hidden:"feature-unsupported"===e,onclick:this._toggleTracking,onkeydown:this._toggleTracking,role:"button",tabIndex:0,"aria-label":r,title:r},n("span",{"aria-hidden":"true",class:this.classes(d.icon,i)}),n("span",{class:d.text},r))}_toggleTracking(){const e=this.viewModel;e&&"feature-unsupported"!==e.state&&"disabled"!==e.state&&("tracking"!==e.state&&"waiting"!==e.state?this.viewModel.start():this.viewModel.stop())}};e([t()],c.prototype,"geolocationOptions",null),e([t()],c.prototype,"goToLocationEnabled",null),e([t()],c.prototype,"goToOverride",null),e([t()],c.prototype,"graphic",null),e([t()],c.prototype,"iconClass",void 0),e([t()],c.prototype,"label",null),e([t(),r("esri/widgets/Track/t9n/Track")],c.prototype,"messages",void 0),e([t()],c.prototype,"scale",null),e([t({readOnly:!0})],c.prototype,"tracking",null),e([t()],c.prototype,"useHeadingEnabled",null),e([t()],c.prototype,"view",null),e([t({type:l}),a(["track","track-error"])],c.prototype,"viewModel",void 0),e([s()],c.prototype,"_toggleTracking",null),c=e([o("esri.widgets.Track")],c);const p=c;export{p as default};
|