You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
7.5 KiB
18 lines
7.5 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("require ../chunks/tslib.es6 ../core/Logger ../core/reactiveUtils ../core/accessorSupport/decorators/property ../core/has ../core/RandomLCG ../core/accessorSupport/decorators/subclass ./Widget ./Daylight/css ./Daylight/DaylightViewModel ./Daylight/VisibleElements ./Daylight/support/daylightUtils ./Daylight/support/SliderWithDropdown ../chunks/componentsUtils ./support/globalCss ./support/Heading ./support/timeWidgetUtils ./support/widgetUtils ./support/decorators/messageBundle ./support/jsxFactory".split(" "), |
|
function(n,h,x,l,k,e,E,y,z,d,r,t,A,B,C,p,D,q,F,u,f){e=class extends z{constructor(a,c){super(a,c);this.headingLevel=3;this.viewModel=new r;this.visibleElements=new t;this.dateOrSeason="date";this._timeSlider=new B({viewModel:this.viewModel.timeSliderViewModel,steps:this.timeSliderSteps,labelInputsEnabled:!1,visibleElements:{labels:!0},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:(b,g,m)=>q.onPrimaryTickCreated({tickElement:g,labelElement:m,tickClasses:v, |
|
onClick:this._makeGoToTime(b)})},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:(b,g)=>q.onSecondaryTickCreated({tickElement:g,tickClasses:v,onClick:this._makeGoToTime(b)})}]});this._datePicker=null;this._onPlayDayClick=()=>{this.viewModel.toggleDayPlaying()};this._onDatePickerAfterCreate=b=>{this._datePicker=b};this._onDateChange=b=>{b=b.target.valueAsDate;this.viewModel.onDateChange(Array.isArray(b)?b[0]:b)};this._onYearPlayClick=()=>{this.viewModel.toggleYearPlaying()}; |
|
this._onSeasonChange=b=>{this.viewModel.currentSeason=b.target.value};this._onSunLightingCheckboxChange=()=>{this.viewModel.toggleSunLightingEnabled()};this._onShadowCheckboxChange=()=>{this.viewModel.toggleDirectShadowsEnabled()}}get icon(){return"brightness"}set icon(a){this._overrideIfSome("icon",a)}get label(){return this.messages?.title??""}set label(a){this._overrideIfSome("label",a)}get playSpeedMultiplier(){return this.viewModel.playSpeedMultiplier}set playSpeedMultiplier(a){this.viewModel.playSpeedMultiplier= |
|
a}get timeSliderSteps(){return this._timeSlider?.steps??5}set timeSliderSteps(a){this._timeSlider.steps=a}get view(){return this.viewModel.view}set view(a){this.viewModel.view=a}postInitialize(){this.viewModel.isSupported&&this.addHandles([l.watch(()=>this.viewModel.timeSliderViewModel,a=>this._timeSlider.viewModel=a,l.syncAndInitial),l.watch(()=>this.visibleElements?.timezone,a=>this._timeSlider.showDropDown=a,l.syncAndInitial),l.watch(()=>!this.viewModel.sunLightingEnabled,a=>{this._timeSlider.disabled= |
|
a},l.syncAndInitial),l.when(()=>!this.visible,()=>{this._datePicker&&(this._datePicker.open=!1)},l.sync)])}destroy(){this._timeSlider.destroy()}render(){const {messages:a,viewModel:c,visibleElements:b}=this,g=c.isSupported;return f.tsx("div",{class:this.classes(d.css.base,p.globalCss.widget)},g?f.tsx(f.tsxFragment,null,b.header?f.tsx(D.Heading,{level:this.headingLevel},a.title):null,this._renderTimeOptions(),b.datePicker?this._renderDateOrSeason():null,b.sunLightingToggle?this._renderSunLightingToggle(): |
|
null,b.shadowsToggle?this._renderShadowsToggle():null):f.tsx("div",{class:d.css.panelError,key:"unsupported"},f.tsx("p",null,a.unsupported)))}loadDependencies(){return C.loadCalciteComponents({button:()=>new Promise((a,c)=>n(["../chunks/calcite-button"],a,c)),checkbox:()=>new Promise((a,c)=>n(["../chunks/calcite-checkbox"],a,c)),label:()=>new Promise((a,c)=>n(["../chunks/calcite-label"],a,c)),"input-date-picker":()=>new Promise((a,c)=>n(["../chunks/calcite-input-date-picker"],a,c)),option:()=>new Promise((a, |
|
c)=>n(["../chunks/calcite-option"],a,c)),select:()=>new Promise((a,c)=>n(["../chunks/calcite-select"],a,c))})}_renderTimeOptions(){const {viewModel:a,visibleElements:c,messages:b}=this,{directShadowsEnabled:g,dayPlaying:m}=a,w=!a.sunLightingEnabled;return f.tsx("div",{class:this.classes(d.css.dayContainer,{[d.css.sliderShadowOn]:g,[d.css.sliderShadowOff]:!g,[d.css.sliderDateOn]:c.datePicker,[d.css.sliderDateOff]:!c.datePicker,[d.css.sliderAmPmOn]:q.useAmPm(),[d.css.containerDisabled]:w}),key:"daylight-time-options"}, |
|
this._timeSlider.render(),c.playButtons?this._renderPlayPauseButton({playing:m,disabled:w,label:b.playDay,onClick:this._onPlayDayClick}):null)}_renderDateOptions(){const {viewModel:a,visibleElements:c,messages:b}=this,{yearPlaying:g}=a,m=!a.sunLightingEnabled;return f.tsx("div",{class:this.classes(d.css.dateContainer,m&&d.css.containerDisabled),key:d.css.dateContainer},f.tsx("calcite-input-date-picker",{afterCreate:this._onDatePickerAfterCreate,class:d.css.datePicker,"data-testid":"daylight-date-picker", |
|
disabled:m,key:d.css.datePicker,overlayPositioning:"fixed",placement:"bottom",valueAsDate:a.localDate,onCalciteInputDatePickerChange:this._onDateChange}),c.playButtons?this._renderPlayPauseButton({playing:g,disabled:m,label:b.playYear,onClick:this._onYearPlayClick}):null)}_renderPlayPauseButton({playing:a,disabled:c,label:b,onClick:g}){return f.tsx("calcite-button",{appearance:"solid",class:d.css.playPauseButton,disabled:c,iconStart:a?"pause-f":"play-f",label:b,onclick:g,round:!0,title:b,type:"button"})}_renderSeasonSelect(){const {messages:a, |
|
viewModel:c}=this,b=!c.sunLightingEnabled;return f.tsx("calcite-select",{class:this.classes(d.css.seasonPicker),disabled:b,label:a.season,onCalciteSelectChange:this._onSeasonChange},A.orderedSeasons.map(g=>f.tsx("calcite-option",{selected:c.currentSeason===g,value:g},a[g])))}_renderDateOrSeason(){return"date"===this.dateOrSeason?this._renderDateOptions():this._renderSeasonSelect()}_renderSunLightingToggle(){const a=this.messages?.sunLightingToggle;return f.tsx("calcite-label",{key:"date-time-toggle", |
|
layout:"inline",scale:"s",title:a?.tooltip},f.tsx("calcite-checkbox",{checked:this.viewModel.sunLightingEnabled,class:d.css.sunLightingCheckbox,onCalciteCheckboxChange:this._onSunLightingCheckboxChange}),a?.label)}_renderShadowsToggle(){const a=this.messages.shadowsToggle;return f.tsx("calcite-label",{key:"shadow-toggle",layout:"inline",scale:"s",title:a?.tooltip},f.tsx("calcite-checkbox",{checked:this.viewModel.directShadowsEnabled,class:d.css.shadowsCheckbox,onCalciteCheckboxChange:this._onShadowCheckboxChange}), |
|
a.label)}_makeGoToTime(a){return()=>{this.viewModel.timeSliderPosition=a}}};h.__decorate([k.property(),u.messageBundle("esri/widgets/Daylight/t9n/Daylight")],e.prototype,"messages",void 0);h.__decorate([k.property(),u.messageBundle("esri/widgets/support/t9n/timezone")],e.prototype,"timezoneMessages",void 0);h.__decorate([k.property()],e.prototype,"headingLevel",void 0);h.__decorate([k.property()],e.prototype,"icon",null);h.__decorate([k.property()],e.prototype,"label",null);h.__decorate([k.property()], |
|
e.prototype,"playSpeedMultiplier",null);h.__decorate([k.property()],e.prototype,"timeSliderSteps",null);h.__decorate([k.property()],e.prototype,"view",null);h.__decorate([k.property({type:r})],e.prototype,"viewModel",void 0);h.__decorate([k.property({type:t,nonNullable:!0})],e.prototype,"visibleElements",void 0);h.__decorate([k.property({cast(a){if("season"===a||"date"===a)return a;x.getLogger(this).warn(`"${a}" is not a valid option. Acceptable values are only "date" or "season". Defaulting to "${"date"}".`); |
|
return"date"}})],e.prototype,"dateOrSeason",void 0);h.__decorate([k.property()],e.prototype,"_timeSlider",void 0);h.__decorate([k.property()],e.prototype,"_datePicker",void 0);e=h.__decorate([y.subclass("esri.widgets.Daylight")],e);const v=[p.globalCss.interactive,p.globalCss.anchor];return e}); |