@opengeoweb/time-slider 15.3.0 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +557 -133
- package/package.json +4 -4
- package/src/index.d.ts +0 -5
- package/src/lib/Providers/Providers.d.ts +0 -8
- package/src/lib/Providers/index.d.ts +0 -1
- package/src/lib/components/TimeSlider/TimeSlider.d.ts +0 -16
- package/src/lib/components/TimeSlider/TimeSlider.spec.d.ts +0 -1
- package/src/lib/components/TimeSlider/TimeSlider.stories.d.ts +0 -7
- package/src/lib/components/TimeSlider/changeTimeFunctions.d.ts +0 -14
- package/src/lib/components/TimeSlider/changeTimeFunctions.spec.d.ts +0 -1
- package/src/lib/components/TimeSlider/index.d.ts +0 -4
- package/src/lib/components/TimeSlider/timeSliderEffects.d.ts +0 -2
- package/src/lib/components/TimeSlider/timeSliderUtils.d.ts +0 -129
- package/src/lib/components/TimeSlider/timeSliderUtils.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.d.ts +0 -12
- package/src/lib/components/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/AutoUpdateButton/AutoUpdateButton.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/AutoUpdateButton/AutoUpdateButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButton.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/ControlButtons/ControlButtons.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/HideSliderButton/HideSliderButton.d.ts +0 -6
- package/src/lib/components/TimeSliderButtons/HideSliderButton/HideSliderButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/NowButton/NowButton.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/NowButton/NowButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenu.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +0 -11
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/index.d.ts +0 -2
- package/src/lib/components/TimeSliderButtons/PlayButton/PlayButton.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/PlayButton/PlayButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/SpeedButton/SpeedButton.d.ts +0 -6
- package/src/lib/components/TimeSliderButtons/SpeedButton/SpeedButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSliderButtons.d.ts +0 -10
- package/src/lib/components/TimeSliderButtons/TimeSliderButtons.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSliderButtons.stories.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.d.ts +0 -24
- package/src/lib/components/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButton.d.ts +0 -17
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButton.stories.d.ts +0 -9
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButtonCustomSelect.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButtonCustomSelect.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeStepButton/TimeStepButton.d.ts +0 -11
- package/src/lib/components/TimeSliderButtons/TimeStepButton/TimeStepButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeStepButton/TimeStepButton.stories.d.ts +0 -9
- package/src/lib/components/TimeSliderButtons/index.d.ts +0 -13
- package/src/lib/components/TimeSliderCurrentTimeBox/CalendarButton/CalendarButton.d.ts +0 -10
- package/src/lib/components/TimeSliderCurrentTimeBox/CalendarButton/CalendarButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/MarkerTimeSelector/MarkerTimeSelector.d.ts +0 -24
- package/src/lib/components/TimeSliderCurrentTimeBox/MarkerTimeSelector/MarkerTimeSelector.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBox.d.ts +0 -20
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBox.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxMouseEvents.d.ts +0 -2
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxMouseEvents.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxRenderFunctions.d.ts +0 -3
- package/src/lib/components/TimeSliderCurrentTimeBox/index.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/TimeSliderLegend.d.ts +0 -35
- package/src/lib/components/TimeSliderLegend/TimeSliderLegend.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/TimeSliderLegend.stories.d.ts +0 -9
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawBackground.d.ts +0 -4
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawBackground.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawCurrentTime.d.ts +0 -2
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawNeedle.d.ts +0 -2
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeScale.d.ts +0 -7
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeScale.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeSliderLegend.d.ts +0 -2
- package/src/lib/components/TimeSliderLegend/drawFunctions/index.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/index.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/timeSliderLegendUtils.d.ts +0 -37
- package/src/lib/components/TimeSliderLegend/timeSliderLegenedUtils.spec.d.ts +0 -1
- package/src/lib/index.d.ts +0 -5
- package/src/lib/utils/i18n.d.ts +0 -6
package/index.esm.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
1
|
import { Grid, useTheme, Box, Typography, Menu, MenuItem, CardHeader, FormControl, TextField, Select, Popper, Paper, Stack, InputAdornment, ClickAwayListener } from '@mui/material';
|
|
3
2
|
import React, { useState, useRef, useEffect, createElement } from 'react';
|
|
4
3
|
import { dateUtils, safelyInitI18nForTestsAndStories, CustomIconButton, CustomTooltip, CanvasComponent, renderCounter, CustomToggleButton } from '@opengeoweb/shared';
|
|
@@ -6,6 +5,7 @@ import { debounce, throttle } from 'lodash';
|
|
|
6
5
|
import { ChevronDown, ChevronUp, dragHandlePath, Edit, Animation, AutoUpdateActive, AutoUpdateInActive, StepForward, StepBackward, Now, Pause, Play, Speed, Clock, FastForward, Options, CalendarToday, ThemeWrapper, lightTheme, darkTheme } from '@opengeoweb/theme';
|
|
7
6
|
import i18n from 'i18next';
|
|
8
7
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
8
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { Box as Box$1 } from '@mui/system';
|
|
10
10
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
11
11
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
@@ -259,8 +259,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
var Scale
|
|
263
|
-
(function (Scale) {
|
|
262
|
+
var Scale = /*#__PURE__*/function (Scale) {
|
|
264
263
|
Scale[Scale["Minutes5"] = 0] = "Minutes5";
|
|
265
264
|
Scale[Scale["Hour"] = 1] = "Hour";
|
|
266
265
|
Scale[Scale["Hours3"] = 2] = "Hours3";
|
|
@@ -271,9 +270,9 @@ var Scale;
|
|
|
271
270
|
Scale[Scale["Month"] = 7] = "Month";
|
|
272
271
|
Scale[Scale["Months3"] = 8] = "Months3";
|
|
273
272
|
Scale[Scale["Year"] = 9] = "Year";
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
return Scale;
|
|
274
|
+
}({});
|
|
275
|
+
var AnimationLength = /*#__PURE__*/function (AnimationLength) {
|
|
277
276
|
AnimationLength[AnimationLength["Minutes15"] = 15] = "Minutes15";
|
|
278
277
|
AnimationLength[AnimationLength["Minutes30"] = 30] = "Minutes30";
|
|
279
278
|
AnimationLength[AnimationLength["Hours1"] = 60] = "Hours1";
|
|
@@ -282,15 +281,18 @@ var AnimationLength;
|
|
|
282
281
|
AnimationLength[AnimationLength["Hours6"] = 360] = "Hours6";
|
|
283
282
|
AnimationLength[AnimationLength["Hours12"] = 720] = "Hours12";
|
|
284
283
|
AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
|
|
285
|
-
|
|
284
|
+
return AnimationLength;
|
|
285
|
+
}({});
|
|
286
286
|
/**
|
|
287
287
|
* In this Map collection all fundamental scales
|
|
288
288
|
* (Scale.Minutes5 ... Scale.Year) are mapped with their corresponding
|
|
289
289
|
* secondsPerPx numbers.
|
|
290
290
|
* @returns a Map including information explained above
|
|
291
291
|
*/
|
|
292
|
+
|
|
292
293
|
var secondsPerPxToScale = new Map([[2.5, Scale.Minutes5], [30, Scale.Hour], [3 * 30, Scale.Hours3], [6 * 30, Scale.Hours6], [24 * 30, Scale.Day], [7 * 24 * 30, Scale.Week], [14 * 24 * 30, Scale.Weeks2], [30 * 24 * 30, Scale.Month], [90 * 24 * 30, Scale.Months3], [365 * 24 * 30, Scale.Year]]);
|
|
293
294
|
var spanToScale = new Map([[5 * 60, Scale.Minutes5], [60 * 60, Scale.Hour], [3 * 60 * 60, Scale.Hours3], [6 * 60 * 60, Scale.Hours6], [24 * 60 * 60, Scale.Day], [7 * 24 * 60 * 60, Scale.Week], [14 * 24 * 60 * 60, Scale.Weeks2], [30 * 24 * 60 * 60, Scale.Month], [90 * 24 * 60 * 60, Scale.Months3], [365 * 24 * 60 * 60, Scale.Year]]);
|
|
295
|
+
|
|
294
296
|
/**
|
|
295
297
|
* Creates a reverse mapping of scales to their corresponding secondsPerPx
|
|
296
298
|
* values to make it easier in some parts GeoWeb to fetch a secondsPerpx for
|
|
@@ -298,6 +300,7 @@ var spanToScale = new Map([[5 * 60, Scale.Minutes5], [60 * 60, Scale.Hour], [3 *
|
|
|
298
300
|
* @returns an Object, where names are fundamental scale values (0 - 7) and
|
|
299
301
|
* values are their corresponding secondsPerPx numbers.
|
|
300
302
|
*/
|
|
303
|
+
|
|
301
304
|
var scaleToSecondsPerPx = Object.fromEntries(Array.from(secondsPerPxToScale.entries()).map(function (_ref) {
|
|
302
305
|
var key = _ref[0],
|
|
303
306
|
value = _ref[1];
|
|
@@ -315,6 +318,7 @@ var timestampToPixel = function timestampToPixel(timestamp, centerTime, widthPx,
|
|
|
315
318
|
var pixelToTimestamp = function pixelToTimestamp(timePx, centerTime, widthPx, secondsPerPx) {
|
|
316
319
|
return centerTime - (widthPx / 2 - timePx) * secondsPerPx;
|
|
317
320
|
};
|
|
321
|
+
|
|
318
322
|
/**
|
|
319
323
|
* This function creates and returns an array where there is secondsPerPx
|
|
320
324
|
* number of the data set added for a data scale (secondsPerPx)
|
|
@@ -324,6 +328,7 @@ var pixelToTimestamp = function pixelToTimestamp(timePx, centerTime, widthPx, se
|
|
|
324
328
|
* The secondsPerPx number for a data scale is included
|
|
325
329
|
* contrary to secondsPerPxToScale.
|
|
326
330
|
*/
|
|
331
|
+
|
|
327
332
|
var secondsPerPxValues = function secondsPerPxValues(secondsPerPx) {
|
|
328
333
|
var sortedSecondsPerPx = [].concat(secondsPerPxToScale).map(function (value) {
|
|
329
334
|
return Number(value[0]);
|
|
@@ -341,6 +346,7 @@ var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTi
|
|
|
341
346
|
var centerToFixedPointPx = (fixedTimePoint - oldCenterTime) / oldSecondsPerPx;
|
|
342
347
|
return fixedTimePoint - centerToFixedPointPx * newSecondsPerPx;
|
|
343
348
|
};
|
|
349
|
+
|
|
344
350
|
/**
|
|
345
351
|
* Move the time slider such that a given time point (timePoint)
|
|
346
352
|
* is at a given pixel width (timePointPx).
|
|
@@ -349,6 +355,7 @@ var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTi
|
|
|
349
355
|
var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePointPx, secondsPerPx, canvasWidth) {
|
|
350
356
|
return timePoint - secondsPerPx * (timePointPx - canvasWidth / 2);
|
|
351
357
|
};
|
|
358
|
+
|
|
352
359
|
/** This reusable custom hook tells whether given pointer event targets current canvas node.
|
|
353
360
|
* Example:
|
|
354
361
|
*
|
|
@@ -357,11 +364,13 @@ var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePo
|
|
|
357
364
|
* return isAllowedCanvasNodePointed ? (<CanvasComponent ref={nodeRef}>Component with ref</CanvasComponent>) : (<CanvasComponent>Component with NO ref</CanvasComponent>);
|
|
358
365
|
* ...
|
|
359
366
|
*/
|
|
367
|
+
|
|
360
368
|
var useCanvasTarget = function useCanvasTarget(eventType) {
|
|
361
369
|
var nodeRef = React.useRef(null);
|
|
362
370
|
var _React$useState = React.useState(false),
|
|
363
371
|
isTargetNode = _React$useState[0],
|
|
364
372
|
setIsTargetNode = _React$useState[1];
|
|
373
|
+
|
|
365
374
|
// Check if pointer event targets current node element
|
|
366
375
|
var pointerEventListener = React.useCallback(function (event) {
|
|
367
376
|
setIsTargetNode(nodeRef.current.canvas ? nodeRef.current.canvas.isEqualNode(event.target) : false);
|
|
@@ -372,6 +381,7 @@ var useCanvasTarget = function useCanvasTarget(eventType) {
|
|
|
372
381
|
return document.removeEventListener(eventType, pointerEventListener);
|
|
373
382
|
};
|
|
374
383
|
}, [eventType, pointerEventListener]); // Only add/remove event listener when listener really changes, that is, NOT necessarily between every re-render.
|
|
384
|
+
|
|
375
385
|
return [isTargetNode, nodeRef];
|
|
376
386
|
};
|
|
377
387
|
var timeBoxGeom = {
|
|
@@ -387,15 +397,16 @@ var AUTO_MOVE_AREA_PADDING = 1;
|
|
|
387
397
|
var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
|
|
388
398
|
return (scale === Scale.Year ? timeBoxGeom.largeWidth + timeBoxGeom.iconWidth : timeBoxGeom.smallWidth + timeBoxGeom.iconWidth) / 2 + AUTO_MOVE_AREA_PADDING;
|
|
389
399
|
};
|
|
390
|
-
var TimeInMinutes
|
|
391
|
-
(function (TimeInMinutes) {
|
|
400
|
+
var TimeInMinutes = /*#__PURE__*/function (TimeInMinutes) {
|
|
392
401
|
TimeInMinutes[TimeInMinutes["YEAR"] = 525600] = "YEAR";
|
|
393
402
|
TimeInMinutes[TimeInMinutes["MONTH"] = 43200] = "MONTH";
|
|
394
403
|
TimeInMinutes[TimeInMinutes["WEEK"] = 10080] = "WEEK";
|
|
395
404
|
TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
|
|
396
405
|
TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
|
|
397
406
|
TimeInMinutes[TimeInMinutes["MINUTE"] = 1] = "MINUTE";
|
|
398
|
-
|
|
407
|
+
return TimeInMinutes;
|
|
408
|
+
}({});
|
|
409
|
+
|
|
399
410
|
/**
|
|
400
411
|
*
|
|
401
412
|
* @param minutes
|
|
@@ -448,6 +459,7 @@ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
|
|
|
448
459
|
});
|
|
449
460
|
return durations.time.trim();
|
|
450
461
|
};
|
|
462
|
+
|
|
451
463
|
/**
|
|
452
464
|
* Returns the largest timeunit value divisible by minuts
|
|
453
465
|
* @param minutes
|
|
@@ -465,6 +477,7 @@ function getLargestTimeUnit(minutes) {
|
|
|
465
477
|
}
|
|
466
478
|
return TimeInMinutes.MINUTE;
|
|
467
479
|
}
|
|
480
|
+
|
|
468
481
|
// For a data scale an appropriate fundamental scale is chosen
|
|
469
482
|
// depending on secondsPerPx of data. When a time range of
|
|
470
483
|
// data is for example many months. the fundamental scale Scale.Year
|
|
@@ -473,6 +486,7 @@ function getLargestTimeUnit(minutes) {
|
|
|
473
486
|
//
|
|
474
487
|
// If a time range of data is a few weeks, Scale.Month is chosen. So, all
|
|
475
488
|
// the time range of data can be shown in the window.
|
|
489
|
+
|
|
476
490
|
var getFundamentalScale = function getFundamentalScale(secondsPerPx) {
|
|
477
491
|
if (secondsPerPx >= scaleToSecondsPerPx[Scale.Month]) {
|
|
478
492
|
return Scale.Year;
|
|
@@ -520,10 +534,12 @@ var calculateMouseTimeAndCheckBounds = function calculateMouseTimeAndCheckBounds
|
|
|
520
534
|
if (isDraggingWithinBounds) {
|
|
521
535
|
return undefined;
|
|
522
536
|
}
|
|
537
|
+
|
|
523
538
|
// eslint-disable-next-line no-param-reassign
|
|
524
539
|
tooltipPosition.current = pixelsBetweenViewportAndTimesliderOnLeft && mousePosition + pixelsBetweenViewportAndTimesliderOnLeft;
|
|
525
540
|
return pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
|
|
526
541
|
};
|
|
542
|
+
|
|
527
543
|
// default values
|
|
528
544
|
var defaultAnimationDelayAtStart = 250;
|
|
529
545
|
var defaultDelay = 1000; // [ms]
|
|
@@ -531,6 +547,7 @@ var defaultTimeStep = 60;
|
|
|
531
547
|
var defaultSecondsPerPx = 80;
|
|
532
548
|
var defaultTimeSpan = 24 * 3600;
|
|
533
549
|
var speedFactors = [0.1, 0.2, 0.5, 1, 2, 4, 8, 16]; // Declares available animation speed multipliers for default delay
|
|
550
|
+
|
|
534
551
|
var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
|
|
535
552
|
var adjustedTimeStep = timeStep * 60;
|
|
536
553
|
if (!type || type === 'round') {
|
|
@@ -544,9 +561,11 @@ var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
|
|
|
544
561
|
}
|
|
545
562
|
return undefined;
|
|
546
563
|
};
|
|
564
|
+
|
|
547
565
|
/**
|
|
548
566
|
* Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
|
|
549
567
|
*/
|
|
568
|
+
|
|
550
569
|
var getSpeedDelay = function getSpeedDelay(speedFactor) {
|
|
551
570
|
return defaultDelay / speedFactor;
|
|
552
571
|
};
|
|
@@ -570,9 +589,9 @@ var timeSliderLegendDefaultProps = {
|
|
|
570
589
|
var timeSliderUtils = /*#__PURE__*/Object.freeze({
|
|
571
590
|
__proto__: null,
|
|
572
591
|
AUTO_MOVE_AREA_PADDING: AUTO_MOVE_AREA_PADDING,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
592
|
+
AnimationLength: AnimationLength,
|
|
593
|
+
Scale: Scale,
|
|
594
|
+
TimeInMinutes: TimeInMinutes,
|
|
576
595
|
calculateMouseTimeAndCheckBounds: calculateMouseTimeAndCheckBounds,
|
|
577
596
|
defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
|
|
578
597
|
defaultDelay: defaultDelay,
|
|
@@ -620,6 +639,7 @@ var timeSliderUtils = /*#__PURE__*/Object.freeze({
|
|
|
620
639
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
621
640
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
622
641
|
* */
|
|
642
|
+
|
|
623
643
|
var onsetNewDateDebounced = debounce(function (dateToSet, onSetNewDate) {
|
|
624
644
|
onSetNewDate(dateToSet);
|
|
625
645
|
}, 4, {
|
|
@@ -643,6 +663,7 @@ var setNextTimeStep = function setNextTimeStep(timeStep, currentTime, dataEndTim
|
|
|
643
663
|
var selectedTimeString = dateUtils.fromUnix(newTime).toISOString();
|
|
644
664
|
onSetNewDate(selectedTimeString);
|
|
645
665
|
};
|
|
666
|
+
|
|
646
667
|
/**
|
|
647
668
|
* updates unfiltered selected time and moves selected time a given distance
|
|
648
669
|
* in pixels. Unfiltered selected time can be outside data data limits, but
|
|
@@ -662,6 +683,7 @@ function getFilteredTime(unfilteredTime, timeStep, dataStartTime, dataEndTime) {
|
|
|
662
683
|
var maxTime = Math.max(roundedTime, dataStartTime);
|
|
663
684
|
return Math.min(maxTime, dataEndTime);
|
|
664
685
|
}
|
|
686
|
+
|
|
665
687
|
/** Reusable business logic for how to handle events that set time to now (closest).
|
|
666
688
|
* Used in NowButton and TimeSliderLegend.
|
|
667
689
|
*/
|
|
@@ -698,6 +720,7 @@ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, data
|
|
|
698
720
|
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
699
721
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
700
722
|
* */
|
|
723
|
+
|
|
701
724
|
var useToggleTimesliderVisibility = function useToggleTimesliderVisibility(mapIsActive, isVisible, onToggleTimeSlider) {
|
|
702
725
|
React.useEffect(function () {
|
|
703
726
|
var handleKeyDown = function handleKeyDown(event) {
|
|
@@ -755,6 +778,7 @@ var useMoveTimeWithKeyboard = function useMoveTimeWithKeyboard(mapIsActive, time
|
|
|
755
778
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
756
779
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
757
780
|
* */
|
|
781
|
+
|
|
758
782
|
var TIME_SLIDER_NAMESPACE = 'timeslider';
|
|
759
783
|
var initTimesliderI18n = function initTimesliderI18n() {
|
|
760
784
|
safelyInitI18nForTestsAndStories(i18n, TIME_SLIDER_NAMESPACE, [{
|
|
@@ -766,19 +790,37 @@ var useTimesliderTranslation = function useTimesliderTranslation() {
|
|
|
766
790
|
return useTranslation(TIME_SLIDER_NAMESPACE);
|
|
767
791
|
};
|
|
768
792
|
|
|
793
|
+
/* *
|
|
794
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
795
|
+
* you may not use this file except in compliance with the License.
|
|
796
|
+
* You may obtain a copy of the License at
|
|
797
|
+
*
|
|
798
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
799
|
+
*
|
|
800
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
801
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
802
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
803
|
+
* See the License for the specific language governing permissions and
|
|
804
|
+
* limitations under the License.
|
|
805
|
+
*
|
|
806
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
807
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
808
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
809
|
+
* */
|
|
810
|
+
|
|
769
811
|
var HideSliderButtonComponent = function HideSliderButtonComponent(_ref) {
|
|
770
812
|
var isVisible = _ref.isVisible,
|
|
771
813
|
toggleTimeSliderIsVisible = _ref.toggleTimeSliderIsVisible;
|
|
772
814
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
773
815
|
t = _useTimesliderTransla.t;
|
|
774
|
-
return jsx(CustomIconButton, {
|
|
816
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
775
817
|
"data-testid": "hideTimeSliderButton",
|
|
776
818
|
onClick: function onClick() {
|
|
777
819
|
toggleTimeSliderIsVisible(!isVisible);
|
|
778
820
|
},
|
|
779
821
|
tooltipTitle: isVisible ? t('timeslider-hide') : t('timeslider-show'),
|
|
780
822
|
variant: "tool",
|
|
781
|
-
children: isVisible ? jsx(ChevronDown, {}) : jsx(ChevronUp, {})
|
|
823
|
+
children: isVisible ? /*#__PURE__*/jsx(ChevronDown, {}) : /*#__PURE__*/jsx(ChevronUp, {})
|
|
782
824
|
});
|
|
783
825
|
};
|
|
784
826
|
var HideSliderButton = /*#__PURE__*/React.memo(HideSliderButtonComponent);
|
|
@@ -800,6 +842,8 @@ var HideSliderButton = /*#__PURE__*/React.memo(HideSliderButtonComponent);
|
|
|
800
842
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
801
843
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
802
844
|
* */
|
|
845
|
+
|
|
846
|
+
|
|
803
847
|
/**
|
|
804
848
|
* @param x The pin location
|
|
805
849
|
* @param selectedTimePx The selected px
|
|
@@ -867,6 +911,24 @@ function getPositions(width, unfilteredSelectedTime, centerTime, secondsPerPx, s
|
|
|
867
911
|
};
|
|
868
912
|
}
|
|
869
913
|
|
|
914
|
+
/* *
|
|
915
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
916
|
+
* you may not use this file except in compliance with the License.
|
|
917
|
+
* You may obtain a copy of the License at
|
|
918
|
+
*
|
|
919
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
920
|
+
*
|
|
921
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
922
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
923
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
924
|
+
* See the License for the specific language governing permissions and
|
|
925
|
+
* limitations under the License.
|
|
926
|
+
*
|
|
927
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
928
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
929
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
930
|
+
* */
|
|
931
|
+
|
|
870
932
|
var TimeSlider = function TimeSlider(_ref) {
|
|
871
933
|
var buttons = _ref.buttons,
|
|
872
934
|
timeBox = _ref.timeBox,
|
|
@@ -885,11 +947,13 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
885
947
|
onToggleTimeSlider = _ref$onToggleTimeSlid === void 0 ? function () {} : _ref$onToggleTimeSlid;
|
|
886
948
|
// set up visibility toggle
|
|
887
949
|
useToggleTimesliderVisibility(mapIsActive, isVisible, onToggleTimeSlider);
|
|
950
|
+
|
|
888
951
|
// set up movement with keyboard shortcuts
|
|
889
952
|
useMoveTimeWithKeyboard(mapIsActive, timeStep, dataStartTime, dataEndTime, onSetNewDate, onSetCenterTime, selectedTime);
|
|
953
|
+
|
|
890
954
|
// timeBox, buttons and legend are created in TimeSliderConnect.tsx
|
|
891
955
|
// these components will always be created as TimeSlider never runs in isolation from the store
|
|
892
|
-
return isVisible ? jsxs(Grid, {
|
|
956
|
+
return isVisible ? /*#__PURE__*/jsxs(Grid, {
|
|
893
957
|
container: true,
|
|
894
958
|
"data-testid": "timeSlider",
|
|
895
959
|
sx: {
|
|
@@ -897,7 +961,6 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
897
961
|
gridTemplateColumns: '175px 1fr 40px',
|
|
898
962
|
gridTemplateRows: TIME_SLIDER_LEGEND_HEIGHT,
|
|
899
963
|
gridTemplateAreas: "\". timebox .\"\n \"buttons timelegend toggle\"",
|
|
900
|
-
paddingBottom: 1,
|
|
901
964
|
alignItems: 'center',
|
|
902
965
|
justifyContent: 'center',
|
|
903
966
|
visibility: isVisible ? 'visible' : 'hidden',
|
|
@@ -907,7 +970,7 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
907
970
|
paddingRight: '5%'
|
|
908
971
|
}
|
|
909
972
|
},
|
|
910
|
-
children: [jsx(Grid, {
|
|
973
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
911
974
|
sx: {
|
|
912
975
|
gridArea: 'timebox',
|
|
913
976
|
zIndex: 99,
|
|
@@ -915,35 +978,35 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
915
978
|
overflow: 'hidden'
|
|
916
979
|
},
|
|
917
980
|
children: timeBox
|
|
918
|
-
}), jsx(Grid, {
|
|
981
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
919
982
|
sx: {
|
|
920
983
|
gridArea: 'buttons'
|
|
921
984
|
},
|
|
922
985
|
children: buttons
|
|
923
|
-
}), jsx(Grid, {
|
|
986
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
924
987
|
sx: {
|
|
925
988
|
gridArea: 'timelegend'
|
|
926
989
|
},
|
|
927
990
|
children: legend
|
|
928
|
-
}), jsx(Grid, {
|
|
991
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
929
992
|
sx: {
|
|
930
993
|
gridArea: 'toggle',
|
|
931
|
-
paddingLeft: 1
|
|
994
|
+
paddingLeft: 1,
|
|
995
|
+
lineHeight: 0
|
|
932
996
|
},
|
|
933
|
-
children: jsx(HideSliderButton, {
|
|
997
|
+
children: /*#__PURE__*/jsx(HideSliderButton, {
|
|
934
998
|
isVisible: isVisible,
|
|
935
999
|
toggleTimeSliderIsVisible: onToggleTimeSlider
|
|
936
1000
|
})
|
|
937
1001
|
})]
|
|
938
|
-
}) : jsx(Grid, {
|
|
1002
|
+
}) : /*#__PURE__*/jsx(Grid, {
|
|
939
1003
|
container: true,
|
|
940
1004
|
sx: {
|
|
941
1005
|
paddingRight: 1,
|
|
942
|
-
paddingBottom: 1,
|
|
943
1006
|
alignItems: 'center',
|
|
944
1007
|
justifyContent: 'flex-end'
|
|
945
1008
|
},
|
|
946
|
-
children: jsx(HideSliderButton, {
|
|
1009
|
+
children: /*#__PURE__*/jsx(HideSliderButton, {
|
|
947
1010
|
isVisible: isVisible,
|
|
948
1011
|
toggleTimeSliderIsVisible: onToggleTimeSlider
|
|
949
1012
|
})
|
|
@@ -1158,6 +1221,7 @@ var roundByUnitOfTime = function roundByUnitOfTime(timeUnix, unit, roundUp) {
|
|
|
1158
1221
|
}
|
|
1159
1222
|
return dateUtils.unix(_timeStartOfPassedUnit4);
|
|
1160
1223
|
}
|
|
1224
|
+
|
|
1161
1225
|
// Default unit === 'year'
|
|
1162
1226
|
var timeStartOfPassedUnit = dateUtils.startOfYearUTC(dateUtils.fromUnix(timeUnix));
|
|
1163
1227
|
if (roundUp) {
|
|
@@ -1175,12 +1239,14 @@ var roundToNearestMultiple = function roundToNearestMultiple(timeUnix, scale, ro
|
|
|
1175
1239
|
var roundFn = roundUp ? Math.ceil : Math.floor;
|
|
1176
1240
|
return roundFn(timeUnix / stepSeconds) * stepSeconds;
|
|
1177
1241
|
};
|
|
1242
|
+
|
|
1178
1243
|
/**
|
|
1179
1244
|
* In this script starting and ending times of the time slider are rounded.
|
|
1180
1245
|
* Here it is defined what is a time unit to a start of which a rounding is
|
|
1181
1246
|
* done for each scale.
|
|
1182
1247
|
* @returns an object where there are rounding units of each scale
|
|
1183
1248
|
*/
|
|
1249
|
+
|
|
1184
1250
|
var scaleToRoundableUnit = (_scaleToRoundableUnit = {}, _scaleToRoundableUnit[Scale.Hour] = 'hour', _scaleToRoundableUnit[Scale.Day] = 'day', _scaleToRoundableUnit[Scale.Week] = 'week', _scaleToRoundableUnit[Scale.Weeks2] = 'week', _scaleToRoundableUnit[Scale.Month] = 'week', _scaleToRoundableUnit[Scale.Months3] = 'week', _scaleToRoundableUnit[Scale.Year] = 'year', _scaleToRoundableUnit);
|
|
1185
1251
|
var getRoundedStartAndEnd = function getRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, scale) {
|
|
1186
1252
|
if (scale === Scale.Minutes5 || scale === Scale.Hours3 || scale === Scale.Hours6) {
|
|
@@ -1291,12 +1357,14 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1291
1357
|
var _getRoundedStartAndEn = getRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, fundamentalScale),
|
|
1292
1358
|
roundedStart = _getRoundedStartAndEn[0],
|
|
1293
1359
|
roundedEnd = _getRoundedStartAndEn[1];
|
|
1360
|
+
|
|
1294
1361
|
// draw regular tickmarks
|
|
1295
1362
|
var ctx = context;
|
|
1296
1363
|
getTimesteps(roundedStart, roundedEnd, fundamentalScale).forEach(function (timestep) {
|
|
1297
1364
|
var stepPx = timestampToPixelEdges(timestep, visibleTimeStart, visibleTimeEnd, canvasWidth);
|
|
1298
1365
|
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
1299
1366
|
drawStepPxLine(ctx, theme, Math.floor(stepPx) + 0.5, height, fundamentalScale, timestep);
|
|
1367
|
+
|
|
1300
1368
|
// Draw the time step time as text
|
|
1301
1369
|
var timeFormat = getTimeFormat(fundamentalScale);
|
|
1302
1370
|
var timeText = dateUtils.dateToString(dateUtils.fromUnix(timestep), timeFormat);
|
|
@@ -1309,6 +1377,7 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1309
1377
|
drawYearScaleText(ctx, theme, timeText, stepPx, height);
|
|
1310
1378
|
}
|
|
1311
1379
|
});
|
|
1380
|
+
|
|
1312
1381
|
// draw month overlay lines
|
|
1313
1382
|
if (fundamentalScale === Scale.Week || fundamentalScale === Scale.Weeks2 || fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
1314
1383
|
var _getCustomRoundedStar = getCustomRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, Scale.Year),
|
|
@@ -1319,6 +1388,7 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1319
1388
|
var stepPx = timestampToPixelEdges(timestep, visibleTimeStart, visibleTimeEnd, canvasWidth);
|
|
1320
1389
|
if (fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
1321
1390
|
var month = dateUtils.dateToString(dateUtils.fromUnix(timestep), 'MMM');
|
|
1391
|
+
|
|
1322
1392
|
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
1323
1393
|
drawDateChangeLine(ctx, theme, Math.floor(stepPx) + 0.5, height);
|
|
1324
1394
|
drawTimeText(ctx, theme, stepPx, height, month, fundamentalScale);
|
|
@@ -1353,6 +1423,7 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1353
1423
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1354
1424
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1355
1425
|
* */
|
|
1426
|
+
|
|
1356
1427
|
var drawBackground = function drawBackground(context, theme, visibleTimeStart, visibleTimeEnd, animationStartPx, animationEndPx, canvasWidth, height, secondsPerPx, timeSliderSpan, dataStartPx, dataEndPx, currentTimePx) {
|
|
1357
1428
|
var ctx = context;
|
|
1358
1429
|
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
@@ -1360,6 +1431,7 @@ var drawBackground = function drawBackground(context, theme, visibleTimeStart, v
|
|
|
1360
1431
|
ledgendObservedBackground = _theme$palette$geoweb.ledgendObservedBackground,
|
|
1361
1432
|
legendForecastBackground = _theme$palette$geoweb.legendForecastBackground,
|
|
1362
1433
|
legendNoDataBackground = _theme$palette$geoweb.legendNoDataBackground;
|
|
1434
|
+
|
|
1363
1435
|
// top spacing
|
|
1364
1436
|
var y = 0;
|
|
1365
1437
|
var scaleToUse = timeSliderSpan ? getScaleFromSpan(timeSliderSpan) : getFundamentalScale(secondsPerPx);
|
|
@@ -1482,6 +1554,7 @@ function getColorChangeTimesteps(scale, visibleTimeStart, visibleTimeEnd) {
|
|
|
1482
1554
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1483
1555
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1484
1556
|
* */
|
|
1557
|
+
|
|
1485
1558
|
var drawCurrentTime = function drawCurrentTime(context, theme, width, height, startTime, endTime, currentTime) {
|
|
1486
1559
|
var ctx = context;
|
|
1487
1560
|
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
@@ -1519,6 +1592,7 @@ var drawCurrentTime = function drawCurrentTime(context, theme, width, height, st
|
|
|
1519
1592
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1520
1593
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1521
1594
|
* */
|
|
1595
|
+
|
|
1522
1596
|
var drawNeedle = function drawNeedle(context, theme, width, height, startTime, endTime, selectedTime) {
|
|
1523
1597
|
if (!selectedTime) {
|
|
1524
1598
|
return;
|
|
@@ -1529,6 +1603,7 @@ var drawNeedle = function drawNeedle(context, theme, width, height, startTime, e
|
|
|
1529
1603
|
playerNeedlePlayerTop = _theme$palette$geoweb.playerNeedlePlayerTop,
|
|
1530
1604
|
playerTimeMarkers = _theme$palette$geoweb.playerTimeMarkers;
|
|
1531
1605
|
var selectedPx = timestampToPixelEdges(selectedTime, startTime, endTime, width);
|
|
1606
|
+
|
|
1532
1607
|
// Draw a high vertical line (needle) indicating the current or selected time
|
|
1533
1608
|
ctx.beginPath();
|
|
1534
1609
|
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
@@ -1540,6 +1615,7 @@ var drawNeedle = function drawNeedle(context, theme, width, height, startTime, e
|
|
|
1540
1615
|
ctx.lineWidth = 1;
|
|
1541
1616
|
ctx.strokeStyle = playerNeedlePlayerTop.rgba;
|
|
1542
1617
|
ctx.stroke();
|
|
1618
|
+
|
|
1543
1619
|
// Triange connecting timebox.
|
|
1544
1620
|
ctx.beginPath();
|
|
1545
1621
|
ctx.moveTo(Math.floor(selectedPx) + 5, 0);
|
|
@@ -1567,6 +1643,7 @@ var drawNeedle = function drawNeedle(context, theme, width, height, startTime, e
|
|
|
1567
1643
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1568
1644
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1569
1645
|
* */
|
|
1646
|
+
|
|
1570
1647
|
var drawTimeSliderLegend = function drawTimeSliderLegend(context, theme, canvasWidth, height, centerTime, secondsPerPx, timeSliderSpan, selectedTimeUnix, currentTimeUnix, animationStartTime, animationEndTime, dataStartTime, dataEndTime) {
|
|
1571
1648
|
var ctx = context;
|
|
1572
1649
|
var _map = [0, canvasWidth].map(function (px) {
|
|
@@ -1589,8 +1666,27 @@ var drawTimeSliderLegend = function drawTimeSliderLegend(context, theme, canvasW
|
|
|
1589
1666
|
drawNeedle(ctx, theme, canvasWidth, height, visibleTimeStart, visibleTimeEnd, selectedTimeUnix);
|
|
1590
1667
|
};
|
|
1591
1668
|
|
|
1669
|
+
/* *
|
|
1670
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1671
|
+
* you may not use this file except in compliance with the License.
|
|
1672
|
+
* You may obtain a copy of the License at
|
|
1673
|
+
*
|
|
1674
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1675
|
+
*
|
|
1676
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1677
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1678
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1679
|
+
* See the License for the specific language governing permissions and
|
|
1680
|
+
* limitations under the License.
|
|
1681
|
+
*
|
|
1682
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1683
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1684
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1685
|
+
* */
|
|
1686
|
+
|
|
1592
1687
|
// Explanation of props can be found here:
|
|
1593
1688
|
// https://drive.google.com/file/d/1jqqNcciCH0UJiZ04HO-1vknmPPpT8fK5/view?usp=sharing
|
|
1689
|
+
|
|
1594
1690
|
var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
1595
1691
|
var _node$current, _getTimeSliderLegendE;
|
|
1596
1692
|
var mapId = _ref.mapId,
|
|
@@ -1653,6 +1749,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1653
1749
|
var _useState7 = useState(),
|
|
1654
1750
|
lastHandledRoundedTime = _useState7[0],
|
|
1655
1751
|
setLastHandledRoundedTime = _useState7[1];
|
|
1752
|
+
|
|
1656
1753
|
// remove active drag. can happen outside canvas.
|
|
1657
1754
|
var _useState8 = useState(),
|
|
1658
1755
|
localAnimationStartTime = _useState8[0],
|
|
@@ -1674,6 +1771,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1674
1771
|
var startDraggingPosition = useRef(0);
|
|
1675
1772
|
var popperRef = useRef(null);
|
|
1676
1773
|
var isClickOrDrag = useRef();
|
|
1774
|
+
|
|
1677
1775
|
// Display unfilteredSelectedTime (already snapped to available timestep)
|
|
1678
1776
|
var displayTime = unfilteredSelectedTime;
|
|
1679
1777
|
var start = localAnimationStartTime;
|
|
@@ -1762,6 +1860,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1762
1860
|
if (timeBetweenMouseAndStartAndEnd.current === undefined) {
|
|
1763
1861
|
// to move the whole animation area we need to calculate the distance
|
|
1764
1862
|
// between the mouse position and the start and end position
|
|
1863
|
+
|
|
1765
1864
|
var _timeFromMouseToStart = mouseTimeUnix - start;
|
|
1766
1865
|
var _timeFromMouseToEnd = end - mouseTimeUnix;
|
|
1767
1866
|
timeBetweenMouseAndStartAndEnd.current = {
|
|
@@ -1882,6 +1981,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1882
1981
|
startAnimationPosition = _getPositions.startAnimationPosition,
|
|
1883
1982
|
endAnimationPosition = _getPositions.endAnimationPosition,
|
|
1884
1983
|
selectedTimePosition = _getPositions.selectedTimePosition;
|
|
1984
|
+
|
|
1885
1985
|
// start dragging selected time.
|
|
1886
1986
|
if (isSelectedTimeIconArea(x, selectedTimePosition, DRAG_AREA_WIDTH)) {
|
|
1887
1987
|
setCursorStyle('grabbing');
|
|
@@ -1891,6 +1991,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1891
1991
|
if (reduxAnimationStartTime && reduxAnimationEndTime) {
|
|
1892
1992
|
var pixelsBetweenOnLeft = getPixelsBetweenViewportAndTimesliderOnLeft(mapId);
|
|
1893
1993
|
tooltipPosition.current = pixelsBetweenOnLeft ? x + pixelsBetweenOnLeft : x;
|
|
1994
|
+
|
|
1894
1995
|
// start dragging either marker
|
|
1895
1996
|
if (isLeftAnimationIconArea(x, startAnimationPosition, DRAG_AREA_WIDTH)) {
|
|
1896
1997
|
setCursorStyle('grabbing');
|
|
@@ -1935,6 +2036,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1935
2036
|
startAnimationPosition = _getPositions2.startAnimationPosition,
|
|
1936
2037
|
endAnimationPosition = _getPositions2.endAnimationPosition,
|
|
1937
2038
|
selectedTimePosition = _getPositions2.selectedTimePosition;
|
|
2039
|
+
|
|
1938
2040
|
// Adjust mouse cursor while hovering draggable areas
|
|
1939
2041
|
var leftAnimationIconArea = isLeftAnimationIconArea(x, startAnimationPosition, DRAG_AREA_WIDTH);
|
|
1940
2042
|
var rightAnimationIconArea = isRightAnimationIconArea(x, endAnimationPosition, DRAG_AREA_WIDTH);
|
|
@@ -1980,12 +2082,12 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1980
2082
|
}
|
|
1981
2083
|
return undefined;
|
|
1982
2084
|
}, [isTimeScrollingEnabled, mapWindowRef, onWheel]);
|
|
1983
|
-
return jsxs(Box, {
|
|
2085
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
1984
2086
|
sx: {
|
|
1985
2087
|
position: 'relative',
|
|
1986
2088
|
height: TIME_SLIDER_LEGEND_HEIGHT + "px"
|
|
1987
2089
|
},
|
|
1988
|
-
children: [jsx(CustomTooltip, {
|
|
2090
|
+
children: [/*#__PURE__*/jsx(CustomTooltip, {
|
|
1989
2091
|
open: Boolean(showTooltip),
|
|
1990
2092
|
slotProps: {
|
|
1991
2093
|
popper: {
|
|
@@ -1996,7 +2098,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1996
2098
|
}
|
|
1997
2099
|
},
|
|
1998
2100
|
title: getTooltipText(),
|
|
1999
|
-
children: jsx(Box, {
|
|
2101
|
+
children: /*#__PURE__*/jsx(Box, {
|
|
2000
2102
|
className: getTimeSliderLegendId(mapId),
|
|
2001
2103
|
"data-testid": "timeSliderLegend",
|
|
2002
2104
|
onMouseLeave: function onMouseLeave() {
|
|
@@ -2008,7 +2110,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2008
2110
|
overflow: 'hidden',
|
|
2009
2111
|
cursor: cursorStyle
|
|
2010
2112
|
},
|
|
2011
|
-
children: jsx(CanvasComponent, {
|
|
2113
|
+
children: /*#__PURE__*/jsx(CanvasComponent, {
|
|
2012
2114
|
onMouseDown: onMouseDown,
|
|
2013
2115
|
onMouseMove: onMouseMove,
|
|
2014
2116
|
onMouseUp: onMouseUp,
|
|
@@ -2020,7 +2122,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2020
2122
|
ref: node
|
|
2021
2123
|
})
|
|
2022
2124
|
})
|
|
2023
|
-
}), !!isTimeSliderHoverOn && jsx(Box, {
|
|
2125
|
+
}), !!isTimeSliderHoverOn && /*#__PURE__*/jsx(Box, {
|
|
2024
2126
|
"data-testid": "customCanvasMouseOverContainer",
|
|
2025
2127
|
onMouseLeave: function onMouseLeave() {
|
|
2026
2128
|
return setIsMouseOverCanvas(false);
|
|
@@ -2041,6 +2143,24 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2041
2143
|
});
|
|
2042
2144
|
};
|
|
2043
2145
|
|
|
2146
|
+
/* *
|
|
2147
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2148
|
+
* you may not use this file except in compliance with the License.
|
|
2149
|
+
* You may obtain a copy of the License at
|
|
2150
|
+
*
|
|
2151
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2152
|
+
*
|
|
2153
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2154
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2155
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2156
|
+
* See the License for the specific language governing permissions and
|
|
2157
|
+
* limitations under the License.
|
|
2158
|
+
*
|
|
2159
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2160
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2161
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2162
|
+
* */
|
|
2163
|
+
|
|
2044
2164
|
var THROTTLE_WAIT_TIME = 300; // [ms]
|
|
2045
2165
|
var THROTTLE_OPTIONS = {
|
|
2046
2166
|
trailing: false // Invoke function when called, but not more than once every <THROTTLE_WAIT_TIME>.
|
|
@@ -2095,6 +2215,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2095
2215
|
}
|
|
2096
2216
|
return '';
|
|
2097
2217
|
};
|
|
2218
|
+
|
|
2098
2219
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2099
2220
|
var throttledScroll = React.useCallback(throttle(function (newValue) {
|
|
2100
2221
|
onChangeSliderValue(newValue);
|
|
@@ -2104,11 +2225,11 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2104
2225
|
var newValue = marks[Math.min(Math.max(currentMarkIndex - direction, 0), marks.length - 1)];
|
|
2105
2226
|
throttledScroll(newValue.value);
|
|
2106
2227
|
}, [currentMarkIndex, marks, throttledScroll]);
|
|
2107
|
-
return jsxs(Box, {
|
|
2228
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
2108
2229
|
onKeyDown: function onKeyDown(event) {
|
|
2109
2230
|
event.stopPropagation();
|
|
2110
2231
|
},
|
|
2111
|
-
children: [jsxs(CustomIconButton, {
|
|
2232
|
+
children: [/*#__PURE__*/jsxs(CustomIconButton, {
|
|
2112
2233
|
isSelected: true,
|
|
2113
2234
|
onClick: function onClick() {
|
|
2114
2235
|
setOpen(true);
|
|
@@ -2116,12 +2237,15 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2116
2237
|
onWheel: onWheel,
|
|
2117
2238
|
ref: setAnchorRef,
|
|
2118
2239
|
sx: {
|
|
2119
|
-
padding: '
|
|
2120
|
-
|
|
2240
|
+
padding: '0px',
|
|
2241
|
+
paddingRight: '12px',
|
|
2242
|
+
width: '100%!important',
|
|
2243
|
+
minWidth: '64px',
|
|
2244
|
+
justifyContent: 'space-between'
|
|
2121
2245
|
},
|
|
2122
2246
|
tooltipTitle: title,
|
|
2123
2247
|
variant: "tool",
|
|
2124
|
-
children: [icon, jsx(Typography, {
|
|
2248
|
+
children: [icon, /*#__PURE__*/jsx(Typography, {
|
|
2125
2249
|
sx: {
|
|
2126
2250
|
fontSize: 12,
|
|
2127
2251
|
fontWeight: 400,
|
|
@@ -2129,7 +2253,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2129
2253
|
},
|
|
2130
2254
|
children: buttonText(value, displayCurrentLength, currentMark)
|
|
2131
2255
|
})]
|
|
2132
|
-
}), !!anchorRef && jsxs(Menu, {
|
|
2256
|
+
}), !!anchorRef && /*#__PURE__*/jsxs(Menu, {
|
|
2133
2257
|
anchorEl: anchorRef,
|
|
2134
2258
|
anchorOrigin: {
|
|
2135
2259
|
vertical: -15,
|
|
@@ -2150,7 +2274,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2150
2274
|
vertical: 'bottom',
|
|
2151
2275
|
horizontal: 'center'
|
|
2152
2276
|
},
|
|
2153
|
-
children: [jsx(MenuItem, {
|
|
2277
|
+
children: [/*#__PURE__*/jsx(MenuItem, {
|
|
2154
2278
|
disabled: true,
|
|
2155
2279
|
sx: {
|
|
2156
2280
|
fontSize: '12px',
|
|
@@ -2164,7 +2288,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2164
2288
|
children: title
|
|
2165
2289
|
}), marks.map(function (mark) {
|
|
2166
2290
|
var isSelected = (currentMark == null ? void 0 : currentMark.value) === mark.value && !isAutoSelected;
|
|
2167
|
-
return jsx(MenuItem, {
|
|
2291
|
+
return /*#__PURE__*/jsx(MenuItem, {
|
|
2168
2292
|
disabled: allOptionsDisabled,
|
|
2169
2293
|
onClick: function onClick() {
|
|
2170
2294
|
if (!isSelected) {
|
|
@@ -2175,7 +2299,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2175
2299
|
selected: !!isSelected && !displayLengthInputField,
|
|
2176
2300
|
children: mark.label || mark.text
|
|
2177
2301
|
}, mark.value);
|
|
2178
|
-
}), !!handleAutoClick && jsx(MenuItem, {
|
|
2302
|
+
}), !!handleAutoClick && /*#__PURE__*/jsx(MenuItem, {
|
|
2179
2303
|
disabled: allOptionsDisabled || isAutoDisabled,
|
|
2180
2304
|
onClick: function onClick() {
|
|
2181
2305
|
handleAutoClick();
|
|
@@ -2183,7 +2307,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2183
2307
|
},
|
|
2184
2308
|
selected: isAutoSelected,
|
|
2185
2309
|
children: t('timeslider-auto')
|
|
2186
|
-
}), !!displayCurrentLength && jsxs(MenuItem, {
|
|
2310
|
+
}), !!displayCurrentLength && /*#__PURE__*/jsxs(MenuItem, {
|
|
2187
2311
|
disabled: disbleUserSetDuration,
|
|
2188
2312
|
onClick: function onClick() {
|
|
2189
2313
|
return setDisplayLengthInputField(true);
|
|
@@ -2191,13 +2315,13 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2191
2315
|
sx: {
|
|
2192
2316
|
maxWidth: '175px'
|
|
2193
2317
|
},
|
|
2194
|
-
children: [!!displayLengthInputField && customLengthSelector, !displayLengthInputField && jsxs(Box, {
|
|
2318
|
+
children: [!!displayLengthInputField && customLengthSelector, !displayLengthInputField && /*#__PURE__*/jsxs(Box, {
|
|
2195
2319
|
sx: {
|
|
2196
2320
|
flexDirection: 'column',
|
|
2197
2321
|
display: 'flex',
|
|
2198
2322
|
flexGrow: 1
|
|
2199
2323
|
},
|
|
2200
|
-
children: [jsx(CardHeader, {
|
|
2324
|
+
children: [/*#__PURE__*/jsx(CardHeader, {
|
|
2201
2325
|
slotProps: {
|
|
2202
2326
|
title: {
|
|
2203
2327
|
fontSize: 12
|
|
@@ -2209,7 +2333,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2209
2333
|
color: 'geowebColors.greys.accessible'
|
|
2210
2334
|
},
|
|
2211
2335
|
title: t(customFieldHeader)
|
|
2212
|
-
}), jsxs(Box, {
|
|
2336
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
2213
2337
|
sx: {
|
|
2214
2338
|
flexDirection: 'row',
|
|
2215
2339
|
display: 'flex',
|
|
@@ -2217,20 +2341,20 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2217
2341
|
flexGrow: 1,
|
|
2218
2342
|
paddingTop: 0.5
|
|
2219
2343
|
},
|
|
2220
|
-
children: [jsx(Typography, {
|
|
2344
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
2221
2345
|
sx: {
|
|
2222
2346
|
fontSize: 14,
|
|
2223
2347
|
textTransform: 'none',
|
|
2224
2348
|
lineHeight: 2
|
|
2225
2349
|
},
|
|
2226
2350
|
children: minutesToDescribedDuration(value)
|
|
2227
|
-
}), jsx(CustomTooltip, {
|
|
2351
|
+
}), /*#__PURE__*/jsx(CustomTooltip, {
|
|
2228
2352
|
title: t('timeslider-edit'),
|
|
2229
|
-
children: jsx("span", {
|
|
2230
|
-
children: jsx(CustomIconButton, {
|
|
2353
|
+
children: /*#__PURE__*/jsx("span", {
|
|
2354
|
+
children: /*#__PURE__*/jsx(CustomIconButton, {
|
|
2231
2355
|
"aria-label": "edit animation option",
|
|
2232
2356
|
"data-testid": "editAnimationOption",
|
|
2233
|
-
children: jsx(Edit, {})
|
|
2357
|
+
children: /*#__PURE__*/jsx(Edit, {})
|
|
2234
2358
|
})
|
|
2235
2359
|
})
|
|
2236
2360
|
})]
|
|
@@ -2241,6 +2365,24 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2241
2365
|
});
|
|
2242
2366
|
};
|
|
2243
2367
|
|
|
2368
|
+
/* *
|
|
2369
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2370
|
+
* you may not use this file except in compliance with the License.
|
|
2371
|
+
* You may obtain a copy of the License at
|
|
2372
|
+
*
|
|
2373
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2374
|
+
*
|
|
2375
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2376
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2377
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2378
|
+
* See the License for the specific language governing permissions and
|
|
2379
|
+
* limitations under the License.
|
|
2380
|
+
*
|
|
2381
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2382
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2383
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2384
|
+
* */
|
|
2385
|
+
|
|
2244
2386
|
var marks$2 = [{
|
|
2245
2387
|
value: AnimationLength.Minutes15,
|
|
2246
2388
|
text: 'timeslider-min',
|
|
@@ -2300,11 +2442,11 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
|
|
|
2300
2442
|
var _useState = useState(false),
|
|
2301
2443
|
open = _useState[0],
|
|
2302
2444
|
setOpen = _useState[1];
|
|
2303
|
-
return jsx(TimeSliderMenu, {
|
|
2445
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2304
2446
|
allOptionsDisabled: disabled,
|
|
2305
2447
|
displayCurrentLength: true,
|
|
2306
2448
|
handleAutoClick: toggleAnimationLengthAuto,
|
|
2307
|
-
icon: jsx(Animation, {
|
|
2449
|
+
icon: /*#__PURE__*/jsx(Animation, {
|
|
2308
2450
|
"data-testid": "animationLengthButton"
|
|
2309
2451
|
}),
|
|
2310
2452
|
isAutoDisabled: !layerHasTimeStep,
|
|
@@ -2318,6 +2460,24 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
|
|
|
2318
2460
|
});
|
|
2319
2461
|
};
|
|
2320
2462
|
|
|
2463
|
+
/* *
|
|
2464
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2465
|
+
* you may not use this file except in compliance with the License.
|
|
2466
|
+
* You may obtain a copy of the License at
|
|
2467
|
+
*
|
|
2468
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2469
|
+
*
|
|
2470
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2471
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2472
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2473
|
+
* See the License for the specific language governing permissions and
|
|
2474
|
+
* limitations under the License.
|
|
2475
|
+
*
|
|
2476
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2477
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2478
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2479
|
+
* */
|
|
2480
|
+
|
|
2321
2481
|
var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
2322
2482
|
var _ref$toggleAutoUpdate = _ref.toggleAutoUpdate,
|
|
2323
2483
|
toggleAutoUpdate = _ref$toggleAutoUpdate === void 0 ? function () {} : _ref$toggleAutoUpdate,
|
|
@@ -2327,7 +2487,7 @@ var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
|
2327
2487
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
2328
2488
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2329
2489
|
t = _useTimesliderTransla.t;
|
|
2330
|
-
return jsx(CustomIconButton, {
|
|
2490
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2331
2491
|
"data-testid": "autoUpdateButton",
|
|
2332
2492
|
disabled: disabled,
|
|
2333
2493
|
isSelected: isAutoUpdating,
|
|
@@ -2336,14 +2496,32 @@ var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
|
2336
2496
|
},
|
|
2337
2497
|
tooltipTitle: isAutoUpdating ? t('timeslider-auto-update-on') : t('timeslider-auto-update-off'),
|
|
2338
2498
|
variant: "tool",
|
|
2339
|
-
children: isAutoUpdating ? jsx(AutoUpdateActive, {
|
|
2499
|
+
children: isAutoUpdating ? /*#__PURE__*/jsx(AutoUpdateActive, {
|
|
2340
2500
|
"data-testid": "auto-update-svg-on"
|
|
2341
|
-
}) : jsx(AutoUpdateInActive, {
|
|
2501
|
+
}) : /*#__PURE__*/jsx(AutoUpdateInActive, {
|
|
2342
2502
|
"data-testid": "auto-update-svg-off"
|
|
2343
2503
|
})
|
|
2344
2504
|
});
|
|
2345
2505
|
};
|
|
2346
2506
|
|
|
2507
|
+
/* *
|
|
2508
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2509
|
+
* you may not use this file except in compliance with the License.
|
|
2510
|
+
* You may obtain a copy of the License at
|
|
2511
|
+
*
|
|
2512
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2513
|
+
*
|
|
2514
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2515
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2516
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2517
|
+
* See the License for the specific language governing permissions and
|
|
2518
|
+
* limitations under the License.
|
|
2519
|
+
*
|
|
2520
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2521
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2522
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2523
|
+
* */
|
|
2524
|
+
|
|
2347
2525
|
var BackwardForwardStepButton = function BackwardForwardStepButton(_ref) {
|
|
2348
2526
|
var isForwardStep = _ref.isForwardStep,
|
|
2349
2527
|
isDisabled = _ref.isDisabled,
|
|
@@ -2353,21 +2531,39 @@ var BackwardForwardStepButton = function BackwardForwardStepButton(_ref) {
|
|
|
2353
2531
|
renderCounter.count(BackwardForwardStepButton.name);
|
|
2354
2532
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2355
2533
|
t = _useTimesliderTransla.t;
|
|
2356
|
-
return jsx(CustomIconButton, {
|
|
2534
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2357
2535
|
"aria-label": isForwardStep ? 'forward' : 'backward',
|
|
2358
2536
|
"data-testid": isForwardStep ? 'stepForwardButton' : 'stepBackwardButton',
|
|
2359
2537
|
disabled: isDisabled,
|
|
2360
2538
|
onClick: onClickBFButton,
|
|
2361
2539
|
tooltipTitle: isForwardStep ? t('timeslider-forward') : t('timeslider-backward'),
|
|
2362
2540
|
variant: "tool",
|
|
2363
|
-
children: isForwardStep ? jsx(StepForward, {
|
|
2541
|
+
children: isForwardStep ? /*#__PURE__*/jsx(StepForward, {
|
|
2364
2542
|
"data-testid": "step-forward-svg-path"
|
|
2365
|
-
}) : jsx(StepBackward, {
|
|
2543
|
+
}) : /*#__PURE__*/jsx(StepBackward, {
|
|
2366
2544
|
"data-testid": "step-backward-svg-path"
|
|
2367
2545
|
})
|
|
2368
2546
|
});
|
|
2369
2547
|
};
|
|
2370
2548
|
|
|
2549
|
+
/* *
|
|
2550
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2551
|
+
* you may not use this file except in compliance with the License.
|
|
2552
|
+
* You may obtain a copy of the License at
|
|
2553
|
+
*
|
|
2554
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2555
|
+
*
|
|
2556
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2557
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2558
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2559
|
+
* See the License for the specific language governing permissions and
|
|
2560
|
+
* limitations under the License.
|
|
2561
|
+
*
|
|
2562
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2563
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2564
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2565
|
+
* */
|
|
2566
|
+
|
|
2371
2567
|
var NowButton = function NowButton(_ref) {
|
|
2372
2568
|
var _ref$onSetNow = _ref.onSetNow,
|
|
2373
2569
|
onSetNow = _ref$onSetNow === void 0 ? function () {} : _ref$onSetNow,
|
|
@@ -2375,7 +2571,7 @@ var NowButton = function NowButton(_ref) {
|
|
|
2375
2571
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
2376
2572
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2377
2573
|
t = _useTimesliderTransla.t;
|
|
2378
|
-
return jsx(CustomIconButton, {
|
|
2574
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2379
2575
|
"aria-label": "now",
|
|
2380
2576
|
"data-testid": "nowButtonTooltip",
|
|
2381
2577
|
disabled: disabled,
|
|
@@ -2384,12 +2580,30 @@ var NowButton = function NowButton(_ref) {
|
|
|
2384
2580
|
},
|
|
2385
2581
|
tooltipTitle: t('timeslider-now'),
|
|
2386
2582
|
variant: "tool",
|
|
2387
|
-
children: jsx(Now, {
|
|
2583
|
+
children: /*#__PURE__*/jsx(Now, {
|
|
2388
2584
|
"data-testid": "now-svg"
|
|
2389
2585
|
})
|
|
2390
2586
|
});
|
|
2391
2587
|
};
|
|
2392
2588
|
|
|
2589
|
+
/* *
|
|
2590
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2591
|
+
* you may not use this file except in compliance with the License.
|
|
2592
|
+
* You may obtain a copy of the License at
|
|
2593
|
+
*
|
|
2594
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2595
|
+
*
|
|
2596
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2597
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2598
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2599
|
+
* See the License for the specific language governing permissions and
|
|
2600
|
+
* limitations under the License.
|
|
2601
|
+
*
|
|
2602
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2603
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2604
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2605
|
+
* */
|
|
2606
|
+
|
|
2393
2607
|
var PlayButton = function PlayButton(_ref) {
|
|
2394
2608
|
var isAnimating = _ref.isAnimating,
|
|
2395
2609
|
isDisabled = _ref.isDisabled,
|
|
@@ -2400,46 +2614,82 @@ var PlayButton = function PlayButton(_ref) {
|
|
|
2400
2614
|
};
|
|
2401
2615
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2402
2616
|
t = _useTimesliderTransla.t;
|
|
2403
|
-
return jsx(CustomIconButton, {
|
|
2617
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2404
2618
|
"data-testid": "playButton",
|
|
2405
2619
|
disabled: isDisabled,
|
|
2406
2620
|
isSelected: isAnimating,
|
|
2407
2621
|
onClick: onTogglePlay,
|
|
2408
2622
|
tooltipTitle: isAnimating ? t('timeslider-pause') : t('timeslider-play'),
|
|
2409
2623
|
variant: "tool",
|
|
2410
|
-
children: isAnimating ? jsx(Pause, {
|
|
2624
|
+
children: isAnimating ? /*#__PURE__*/jsx(Pause, {
|
|
2411
2625
|
"data-testid": "pause-svg-path"
|
|
2412
|
-
}) : jsx(Play, {
|
|
2626
|
+
}) : /*#__PURE__*/jsx(Play, {
|
|
2413
2627
|
"data-testid": "play-svg-path"
|
|
2414
2628
|
})
|
|
2415
2629
|
});
|
|
2416
2630
|
};
|
|
2417
2631
|
|
|
2632
|
+
/* *
|
|
2633
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2634
|
+
* you may not use this file except in compliance with the License.
|
|
2635
|
+
* You may obtain a copy of the License at
|
|
2636
|
+
*
|
|
2637
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2638
|
+
*
|
|
2639
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2640
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2641
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2642
|
+
* See the License for the specific language governing permissions and
|
|
2643
|
+
* limitations under the License.
|
|
2644
|
+
*
|
|
2645
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2646
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2647
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2648
|
+
* */
|
|
2649
|
+
|
|
2418
2650
|
var ControlButtons = function ControlButtons(_ref) {
|
|
2419
2651
|
var backwardBtn = _ref.backwardBtn,
|
|
2420
2652
|
forwardBtn = _ref.forwardBtn,
|
|
2421
2653
|
playBtn = _ref.playBtn,
|
|
2422
2654
|
nowBtn = _ref.nowBtn,
|
|
2423
2655
|
autoUpdateBtn = _ref.autoUpdateBtn;
|
|
2424
|
-
return jsxs(Fragment, {
|
|
2425
|
-
children: [jsx(Grid, {
|
|
2426
|
-
children: backwardBtn || jsx(BackwardForwardStepButton, {
|
|
2656
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
2657
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
2658
|
+
children: backwardBtn || /*#__PURE__*/jsx(BackwardForwardStepButton, {
|
|
2427
2659
|
isForwardStep: false
|
|
2428
2660
|
})
|
|
2429
|
-
}), jsx(Grid, {
|
|
2430
|
-
children: forwardBtn || jsx(BackwardForwardStepButton, {
|
|
2661
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2662
|
+
children: forwardBtn || /*#__PURE__*/jsx(BackwardForwardStepButton, {
|
|
2431
2663
|
isForwardStep: true
|
|
2432
2664
|
})
|
|
2433
|
-
}), jsx(Grid, {
|
|
2434
|
-
children: playBtn || jsx(PlayButton, {})
|
|
2435
|
-
}), jsx(Grid, {
|
|
2436
|
-
children: nowBtn || jsx(NowButton, {})
|
|
2437
|
-
}), jsx(Grid, {
|
|
2438
|
-
children: autoUpdateBtn || jsx(AutoUpdateButton, {})
|
|
2665
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2666
|
+
children: playBtn || /*#__PURE__*/jsx(PlayButton, {})
|
|
2667
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2668
|
+
children: nowBtn || /*#__PURE__*/jsx(NowButton, {})
|
|
2669
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2670
|
+
children: autoUpdateBtn || /*#__PURE__*/jsx(AutoUpdateButton, {})
|
|
2439
2671
|
})]
|
|
2440
2672
|
});
|
|
2441
2673
|
};
|
|
2442
2674
|
|
|
2675
|
+
/* *
|
|
2676
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2677
|
+
* you may not use this file except in compliance with the License.
|
|
2678
|
+
* You may obtain a copy of the License at
|
|
2679
|
+
*
|
|
2680
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2681
|
+
*
|
|
2682
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2683
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2684
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2685
|
+
* See the License for the specific language governing permissions and
|
|
2686
|
+
* limitations under the License.
|
|
2687
|
+
*
|
|
2688
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2689
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2690
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2691
|
+
* */
|
|
2692
|
+
|
|
2443
2693
|
var SpeedButton = function SpeedButton(_ref) {
|
|
2444
2694
|
var animationDelay = _ref.animationDelay,
|
|
2445
2695
|
setMapAnimationDelay = _ref.setMapAnimationDelay;
|
|
@@ -2458,8 +2708,8 @@ var SpeedButton = function SpeedButton(_ref) {
|
|
|
2458
2708
|
var _useState = useState(false),
|
|
2459
2709
|
open = _useState[0],
|
|
2460
2710
|
setOpen = _useState[1];
|
|
2461
|
-
return jsx(TimeSliderMenu, {
|
|
2462
|
-
icon: jsx(Speed, {}),
|
|
2711
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2712
|
+
icon: /*#__PURE__*/jsx(Speed, {}),
|
|
2463
2713
|
marks: marks,
|
|
2464
2714
|
onChangeSliderValue: function onChangeSliderValue(markValue) {
|
|
2465
2715
|
setMapAnimationDelay(markValue);
|
|
@@ -2471,6 +2721,24 @@ var SpeedButton = function SpeedButton(_ref) {
|
|
|
2471
2721
|
});
|
|
2472
2722
|
};
|
|
2473
2723
|
|
|
2724
|
+
/* *
|
|
2725
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2726
|
+
* you may not use this file except in compliance with the License.
|
|
2727
|
+
* You may obtain a copy of the License at
|
|
2728
|
+
*
|
|
2729
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2730
|
+
*
|
|
2731
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2732
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2733
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2734
|
+
* See the License for the specific language governing permissions and
|
|
2735
|
+
* limitations under the License.
|
|
2736
|
+
*
|
|
2737
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2738
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
2739
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2740
|
+
* */
|
|
2741
|
+
|
|
2474
2742
|
var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
2475
2743
|
var timeSliderSpan = _ref.timeSliderSpan,
|
|
2476
2744
|
setOpen = _ref.setOpen,
|
|
@@ -2486,8 +2754,8 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2486
2754
|
var _React$useState3 = React.useState(true),
|
|
2487
2755
|
isANumber = _React$useState3[0],
|
|
2488
2756
|
setIsANumber = _React$useState3[1];
|
|
2489
|
-
return jsx(Box, {
|
|
2490
|
-
children: jsxs(FormControl, {
|
|
2757
|
+
return /*#__PURE__*/jsx(Box, {
|
|
2758
|
+
children: /*#__PURE__*/jsxs(FormControl, {
|
|
2491
2759
|
onKeyDown: function onKeyDown(event) {
|
|
2492
2760
|
event.stopPropagation();
|
|
2493
2761
|
},
|
|
@@ -2497,7 +2765,7 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2497
2765
|
display: 'flex'
|
|
2498
2766
|
},
|
|
2499
2767
|
variant: "standard",
|
|
2500
|
-
children: [jsx(TextField, {
|
|
2768
|
+
children: [/*#__PURE__*/jsx(TextField, {
|
|
2501
2769
|
autoFocus: true,
|
|
2502
2770
|
color: isANumber ? 'primary' : 'warning',
|
|
2503
2771
|
label: t('timeslider-span'),
|
|
@@ -2527,11 +2795,11 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2527
2795
|
},
|
|
2528
2796
|
value: Math.round(selectedTimeValue * 100) / 100,
|
|
2529
2797
|
variant: "standard"
|
|
2530
|
-
}), jsx(Box, {
|
|
2798
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
2531
2799
|
sx: {
|
|
2532
2800
|
alignContent: 'end'
|
|
2533
2801
|
},
|
|
2534
|
-
children: jsxs(Select, {
|
|
2802
|
+
children: /*#__PURE__*/jsxs(Select, {
|
|
2535
2803
|
"aria-label": "time-resolution-selector",
|
|
2536
2804
|
defaultValue: "h",
|
|
2537
2805
|
onChange: function onChange(e) {
|
|
@@ -2542,22 +2810,22 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2542
2810
|
size: "small",
|
|
2543
2811
|
tabIndex: -1,
|
|
2544
2812
|
value: selectedTimeResolution,
|
|
2545
|
-
children: [jsx(MenuItem, {
|
|
2813
|
+
children: [/*#__PURE__*/jsx(MenuItem, {
|
|
2546
2814
|
value: TimeInMinutes.YEAR,
|
|
2547
2815
|
children: t('years')
|
|
2548
|
-
}), jsx(MenuItem, {
|
|
2816
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2549
2817
|
value: TimeInMinutes.MONTH,
|
|
2550
2818
|
children: t('months')
|
|
2551
|
-
}), jsx(MenuItem, {
|
|
2819
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2552
2820
|
value: TimeInMinutes.WEEK,
|
|
2553
2821
|
children: t('weeks')
|
|
2554
|
-
}), jsx(MenuItem, {
|
|
2822
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2555
2823
|
value: TimeInMinutes.DAY,
|
|
2556
2824
|
children: t('days')
|
|
2557
|
-
}), jsx(MenuItem, {
|
|
2825
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2558
2826
|
value: TimeInMinutes.HOUR,
|
|
2559
2827
|
children: t('hours')
|
|
2560
|
-
}), jsx(MenuItem, {
|
|
2828
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2561
2829
|
value: TimeInMinutes.MINUTE,
|
|
2562
2830
|
children: t('minutes')
|
|
2563
2831
|
})]
|
|
@@ -2567,6 +2835,24 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2567
2835
|
});
|
|
2568
2836
|
};
|
|
2569
2837
|
|
|
2838
|
+
/* *
|
|
2839
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2840
|
+
* you may not use this file except in compliance with the License.
|
|
2841
|
+
* You may obtain a copy of the License at
|
|
2842
|
+
*
|
|
2843
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2844
|
+
*
|
|
2845
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2846
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2847
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2848
|
+
* See the License for the specific language governing permissions and
|
|
2849
|
+
* limitations under the License.
|
|
2850
|
+
*
|
|
2851
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2852
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2853
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2854
|
+
* */
|
|
2855
|
+
|
|
2570
2856
|
var marks$1 = [{
|
|
2571
2857
|
value: 60,
|
|
2572
2858
|
text: 'timeslider-hour',
|
|
@@ -2637,10 +2923,10 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
2637
2923
|
var _useState = useState(isOpenByDefault),
|
|
2638
2924
|
open = _useState[0],
|
|
2639
2925
|
setOpen = _useState[1];
|
|
2640
|
-
return jsx(TimeSliderMenu, {
|
|
2926
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2641
2927
|
allOptionsDisabled: disabled,
|
|
2642
2928
|
customFieldHeader: t('timeslider-span'),
|
|
2643
|
-
customLengthSelector: jsx(TimeSpanButtonCustomSelect, {
|
|
2929
|
+
customLengthSelector: /*#__PURE__*/jsx(TimeSpanButtonCustomSelect, {
|
|
2644
2930
|
onChangeSliderValue: onChangeSliderValue,
|
|
2645
2931
|
setOpen: setOpen,
|
|
2646
2932
|
timeSliderSpan: timeSliderSpan
|
|
@@ -2648,7 +2934,7 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
2648
2934
|
disbleUserSetDuration: false,
|
|
2649
2935
|
displayCurrentLength: true,
|
|
2650
2936
|
handleAutoClick: onToggleTimeSpan,
|
|
2651
|
-
icon: jsx(Clock, {}),
|
|
2937
|
+
icon: /*#__PURE__*/jsx(Clock, {}),
|
|
2652
2938
|
isAutoDisabled: !layerHasTimeStep,
|
|
2653
2939
|
isAutoSelected: isTimeSpanAuto,
|
|
2654
2940
|
marks: translatedMarks,
|
|
@@ -2660,6 +2946,24 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
2660
2946
|
});
|
|
2661
2947
|
};
|
|
2662
2948
|
|
|
2949
|
+
/* *
|
|
2950
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2951
|
+
* you may not use this file except in compliance with the License.
|
|
2952
|
+
* You may obtain a copy of the License at
|
|
2953
|
+
*
|
|
2954
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2955
|
+
*
|
|
2956
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2957
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2958
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2959
|
+
* See the License for the specific language governing permissions and
|
|
2960
|
+
* limitations under the License.
|
|
2961
|
+
*
|
|
2962
|
+
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2963
|
+
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
2964
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2965
|
+
* */
|
|
2966
|
+
|
|
2663
2967
|
var marks = [{
|
|
2664
2968
|
value: 1,
|
|
2665
2969
|
text: 'timeslider-min',
|
|
@@ -2785,11 +3089,11 @@ var TimeStepButton = function TimeStepButton(_ref) {
|
|
|
2785
3089
|
var _useState = useState(isOpenByDefault),
|
|
2786
3090
|
open = _useState[0],
|
|
2787
3091
|
setOpen = _useState[1];
|
|
2788
|
-
return jsx(TimeSliderMenu, {
|
|
3092
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2789
3093
|
allOptionsDisabled: disabled,
|
|
2790
3094
|
displayCurrentLength: true,
|
|
2791
3095
|
handleAutoClick: handleToggleTimeStep,
|
|
2792
|
-
icon: jsx(FastForward, {
|
|
3096
|
+
icon: /*#__PURE__*/jsx(FastForward, {
|
|
2793
3097
|
"data-testid": "timeStepButton"
|
|
2794
3098
|
}),
|
|
2795
3099
|
isAutoDisabled: !layerHasTimeStep,
|
|
@@ -2803,17 +3107,35 @@ var TimeStepButton = function TimeStepButton(_ref) {
|
|
|
2803
3107
|
});
|
|
2804
3108
|
};
|
|
2805
3109
|
|
|
3110
|
+
/* *
|
|
3111
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3112
|
+
* you may not use this file except in compliance with the License.
|
|
3113
|
+
* You may obtain a copy of the License at
|
|
3114
|
+
*
|
|
3115
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3116
|
+
*
|
|
3117
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3118
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3119
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3120
|
+
* See the License for the specific language governing permissions and
|
|
3121
|
+
* limitations under the License.
|
|
3122
|
+
*
|
|
3123
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3124
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3125
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3126
|
+
* */
|
|
3127
|
+
|
|
2806
3128
|
var OptionsMenu = function OptionsMenu(_ref) {
|
|
2807
3129
|
var speedBtn = _ref.speedBtn,
|
|
2808
3130
|
timeSpanBtn = _ref.timeSpanBtn,
|
|
2809
3131
|
timeStepBtn = _ref.timeStepBtn,
|
|
2810
3132
|
animationLengthBtn = _ref.animationLengthBtn;
|
|
2811
|
-
return jsxs(Fragment, {
|
|
2812
|
-
children: [jsx(Grid, {
|
|
3133
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
3134
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
2813
3135
|
size: {
|
|
2814
3136
|
xs: 'auto'
|
|
2815
3137
|
},
|
|
2816
|
-
children: timeSpanBtn || jsx(TimeSpanButton, {
|
|
3138
|
+
children: timeSpanBtn || /*#__PURE__*/jsx(TimeSpanButton, {
|
|
2817
3139
|
disabled: false,
|
|
2818
3140
|
isTimeSpanAuto: false,
|
|
2819
3141
|
layerHasTimeStep: false,
|
|
@@ -2821,27 +3143,27 @@ var OptionsMenu = function OptionsMenu(_ref) {
|
|
|
2821
3143
|
onToggleTimeSpan: function onToggleTimeSpan() {},
|
|
2822
3144
|
timeSliderSpan: 0
|
|
2823
3145
|
})
|
|
2824
|
-
}), jsx(Grid, {
|
|
3146
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2825
3147
|
size: {
|
|
2826
3148
|
xs: 'auto'
|
|
2827
3149
|
},
|
|
2828
|
-
children: animationLengthBtn || jsx(AnimationLengthButton, {
|
|
3150
|
+
children: animationLengthBtn || /*#__PURE__*/jsx(AnimationLengthButton, {
|
|
2829
3151
|
onChangeAnimationLength: function onChangeAnimationLength() {},
|
|
2830
3152
|
toggleAnimationLengthAuto: function toggleAnimationLengthAuto() {}
|
|
2831
3153
|
})
|
|
2832
|
-
}), jsx(Grid, {
|
|
3154
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2833
3155
|
size: {
|
|
2834
3156
|
xs: 'auto'
|
|
2835
3157
|
},
|
|
2836
|
-
children: timeStepBtn || jsx(TimeStepButton, {
|
|
3158
|
+
children: timeStepBtn || /*#__PURE__*/jsx(TimeStepButton, {
|
|
2837
3159
|
isTimestepAuto: false,
|
|
2838
3160
|
onChangeTimeStep: function onChangeTimeStep() {}
|
|
2839
3161
|
})
|
|
2840
|
-
}), jsx(Grid, {
|
|
3162
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2841
3163
|
size: {
|
|
2842
3164
|
xs: 'auto'
|
|
2843
3165
|
},
|
|
2844
|
-
children: speedBtn || jsx(SpeedButton, {
|
|
3166
|
+
children: speedBtn || /*#__PURE__*/jsx(SpeedButton, {
|
|
2845
3167
|
animationDelay: defaultAnimationDelayAtStart,
|
|
2846
3168
|
setMapAnimationDelay: function setMapAnimationDelay() {}
|
|
2847
3169
|
})
|
|
@@ -2849,6 +3171,24 @@ var OptionsMenu = function OptionsMenu(_ref) {
|
|
|
2849
3171
|
});
|
|
2850
3172
|
};
|
|
2851
3173
|
|
|
3174
|
+
/* *
|
|
3175
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3176
|
+
* you may not use this file except in compliance with the License.
|
|
3177
|
+
* You may obtain a copy of the License at
|
|
3178
|
+
*
|
|
3179
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3180
|
+
*
|
|
3181
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3182
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3183
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3184
|
+
* See the License for the specific language governing permissions and
|
|
3185
|
+
* limitations under the License.
|
|
3186
|
+
*
|
|
3187
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3188
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
3189
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3190
|
+
* */
|
|
3191
|
+
|
|
2852
3192
|
var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
2853
3193
|
var speedBtn = _ref.speedBtn,
|
|
2854
3194
|
timeStepBtn = _ref.timeStepBtn,
|
|
@@ -2869,8 +3209,8 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2869
3209
|
setOpen(true);
|
|
2870
3210
|
}
|
|
2871
3211
|
}, [anchorEl, isOpenByDefault]);
|
|
2872
|
-
return jsxs("div", {
|
|
2873
|
-
children: [jsx(CustomIconButton, {
|
|
3212
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3213
|
+
children: [/*#__PURE__*/jsx(CustomIconButton, {
|
|
2874
3214
|
"aria-label": "animation options",
|
|
2875
3215
|
"data-testid": "optionsMenuButton",
|
|
2876
3216
|
isSelected: open,
|
|
@@ -2885,8 +3225,8 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2885
3225
|
placement: 'bottom'
|
|
2886
3226
|
},
|
|
2887
3227
|
variant: "tool",
|
|
2888
|
-
children: jsx(Options, {})
|
|
2889
|
-
}), jsx(Popper, {
|
|
3228
|
+
children: /*#__PURE__*/jsx(Options, {})
|
|
3229
|
+
}), /*#__PURE__*/jsx(Popper, {
|
|
2890
3230
|
anchorEl: anchorEl,
|
|
2891
3231
|
"data-testid": "optionsMenuPopOver",
|
|
2892
3232
|
open: open,
|
|
@@ -2894,19 +3234,19 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2894
3234
|
sx: {
|
|
2895
3235
|
zIndex: 10
|
|
2896
3236
|
},
|
|
2897
|
-
children: jsx(Paper, {
|
|
3237
|
+
children: /*#__PURE__*/jsx(Paper, {
|
|
2898
3238
|
elevation: 3,
|
|
2899
3239
|
sx: {
|
|
2900
3240
|
position: 'relative',
|
|
2901
3241
|
top: '-2rem'
|
|
2902
3242
|
},
|
|
2903
|
-
children: jsx(Grid, {
|
|
3243
|
+
children: /*#__PURE__*/jsx(Grid, {
|
|
2904
3244
|
container: true,
|
|
2905
3245
|
spacing: 1,
|
|
2906
3246
|
sx: {
|
|
2907
3247
|
padding: '10px'
|
|
2908
3248
|
},
|
|
2909
|
-
children: jsx(OptionsMenu, {
|
|
3249
|
+
children: /*#__PURE__*/jsx(OptionsMenu, {
|
|
2910
3250
|
animationLengthBtn: animationLengthBtn,
|
|
2911
3251
|
speedBtn: speedBtn,
|
|
2912
3252
|
timeSpanBtn: timeSpanBtn,
|
|
@@ -2918,6 +3258,24 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2918
3258
|
});
|
|
2919
3259
|
};
|
|
2920
3260
|
|
|
3261
|
+
/* *
|
|
3262
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3263
|
+
* you may not use this file except in compliance with the License.
|
|
3264
|
+
* You may obtain a copy of the License at
|
|
3265
|
+
*
|
|
3266
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3267
|
+
*
|
|
3268
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3269
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3270
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3271
|
+
* See the License for the specific language governing permissions and
|
|
3272
|
+
* limitations under the License.
|
|
3273
|
+
*
|
|
3274
|
+
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3275
|
+
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
3276
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3277
|
+
* */
|
|
3278
|
+
|
|
2921
3279
|
var TimeSliderButtons = function TimeSliderButtons(_ref) {
|
|
2922
3280
|
var optionsMenuBtn = _ref.optionsMenuBtn,
|
|
2923
3281
|
playBtn = _ref.playBtn,
|
|
@@ -2925,18 +3283,21 @@ var TimeSliderButtons = function TimeSliderButtons(_ref) {
|
|
|
2925
3283
|
forwardBtn = _ref.forwardBtn,
|
|
2926
3284
|
nowBtn = _ref.nowBtn,
|
|
2927
3285
|
autoUpdateBtn = _ref.autoUpdateBtn;
|
|
2928
|
-
return jsx(
|
|
3286
|
+
return /*#__PURE__*/jsx(Box, {
|
|
2929
3287
|
"data-testid": "timeSliderButtons",
|
|
2930
|
-
|
|
3288
|
+
sx: {
|
|
3289
|
+
height: 24
|
|
3290
|
+
},
|
|
3291
|
+
children: /*#__PURE__*/jsxs(Grid, {
|
|
2931
3292
|
container: true,
|
|
2932
3293
|
spacing: 0.5,
|
|
2933
3294
|
sx: {
|
|
2934
3295
|
alignItems: 'center',
|
|
2935
3296
|
justifyContent: 'center'
|
|
2936
3297
|
},
|
|
2937
|
-
children: [jsx(Grid, {
|
|
2938
|
-
children: optionsMenuBtn || jsx(OptionsMenuButton, {})
|
|
2939
|
-
}), jsx(ControlButtons, {
|
|
3298
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
3299
|
+
children: optionsMenuBtn || /*#__PURE__*/jsx(OptionsMenuButton, {})
|
|
3300
|
+
}), /*#__PURE__*/jsx(ControlButtons, {
|
|
2940
3301
|
autoUpdateBtn: autoUpdateBtn,
|
|
2941
3302
|
backwardBtn: backwardBtn,
|
|
2942
3303
|
forwardBtn: forwardBtn,
|
|
@@ -2964,6 +3325,7 @@ var TimeSliderButtons = function TimeSliderButtons(_ref) {
|
|
|
2964
3325
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2965
3326
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2966
3327
|
* */
|
|
3328
|
+
|
|
2967
3329
|
var onMouseMove = function onMouseMove(x, width, selectedTime, centerTime, secondsPerPx, mouseDownInTimeBox, isTimeBoxArea, setCursorStyle) {
|
|
2968
3330
|
if (!selectedTime || mouseDownInTimeBox) {
|
|
2969
3331
|
return;
|
|
@@ -3003,6 +3365,7 @@ var onMouseDown = function onMouseDown(x, width, selectedTime, centerTime, secon
|
|
|
3003
3365
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3004
3366
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3005
3367
|
* */
|
|
3368
|
+
|
|
3006
3369
|
var secondsInYear = 365 * 24 * 3600;
|
|
3007
3370
|
var drawRoundedRectangle = function drawRoundedRectangle(ctx, x, y, width, height, cornerRadius, theme) {
|
|
3008
3371
|
ctx.save();
|
|
@@ -3013,11 +3376,14 @@ var drawRoundedRectangle = function drawRoundedRectangle(ctx, x, y, width, heigh
|
|
|
3013
3376
|
ctx.fillStyle = playerTimeMarkers.fill;
|
|
3014
3377
|
ctx.lineWidth = timeBoxGeom.lineWidth;
|
|
3015
3378
|
var halfLineWidth = timeBoxGeom.lineWidth / 2;
|
|
3379
|
+
|
|
3016
3380
|
// Top left corner
|
|
3017
3381
|
ctx.moveTo(halfLineWidth, height / 2);
|
|
3018
3382
|
ctx.arcTo(halfLineWidth, halfLineWidth, width / 2, halfLineWidth, cornerRadius);
|
|
3383
|
+
|
|
3019
3384
|
// Top right corner
|
|
3020
3385
|
ctx.arcTo(width - halfLineWidth, halfLineWidth, width - halfLineWidth, height / 2, cornerRadius);
|
|
3386
|
+
|
|
3021
3387
|
// Bottom right corner
|
|
3022
3388
|
ctx.arcTo(width - halfLineWidth, height - halfLineWidth, width / 2, height - halfLineWidth, cornerRadius);
|
|
3023
3389
|
// Bottom left corner
|
|
@@ -3041,6 +3407,7 @@ var drawAutoUpdateIcon = function drawAutoUpdateIcon(ctx, x, y, theme, isAutoUpd
|
|
|
3041
3407
|
ctx.save();
|
|
3042
3408
|
ctx.translate(x, y);
|
|
3043
3409
|
ctx.fillStyle = isAutoUpdating ? '#7BACFF' : '#B4B4B4'; // ON
|
|
3410
|
+
|
|
3044
3411
|
ctx.font = "7px " + playerTimeText.fontFamily;
|
|
3045
3412
|
ctx.fillText(text, 5, 14);
|
|
3046
3413
|
ctx.restore();
|
|
@@ -3093,7 +3460,7 @@ var toUTCTime = function toUTCTime(dateTime) {
|
|
|
3093
3460
|
return dateUtils.unix(dateTime) - getTimezoneOffsetS(dateTime);
|
|
3094
3461
|
};
|
|
3095
3462
|
var OpenPicker = function OpenPicker() {
|
|
3096
|
-
return jsx(CalendarToday, {});
|
|
3463
|
+
return /*#__PURE__*/jsx(CalendarToday, {});
|
|
3097
3464
|
};
|
|
3098
3465
|
var enabledAndSelectedButtonStyle = {
|
|
3099
3466
|
borderWidth: '6px',
|
|
@@ -3193,14 +3560,14 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3193
3560
|
setIsUndefinedDateRange(!dataStartTime || !dataEndTime || dataStartTime > dataEndTime);
|
|
3194
3561
|
setIsDisabledRange(isDateRangeDisabled(localTimeValue));
|
|
3195
3562
|
}, [dataStartTime, dataEndTime, localTimeValue, isDateRangeDisabled]);
|
|
3196
|
-
return jsx(Paper, {
|
|
3563
|
+
return /*#__PURE__*/jsx(Paper, {
|
|
3197
3564
|
sx: {
|
|
3198
3565
|
borderRadius: '0px',
|
|
3199
3566
|
width: '240px'
|
|
3200
3567
|
},
|
|
3201
|
-
children: jsxs(Stack, {
|
|
3568
|
+
children: /*#__PURE__*/jsxs(Stack, {
|
|
3202
3569
|
"data-testid": "markerTimeSelector",
|
|
3203
|
-
children: [jsx(Paper, {
|
|
3570
|
+
children: [/*#__PURE__*/jsx(Paper, {
|
|
3204
3571
|
sx: {
|
|
3205
3572
|
height: '24px',
|
|
3206
3573
|
align: 'center',
|
|
@@ -3209,7 +3576,7 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3209
3576
|
alignItems: 'center',
|
|
3210
3577
|
borderRadius: '0px'
|
|
3211
3578
|
},
|
|
3212
|
-
children: jsx(Paper, {
|
|
3579
|
+
children: /*#__PURE__*/jsx(Paper, {
|
|
3213
3580
|
sx: {
|
|
3214
3581
|
variant: 'subtitle',
|
|
3215
3582
|
textAlign: 'center',
|
|
@@ -3226,9 +3593,9 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3226
3593
|
},
|
|
3227
3594
|
children: t('timeslider-marker')
|
|
3228
3595
|
})
|
|
3229
|
-
}), jsx(LocalizationProvider, {
|
|
3596
|
+
}), /*#__PURE__*/jsx(LocalizationProvider, {
|
|
3230
3597
|
dateAdapter: AdapterDateFns,
|
|
3231
|
-
children: jsx(DateTimePicker, {
|
|
3598
|
+
children: /*#__PURE__*/jsx(DateTimePicker, {
|
|
3232
3599
|
ampm: false,
|
|
3233
3600
|
autoFocus: true,
|
|
3234
3601
|
closeOnSelect: false,
|
|
@@ -3246,7 +3613,7 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3246
3613
|
variant: 'filled',
|
|
3247
3614
|
InputProps: {
|
|
3248
3615
|
onKeyDownCapture: handleKeyDown,
|
|
3249
|
-
endAdornment: jsx(InputAdornment, {
|
|
3616
|
+
endAdornment: /*#__PURE__*/jsx(InputAdornment, {
|
|
3250
3617
|
position: "end",
|
|
3251
3618
|
sx: {
|
|
3252
3619
|
paddingTop: '16px'
|
|
@@ -3286,6 +3653,24 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3286
3653
|
});
|
|
3287
3654
|
};
|
|
3288
3655
|
|
|
3656
|
+
/* *
|
|
3657
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3658
|
+
* you may not use this file except in compliance with the License.
|
|
3659
|
+
* You may obtain a copy of the License at
|
|
3660
|
+
*
|
|
3661
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3662
|
+
*
|
|
3663
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3664
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3665
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3666
|
+
* See the License for the specific language governing permissions and
|
|
3667
|
+
* limitations under the License.
|
|
3668
|
+
*
|
|
3669
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3670
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
3671
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3672
|
+
* */
|
|
3673
|
+
|
|
3289
3674
|
var style = {
|
|
3290
3675
|
'&.MuiToggleButton-root': {
|
|
3291
3676
|
color: '#B4B4B4',
|
|
@@ -3318,25 +3703,25 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3318
3703
|
setOpen = _React$useState2[1];
|
|
3319
3704
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
3320
3705
|
t = _useTimesliderTransla.t;
|
|
3321
|
-
return jsx(ClickAwayListener, {
|
|
3706
|
+
return /*#__PURE__*/jsx(ClickAwayListener, {
|
|
3322
3707
|
mouseEvent: "onMouseDown",
|
|
3323
3708
|
onClickAway: function onClickAway() {
|
|
3324
3709
|
return setOpen(false);
|
|
3325
3710
|
},
|
|
3326
|
-
children: jsxs("div", {
|
|
3711
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
3327
3712
|
style: {
|
|
3328
3713
|
position: 'absolute',
|
|
3329
3714
|
top: '-2px',
|
|
3330
3715
|
left: calendarIconPx + "px"
|
|
3331
3716
|
},
|
|
3332
|
-
children: [jsx(CustomTooltip, {
|
|
3717
|
+
children: [/*#__PURE__*/jsx(CustomTooltip, {
|
|
3333
3718
|
slotProps: {
|
|
3334
3719
|
transition: {
|
|
3335
3720
|
exit: false
|
|
3336
3721
|
}
|
|
3337
3722
|
},
|
|
3338
3723
|
title: !open && t('timeslider-marker-placement'),
|
|
3339
|
-
children: jsx(CustomToggleButton, {
|
|
3724
|
+
children: /*#__PURE__*/jsx(CustomToggleButton, {
|
|
3340
3725
|
onClick: function onClick() {
|
|
3341
3726
|
return setOpen(!open);
|
|
3342
3727
|
},
|
|
@@ -3346,13 +3731,13 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3346
3731
|
selected: open,
|
|
3347
3732
|
sx: style,
|
|
3348
3733
|
variant: "flat",
|
|
3349
|
-
children: jsx(CalendarToday, {
|
|
3734
|
+
children: /*#__PURE__*/jsx(CalendarToday, {
|
|
3350
3735
|
style: {
|
|
3351
3736
|
marginRight: '0px'
|
|
3352
3737
|
}
|
|
3353
3738
|
})
|
|
3354
3739
|
})
|
|
3355
|
-
}), jsx(Popper, {
|
|
3740
|
+
}), /*#__PURE__*/jsx(Popper, {
|
|
3356
3741
|
anchorEl: anchorEl,
|
|
3357
3742
|
"data-testid": "dateTimePickerPopOver",
|
|
3358
3743
|
open: open,
|
|
@@ -3360,7 +3745,7 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3360
3745
|
sx: {
|
|
3361
3746
|
zIndex: 10
|
|
3362
3747
|
},
|
|
3363
|
-
children: jsx(MarkerTimeSelector, {
|
|
3748
|
+
children: /*#__PURE__*/jsx(MarkerTimeSelector, {
|
|
3364
3749
|
dataEndTime: dataEndTime,
|
|
3365
3750
|
dataStartTime: dataStartTime,
|
|
3366
3751
|
onCancel: function onCancel() {
|
|
@@ -3377,6 +3762,24 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3377
3762
|
});
|
|
3378
3763
|
};
|
|
3379
3764
|
|
|
3765
|
+
/* *
|
|
3766
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3767
|
+
* you may not use this file except in compliance with the License.
|
|
3768
|
+
* You may obtain a copy of the License at
|
|
3769
|
+
*
|
|
3770
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3771
|
+
*
|
|
3772
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3773
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3774
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3775
|
+
* See the License for the specific language governing permissions and
|
|
3776
|
+
* limitations under the License.
|
|
3777
|
+
*
|
|
3778
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3779
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3780
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3781
|
+
* */
|
|
3782
|
+
|
|
3380
3783
|
var getTimeBoxWidth = function getTimeBoxWidth(span) {
|
|
3381
3784
|
var smallWidth = timeBoxGeom.smallWidth,
|
|
3382
3785
|
largeWidth = timeBoxGeom.largeWidth,
|
|
@@ -3387,6 +3790,7 @@ var getTimeBoxWidth = function getTimeBoxWidth(span) {
|
|
|
3387
3790
|
};
|
|
3388
3791
|
var CALENDAR_ICON_LEFT_SPACING = 1;
|
|
3389
3792
|
var DEFAULT_PX_TO_MOVE_TIMESLIDER_CENTER = 25; // When the timeslider centertime is reaching the end of the canvas, move the timeslider center a bit
|
|
3793
|
+
|
|
3390
3794
|
var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
3391
3795
|
var centerTime = _ref.centerTime,
|
|
3392
3796
|
_ref$secondsPerPx = _ref.secondsPerPx,
|
|
@@ -3416,6 +3820,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3416
3820
|
canvasWidth = _React$useState3[0],
|
|
3417
3821
|
setCanvasWidth = _React$useState3[1];
|
|
3418
3822
|
var isAnimating = linkedMapAnimationInfo == null ? void 0 : linkedMapAnimationInfo.isAnimating;
|
|
3823
|
+
|
|
3419
3824
|
// Move TimeBox back to view if it goes out of bounds
|
|
3420
3825
|
useEffect(function () {
|
|
3421
3826
|
if (!(onSetCenterTime && canvasWidth && !mouseDownInTimeBox)) {
|
|
@@ -3467,19 +3872,20 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3467
3872
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
3468
3873
|
};
|
|
3469
3874
|
}, [canvasWidth, centerTime, mouseDownInTimeBox, secondsPerPx, setUnfilteredSelectedTime, unfilteredSelectedTime]);
|
|
3875
|
+
|
|
3470
3876
|
// Display unfilteredSelectedTime (already snapped to available timestep)
|
|
3471
3877
|
var displayTime = unfilteredSelectedTime;
|
|
3472
3878
|
var timePx = timestampToPixel(displayTime, centerTime, canvasWidth, secondsPerPx);
|
|
3473
3879
|
var currentTimeBoxWidth = getTimeBoxWidth(span);
|
|
3474
3880
|
var calendarIconPx = timePx - currentTimeBoxWidth / 2 + CALENDAR_ICON_LEFT_SPACING;
|
|
3475
|
-
return jsxs(Box$1, {
|
|
3881
|
+
return /*#__PURE__*/jsxs(Box$1, {
|
|
3476
3882
|
className: "timeSliderTimeBox",
|
|
3477
3883
|
"data-testid": "timeSliderTimeBox",
|
|
3478
3884
|
sx: {
|
|
3479
3885
|
height: '24px',
|
|
3480
3886
|
cursor: cursorStyle
|
|
3481
3887
|
},
|
|
3482
|
-
children: [jsx(CanvasComponent, {
|
|
3888
|
+
children: [/*#__PURE__*/jsx(CanvasComponent, {
|
|
3483
3889
|
onMouseDown: function onMouseDown$1(x, y, width) {
|
|
3484
3890
|
if (!unfilteredSelectedTime) {
|
|
3485
3891
|
return;
|
|
@@ -3498,7 +3904,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3498
3904
|
renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, unfilteredSelectedTime, secondsPerPx, span, isAutoUpdating);
|
|
3499
3905
|
},
|
|
3500
3906
|
ref: node
|
|
3501
|
-
}), jsx(CalendarButton, {
|
|
3907
|
+
}), /*#__PURE__*/jsx(CalendarButton, {
|
|
3502
3908
|
calendarIconPx: calendarIconPx,
|
|
3503
3909
|
dataEndTime: dataEndTime,
|
|
3504
3910
|
dataStartTime: dataStartTime,
|
|
@@ -3515,10 +3921,28 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3515
3921
|
});
|
|
3516
3922
|
};
|
|
3517
3923
|
|
|
3924
|
+
/* *
|
|
3925
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3926
|
+
* you may not use this file except in compliance with the License.
|
|
3927
|
+
* You may obtain a copy of the License at
|
|
3928
|
+
*
|
|
3929
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3930
|
+
*
|
|
3931
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3932
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3933
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3934
|
+
* See the License for the specific language governing permissions and
|
|
3935
|
+
* limitations under the License.
|
|
3936
|
+
*
|
|
3937
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3938
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
3939
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3940
|
+
* */
|
|
3941
|
+
|
|
3518
3942
|
var TimesliderI18nProvider = function TimesliderI18nProvider(_ref) {
|
|
3519
3943
|
var children = _ref.children;
|
|
3520
3944
|
initTimesliderI18n();
|
|
3521
|
-
return jsx(I18nextProvider, {
|
|
3945
|
+
return /*#__PURE__*/jsx(I18nextProvider, {
|
|
3522
3946
|
i18n: i18n,
|
|
3523
3947
|
children: children
|
|
3524
3948
|
});
|
|
@@ -3528,8 +3952,8 @@ var DemoWrapper = function DemoWrapper(_ref2) {
|
|
|
3528
3952
|
_ref2$theme = _ref2.theme,
|
|
3529
3953
|
theme = _ref2$theme === void 0 ? 'light' : _ref2$theme;
|
|
3530
3954
|
var themeToApply = theme === 'light' ? lightTheme : darkTheme;
|
|
3531
|
-
return jsx(TimesliderI18nProvider, {
|
|
3532
|
-
children: jsx(ThemeWrapper, {
|
|
3955
|
+
return /*#__PURE__*/jsx(TimesliderI18nProvider, {
|
|
3956
|
+
children: /*#__PURE__*/jsx(ThemeWrapper, {
|
|
3533
3957
|
theme: themeToApply,
|
|
3534
3958
|
children: children
|
|
3535
3959
|
})
|