UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 1.77 kB
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/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../support/widgetUtils.js";import{tsx as s}from"../support/jsxFactory.js";import l from"./ValuePickerBaseComponent.js";let r=class extends l{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 s("div",null)}animate(){this._step(1)}next(){this._step(1)}previous(){this._step(-1)}_step(e){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 t=this.collection.indexOf(this.viewModel.values[0])+e;t<0||t>=this.collection.length?this.viewModel.loop?this.viewModel.values=[this.collection.at(1===e?0:-1)]:"playing"===this.viewModel.state&&this.viewModel.pause():this.viewModel.values=[this.collection.at(t)]}};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};