@opengeoweb/shared 8.4.1 → 9.1.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 +153 -4
- package/package.json +2 -17
- package/src/lib/components/SearchField/SearchField.d.ts +9 -0
- package/src/lib/components/SearchField/SearchField.spec.d.ts +1 -0
- package/src/lib/components/SearchField/SearchFieldButtonContainer.d.ts +9 -0
- package/src/lib/components/SearchField/SearchFieldButtonContainer.spec.d.ts +1 -0
- package/src/lib/components/SearchField/index.d.ts +2 -0
- package/src/lib/components/WithEggs/WithEggs.d.ts +5 -1
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/types/types.d.ts +11 -1
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { useRef, useContext } from 'react';
|
|
3
|
-
import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, Switch } from '@mui/material';
|
|
4
|
-
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown } from '@opengeoweb/theme';
|
|
3
|
+
import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, Switch, TextField, InputAdornment } from '@mui/material';
|
|
4
|
+
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear } from '@opengeoweb/theme';
|
|
5
5
|
import require$$2, { flushSync } from 'react-dom';
|
|
6
6
|
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, set as set$1 } from 'date-fns';
|
|
7
7
|
|
|
@@ -332,6 +332,7 @@ var CustomIconButton = /*#__PURE__*/React$1.forwardRef(function (_a, ref) {
|
|
|
332
332
|
size: size,
|
|
333
333
|
className: classNames,
|
|
334
334
|
ref: ref,
|
|
335
|
+
"aria-pressed": isSelected,
|
|
335
336
|
sx: Object.assign(Object.assign({}, props.sx), shouldShowAsDisabled && {
|
|
336
337
|
'&.MuiIconButton-root': {
|
|
337
338
|
color: "geowebColors.iconButtons.".concat(variant, ".disabled.color")
|
|
@@ -22506,7 +22507,8 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
22506
22507
|
}),
|
|
22507
22508
|
ref: nodeRef,
|
|
22508
22509
|
className: "toolContainerDraggable",
|
|
22509
|
-
role: "dialog"
|
|
22510
|
+
role: "dialog",
|
|
22511
|
+
"aria-label": title
|
|
22510
22512
|
}, /*#__PURE__*/React__default.createElement(ResizeComponent, Object.assign({}, props, {
|
|
22511
22513
|
size: size,
|
|
22512
22514
|
setSize: setSize,
|
|
@@ -24593,6 +24595,153 @@ var SwitchButton = function SwitchButton(props) {
|
|
|
24593
24595
|
}, "Editor")));
|
|
24594
24596
|
};
|
|
24595
24597
|
|
|
24598
|
+
/* *
|
|
24599
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24600
|
+
* you may not use this file except in compliance with the License.
|
|
24601
|
+
* You may obtain a copy of the License at
|
|
24602
|
+
*
|
|
24603
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24604
|
+
*
|
|
24605
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24606
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24607
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24608
|
+
* See the License for the specific language governing permissions and
|
|
24609
|
+
* limitations under the License.
|
|
24610
|
+
*
|
|
24611
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
24612
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
24613
|
+
* */
|
|
24614
|
+
var isURL = function isURL(string) {
|
|
24615
|
+
return /^https?:\/\//.test(string);
|
|
24616
|
+
};
|
|
24617
|
+
var ClearButton = function ClearButton(_ref) {
|
|
24618
|
+
var onClick = _ref.onClick;
|
|
24619
|
+
return /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
24620
|
+
tooltipTitle: "Clear",
|
|
24621
|
+
sx: buttonStyle,
|
|
24622
|
+
onClick: onClick
|
|
24623
|
+
}, /*#__PURE__*/React__default.createElement(Clear, null));
|
|
24624
|
+
};
|
|
24625
|
+
var buttonStyle = {
|
|
24626
|
+
'&.MuiButtonBase-root.MuiIconButton-root': {
|
|
24627
|
+
width: 48,
|
|
24628
|
+
height: 48,
|
|
24629
|
+
marginRight: '-12px'
|
|
24630
|
+
}
|
|
24631
|
+
};
|
|
24632
|
+
var SearchFieldButton = function SearchFieldButton(_ref2) {
|
|
24633
|
+
var localSearchString = _ref2.localSearchString,
|
|
24634
|
+
onClickClear = _ref2.onClickClear,
|
|
24635
|
+
setPopupIsOpen = _ref2.setPopupIsOpen;
|
|
24636
|
+
if (isURL(localSearchString)) {
|
|
24637
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
24638
|
+
style: {
|
|
24639
|
+
marginRight: '15px'
|
|
24640
|
+
}
|
|
24641
|
+
}, /*#__PURE__*/React__default.createElement(ClearButton, {
|
|
24642
|
+
onClick: function onClick() {
|
|
24643
|
+
return onClickClear();
|
|
24644
|
+
}
|
|
24645
|
+
})), /*#__PURE__*/React__default.createElement(Button, {
|
|
24646
|
+
variant: "tertiary",
|
|
24647
|
+
onClick: function onClick() {
|
|
24648
|
+
return setPopupIsOpen(true);
|
|
24649
|
+
}
|
|
24650
|
+
}, "Save"));
|
|
24651
|
+
}
|
|
24652
|
+
if (localSearchString) {
|
|
24653
|
+
return /*#__PURE__*/React__default.createElement(ClearButton, {
|
|
24654
|
+
onClick: function onClick() {
|
|
24655
|
+
return onClickClear();
|
|
24656
|
+
}
|
|
24657
|
+
});
|
|
24658
|
+
}
|
|
24659
|
+
return /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
24660
|
+
tooltipTitle: "Search",
|
|
24661
|
+
sx: buttonStyle
|
|
24662
|
+
}, /*#__PURE__*/React__default.createElement(Search, null));
|
|
24663
|
+
};
|
|
24664
|
+
|
|
24665
|
+
var SearchField = function SearchField(_ref) {
|
|
24666
|
+
var searchFilter = _ref.searchFilter,
|
|
24667
|
+
_ref$label = _ref.label,
|
|
24668
|
+
label = _ref$label === void 0 ? 'Search through services or enter a service URL' : _ref$label,
|
|
24669
|
+
setSearchFilter = _ref.setSearchFilter,
|
|
24670
|
+
onOpenServicePopup = _ref.onOpenServicePopup;
|
|
24671
|
+
var _React$useState = React$1.useState(''),
|
|
24672
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
24673
|
+
localSearchString = _React$useState2[0],
|
|
24674
|
+
setLocalSearchString = _React$useState2[1];
|
|
24675
|
+
var _React$useState3 = React$1.useState(false),
|
|
24676
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
24677
|
+
urlIsValid = _React$useState4[0],
|
|
24678
|
+
setUrlIsValid = _React$useState4[1];
|
|
24679
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24680
|
+
var setSearchFilterDebounced = React$1.useCallback(lodash.exports.debounce(setSearchFilter, 300), []);
|
|
24681
|
+
var handleChange = function handleChange(text) {
|
|
24682
|
+
setLocalSearchString(text);
|
|
24683
|
+
if (!isURL(text)) {
|
|
24684
|
+
setSearchFilterDebounced(text);
|
|
24685
|
+
} else if (searchFilter) {
|
|
24686
|
+
setSearchFilterDebounced('');
|
|
24687
|
+
}
|
|
24688
|
+
};
|
|
24689
|
+
React$1.useEffect(function () {
|
|
24690
|
+
if (isURL(localSearchString)) {
|
|
24691
|
+
setUrlIsValid(true);
|
|
24692
|
+
}
|
|
24693
|
+
}, [localSearchString]);
|
|
24694
|
+
React$1.useEffect(function () {
|
|
24695
|
+
var keyDownHandler = function keyDownHandler(event) {
|
|
24696
|
+
if (event.key === 'Enter') {
|
|
24697
|
+
event.preventDefault();
|
|
24698
|
+
if (urlIsValid) {
|
|
24699
|
+
onOpenServicePopup(localSearchString);
|
|
24700
|
+
setLocalSearchString('');
|
|
24701
|
+
}
|
|
24702
|
+
}
|
|
24703
|
+
};
|
|
24704
|
+
document.addEventListener('keydown', keyDownHandler);
|
|
24705
|
+
return function () {
|
|
24706
|
+
document.removeEventListener('keydown', keyDownHandler);
|
|
24707
|
+
};
|
|
24708
|
+
}, [urlIsValid, localSearchString, onOpenServicePopup]);
|
|
24709
|
+
// mirror store unless typing a URL
|
|
24710
|
+
React$1.useEffect(function () {
|
|
24711
|
+
if (isURL(localSearchString)) {
|
|
24712
|
+
return;
|
|
24713
|
+
}
|
|
24714
|
+
setLocalSearchString(searchFilter);
|
|
24715
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24716
|
+
}, [searchFilter]);
|
|
24717
|
+
return /*#__PURE__*/React$1.createElement(TextField, {
|
|
24718
|
+
variant: "filled",
|
|
24719
|
+
label: label,
|
|
24720
|
+
value: localSearchString,
|
|
24721
|
+
onChange: function onChange(e) {
|
|
24722
|
+
handleChange(e.target.value);
|
|
24723
|
+
},
|
|
24724
|
+
autoFocus: true,
|
|
24725
|
+
fullWidth: true,
|
|
24726
|
+
InputProps: {
|
|
24727
|
+
endAdornment: /*#__PURE__*/React$1.createElement(InputAdornment, {
|
|
24728
|
+
position: "end"
|
|
24729
|
+
}, /*#__PURE__*/React$1.createElement(SearchFieldButton, {
|
|
24730
|
+
setPopupIsOpen: function setPopupIsOpen() {
|
|
24731
|
+
onOpenServicePopup(localSearchString);
|
|
24732
|
+
setLocalSearchString('');
|
|
24733
|
+
},
|
|
24734
|
+
localSearchString: localSearchString,
|
|
24735
|
+
onClickClear: function onClickClear() {
|
|
24736
|
+
setLocalSearchString('');
|
|
24737
|
+
setSearchFilterDebounced('');
|
|
24738
|
+
setUrlIsValid(false);
|
|
24739
|
+
}
|
|
24740
|
+
}))
|
|
24741
|
+
}
|
|
24742
|
+
});
|
|
24743
|
+
};
|
|
24744
|
+
|
|
24596
24745
|
/* *
|
|
24597
24746
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24598
24747
|
* you may not use this file except in compliance with the License.
|
|
@@ -26908,4 +27057,4 @@ var getHeight = function getHeight(element) {
|
|
|
26908
27057
|
return element.offsetHeight + marginTop + marginBottom;
|
|
26909
27058
|
};
|
|
26910
27059
|
|
|
26911
|
-
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, ResizeComponent as Resizable, 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, getPosition, getWarningMessage, isAxiosError, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
|
|
27060
|
+
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, 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, getPosition, getWarningMessage, isAxiosError, 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": "
|
|
3
|
+
"version": "9.1.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": {
|
|
@@ -9,20 +9,5 @@
|
|
|
9
9
|
},
|
|
10
10
|
"module": "./index.esm.js",
|
|
11
11
|
"type": "module",
|
|
12
|
-
"main": "./index.esm.js"
|
|
13
|
-
"dependencies": {},
|
|
14
|
-
"peerDependencies": {
|
|
15
|
-
"@mui/material": "5.12.0",
|
|
16
|
-
"@opengeoweb/theme": "8.4.1",
|
|
17
|
-
"@redux-eggs/core": "2.2.0",
|
|
18
|
-
"@reduxjs/toolkit": "1.9.7",
|
|
19
|
-
"axios": "1.5.0",
|
|
20
|
-
"date-fns": "2.30.0",
|
|
21
|
-
"lodash": "4.17.21",
|
|
22
|
-
"re-resizable": "6.9.11",
|
|
23
|
-
"react": "18.2.0",
|
|
24
|
-
"react-draggable": "4.4.6",
|
|
25
|
-
"react-redux": "8.1.3",
|
|
26
|
-
"redux-saga": "1.2.3"
|
|
27
|
-
}
|
|
12
|
+
"main": "./index.esm.js"
|
|
28
13
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface SearchFieldProps {
|
|
3
|
+
searchFilter: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
setSearchFilter: (filterText: string) => void;
|
|
6
|
+
onOpenServicePopup: (url: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const SearchField: React.FC<SearchFieldProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const isURL: (string: string) => boolean;
|
|
3
|
+
interface FieldButtonProps {
|
|
4
|
+
localSearchString: string;
|
|
5
|
+
onClickClear: () => void;
|
|
6
|
+
setPopupIsOpen: (value: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const SearchFieldButton: React.FC<FieldButtonProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Egg } from '@redux-eggs/core';
|
|
3
|
-
|
|
3
|
+
import { Theme } from '@mui/material';
|
|
4
|
+
export declare function withEggs(eggs: Egg[]): (Component: React.FC<{
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
theme?: Theme;
|
|
7
|
+
}>) => React.FC;
|
package/src/lib/types/types.d.ts
CHANGED
|
@@ -27,6 +27,16 @@ export interface ConfigType {
|
|
|
27
27
|
GW_FEATURE_MENU_USER_DOCUMENTATION_URL?: string;
|
|
28
28
|
GW_FEATURE_MENU_VERSION?: boolean;
|
|
29
29
|
GW_FEATURE_MENU_FE_VERSION?: boolean;
|
|
30
|
-
|
|
30
|
+
GW_FEATURE_DISPLAY_SEARCH_ON_MAP?: boolean;
|
|
31
31
|
GW_LANGUAGE?: string;
|
|
32
32
|
}
|
|
33
|
+
export interface TimeSeriesService {
|
|
34
|
+
id: string;
|
|
35
|
+
description: string;
|
|
36
|
+
url: string;
|
|
37
|
+
type: ServiceInterface;
|
|
38
|
+
name: string;
|
|
39
|
+
scope?: TimeseriesServiceScope;
|
|
40
|
+
}
|
|
41
|
+
export type ServiceInterface = 'EDR' | 'OGC';
|
|
42
|
+
export type TimeseriesServiceScope = 'user' | 'system';
|