@opengeoweb/time-slider 19.3.0 → 19.4.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.
Files changed (2) hide show
  1. package/dist/index.esm.js +21 -9
  2. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -2081,16 +2081,25 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
2081
2081
  setDisplayLengthInputField(false);
2082
2082
  }
2083
2083
  }, [displayLengthInputField, open]);
2084
+ var getDisplayTextFromMark = function getDisplayTextFromMark(mark) {
2085
+ if (!(mark != null && mark.label)) {
2086
+ return '';
2087
+ }
2088
+ var parts = t(mark.label).split(' ');
2089
+ if (parts.length > 1) {
2090
+ return parts[0] + parts.slice(1).join(' ');
2091
+ }
2092
+ return parts.join('');
2093
+ };
2084
2094
  var buttonText = function buttonText(value, displayCurrentLength, currentMark) {
2085
2095
  if (displayCurrentLength) {
2096
+ if (!Number.isInteger(value)) {
2097
+ return value + "m";
2098
+ }
2086
2099
  return minutesToDescribedDuration(value);
2087
2100
  }
2088
- if (currentMark) {
2089
- var parts = t(currentMark.label).split(' ');
2090
- if (parts.length > 1) {
2091
- return parts[0] + parts.slice(1).join(' ');
2092
- }
2093
- return parts.join('');
2101
+ if (currentMark != null && currentMark.label) {
2102
+ return getDisplayTextFromMark(currentMark);
2094
2103
  }
2095
2104
  return '';
2096
2105
  };
@@ -2103,6 +2112,9 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
2103
2112
  var newValue = marks[Math.min(Math.max(currentMarkIndex - direction, 0), marks.length - 1)];
2104
2113
  throttledScroll(newValue.value);
2105
2114
  }, [currentMarkIndex, marks, throttledScroll]);
2115
+ var buttonDisplayText = buttonText(value, displayCurrentLength, currentMark);
2116
+ var menuDisplayValue = !Number.isInteger(value) ? value + "m" : minutesToDescribedDuration(value);
2117
+ var displayValue = isAutoSelected ? "A: " + buttonDisplayText : buttonDisplayText;
2106
2118
  return jsxs(Box, {
2107
2119
  onKeyDown: function onKeyDown(event) {
2108
2120
  event.stopPropagation();
@@ -2129,7 +2141,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
2129
2141
  fontWeight: 400,
2130
2142
  textTransform: 'none'
2131
2143
  },
2132
- children: buttonText(value, displayCurrentLength, currentMark)
2144
+ children: displayValue
2133
2145
  })]
2134
2146
  }), !!anchorRef && jsxs(Menu, {
2135
2147
  anchorEl: anchorRef,
@@ -2165,7 +2177,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
2165
2177
  },
2166
2178
  children: title
2167
2179
  }), marks.map(function (mark) {
2168
- var isSelected = (currentMark == null ? void 0 : currentMark.value) === mark.value && !isAutoSelected;
2180
+ var isSelected = (currentMark == null ? void 0 : currentMark.value) === mark.value;
2169
2181
  return jsx(MenuItem, {
2170
2182
  disabled: allOptionsDisabled,
2171
2183
  onClick: function onClick() {
@@ -2227,7 +2239,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
2227
2239
  textTransform: 'none',
2228
2240
  lineHeight: 2
2229
2241
  },
2230
- children: minutesToDescribedDuration(value)
2242
+ children: menuDisplayValue
2231
2243
  }), jsx(CustomTooltip, {
2232
2244
  title: t('timeslider-edit'),
2233
2245
  children: jsx("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/time-slider",
3
- "version": "19.3.0",
3
+ "version": "19.4.0",
4
4
  "description": "GeoWeb time-slider library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {