@opengeoweb/workspace 9.32.1 → 9.33.1-spike-ol.5

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
@@ -1,14 +1,14 @@
1
1
  import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware } from '@reduxjs/toolkit';
2
- import { syncGroupsTypes, syncGroupsActions, layerActions, mapStoreActions, uiActions, genericActions, mapActions, layerTypes, mapEnums, selectorMemoizationOptions, genericSelectors, mapSelectors, syncGroupsSelectors, routerActions, coreModuleConfig, uiTypes, loadingIndicatorSelectors, uiSelectors } from '@opengeoweb/store';
2
+ import { syncGroupsTypes, syncGroupsActions, layerActions, mapStoreActions, uiActions, genericActions, mapActions, layerTypes, mapEnums, selectorMemoizationOptions, genericSelectors, mapSelectors, syncGroupsSelectors, routerActions, coreModuleConfig, linkComponentTypesConstants, uiTypes, loadingIndicatorSelectors, uiSelectors } from '@opengeoweb/store';
3
3
  import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInstance, ApiProvider, useApiContext } from '@opengeoweb/api';
4
4
  import _, { chunk, cloneDeep, isEmpty, isEqual, isString } from 'lodash';
5
5
  import { getLeaves, MosaicContext, getAndAssertNodeAtPathExists, createBalancedTreeFromLeaves, MosaicWindow, Mosaic } from 'react-mosaic-component';
6
6
  import { timeSeriesActions, TimeSeriesTypes, timeSeriesSelectors, timeSeriesModuleConfig } from '@opengeoweb/timeseries';
7
- import { PROJECTION, getAxiosErrorMessage, isAxiosAuthError, isAxiosError as isAxiosError$1, SHARED_NAMESPACE, sharedTranslations, withEggs, ConfirmationServiceProvider, useConfirmationDialog, CustomIconButton, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, DEFAULT_FILTER_HEIGHT, usePrevious, Filter, Resizable, ToolContainer, renderCounter, CustomToggleButton, ConfirmationDialog } from '@opengeoweb/shared';
7
+ import { PROJECTION, getAxiosErrorMessage, isAxiosAuthError, isAxiosError as isAxiosError$1, SHARED_NAMESPACE, sharedTranslations, withEggs, ConfirmationServiceProvider, CustomIconButton, useConfirmationDialog, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, DEFAULT_FILTER_HEIGHT, usePrevious, Filter, Resizable, ToolContainer, renderCounter, CustomToggleButton, ConfirmationDialog } from '@opengeoweb/shared';
8
8
  import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
9
9
  import { isAxiosError } from 'axios';
10
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
- import { ThemeWrapper, lightTheme, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, Delete, Preset, PresetWorkspace, PresetTiles, CloudLoading, CloudIdle, WebAssetOff, Exclamation } from '@opengeoweb/theme';
11
+ import { ThemeWrapper, lightTheme, Link, LinkOff, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, Delete, Preset, PresetWorkspace, PresetTiles, CloudLoading, CloudIdle, WebAssetOff, Exclamation } from '@opengeoweb/theme';
12
12
  import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
13
13
  import { initReactI18next, useTranslation, I18nextProvider } from 'react-i18next';
14
14
  import { AuthenticationProvider, useAuthenticationContext, GEOWEB_ROLE_PRESETS_ADMIN } from '@opengeoweb/authentication';
