@opengeoweb/shared 9.37.0 → 10.0.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 +81 -177
- package/package.json +1 -1
- package/src/lib/components/DraggableResizable/Draggable.d.ts +1 -0
- package/src/lib/components/Filter/index.d.ts +0 -2
- package/src/lib/components/Filter/FilterListItem.d.ts +0 -17
- package/src/lib/components/Filter/FilterListItem.spec.d.ts +0 -1
- package/src/lib/components/Filter/FilterListItem.stories.d.ts +0 -13
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid2, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1,
|
|
2
|
+
import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid2, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1, ListItemButton, Checkbox } from '@mui/material';
|
|
3
3
|
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, Admin, useThemeContext, ThemeTypes, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { useRef, Component, useState } from 'react';
|
|
@@ -1626,19 +1626,29 @@ var AppHeader = function AppHeader(_ref) {
|
|
|
1626
1626
|
});
|
|
1627
1627
|
};
|
|
1628
1628
|
|
|
1629
|
-
var _excluded$a = ["bounds", "children"];
|
|
1629
|
+
var _excluded$a = ["bounds", "setIsDragging", "children", "onStop"];
|
|
1630
1630
|
var DraggableComponent$1 = function DraggableComponent(_ref) {
|
|
1631
1631
|
var _ref$bounds = _ref.bounds,
|
|
1632
1632
|
bounds = _ref$bounds === void 0 ? 'body' : _ref$bounds,
|
|
1633
|
+
setIsDragging = _ref.setIsDragging,
|
|
1633
1634
|
children = _ref.children,
|
|
1635
|
+
onStop = _ref.onStop,
|
|
1634
1636
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
1635
1637
|
var onDragStart = function onDragStart(e) {
|
|
1636
1638
|
// This makes sure that nothing is selected during drag
|
|
1639
|
+
setIsDragging && setIsDragging(true);
|
|
1637
1640
|
e.preventDefault();
|
|
1638
1641
|
};
|
|
1642
|
+
var onDragStop = function onDragStop(event, pos) {
|
|
1643
|
+
setIsDragging && setIsDragging(false);
|
|
1644
|
+
onStop && onStop(event, pos);
|
|
1645
|
+
};
|
|
1639
1646
|
return jsx(Draggable, Object.assign({
|
|
1640
1647
|
bounds: bounds
|
|
1641
1648
|
}, props, {
|
|
1649
|
+
onStop: function onStop(event, pos) {
|
|
1650
|
+
return onDragStop(event, pos);
|
|
1651
|
+
},
|
|
1642
1652
|
enableUserSelectHack: false,
|
|
1643
1653
|
onStart: onDragStart,
|
|
1644
1654
|
children: children
|
|
@@ -2519,15 +2529,19 @@ var DraggableComponent = function DraggableComponent(_ref) {
|
|
|
2519
2529
|
var _React$useState2 = React__default.useState(startSize),
|
|
2520
2530
|
size = _React$useState2[0],
|
|
2521
2531
|
setSize = _React$useState2[1];
|
|
2532
|
+
var _React$useState3 = React__default.useState(false),
|
|
2533
|
+
isDragging = _React$useState3[0],
|
|
2534
|
+
setIsDragging = _React$useState3[1];
|
|
2522
2535
|
var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
|
|
2523
2536
|
var onStopDrag = React__default.useCallback(function (_event, position) {
|
|
2524
2537
|
setPosition(position);
|
|
2525
2538
|
onDragEnd(position, size);
|
|
2526
2539
|
}, [setPosition, onDragEnd, size]);
|
|
2527
|
-
var _React$
|
|
2528
|
-
initialMaxHeight = _React$
|
|
2529
|
-
setInitialMaxHeight = _React$
|
|
2540
|
+
var _React$useState4 = React__default.useState(defaultInitialMaxHeight),
|
|
2541
|
+
initialMaxHeight = _React$useState4[0],
|
|
2542
|
+
setInitialMaxHeight = _React$useState4[1];
|
|
2530
2543
|
var onStartResize = function onStartResize() {
|
|
2544
|
+
setIsDragging(true);
|
|
2531
2545
|
setInitialMaxHeight('initial');
|
|
2532
2546
|
};
|
|
2533
2547
|
var onResize = React__default.useCallback(function (_event, handle, node, delta) {
|
|
@@ -2544,6 +2558,7 @@ var DraggableComponent = function DraggableComponent(_ref) {
|
|
|
2544
2558
|
parent.style.transform = "translate(" + newPos.x + "px, " + newPos.y + "px)";
|
|
2545
2559
|
}, [onChangeSize, position, isRightAligned]);
|
|
2546
2560
|
var onStopResize = function onStopResize(_event, direction, node, delta) {
|
|
2561
|
+
setIsDragging(false);
|
|
2547
2562
|
setPosition(calculateNewPosition(position, isRightAligned, direction, delta));
|
|
2548
2563
|
onResizeStop(_event, direction, node, delta);
|
|
2549
2564
|
};
|
|
@@ -2560,54 +2575,67 @@ var DraggableComponent = function DraggableComponent(_ref) {
|
|
|
2560
2575
|
setSize(size);
|
|
2561
2576
|
}
|
|
2562
2577
|
});
|
|
2563
|
-
return isOpen ?
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
children: jsx(Box, {
|
|
2572
|
-
tabIndex: -1,
|
|
2573
|
-
sx: Object.assign({
|
|
2578
|
+
return isOpen ? jsxs(Fragment, {
|
|
2579
|
+
children: [isDragging && jsx(Box, {
|
|
2580
|
+
"data-testid": "dragging-overlay",
|
|
2581
|
+
sx: {
|
|
2582
|
+
top: 0,
|
|
2583
|
+
left: 0,
|
|
2584
|
+
right: 0,
|
|
2585
|
+
bottom: 0,
|
|
2574
2586
|
position: 'absolute',
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
children: jsx(
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2587
|
+
zIndex: 999
|
|
2588
|
+
}
|
|
2589
|
+
}), jsx(DraggableComponent$1, {
|
|
2590
|
+
nodeRef: nodeRef,
|
|
2591
|
+
bounds: bounds,
|
|
2592
|
+
cancel: cancel,
|
|
2593
|
+
position: position,
|
|
2594
|
+
onStop: onStopDrag,
|
|
2595
|
+
handle: "." + headerClassName,
|
|
2596
|
+
onMouseDown: onMouseDown,
|
|
2597
|
+
setIsDragging: setIsDragging,
|
|
2598
|
+
children: jsx(Box, {
|
|
2599
|
+
tabIndex: -1,
|
|
2600
|
+
sx: Object.assign({
|
|
2601
|
+
position: 'absolute',
|
|
2602
|
+
pointerEvents: 'all',
|
|
2603
|
+
zIndex: zIndex
|
|
2604
|
+
}, startPosition, sx, {
|
|
2605
|
+
'&:hover .resizableHandle': {
|
|
2606
|
+
display: 'inline'
|
|
2607
|
+
}
|
|
2608
|
+
}),
|
|
2609
|
+
ref: nodeRef,
|
|
2610
|
+
className: "toolContainerDraggable",
|
|
2611
|
+
role: "dialog",
|
|
2612
|
+
"aria-label": title,
|
|
2613
|
+
children: jsx(ResizeComponent, Object.assign({}, props, {
|
|
2614
|
+
size: size,
|
|
2615
|
+
setSize: setSize,
|
|
2616
|
+
onResizeStart: onStartResize,
|
|
2617
|
+
onResizeStop: onStopResize,
|
|
2618
|
+
onResize: onResize,
|
|
2619
|
+
nodeRef: nodeRef,
|
|
2620
|
+
children: jsx(ToolContainer, {
|
|
2621
|
+
maxHeight: initialMaxHeight,
|
|
2622
|
+
onClose: onClose,
|
|
2623
|
+
title: title,
|
|
2624
|
+
size: headerSize,
|
|
2625
|
+
isDraggable: true,
|
|
2626
|
+
isResizable: true,
|
|
2627
|
+
elevation: elevation,
|
|
2628
|
+
headerClassName: headerClassName,
|
|
2629
|
+
leftHeaderComponent: leftHeaderComponent,
|
|
2630
|
+
rightHeaderComponent: rightHeaderComponent,
|
|
2631
|
+
dragHandleIcon: dragHandleIcon,
|
|
2632
|
+
closeIcon: closeIcon,
|
|
2633
|
+
className: className,
|
|
2634
|
+
children: children
|
|
2635
|
+
})
|
|
2636
|
+
}))
|
|
2637
|
+
})
|
|
2638
|
+
})]
|
|
2611
2639
|
}) : null;
|
|
2612
2640
|
};
|
|
2613
2641
|
|
|
@@ -4773,130 +4801,6 @@ var Filter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
4773
4801
|
});
|
|
4774
4802
|
});
|
|
4775
4803
|
|
|
4776
|
-
var FilterLabel = function FilterLabel(_ref) {
|
|
4777
|
-
var name = _ref.name;
|
|
4778
|
-
return jsx(Typography, {
|
|
4779
|
-
variant: "body2",
|
|
4780
|
-
sx: {
|
|
4781
|
-
fontSize: '16px',
|
|
4782
|
-
textOverflow: 'ellipsis',
|
|
4783
|
-
whiteSpace: 'nowrap',
|
|
4784
|
-
overflow: 'hidden'
|
|
4785
|
-
},
|
|
4786
|
-
children: name
|
|
4787
|
-
});
|
|
4788
|
-
};
|
|
4789
|
-
var FilterListItem = function FilterListItem(_ref2) {
|
|
4790
|
-
var filter = _ref2.filter,
|
|
4791
|
-
_ref2$toggleFilter = _ref2.toggleFilter,
|
|
4792
|
-
toggleFilter = _ref2$toggleFilter === void 0 ? function () {} : _ref2$toggleFilter,
|
|
4793
|
-
_ref2$enableOnlyOneFi = _ref2.enableOnlyOneFilter,
|
|
4794
|
-
enableOnlyOneFilter = _ref2$enableOnlyOneFi === void 0 ? function () {} : _ref2$enableOnlyOneFi,
|
|
4795
|
-
children = _ref2.children;
|
|
4796
|
-
var _useSharedTranslation = useSharedTranslation(),
|
|
4797
|
-
t = _useSharedTranslation.t;
|
|
4798
|
-
var _React$useState = React.useState(false),
|
|
4799
|
-
isHovering = _React$useState[0],
|
|
4800
|
-
setIsHovering = _React$useState[1];
|
|
4801
|
-
var handleMouseEnter = React.useCallback(function () {
|
|
4802
|
-
setIsHovering(true);
|
|
4803
|
-
}, []);
|
|
4804
|
-
var handleMouseLeave = React.useCallback(function () {
|
|
4805
|
-
setIsHovering(false);
|
|
4806
|
-
}, []);
|
|
4807
|
-
var selectOnlyOne = function selectOnlyOne(filterId) {
|
|
4808
|
-
enableOnlyOneFilter(filterId);
|
|
4809
|
-
};
|
|
4810
|
-
var toggleCheckbox = function toggleCheckbox(filterId) {
|
|
4811
|
-
toggleFilter([filterId]);
|
|
4812
|
-
};
|
|
4813
|
-
var mouseMoveRef = React.useRef(null);
|
|
4814
|
-
React.useEffect(function () {
|
|
4815
|
-
window.addEventListener('mousemove', checkHover, true);
|
|
4816
|
-
return function () {
|
|
4817
|
-
window.removeEventListener('mousemove', checkHover, true);
|
|
4818
|
-
};
|
|
4819
|
-
});
|
|
4820
|
-
var checkHover = function checkHover(e) {
|
|
4821
|
-
if (mouseMoveRef.current) {
|
|
4822
|
-
var mouseOver = mouseMoveRef.current.contains(e.target);
|
|
4823
|
-
if (!isHovering && mouseOver) {
|
|
4824
|
-
handleMouseEnter();
|
|
4825
|
-
}
|
|
4826
|
-
if (isHovering && !mouseOver) {
|
|
4827
|
-
handleMouseLeave();
|
|
4828
|
-
}
|
|
4829
|
-
}
|
|
4830
|
-
};
|
|
4831
|
-
var name = filter.amountVisible ? filter.name + " (" + filter.amountVisible + ")" : filter.name;
|
|
4832
|
-
if (filter.amountVisible !== 0) {
|
|
4833
|
-
return jsx("div", {
|
|
4834
|
-
ref: mouseMoveRef,
|
|
4835
|
-
onMouseEnter: handleMouseEnter,
|
|
4836
|
-
onMouseLeave: handleMouseLeave,
|
|
4837
|
-
onFocus: handleMouseEnter,
|
|
4838
|
-
onBlur: handleMouseLeave,
|
|
4839
|
-
children: jsxs(ListItem, {
|
|
4840
|
-
sx: {
|
|
4841
|
-
width: '100%',
|
|
4842
|
-
minWidth: '300px',
|
|
4843
|
-
padding: '0px',
|
|
4844
|
-
paddingLeft: '0px',
|
|
4845
|
-
paddingRight: '50px',
|
|
4846
|
-
fontSize: '12px'
|
|
4847
|
-
},
|
|
4848
|
-
secondaryAction: jsx(CustomIconButton, {
|
|
4849
|
-
"aria-label": "Only " + filter.name,
|
|
4850
|
-
style: {
|
|
4851
|
-
backgroundColor: 'transparent',
|
|
4852
|
-
width: 'auto',
|
|
4853
|
-
display: isHovering ? 'block' : 'none'
|
|
4854
|
-
},
|
|
4855
|
-
edge: "end",
|
|
4856
|
-
onClick: function onClick() {
|
|
4857
|
-
selectOnlyOne(filter.id);
|
|
4858
|
-
},
|
|
4859
|
-
children: jsx(Typography, {
|
|
4860
|
-
sx: {
|
|
4861
|
-
color: 'geowebColors.buttons.primary.default.fill',
|
|
4862
|
-
fontSize: '14px',
|
|
4863
|
-
fontWeight: 500
|
|
4864
|
-
},
|
|
4865
|
-
children: t('shared-only')
|
|
4866
|
-
})
|
|
4867
|
-
}),
|
|
4868
|
-
children: [jsx(ListItemIcon, {
|
|
4869
|
-
sx: {
|
|
4870
|
-
minWidth: '42px'
|
|
4871
|
-
},
|
|
4872
|
-
children: jsx(Checkbox, {
|
|
4873
|
-
inputProps: {
|
|
4874
|
-
'aria-label': filter.name,
|
|
4875
|
-
checked: filter.checked
|
|
4876
|
-
},
|
|
4877
|
-
className: filter.checked ? 'is-checked' : '',
|
|
4878
|
-
color: "secondary",
|
|
4879
|
-
checked: filter.checked,
|
|
4880
|
-
onChange: function onChange() {
|
|
4881
|
-
toggleCheckbox(filter.id);
|
|
4882
|
-
},
|
|
4883
|
-
sx: {
|
|
4884
|
-
paddingTop: '6px',
|
|
4885
|
-
paddingBottom: '7px',
|
|
4886
|
-
'&&:hover': {
|
|
4887
|
-
backgroundColor: 'transparent'
|
|
4888
|
-
}
|
|
4889
|
-
}
|
|
4890
|
-
})
|
|
4891
|
-
}), children || jsx(FilterLabel, {
|
|
4892
|
-
name: name
|
|
4893
|
-
})]
|
|
4894
|
-
})
|
|
4895
|
-
});
|
|
4896
|
-
}
|
|
4897
|
-
return null;
|
|
4898
|
-
};
|
|
4899
|
-
|
|
4900
4804
|
var FilterOption = function FilterOption(_ref) {
|
|
4901
4805
|
var optionId = _ref.optionId,
|
|
4902
4806
|
checked = _ref.checked,
|
|
@@ -6011,4 +5915,4 @@ var RenderCounter = /*#__PURE__*/function () {
|
|
|
6011
5915
|
}();
|
|
6012
5916
|
var renderCounter = new RenderCounter();
|
|
6013
5917
|
|
|
6014
|
-
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip,
|
|
5918
|
+
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, StorybookDocsWrapper, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createToolkitMockStore, createToolkitMockStoreWithEggs, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, useWheelStopPropagation, withEggs };
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ export interface DraggableComponentProps {
|
|
|
10
10
|
onStop?: (event: DraggableEvent, pos: DraggablePosition) => void;
|
|
11
11
|
onMouseDown?: (event: MouseEvent) => void;
|
|
12
12
|
handle?: string;
|
|
13
|
+
setIsDragging?: (isDragging: boolean) => void;
|
|
13
14
|
}
|
|
14
15
|
declare const DraggableComponent: React.FC<DraggableComponentProps>;
|
|
15
16
|
export default DraggableComponent;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { default as Filter } from './Filter';
|
|
2
2
|
export { DEFAULT_FILTER_HEIGHT } from './Filter';
|
|
3
3
|
export type { ListFilter } from './FilterList';
|
|
4
|
-
export { FilterListItem, FilterLabel } from './FilterListItem';
|
|
5
|
-
export type { Filter as FilterListItemFilter, FilterListItemProps, } from './FilterListItem';
|
|
6
4
|
export { FilterOption } from './FilterOption';
|
|
7
5
|
export { default as FilterChip } from './FilterChip';
|
|
8
6
|
export type { FilterChipProps } from './FilterChip';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface Filter {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
checked?: boolean;
|
|
6
|
-
amountVisible?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface FilterListItemProps {
|
|
9
|
-
filter: Filter;
|
|
10
|
-
toggleFilter?: (filterIds: string[]) => void;
|
|
11
|
-
enableOnlyOneFilter?: (filterId: string) => void;
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
}
|
|
14
|
-
export declare const FilterLabel: React.FC<{
|
|
15
|
-
name: string;
|
|
16
|
-
}>;
|
|
17
|
-
export declare const FilterListItem: React.FC<FilterListItemProps>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
};
|
|
5
|
-
export default _default;
|
|
6
|
-
export declare const FilterListItemLight: {
|
|
7
|
-
(): React.ReactElement;
|
|
8
|
-
tags: string[];
|
|
9
|
-
};
|
|
10
|
-
export declare const FilterListItemDark: {
|
|
11
|
-
(): React.ReactElement;
|
|
12
|
-
tags: string[];
|
|
13
|
-
};
|