@opengeoweb/shared 9.6.0 → 9.7.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 CHANGED
@@ -6,7 +6,7 @@ import { throttle, escapeRegExp, debounce } from 'lodash';
6
6
  import Draggable from 'react-draggable';
7
7
  import { Resizable } from 're-resizable';
8
8
  import { useStore } from 'react-redux';
9
- import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$1 } from 'date-fns';
9
+ import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$1, startOfDay } from 'date-fns';
10
10
  import configureStore from 'redux-mock-store';
11
11
  import { configureStore as configureStore$1 } from '@reduxjs/toolkit';
12
12
 
@@ -91,6 +91,17 @@ var StatusTag = function StatusTag(_a) {
91
91
  }, content));
92
92
  };
93
93
 
94
+ function _callSuper(t, o, e) {
95
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
96
+ }
97
+ function _isNativeReflectConstruct() {
98
+ try {
99
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
100
+ } catch (t) {}
101
+ return (_isNativeReflectConstruct = function () {
102
+ return !!t;
103
+ })();
104
+ }
94
105
  function _iterableToArrayLimit(r, l) {
95
106
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
96
107
  if (null != t) {
@@ -197,17 +208,6 @@ function _setPrototypeOf(o, p) {
197
208
  };
198
209
  return _setPrototypeOf(o, p);
199
210
  }
200
- function _isNativeReflectConstruct() {
201
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
202
- if (Reflect.construct.sham) return false;
203
- if (typeof Proxy === "function") return true;
204
- try {
205
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
206
- return true;
207
- } catch (e) {
208
- return false;
209
- }
210
- }
211
211
  function _assertThisInitialized(self) {
212
212
  if (self === void 0) {
213
213
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -222,20 +222,6 @@ function _possibleConstructorReturn(self, call) {
222
222
  }
223
223
  return _assertThisInitialized(self);
224
224
  }
225
- function _createSuper(Derived) {
226
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
227
- return function _createSuperInternal() {
228
- var Super = _getPrototypeOf(Derived),
229
- result;
230
- if (hasNativeReflectConstruct) {
231
- var NewTarget = _getPrototypeOf(this).constructor;
232
- result = Reflect.construct(Super, arguments, NewTarget);
233
- } else {
234
- result = Super.apply(this, arguments);
235
- }
236
- return _possibleConstructorReturn(this, result);
237
- };
238
- }
239
225
  function _slicedToArray(arr, i) {
240
226
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
241
227
  }
@@ -557,11 +543,12 @@ function usePreventBrowserClose(shouldPreventClose) {
557
543
  * See the License for the specific language governing permissions and
558
544
  * limitations under the License.
559
545
  *
560
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
561
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
546
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
547
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
562
548
  * */
549
+ var pollingIntervalTimeout = 300000;
563
550
  var usePoller = function usePoller(deps, callback) {
564
- var pollingInterval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300000;
551
+ var pollingInterval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pollingIntervalTimeout;
565
552
  var interval = useRef(null);
566
553
  React.useEffect(function () {
567
554
  if (deps.filter(function (dep) {
@@ -1240,11 +1227,10 @@ var ResizeComponent = function ResizeComponent(_a) {
1240
1227
  */
1241
1228
  var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
1242
1229
  _inherits(ErrorBoundary, _React$Component);
1243
- var _super = _createSuper(ErrorBoundary);
1244
1230
  function ErrorBoundary(props) {
1245
1231
  var _this;
1246
1232
  _classCallCheck(this, ErrorBoundary);
1247
- _this = _super.call(this, props);
1233
+ _this = _callSuper(this, ErrorBoundary, [props]);
1248
1234
  _this.state = {
1249
1235
  error: undefined,
1250
1236
  errorInfo: undefined
@@ -1508,7 +1494,9 @@ var getStyle = function getStyle(size) {
1508
1494
  {
1509
1495
  return {
1510
1496
  fontSize: 12,
1511
- fontWeight: 500
1497
+ fontWeight: 500,
1498
+ lineHeight: '22px',
1499
+ marginTop: '-1px'
1512
1500
  };
1513
1501
  }
1514
1502
  case 'small':
@@ -1619,7 +1607,9 @@ var ToolHeader = function ToolHeader(_ref) {
1619
1607
  noWrap: true,
1620
1608
  sx: {
1621
1609
  fontSize: styles.fontSize,
1622
- fontWeight: styles.fontWeight
1610
+ fontWeight: styles.fontWeight,
1611
+ lineHeight: styles.lineHeight,
1612
+ marginTop: styles.marginTop
1623
1613
  },
1624
1614
  role: "heading"
1625
1615
  }, title)), size === 'xxs' && ( /*#__PURE__*/React__default.createElement(CustomIconButton, {
@@ -1833,31 +1823,33 @@ var useHandleSizeFromOutsideComponent = function useHandleSizeFromOutsideCompone
1833
1823
  // update size when startSize has changed outside the component
1834
1824
  if (startSize !== size) {
1835
1825
  var node = (_a = nodeRef.current) === null || _a === void 0 ? void 0 : _a.firstChild;
1836
- var boundsNode = bounds === 'parent' ? (_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.parentNode : document.querySelector(bounds);
1837
- var _boundsNode$getBoundi = boundsNode.getBoundingClientRect(),
1838
- maxWidth = _boundsNode$getBoundi.width;
1839
- var newWidth = Number(startSize.width);
1840
- var _ref4 = (_c = node === null || node === void 0 ? void 0 : node.getBoundingClientRect()) !== null && _c !== void 0 ? _c : {},
1841
- currentX = _ref4.x,
1842
- currentWidth = _ref4.width;
1843
- var _ref5 = isRightAligned ? getRightPositionAndSize({
1844
- currentX: currentX,
1845
- currentWidth: currentWidth,
1846
- newWidth: newWidth,
1847
- maxWidth: maxWidth,
1848
- position: position,
1849
- startSize: startSize
1850
- }) : getLeftPositionAndSize({
1851
- currentX: currentX - boundsNode.getBoundingClientRect().x,
1852
- newWidth: newWidth,
1853
- maxWidth: maxWidth,
1854
- position: position,
1855
- startSize: startSize
1856
- }),
1857
- newPosition = _ref5.position,
1858
- newSize = _ref5.size;
1859
- setSize(newSize);
1860
- setPosition(newPosition);
1826
+ if (node) {
1827
+ var boundsNode = bounds === 'parent' ? (_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.parentNode : document.querySelector(bounds);
1828
+ var _boundsNode$getBoundi = boundsNode.getBoundingClientRect(),
1829
+ maxWidth = _boundsNode$getBoundi.width;
1830
+ var newWidth = Number(startSize.width);
1831
+ var _ref4 = (_c = node === null || node === void 0 ? void 0 : node.getBoundingClientRect()) !== null && _c !== void 0 ? _c : {},
1832
+ currentX = _ref4.x,
1833
+ currentWidth = _ref4.width;
1834
+ var _ref5 = isRightAligned ? getRightPositionAndSize({
1835
+ currentX: currentX,
1836
+ currentWidth: currentWidth,
1837
+ newWidth: newWidth,
1838
+ maxWidth: maxWidth,
1839
+ position: position,
1840
+ startSize: startSize
1841
+ }) : getLeftPositionAndSize({
1842
+ currentX: currentX - boundsNode.getBoundingClientRect().x,
1843
+ newWidth: newWidth,
1844
+ maxWidth: maxWidth,
1845
+ position: position,
1846
+ startSize: startSize
1847
+ }),
1848
+ newPosition = _ref5.position,
1849
+ newSize = _ref5.size;
1850
+ setSize(newSize);
1851
+ setPosition(newPosition);
1852
+ }
1861
1853
  }
1862
1854
  // eslint-disable-next-line react-hooks/exhaustive-deps
1863
1855
  }, [startSize.width, startSize.height]);
@@ -3391,8 +3383,8 @@ var getWarningMessage = function getWarningMessage(error) {
3391
3383
  * See the License for the specific language governing permissions and
3392
3384
  * limitations under the License.
3393
3385
  *
3394
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3395
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
3386
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3387
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
3396
3388
  * */
3397
3389
  /**
3398
3390
  * Parsing date strings with geoweb dateUtils:
@@ -3755,7 +3747,9 @@ var index = /*#__PURE__*/Object.freeze({
3755
3747
  unix: unix,
3756
3748
  fromUnix: fromUnix,
3757
3749
  set: set,
3758
- isEqual: isEqual
3750
+ isEqual: isEqual,
3751
+ startOfDay: startOfDay,
3752
+ parseISO: parseISO
3759
3753
  });
3760
3754
 
3761
3755
  /* *
@@ -3884,4 +3878,4 @@ var RenderCounter = /*#__PURE__*/function () {
3884
3878
  }();
3885
3879
  var renderCounter = new RenderCounter();
3886
3880
 
3887
- export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, BUTTON_TITLE, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, LastUpdateTime, ResizeComponent as Resizable, SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, createMockStoreWithEggsAndMiddleware, createToolkitMockStoreWithEggs, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getHeight, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosError, renderCounter, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
3881
+ export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, BUTTON_TITLE, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, LastUpdateTime, ResizeComponent as Resizable, SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, createMockStoreWithEggsAndMiddleware, createToolkitMockStoreWithEggs, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getHeight, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosError, pollingIntervalTimeout, renderCounter, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "9.6.0",
3
+ "version": "9.7.0",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,2 +1,3 @@
1
1
  import * as React from 'react';
2
+ export declare const pollingIntervalTimeout = 300000;
2
3
  export declare const usePoller: (deps: unknown[], callback: () => void, pollingInterval?: number) => React.RefObject<ReturnType<typeof setTimeout>>;
@@ -1,4 +1,4 @@
1
- import { isEqual, Duration } from 'date-fns';
1
+ import { parseISO, isEqual, Duration, startOfDay } from 'date-fns';
2
2
  export interface DateValues {
3
3
  year?: number;
4
4
  month?: number;
@@ -226,4 +226,4 @@ export declare const set: (date: Date, values: DateValues, useLocalTimeZone?: bo
226
226
  * @param {Date} date - second date
227
227
  * @returns {boolean} - True if dates are equal
228
228
  */
229
- export { isEqual };
229
+ export { isEqual, startOfDay, parseISO };