@@ -20,7 +20,7 @@ import { CORE_NAMESPACE, coreTranslations } from '@opengeoweb/core';
20
20
  import { FORM_FIELDS_NAMESPACE, formFieldsTranslations, ReactHookFormTextField, ReactHookFormHiddenInput, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
21
21
  import * as React from 'react';
22
22
  import React__default, { useCallback } from 'react';
23
- import { LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid2, Box, Backdrop, Menu, ListSubheader, MenuItem, useTheme, FormGroup, FormControlLabel, Checkbox, Tabs } from '@mui/material';
23
+ import { Menu, Typography, List, ListItem, ListItemButton, ListItemIcon, Checkbox, ListItemText, LinearProgress, Grid2, Box, Backdrop, ListSubheader, MenuItem, useTheme, FormGroup, FormControlLabel, Tabs } from '@mui/material';
24
24
  import 'react-mosaic-component/react-mosaic-component.css';
25
25
  import AutoSizer from 'react-virtualized-auto-sizer';
26
26
  import { FixedSizeList } from 'react-window';
@@ -100,7 +100,9 @@ var en = {
100
100
  "workspace-dialog-delete-system": "Delete system workspace",
101
101
  "workspace-dialog-confirm-delete-system": "The system workspace will be deleted, but all the view presets used will remain intact.",
102
102
  "workspace-dialog-confirm-delete-user": "The workspace will be deleted, but all the view presets used will remain intact.",
103
- "workspace-list-success-delete-system": "\"{{TITLE}}\" has been successfully removed from the system's workspaces."
103
+ "workspace-list-success-delete-system": "\"{{TITLE}}\" has been successfully removed from the system's workspaces.",
104
+ "workspace-link-location-header": "Location",
105
+ "workspace-link": "Link"
104
106
  };
105
107
  var fi = {
106
108
  "workspace-menu": "Workspace menu",
@@ -173,7 +175,9 @@ var fi = {
173
175
  "workspace-admin-reset-workspace": "ei käännetty",
174
176
  "workspace-admin-reset-workspace-title": "ei käännetty",
175
177
  "workspace-dialog-confirm-delete-system": "ei käännetty",
176
- "workspace-dialog-confirm-delete-user": "Workspace poistetaan, mutta kaikki view presetit säilyvät tallennettuina."
178
+ "workspace-dialog-confirm-delete-user": "Workspace poistetaan, mutta kaikki view presetit säilyvät tallennettuina.",
179
+ "workspace-link-location-header": "Sijainti",
180
+ "workspace-link": "Link"
177
181
  };
178
182
  var no = {
179
183
  "workspace-menu": "Arbeidsrommeny",
@@ -246,7 +250,9 @@ var no = {
246
250
  "workspace-admin-reset-workspace": "Tilbakestill",
247
251
  "workspace-admin-reset-workspace-title": "Tilbakestill til original",
248
252
  "workspace-dialog-confirm-delete-system": "Systemets arbeidsrom vil bli slettet, men alle vinduer som er brukt vil forbli intakte.",
249
- "workspace-dialog-confirm-delete-user": "Arbeidsrommet blir slettet, men alle vinduer som er brukt vil forbli intakte."
253
+ "workspace-dialog-confirm-delete-user": "Arbeidsrommet blir slettet, men alle vinduer som er brukt vil forbli intakte.",
254
+ "workspace-link-location-header": "Lokasjon",
255
+ "workspace-link": "Link"
250
256
  };
251
257
  var nl = {
252
258
  "workspace-menu": "Workspace menu",
@@ -322,7 +328,9 @@ var nl = {
322
328
  "workspace-dialog-confirm-delete-system": "Deze systeem workspace zal worden verwijderd, maar alle gebruikte viewpresets zullen intact blijven.",
323
329
  "workspace-dialog-confirm-reset-personal-message": "De workspace zal worden hersteld en alle aanpassing zullen worden verwijderd. Weet je zeker dat je door wilt gaan?",
324
330
  "workspace-list-success-delete-system": "\"{{TITLE}}\" is succesvol verwijderd uit de systeem workspaces.",
325
- "workspace-dialog-confirm-delete-user": "Deze workspace zal worden verwijderd, maar alle gebruikte view presets zullen intact blijven."
331
+ "workspace-dialog-confirm-delete-user": "Deze workspace zal worden verwijderd, maar alle gebruikte view presets zullen intact blijven.",
332
+ "workspace-link-location-header": "Locatie",
333
+ "workspace-link": "Link"
326
334
  };
327
335
  var workspaceTranslations = {
328
336
  en: en,
@@ -5529,6 +5537,7 @@ const getViewById = createSelector(getWorkspaceState, (store, viewId) => viewId,
5529
5537
  var _store$views;
5530
5538
  return store == null || (_store$views = store.views) == null || (_store$views = _store$views.byId) == null ? void 0 : _store$views[viewId];
5531
5539
  }, selectorMemoizationOptions);
5540
+ const getViewsById = createSelector(getWorkspaceState, store => store.views.byId);
5532
5541
  /**
5533
5542
  * Gets all view ids
5534
5543
  *
@@ -5635,6 +5644,7 @@ var selectors$1 = /*#__PURE__*/Object.freeze({
5635
5644
  getViewIds: getViewIds,
5636
5645
  getViewPresetToSendToBackend: getViewPresetToSendToBackend,
5637
5646
  getViewType: getViewType,
5647
+ getViewsById: getViewsById,
5638
5648
  getWorkspaceData: getWorkspaceData,
5639
5649
  getWorkspaceError: getWorkspaceError,
5640
5650
  getWorkspaceState: getWorkspaceState,
@@ -9295,7 +9305,6 @@ const initWorkspaceTestI18n = () => {
9295
9305
  }
9296
9306
  });
9297
9307
  };
9298
- initWorkspaceTestI18n();
9299
9308
  const ns = [WORKSPACE_NAMESPACE, SHARED_NAMESPACE];
9300
9309
  const useWorkspaceTranslation = () => useTranslation(ns);
9301
9310
 
@@ -9359,6 +9368,7 @@ const WorkspaceWrapperProviderWithStore = ({
9359
9368
  const WorkspaceI18nProvider = ({
9360
9369
  children
9361
9370
  }) => {
9371
+ initWorkspaceTestI18n();
9362
9372
  return jsx(I18nextProvider, {
9363
9373
  i18n: i18n,
9364
9374
  children: children
@@ -9495,11 +9505,113 @@ var addToUnscopables = addToUnscopables$3;
9495
9505
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
9496
9506
  addToUnscopables('flat');
9497
9507
 
9508
+ const LinkMenuConnect = ({
9509
+ panelId
9510
+ }) => {
9511
+ const dispatch = useDispatch();
9512
+ const {
9513
+ t
9514
+ } = useWorkspaceTranslation();
9515
+ const [anchorEl, setAnchorEl] = React__default.useState(null);
9516
+ const maps = useSelector(store => mapSelectors.getAllMapIds(store));
9517
+ const viewsById = useSelector(getViewsById);
9518
+ const selectedMapIds = useSelector(store => genericSelectors.getSelectedMaps(store.syncronizationGroupStore, panelId));
9519
+ const viewComponentType = useSelector(store => getViewComponentType(store, panelId));
9520
+ const handleLinkViews = event => {
9521
+ setAnchorEl(event.currentTarget);
9522
+ };
9523
+ const handleMenuClose = () => {
9524
+ setAnchorEl(null);
9525
+ };
9526
+ const handleMapSelect = mapId => {
9527
+ const updatedMapIds = selectedMapIds.includes(mapId) ? selectedMapIds.filter(id => id !== mapId) : [...selectedMapIds, mapId];
9528
+ dispatch(genericActions.changeLinkedMap({
9529
+ panelId,
9530
+ mapIds: updatedMapIds
9531
+ }));
9532
+ };
9533
+ return jsxs(Fragment, {
9534
+ children: [linkComponentTypesConstants.supportedComponentTypesForLinking.includes(viewComponentType) && jsx(CustomIconButton, {
9535
+ onClick: handleLinkViews,
9536
+ "data-testid": "icon-button",
9537
+ tooltipTitle: `Link ${viewComponentType}`,
9538
+ sx: {
9539
+ marginLeft: 0.5,
9540
+ marginRight: 0.5
9541
+ },
9542
+ children: selectedMapIds.length > 0 ? jsx(Link, {
9543
+ "data-testid": "link-icon",
9544
+ style: {
9545
+ fill: anchorEl ? 'white' : undefined,
9546
+ backgroundColor: anchorEl ? '#186DFF' : undefined
9547
+ }
9548
+ }) : jsx(LinkOff, {
9549
+ "data-testid": "link-off-icon",
9550
+ style: {
9551
+ fill: anchorEl ? 'white' : undefined,
9552
+ backgroundColor: anchorEl ? '#186DFF' : undefined
9553
+ }
9554
+ })
9555
+ }), jsxs(Menu, {
9556
+ id: "map-select-menu",
9557
+ "data-testid": "map-select-menu",
9558
+ anchorEl: anchorEl,
9559
+ open: Boolean(anchorEl),
9560
+ onClose: handleMenuClose,
9561
+ keepMounted: true,
9562
+ children: [jsxs(Typography, {
9563
+ variant: "h6",
9564
+ style: {
9565
+ padding: '10px 15px 0',
9566
+ fontWeight: 'bold'
9567
+ },
9568
+ children: [t('workspace-link'), " - ", t('workspace-link-location-header')]
9569
+ }), jsx(List, {
9570
+ dense: true,
9571
+ children: maps.map(mapId => {
9572
+ var _viewsById$mapId;
9573
+ const labelId = `checkbox-link-label-${mapId}`;
9574
+ return jsx(ListItem, {
9575
+ onClick: () => handleMapSelect(mapId),
9576
+ disablePadding: true,
9577
+ dense: true,
9578
+ divider: true,
9579
+ children: jsxs(ListItemButton, {
9580
+ role: "checkbox",
9581
+ dense: true,
9582
+ sx: {
9583
+ margin: 0,
9584
+ padding: '0 16px'
9585
+ },
9586
+ children: [jsx(ListItemIcon, {
9587
+ children: jsx(Checkbox, {
9588
+ edge: "start",
9589
+ tabIndex: -1,
9590
+ checked: selectedMapIds.includes(mapId),
9591
+ disableRipple: true,
9592
+ inputProps: {
9593
+ 'aria-labelledby': labelId
9594
+ }
9595
+ })
9596
+ }), jsx(ListItemText, {
9597
+ id: labelId,
9598
+ primary: (_viewsById$mapId = viewsById[mapId]) == null ? void 0 : _viewsById$mapId.title,
9599
+ secondary: mapId
9600
+ })]
9601
+ })
9602
+ }, mapId);
9603
+ })
9604
+ })]
9605
+ })]
9606
+ });
9607
+ };
9608
+
9498
9609
  const buttonStyle = {
9499
9610
  marginLeft: 0.5,
9500
9611
  marginRight: 0.5
9501
9612
  };
9502
9613
  const WorkspaceControls = ({
9614
+ panelId,
9503
9615
  createNode,
9504
9616
  path,
9505
9617
  shouldPreventCloseView: _shouldPreventCloseView = false
@@ -9540,7 +9652,9 @@ const WorkspaceControls = ({
9540
9652
  }
9541
9653
  };
9542
9654
  return jsxs(Fragment, {
9543
- children: [jsx(CustomIconButton, {
9655
+ children: [jsx(LinkMenuConnect, {
9656
+ panelId: panelId
9657
+ }), jsx(CustomIconButton, {
9544
9658
  "data-testid": "split-horizontal-btn",
9545
9659
  sx: buttonStyle,
9546
9660
  onClick: () => {
@@ -10631,6 +10745,7 @@ const WorkspaceTileConnect = /*#__PURE__*/React.memo(({
10631
10745
  isViewPresetDialogOpen: isViewPresetDialogOpen || false
10632
10746
  }),
10633
10747
  toolbarControls: jsx(WorkspaceControls, {
10748
+ panelId: _mosaicNodeId,
10634
10749
  createNode: createNode,
10635
10750
  path: path,
10636
10751
  shouldPreventCloseView: shouldPreventCloseView
@@ -10986,11 +11101,12 @@ const WorkspaceSelectListConnect = () => {
10986
11101
  };
10987
11102
  const isAllSelected = workspaceListFilters.every(filter => filter.isSelected);
10988
11103
  const shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0;
10989
- return jsxs("div", {
11104
+ return jsxs(Box, {
10990
11105
  "data-testid": "workspace-selectlist-connect",
10991
11106
  style: {
10992
11107
  height: '100%'
10993
11108
  },
11109
+ tabIndex: 0,
10994
11110
  children: [isFetching && jsx(LinearProgress, {
10995
11111
  "data-testid": "loading-bar",
10996
11112
  color: "secondary",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/workspace",
3
- "version": "9.32.1",
3
+ "version": "9.33.1-spike-ol.5",
4
4
  "description": "GeoWeb Workspace library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -31,6 +31,7 @@
31
31
  "@opengeoweb/taf": "*",
32
32
  "@opengeoweb/sigmet-airmet": "*",
33
33
  "@opengeoweb/warnings": "*",
34
+ "@opengeoweb/spaceweather": "*",
34
35
  "i18next": "^23.11.5",
35
36
  "react-i18next": "^15.1.1",
36
37
  "@mui/material": "^6.1.1",
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface SelectMenuProps {
3
+ panelId: string;
4
+ }
5
+ declare const LinkMenuConnect: React.FC<SelectMenuProps>;
6
+ export default LinkMenuConnect;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { MosaicBranch, MosaicNode } from 'react-mosaic-component';
3
3
  interface WorkspaceControlsProps {
4
+ panelId: string;
4
5
  path: MosaicBranch[];
5
6
  createNode?: () => MosaicNode<string>;
6
7
  shouldPreventCloseView?: boolean;
@@ -41,7 +41,12 @@ export declare const getMosaicNode: ((state: AppStore) => import("react-mosaic-c
41
41
  * @param {string} viewId viewId: string - view id
42
42
  * @returns {object} returnType: WorkspaceViewType
43
43
  */
44
- export declare const getViewById: ((state: AppStore, viewId: string) => import("./types").WorkspaceViewType | undefined) & import("reselect").OutputSelectorFields<(args_0: WorkspaceState, args_1: string) => import("./types").WorkspaceViewType | undefined, {
44
+ export declare const getViewById: ((state: AppStore, viewId: string) => import("./types").WorkspaceViewType) & import("reselect").OutputSelectorFields<(args_0: WorkspaceState, args_1: string) => import("./types").WorkspaceViewType, {
45
+ clearCache: () => void;
46
+ }> & {
47
+ clearCache: () => void;
48
+ };
49
+ export declare const getViewsById: ((state: AppStore) => Record<string, import("./types").WorkspaceViewType>) & import("reselect").OutputSelectorFields<(args_0: WorkspaceState) => Record<string, import("./types").WorkspaceViewType>, {
45
50
  clearCache: () => void;
46
51
  }> & {
47
52
  clearCache: () => void;
@@ -64,7 +69,7 @@ export declare const getViewIds: ((state: AppStore) => string[]) & import("resel
64
69
  * @param {string} viewId viewId: string - view id
65
70
  * @returns {boolean} returnType: boolean
66
71
  */
67
- export declare const getShouldPreventClose: ((state: AppStore, viewId: string) => boolean) & import("reselect").OutputSelectorFields<(args_0: import("./types").WorkspaceViewType | undefined) => boolean, {
72
+ export declare const getShouldPreventClose: ((state: AppStore, viewId: string) => boolean) & import("reselect").OutputSelectorFields<(args_0: import("./types").WorkspaceViewType) => boolean, {
68
73
  clearCache: () => void;
69
74
  }> & {
70
75
  clearCache: () => void;
@@ -158,14 +163,14 @@ export declare const getWorkspaceData: ((state: AppStore & import("@opengeoweb/s
158
163
  }> & {
159
164
  clearCache: () => void;
160
165
  };
161
- export declare const getViewComponentType: ((state: AppStore, viewId: string) => WorkspaceSupportedComponentTypes) & import("reselect").OutputSelectorFields<(args_0: import("./types").WorkspaceViewType | undefined) => WorkspaceSupportedComponentTypes, {
166
+ export declare const getViewComponentType: ((state: AppStore, viewId: string) => WorkspaceSupportedComponentTypes) & import("reselect").OutputSelectorFields<(args_0: import("./types").WorkspaceViewType) => WorkspaceSupportedComponentTypes, {
162
167
  clearCache: () => void;
163
168
  }> & {
164
169
  clearCache: () => void;
165
170
  };
166
171
  export declare const getViewPresetToSendToBackend: ((state: any, viewId: any) => Omit<ViewPreset, "title"> & {
167
172
  title?: string | undefined;
168
- }) & import("reselect").OutputSelectorFields<(args_0: import("./types").WorkspaceViewType | undefined, args_1: WorkspaceSupportedComponentTypes, args_2: import("@opengeoweb/store").MapPreset, args_3: string[], args_4: import("dist/libs/timeseries/src/lib/store/types").TimeSeriesPreset | undefined) => Omit<ViewPreset, "title"> & {
173
+ }) & import("reselect").OutputSelectorFields<(args_0: import("./types").WorkspaceViewType, args_1: WorkspaceSupportedComponentTypes, args_2: import("@opengeoweb/store").MapPreset, args_3: string[], args_4: import("dist/libs/timeseries/src/lib/store/types").TimeSeriesPreset | undefined) => Omit<ViewPreset, "title"> & {
169
174
  title?: string | undefined;
170
175
  }, {
171
176
  clearCache: () => void;
@@ -14,7 +14,7 @@ export interface WorkspaceViewType {
14
14
  keywords?: string;
15
15
  }
16
16
  export interface WorkspaceViews {
17
- byId?: Record<string, WorkspaceViewType>;
17
+ byId: Record<string, WorkspaceViewType>;
18
18
  allIds: string[];
19
19
  }
20
20
  export interface WorkspaceViewsFromBE {
@@ -4,9 +4,10 @@ import { ComponentsLookUpPayload as TimeseriesComponentsLookUpPayload } from '@o
4
4
  import { ComponentsLookUpPayload as TafComponentsLookUpPayload } from '@opengeoweb/taf';
5
5
  import { SigmetComponentsLookUpPayload, AirmetComponentsLookUpPayload } from '@opengeoweb/sigmet-airmet';
6
6
  import { ComponentsLookUpPayload as WarningListComponentsLookUpPayLoad } from '@opengeoweb/warnings';
7
+ import { ComponentsLookUpPayload as SpaceweatherComponentsLookUpPayLoad } from '@opengeoweb/spaceweather';
7
8
  /**
8
9
  * The lookup table is for registering your own components with the workspace.
9
10
  * @param payload
10
11
  * @returns
11
12
  */
12
- export declare const componentsLookUp: (payload: CoreComponentsLookUpPayload | TimeseriesComponentsLookUpPayload | TafComponentsLookUpPayload | SigmetComponentsLookUpPayload | AirmetComponentsLookUpPayload | WarningListComponentsLookUpPayLoad) => React.ReactElement;
13
+ export declare const componentsLookUp: (payload: CoreComponentsLookUpPayload | TimeseriesComponentsLookUpPayload | TafComponentsLookUpPayload | SigmetComponentsLookUpPayload | AirmetComponentsLookUpPayload | WarningListComponentsLookUpPayLoad | SpaceweatherComponentsLookUpPayLoad) => React.ReactElement;
@@ -44,3 +44,7 @@ export declare const WarningList: {
44
44
  (): React.ReactElement;
45
45
  storyName: string;
46
46
  };
47
+ export declare const SpaceweatherModule: {
48
+ (): React.ReactElement;
49
+ storyName: string;
50
+ };