UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.93 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../support/widgetUtils.js";import{tsx as l}from"../support/jsxFactory.js";import s from"./ValuePickerBaseComponent.js";let r=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 o=this.collection.indexOf(this.viewModel.values[0])+e;o<0||o>=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(o)]}};e([o()],r.prototype,"canNext",null),e([o()],r.prototype,"canPlay",null),e([o()],r.prototype,"canPrevious",null),e([o({type:t})],r.prototype,"collection",void 0),e([o()],r.prototype,"type",void 0),r=e([i("esri.widgets.ValuePicker.ValuePickerCollection")],r);const c=r;export{c as default};