@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 4.4 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{setDeepValue as o}from"../../core/object.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as p,Null as n}from"../../core/accessorSupport/ensureType.js";import{reader as i}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import{timeUnitKebabDictionary as a}from"../../portal/timeUnitKebabDictionary.js";import{T as m}from"../../chunks/TimeExtent.js";import{T as c}from"../../chunks/TimeInterval.js";var d;let T=d=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?m.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,s=null!=r.startTime?new Date(r.startTime):null;return new m({start:s,end:o})}writeFullTimeExtent(t,e){if(!t)return;const r=e.properties=e.properties||{},o=t.end,s=t.start;o&&(r.endTime=null!=o?o.getTime():null),s&&(r.startTime=null!=s?s.getTime():null)}readStopInterval(t,e,r){return t?c.fromJSON({value:t.interval,unit:t.units},r):null}writeStopInterval(t,e,r,s){if(!t)return;const p=t.toJSON(s);o("properties.timeStopInterval",{interval:p.value,units:p.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 d(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([s({type:m,json:{type:[[p,n]],read:{source:"properties.currentTimeExtent"},write:{target:"properties.currentTimeExtent"}}})],T.prototype,"currentTimeExtent",void 0),t([i("currentTimeExtent")],T.prototype,"readCurrentTimeExtent",null),t([u("currentTimeExtent")],T.prototype,"writeCurrentTimeExtent",null),t([s({type:m,json:{read:{source:["properties.endTime","properties.startTime"]},write:{target:{"properties.endTime":{type:Number},"properties.startTime":{type:Number}}}}})],T.prototype,"fullTimeExtent",void 0),t([i("fullTimeExtent")],T.prototype,"readFullTimeExtent",null),t([u("fullTimeExtent")],T.prototype,"writeFullTimeExtent",null),t([s({type:Boolean,nonNullable:!0,json:{default:!1,read:{source:"properties.loop"},write:{target:"properties.loop"}}})],T.prototype,"loop",void 0),t([s({type:p,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([s({type:[1,2],nonNullable:!0,json:{type:p,read:{source:"properties.thumbCount"},write:{target:"properties.thumbCount",isRequired:!0}}})],T.prototype,"numThumbs",void 0),t([s({type:Number,nonNullable:!0,json:{read:{source:"properties.thumbMovingRate"},write:{target:"properties.thumbMovingRate",isRequired:!0}}})],T.prototype,"stopDelay",void 0),t([s({type:c,json:{read:{source:"properties.timeStopInterval"},write:{target:{"properties.timeStopInterval.interval":{type:Number},"properties.timeStopInterval.units":{type:a.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([i("stopInterval")],T.prototype,"readStopInterval",null),t([u("stopInterval")],T.prototype,"writeStopInterval",null),t([s({type:[Date],json:{type:[p],read:{source:"properties.stops"},write:{target:"properties.stops",overridePolicy(){return{isRequired:null==this.numStops&&!this.stopInterval}}}}})],T.prototype,"stops",void 0),t([i("stops")],T.prototype,"readStops",null),t([u("stops")],T.prototype,"writeStops",null),T=d=t([l("esri.webdoc.widgets.TimeSlider")],T);const y=T;export{y as default};