@opengeoweb/shared 9.6.0 → 9.8.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
|
|
561
|
-
* Copyright
|
|
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] :
|
|
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 =
|
|
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
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
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
|
|
3395
|
-
* Copyright
|
|
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:
|
|
@@ -3682,6 +3674,27 @@ var unix = function unix(date) {
|
|
|
3682
3674
|
var fromUnix = function fromUnix(unixTime) {
|
|
3683
3675
|
return fromUnixTime(unixTime);
|
|
3684
3676
|
};
|
|
3677
|
+
var parseCustomDateString = function parseCustomDateString(dateStr) {
|
|
3678
|
+
var customFormatRegex = /^\d{12}$/;
|
|
3679
|
+
var customFormatWithTRegex = /^\d{8}T\d{6}$/;
|
|
3680
|
+
if (customFormatRegex.test(dateStr)) {
|
|
3681
|
+
var year = parseInt(dateStr.substring(0, 4), 10);
|
|
3682
|
+
var month = parseInt(dateStr.substring(4, 6), 10) - 1;
|
|
3683
|
+
var day = parseInt(dateStr.substring(6, 8), 10);
|
|
3684
|
+
var hour = parseInt(dateStr.substring(8, 10), 10);
|
|
3685
|
+
var minute = parseInt(dateStr.substring(10, 12), 10);
|
|
3686
|
+
return new Date(Date.UTC(year, month, day, hour, minute));
|
|
3687
|
+
}
|
|
3688
|
+
if (customFormatWithTRegex.test(dateStr)) {
|
|
3689
|
+
var _year = parseInt(dateStr.substring(0, 4), 10);
|
|
3690
|
+
var _month = parseInt(dateStr.substring(4, 6), 10) - 1;
|
|
3691
|
+
var _day = parseInt(dateStr.substring(6, 8), 10);
|
|
3692
|
+
var _hour = parseInt(dateStr.substring(9, 11), 10);
|
|
3693
|
+
var _minute = parseInt(dateStr.substring(11, 13), 10);
|
|
3694
|
+
return new Date(Date.UTC(_year, _month, _day, _hour, _minute));
|
|
3695
|
+
}
|
|
3696
|
+
return new Date(dateStr);
|
|
3697
|
+
};
|
|
3685
3698
|
/**
|
|
3686
3699
|
* Set date values to a given date (by default it is assumed you are passing the new values in UTC).
|
|
3687
3700
|
* @param date - the dater to be changed
|
|
@@ -3754,8 +3767,11 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3754
3767
|
isValid: isValid,
|
|
3755
3768
|
unix: unix,
|
|
3756
3769
|
fromUnix: fromUnix,
|
|
3770
|
+
parseCustomDateString: parseCustomDateString,
|
|
3757
3771
|
set: set,
|
|
3758
|
-
isEqual: isEqual
|
|
3772
|
+
isEqual: isEqual,
|
|
3773
|
+
startOfDay: startOfDay,
|
|
3774
|
+
parseISO: parseISO
|
|
3759
3775
|
});
|
|
3760
3776
|
|
|
3761
3777
|
/* *
|
|
@@ -3884,4 +3900,4 @@ var RenderCounter = /*#__PURE__*/function () {
|
|
|
3884
3900
|
}();
|
|
3885
3901
|
var renderCounter = new RenderCounter();
|
|
3886
3902
|
|
|
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 };
|
|
3903
|
+
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,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;
|
|
@@ -212,6 +212,7 @@ export declare const unix: (date: Date | number) => number;
|
|
|
212
212
|
* @returns the timestamp
|
|
213
213
|
*/
|
|
214
214
|
export declare const fromUnix: (unixTime: number) => Date;
|
|
215
|
+
export declare const parseCustomDateString: (dateStr: string) => Date;
|
|
215
216
|
/**
|
|
216
217
|
* Set date values to a given date (by default it is assumed you are passing the new values in UTC).
|
|
217
218
|
* @param date - the dater to be changed
|
|
@@ -226,4 +227,4 @@ export declare const set: (date: Date, values: DateValues, useLocalTimeZone?: bo
|
|
|
226
227
|
* @param {Date} date - second date
|
|
227
228
|
* @returns {boolean} - True if dates are equal
|
|
228
229
|
*/
|
|
229
|
-
export { isEqual };
|
|
230
|
+
export { isEqual, startOfDay, parseISO };
|