@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 4.23 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as t}from"tslib";import{JSONSupport as e}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{setDeepValue as o}from"../../core/object.js";import{property as p,subclass as i}from"../../core/accessorSupport/decorators.js";import{Integer as n,Null as s}from"../../core/accessorSupport/ensureType.js";import{timeUnitKebabDictionary as l}from"../../portal/timeUnitKebabDictionary.js";import u from"../../time/TimeExtent.js";import m from"../../time/TimeInterval.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{writer as d}from"../../core/accessorSupport/decorators/writer.js";var c;let T=c=class extends e{constructor(t){super(t),this.currentTimeExtent=null,this.fullTimeExtent=null,this.loop=!1,this.numStops=null,this.numThumbs=null,this.stopDelay=null,this.stopInterval=null,this.stops=null}readCurrentTimeExtent(t){return t?u.fromArray(t):void 0}writeCurrentTimeExtent(t,e,r){t&&o(r,t.toArray(),e)}readFullTimeExtent(t,e){const r=e.properties;if(!r)return;const o=null!=r.endTime?new Date(r.endTime):null,p=null!=r.startTime?new Date(r.startTime):null;return new u({start:p,end:o})}writeFullTimeExtent(t,e){if(!t)return;const r=e.properties=e.properties||{},o=t.end,p=t.start;o&&(r.endTime=null!=o?o.getTime():null),p&&(r.startTime=null!=p?p.getTime():null)}readStopInterval(t,e,r){return t?m.fromJSON({value:t.interval,unit:t.units},r):null}writeStopInterval(t,e,r,p){if(!t)return;const i=t.toJSON(p);o("properties.timeStopInterval",{interval:i.value,units:i.unit},e)}readStops(t){return t?.length?t.map(t=>new Date(t)):null}writeStops(t,e,r){t?.length&&o(r,t.map(t=>t.getTime()),e)}clone(){return new c(r({currentTimeExtent:this.currentTimeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:this.numStops,numThumbs:this.numThumbs,stopDelay:this.stopDelay,stopInterval:this.stopInterval,stops:this.stops}))}};t([p({type:u,json:{type:[[n,s]],read:{source:"properties.currentTimeExtent"},write:{target:"properties.currentTimeExtent"}}})],T.prototype,"currentTimeExtent",void 0),t([a("currentTimeExtent")],T.prototype,"readCurrentTimeExtent",null),t([d("currentTimeExtent")],T.prototype,"writeCurrentTimeExtent",null),t([p({type:u,json:{read:{source:["properties.endTime","properties.startTime"]},write:{target:{"properties.endTime":{type:Number},"properties.startTime":{type:Number}}}}})],T.prototype,"fullTimeExtent",void 0),t([a("fullTimeExtent")],T.prototype,"readFullTimeExtent",null),t([d("fullTimeExtent")],T.prototype,"writeFullTimeExtent",null),t([p({type:Boolean,nonNullable:!0,json:{default:!1,read:{source:"properties.loop"},write:{target:"properties.loop"}}})],T.prototype,"loop",void 0),t([p({type:n,json:{read:{source:"properties.numberOfStops"},write:{target:"properties.numberOfStops",overridePolicy(){const t=!!this.stopInterval,e=!!this.stops?.length,r=!(t||e);return{enabled:r,isRequired:r}}}}})],T.prototype,"numStops",void 0),t([p({type:[1,2],nonNullable:!0,json:{type:n,read:{source:"properties.thumbCount"},write:{target:"properties.thumbCount",isRequired:!0}}})],T.prototype,"numThumbs",void 0),t([p({type:Number,nonNullable:!0,json:{read:{source:"properties.thumbMovingRate"},write:{target:"properties.thumbMovingRate",isRequired:!0}}})],T.prototype,"stopDelay",void 0),t([p({type:m,json:{read:{source:"properties.timeStopInterval"},write:{target:{"properties.timeStopInterval.interval":{type:Number},"properties.timeStopInterval.units":{type:l.jsonValues.filter(t=>"esriTimeUnitsUnknown"!==t)}},overridePolicy(){const t=null!=this.numStops,e=!!this.stops?.length;return{enabled:!e,isRequired:!(t||e)}}}}})],T.prototype,"stopInterval",void 0),t([a("stopInterval")],T.prototype,"readStopInterval",null),t([d("stopInterval")],T.prototype,"writeStopInterval",null),t([p({type:[Date],json:{type:[n],read:{source:"properties.stops"},write:{target:"properties.stops",overridePolicy(){return{isRequired:null==this.numStops&&!this.stopInterval}}}}})],T.prototype,"stops",void 0),t([a("stops")],T.prototype,"readStops",null),t([d("stops")],T.prototype,"writeStops",null),T=c=t([i("esri.webdoc.widgets.TimeSlider")],T);const y=T;export{y as default};