@opengeoweb/time-slider 21.2.0 → 21.3.0-nightly-20261128
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/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { Grid, useTheme, Box, InputAdornment, Typography, RadioGroup, FormControlLabel, Radio, Divider, FormHelperText, Popover, Menu, MenuItem, CardHeader, FormControl, TextField, Select, Popper, Paper, Stack, ClickAwayListener } from '@mui/material';
|
|
3
|
-
import
|
|
4
|
-
import { dateUtils, isTargetInteractiveInput, isDialogFocused, safelyInitI18nForTestsAndStories, CustomIconButton, CustomTooltip, CanvasComponent, NumberWithUnitField, DateTimePicker, renderCounter, pickerDateToUTC, CustomToggleButton } from '@opengeoweb/shared';
|
|
3
|
+
import { dateUtils, useGeoWebHotkey, safelyInitI18nForTestsAndStories, CustomIconButton, CustomTooltip, CanvasComponent, NumberWithUnitField, DateTimePicker, renderCounter, pickerDateToUTC, CustomToggleButton } from '@opengeoweb/shared';
|
|
5
4
|
import { debounce, throttle } from 'lodash';
|
|
5
|
+
import React, { useState, useRef, useEffect, useCallback, useContext, useMemo, createElement } from 'react';
|
|
6
6
|
import { ChevronDown, ChevronUp, dragHandlePath, Clock, CalendarToday, Animation, AutoUpdateActive, AutoUpdateInActive, StepForward, StepBackward, Now, Pause, Play, Edit, Speed, FastForward, Options, ThemeWrapper, lightTheme, darkTheme } from '@opengeoweb/theme';
|
|
7
7
|
import i18n from 'i18next';
|
|
8
8
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
@@ -749,47 +749,29 @@ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, data
|
|
|
749
749
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
750
750
|
* */
|
|
751
751
|
var useToggleTimesliderVisibility = function useToggleTimesliderVisibility(mapIsActive, isVisible, onToggleTimeSlider) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
760
|
-
return function () {
|
|
761
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
762
|
-
};
|
|
763
|
-
}, [mapIsActive, isVisible, onToggleTimeSlider]);
|
|
752
|
+
useGeoWebHotkey('timeSlider.toggle', function () {
|
|
753
|
+
return onToggleTimeSlider(!isVisible);
|
|
754
|
+
}, {
|
|
755
|
+
enabled: mapIsActive
|
|
756
|
+
});
|
|
764
757
|
};
|
|
765
758
|
var useMoveTimeWithKeyboard = function useMoveTimeWithKeyboard(mapIsActive, timeStep, dataStartTime, dataEndTime, onSetNewDate, onSetCenterTime, selectedTime) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
case 'ArrowRight':
|
|
783
|
-
setNextTimeStep(timeStep, selectedTime, dataEndTime, onSetNewDate);
|
|
784
|
-
break;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
789
|
-
return function () {
|
|
790
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
791
|
-
};
|
|
792
|
-
}, [dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, selectedTime, timeStep]);
|
|
759
|
+
var hasDataRange = Boolean(dataStartTime && dataEndTime);
|
|
760
|
+
useGeoWebHotkey('timeSlider.now', function () {
|
|
761
|
+
return handleSetNowEvent(timeStep, dataStartTime, dataEndTime, dateUtils.unix(dateUtils.utc()), onSetNewDate, onSetCenterTime);
|
|
762
|
+
}, {
|
|
763
|
+
enabled: mapIsActive
|
|
764
|
+
});
|
|
765
|
+
useGeoWebHotkey('timeSlider.stepBackward', function () {
|
|
766
|
+
return setPreviousTimeStep(timeStep, selectedTime, dataStartTime, onSetNewDate);
|
|
767
|
+
}, {
|
|
768
|
+
enabled: mapIsActive && hasDataRange
|
|
769
|
+
});
|
|
770
|
+
useGeoWebHotkey('timeSlider.stepForward', function () {
|
|
771
|
+
return setNextTimeStep(timeStep, selectedTime, dataEndTime, onSetNewDate);
|
|
772
|
+
}, {
|
|
773
|
+
enabled: mapIsActive && hasDataRange
|
|
774
|
+
});
|
|
793
775
|
};
|
|
794
776
|
|
|
795
777
|
/* *
|
|
@@ -3732,24 +3714,6 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
3732
3714
|
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
3733
3715
|
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
3734
3716
|
* */
|
|
3735
|
-
var isMac = function isMac() {
|
|
3736
|
-
return window.navigator.userAgent.includes(' Mac ');
|
|
3737
|
-
};
|
|
3738
|
-
var hasShortcutModifier = function hasShortcutModifier(event) {
|
|
3739
|
-
return isMac() ? event.ctrlKey && event.shiftKey : event.ctrlKey;
|
|
3740
|
-
};
|
|
3741
|
-
var getTimeStepShortcutDirection = function getTimeStepShortcutDirection(event) {
|
|
3742
|
-
if (!hasShortcutModifier(event)) {
|
|
3743
|
-
return null;
|
|
3744
|
-
}
|
|
3745
|
-
if (event.key === 'ArrowUp') {
|
|
3746
|
-
return 'up';
|
|
3747
|
-
}
|
|
3748
|
-
if (event.key === 'ArrowDown') {
|
|
3749
|
-
return 'down';
|
|
3750
|
-
}
|
|
3751
|
-
return null;
|
|
3752
|
-
};
|
|
3753
3717
|
var focusAdjacentMenuItem = function focusAdjacentMenuItem(target, direction) {
|
|
3754
3718
|
var _target$parentElement, _target$parentElement2, _menuItems$nextIndex;
|
|
3755
3719
|
if (!(target instanceof HTMLElement) || target.getAttribute('role') !== 'menuitem') {
|
|
@@ -3761,41 +3725,18 @@ var focusAdjacentMenuItem = function focusAdjacentMenuItem(target, direction) {
|
|
|
3761
3725
|
(_menuItems$nextIndex = menuItems[nextIndex]) == null || _menuItems$nextIndex.focus();
|
|
3762
3726
|
};
|
|
3763
3727
|
var TimeStepShortcutContext = /*#__PURE__*/React.createContext(null);
|
|
3764
|
-
// Listens for the time-step keyboard shortcut on document (capture phase, so it
|
|
3765
|
-
// runs before any element-level handlers that may stopPropagation). Ignores
|
|
3766
|
-
// presses while focus is in a text input.
|
|
3767
3728
|
var useTimeStepShortcutListener = function useTimeStepShortcutListener(enabled, onShortcut) {
|
|
3768
|
-
var
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
React.useEffect(function () {
|
|
3773
|
-
if (!enabled) {
|
|
3774
|
-
return undefined;
|
|
3775
|
-
}
|
|
3776
|
-
var handleKeyDown = function handleKeyDown(event) {
|
|
3777
|
-
var target = event.target;
|
|
3778
|
-
if (isTargetInteractiveInput(target) || isDialogFocused()) {
|
|
3779
|
-
return;
|
|
3780
|
-
}
|
|
3781
|
-
var direction = getTimeStepShortcutDirection(event);
|
|
3782
|
-
if (!direction) {
|
|
3783
|
-
return;
|
|
3784
|
-
}
|
|
3785
|
-
event.preventDefault();
|
|
3786
|
-
event.stopPropagation();
|
|
3787
|
-
onShortcutRef.current(direction);
|
|
3788
|
-
focusAdjacentMenuItem(target, direction);
|
|
3729
|
+
var handleShortcut = function handleShortcut(direction) {
|
|
3730
|
+
return function (event) {
|
|
3731
|
+
onShortcut(direction);
|
|
3732
|
+
focusAdjacentMenuItem(event.target, direction);
|
|
3789
3733
|
};
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
});
|
|
3797
|
-
};
|
|
3798
|
-
}, [enabled]);
|
|
3734
|
+
};
|
|
3735
|
+
var options = {
|
|
3736
|
+
enabled: enabled
|
|
3737
|
+
};
|
|
3738
|
+
useGeoWebHotkey('timeSlider.increaseTimeStep', handleShortcut('up'), options);
|
|
3739
|
+
useGeoWebHotkey('timeSlider.decreaseTimeStep', handleShortcut('down'), options);
|
|
3799
3740
|
};
|
|
3800
3741
|
|
|
3801
3742
|
var marks = [{
|
package/dist/src/lib/components/TimeSliderButtons/OptionsMenuButton/optionsMenuShortcut.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type TimeStepDirection = 'up' | 'down';
|
|
3
|
-
export declare const getTimeStepShortcutDirection: (event: KeyboardEvent | React.KeyboardEvent) => TimeStepDirection | null;
|
|
4
3
|
export interface TimeStepShortcutContextValue {
|
|
5
4
|
pendingDirection: TimeStepDirection | null;
|
|
6
5
|
closeOptionsMenu: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/time-slider",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.3.0-nightly-20261128",
|
|
4
4
|
"description": "GeoWeb time-slider library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@opengeoweb/shared": "21.
|
|
23
|
+
"@opengeoweb/shared": "21.3.0-nightly-20261128",
|
|
24
24
|
"lodash": "^4.18.1",
|
|
25
|
-
"@opengeoweb/theme": "21.
|
|
25
|
+
"@opengeoweb/theme": "21.3.0-nightly-20261128",
|
|
26
26
|
"@mui/x-date-pickers": "^9.3.0",
|
|
27
27
|
"@mui/system": "^9.0.1",
|
|
28
|
-
"i18next": "^
|
|
28
|
+
"i18next": "^26.3.4",
|
|
29
29
|
"@mui/material": "^9.0.1",
|
|
30
30
|
"react-i18next": "^15.1.1"
|
|
31
31
|
},
|