@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.64 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{property as i,subclass as o}from"../../core/accessorSupport/decorators.js";import{tsx as l}from"../support/widget.js";import s from"./ValuePickerBaseComponent.js";let c=class extends s{constructor(e,t){super(e,t),this.collection=null,this.type="collection"}get canNext(){return!(!this.collection?.length||!this.viewModel)&&this.collection.at(-1)!==this.viewModel.values?.[0]}get canPlay(){return null!=this.viewModel&&!!this.collection?.length}get canPrevious(){return!(!this.collection?.length||!this.viewModel)&&this.collection.at(0)!==this.viewModel.values?.[0]}render(){return l("div",null)}animate(e){this._step(1,e)}next(){this._step(1)}previous(){this._step(-1)}_step(e,t=!1){if(!this.viewModel||!this.collection?.length)return;if(!this.viewModel.values)return void(this.viewModel.values=[this.collection.at(0)]);if(!this.collection.includes(this.viewModel.values[0]))return void(this.viewModel.values=[this.collection.at(0)]);const i=this.collection.indexOf(this.viewModel.values[0])+e;i<0||i>=this.collection.length?this.viewModel.loop||t?this.viewModel.values=[this.collection.at(1===e?0:-1)]:"playing"===this.viewModel.state&&this.viewModel.pause():this.viewModel.values=[this.collection.at(i)]}};e([i()],c.prototype,"canNext",null),e([i()],c.prototype,"canPlay",null),e([i()],c.prototype,"canPrevious",null),e([i({type:t})],c.prototype,"collection",void 0),e([i()],c.prototype,"type",void 0),c=e([o("esri.widgets.ValuePicker.ValuePickerCollection")],c);const n=c;export{n as default};