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.6 KiB
18 lines
7.6 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 ../intl ../core/has ../core/maybe ../core/reactiveUtils ../core/timeUtils ../core/accessorSupport/decorators/property ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ../intl/substitute ./Slider ./Widget ./ShadowCast/css ./ShadowCast/ShadowCastState ./ShadowCast/ShadowCastViewModel ./ShadowCast/ShadowCastVisibleElements ./ShadowCast/ShadowVisualizationType ./ShadowCast/components/DiscreteConfigurator ./ShadowCast/components/DurationConfigurator ./ShadowCast/components/ShadowTooltip ./ShadowCast/components/ThresholdConfigurator ../chunks/componentsUtils ./support/globalCss ./support/Heading ./support/timeWidgetUtils ./support/TimezonePicker ./support/widgetUtils ./support/decorators/messageBundle ./support/jsxFactory ../intl/date".split(" "), |
|
function(t,g,e,Q,w,m,x,h,R,S,A,B,C,D,k,E,F,y,p,G,H,I,J,K,u,z,r,L,T,M,d,N){var v;(v||={}).Slider="slider";const O={labelFormatFunction:r.formatSliderLabel,min:0,max:1439,steps:15,rangeLabelInputsEnabled:!1,visibleElements:{labels:!1,rangeLabels:!1},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:(a,b,c)=>r.onPrimaryTickCreated({tickElement:b,labelElement:c})},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:(a,b)=>r.onSecondaryTickCreated({tickElement:b})}]}; |
|
e=class extends D{constructor(a,b){super(a,b);this.viewModel=null;this.headingLevel=4;this.visibleElements=new y;this._defaultViewModel=null;this._timeSlider=new C({...O,container:document.createElement("div")});this._tooltip=null;this._onTimezoneChange=c=>{this.viewModel.utcOffset=c};this._onDateChange=c=>{c=c.target.valueAsDate;this.viewModel.date=Array.isArray(c)?c[0]:c};a?.viewModel||(this.viewModel=this._defaultViewModel=new F({view:a?.view}))}initialize(){this.addHandles([m.watch(()=>({viewModel:this.viewModel, |
|
slider:this._timeSlider}),a=>this._connectTimeSlider(a),m.syncAndInitial),m.watch(()=>({container:this.view?.surface,viewModel:this.viewModel,tooltipVisible:this.visibleElements.tooltip}),({container:a,viewModel:b,tooltipVisible:c})=>{this._tooltip=w.destroyMaybe(this._tooltip);null!=a&&c&&(this._tooltip=new I.ShadowTooltip({viewModel:b,container:a}))},m.syncAndInitial),m.watch(()=>({viewModel:this.viewModel,visible:this.visible}),({viewModel:a,visible:b})=>a.setRunning(b),m.syncAndInitial)])}destroy(){this._timeSlider= |
|
w.destroyMaybe(this._timeSlider);null!=this._defaultViewModel&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}loadDependencies(){return K.loadCalciteComponents({"input-date-picker":()=>new Promise((a,b)=>t(["../chunks/calcite-input-date-picker"],a,b)),option:()=>new Promise((a,b)=>t(["../chunks/calcite-option"],a,b)),select:()=>new Promise((a,b)=>t(["../chunks/calcite-select"],a,b))})}render(){const {visibleElements:a,viewModel:b}=this;return d.tsx("div",{class:this.classes(k.css.base, |
|
u.globalCss.widget,u.globalCss.panel,{[u.globalCss.widgetDisabled]:b.state===E.ShadowCastState.Disabled}),key:this},this._renderTimeRangeSection(),a.visualizationOptions?this._renderVisualizationOptionsSection():null)}get view(){return this.viewModel?.view}set view(a){this.viewModel&&(this.viewModel.view=a)}get icon(){return"measure-building-height-shadow"}set icon(a){this._overrideIfSome("icon",a)}get label(){return this.messages?.widgetLabel??""}set label(a){this._overrideIfSome("label",a)}get testData(){}_connectTimeSlider({viewModel:a, |
|
slider:b}){this.removeHandles(v.Slider);if(null!=b){var c=f=>x.convertTime(f,"milliseconds","minutes"),l=f=>x.convertTime(f,"minutes","milliseconds"),n=({index:f,value:q})=>{0===f?a.startTimeOfDay=l(q):a.endTimeOfDay=l(q)};this.addHandles([m.watch(()=>[a.startTimeOfDay,a.endTimeOfDay],f=>{b.values=f.map(c)},m.syncAndInitial),b.on("thumb-change",n),b.on("thumb-drag",n),b.on("segment-drag",()=>{[a.startTimeOfDay,a.endTimeOfDay]=b.values.map(l)})],v.Slider)}}_renderTimeRangeSection(){const {visibleElements:a}= |
|
this;return a.timeRangeSlider||a.datePicker?d.tsx("section",{class:k.css.timeRange,key:"time-range"},d.tsx(z.Heading,{level:this.headingLevel},this.messages.timeLabel),a.timeRangeSlider?this._renderTimeRange():null,a.datePicker?this._renderDatePicker():null):null}_renderTimeRange(){const {messages:a,viewModel:b,visibleElements:c}=this,{startTimeOfDay:l,endTimeOfDay:n}=b,[f,q]=[l,n].map(P=>N.formatDate(new Date(P),r.timeStringFormattingOptions));return[d.tsx("div",{class:k.css.timeRangeIndicator,key:"time-range-indicator"}, |
|
B.substitute(a.timeRange,{start:f,end:q}),c.timezone?d.tsx(L.TimezonePicker,{value:b.utcOffset,onChange:this._onTimezoneChange}):null),d.tsx("div",{afterCreate:this._timeSliderContainerAfterCreate,afterRemoved:this._timeSliderContainerAfterRemoved,bind:this,key:"time-slider-container"})]}_timeSliderContainerAfterCreate(a){const b=this._timeSlider?.container;b&&a.appendChild(b)}_timeSliderContainerAfterRemoved(a){const b=this._timeSlider?.container;b&&a.removeChild(b)}_renderDatePicker(){return d.tsx("div", |
|
{class:k.css.datePickerContainer,key:k.css.datePickerContainer},d.tsx("calcite-input-date-picker",{class:k.css.datePicker,"data-testid":"date-picker",key:k.css.datePicker,overlayPositioning:"fixed",placement:"bottom",valueAsDate:this.viewModel.date,onCalciteInputDatePickerChange:this._onDateChange}))}_renderVisualizationOptionsSection(){const {headingLevel:a,messages:b,viewModel:c,visibleElements:l}=this,n=l.colorPicker,f=q=>this.classes(c.visualizationType===q?null:k.css.visualizationConfigHidden); |
|
return d.tsx("section",{class:k.css.visualization,key:"visualization"},d.tsx(z.Heading,{level:a},b.visualizationLabel),this._renderVisualizationSelect(),d.tsx("div",{class:f(p.ShadowVisualizationType.Threshold),key:"threshold-configurator"},d.tsx(J.ThresholdConfigurator,{colorPickerVisible:n,options:c.thresholdOptions})),d.tsx("div",{class:f(p.ShadowVisualizationType.Duration),key:"duration-configurator"},d.tsx(H.DurationConfigurator,{colorPickerVisible:n,options:c.durationOptions})),d.tsx("div", |
|
{class:f(p.ShadowVisualizationType.Discrete),key:"discrete-configurator"},d.tsx(G.DiscreteConfigurator,{colorPickerVisible:n,options:c.discreteOptions})))}_renderVisualizationSelect(){const a=this.messages,b=this.viewModel.visualizationType;return d.tsx("calcite-select",{bind:this,class:k.css.visualizationSelect,key:"visualization-select",label:a.visualizationLabel,onCalciteSelectChange:this._onVisualizationTypeChange},[{type:p.ShadowVisualizationType.Threshold,label:a.threshold.label},{type:p.ShadowVisualizationType.Duration, |
|
label:a.duration.label},{type:p.ShadowVisualizationType.Discrete,label:a.discrete.label}].map(({type:c,label:l})=>d.tsx("calcite-option",{selected:c===b,value:c},l)))}_onVisualizationTypeChange(a){this.viewModel.visualizationType=a.target.selectedOption?.value??p.ShadowVisualizationType.Threshold}};g.__decorate([h.property()],e.prototype,"viewModel",void 0);g.__decorate([h.property()],e.prototype,"view",null);g.__decorate([h.property()],e.prototype,"headingLevel",void 0);g.__decorate([h.property()], |
|
e.prototype,"icon",null);g.__decorate([h.property()],e.prototype,"label",null);g.__decorate([h.property({type:y,nonNullable:!0})],e.prototype,"visibleElements",void 0);g.__decorate([h.property(),M.messageBundle("esri/widgets/ShadowCast/t9n/ShadowCast")],e.prototype,"messages",void 0);g.__decorate([h.property()],e.prototype,"_defaultViewModel",void 0);g.__decorate([h.property()],e.prototype,"_timeSlider",void 0);g.__decorate([h.property()],e.prototype,"_tooltip",void 0);return e=g.__decorate([A.subclass("esri.widgets.ShadowCast")], |
|
e)}); |