@opengeoweb/layer-select 12.1.1 → 12.2.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
@@ -2,18 +2,18 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default from 'react';
4
4
  import { useSelector, useDispatch } from 'react-redux';
5
- import { CustomIconButton, FilterOption, ToolContainerDraggable, CustomAccordion, CustomToggleButton, CustomTooltip, SearchHighlight, SearchField, ToggleMenu } from '@opengeoweb/shared';
6
- import { Filter, LayersAdd, Add, Cached, Edit, Visibility, Delete, Close, Copy } from '@opengeoweb/theme';
7
- import { uiTypes, serviceActions, selectorMemoizationOptions, serviceSelectors, uiActions, getUserAddedServices, setUserAddedServices, layerActions, uiSelectors, layerSelectors, mapListener, serviceListener, layersListener, mapReducer, serviceReducer, layerReducer, uiReducer, useSetupDialog, mapSelectors, layerTypes } from '@opengeoweb/store';
5
+ import { CustomIconButton, FilterOption, ToolContainerDraggable, CustomAccordion, CustomToggleButton, CustomTooltip, SearchHighlight, SearchField, ToggleMenu, CustomDialog } from '@opengeoweb/shared';
6
+ import { Filter, LayersAdd, Add, Cached, Edit, Visibility, Delete, Copy } from '@opengeoweb/theme';
7
+ import { uiTypes, serviceActions, selectorMemoizationOptions, serviceSelectors, uiActions, getUserAddedServices, setUserAddedServices, layerActions, uiSelectors, layerSelectors, mapListener, serviceListener, layersListener, uiReducer, layerReducer, serviceReducer, mapReducer, useSetupDialog, mapSelectors, layerTypes } from '@opengeoweb/store';
8
8
  import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
9
9
  import { compact, countBy, partition } from 'lodash';
10
10
  import { snackbarListener, snackbarReducer, snackbarTypes, snackbarActions } from '@opengeoweb/snackbar';
11
- import { Switch, Grid2, List, Box, Typography, useTheme, Backdrop, CircularProgress, Button, ListItem, ListItemText, Dialog, DialogTitle, LinearProgress, DialogContent, InputAdornment, DialogActions } from '@mui/material';
11
+ import { Switch, Grid2, List, Box, Typography, useTheme, Backdrop, CircularProgress, Button, ListItem, ListItemText, LinearProgress, InputAdornment } from '@mui/material';
12
12
  import 'i18next';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { FixedSizeList } from 'react-window';
15
15
  import { getDimensionsList, LayerInfoButton } from '@opengeoweb/webmap-react';
16
- import { webmapUtils, LayerType, getWMSServiceId, queryWMSServiceInfo, queryWMSLayers, invalidateWMSGetCapabilities, clearImageCacheForAllMaps } from '@opengeoweb/webmap';
16
+ import { LayerType, webmapUtils, getWMSServiceId, queryWMSServiceInfo, queryWMSLayers, invalidateWMSGetCapabilities, clearImageCacheForAllMaps } from '@opengeoweb/webmap';
17
17
  import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField } from '@opengeoweb/form-fields';
18
18
  import { useFormContext } from 'react-hook-form';
19
19
 
@@ -741,9 +741,9 @@ function _regeneratorRuntime() {
741
741
  function define(t, e, r) {
742
742
  return Object.defineProperty(t, e, {
743
743
  value: r,
744
- enumerable: !0,
745
- configurable: !0,
746
- writable: !0
744
+ enumerable: true,
745
+ configurable: true,
746
+ writable: true
747
747
  }), t[e];
748
748
  }
749
749
  try {
@@ -836,7 +836,7 @@ function _regeneratorRuntime() {
836
836
  if ("throw" === i) throw a;
837
837
  return {
838
838
  value: t,
839
- done: !0
839
+ done: true
840
840
  };
841
841
  }
842
842
  for (n.method = i, n.arg = a;;) {
@@ -887,7 +887,7 @@ function _regeneratorRuntime() {
887
887
  function Context(t) {
888
888
  this.tryEntries = [{
889
889
  tryLoc: "root"
890
- }], t.forEach(pushTryEntry, this), this.reset(!0);
890
+ }], t.forEach(pushTryEntry, this), this.reset(true);
891
891
  }
892
892
  function values(e) {
893
893
  if (e || "" === e) {
@@ -897,8 +897,8 @@ function _regeneratorRuntime() {
897
897
  if (!isNaN(e.length)) {
898
898
  var o = -1,
899
899
  i = function next() {
900
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
901
- return next.value = t, next.done = !0, next;
900
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
901
+ return next.value = t, next.done = true, next;
902
902
  };
903
903
  return i.next = i;
904
904
  }
@@ -907,10 +907,10 @@ function _regeneratorRuntime() {
907
907
  }
908
908
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
909
909
  value: GeneratorFunctionPrototype,
910
- configurable: !0
910
+ configurable: true
911
911
  }), o(GeneratorFunctionPrototype, "constructor", {
912
912
  value: GeneratorFunction,
913
- configurable: !0
913
+ configurable: true
914
914
  }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
915
915
  var e = "function" == typeof t && t.constructor;
916
916
  return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
@@ -939,17 +939,17 @@ function _regeneratorRuntime() {
939
939
  return r.reverse(), function next() {
940
940
  for (; r.length;) {
941
941
  var t = r.pop();
942
- if (t in e) return next.value = t, next.done = !1, next;
942
+ if (t in e) return next.value = t, next.done = false, next;
943
943
  }
944
- return next.done = !0, next;
944
+ return next.done = true, next;
945
945
  };
946
946
  }, e.values = values, Context.prototype = {
947
947
  constructor: Context,
948
948
  reset: function (e) {
949
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
949
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
950
950
  },
951
951
  stop: function () {
952
- this.done = !0;
952
+ this.done = true;
953
953
  var t = this.tryEntries[0].completion;
954
954
  if ("throw" === t.type) throw t.arg;
955
955
  return this.rval;
@@ -968,10 +968,10 @@ function _regeneratorRuntime() {
968
968
  var c = n.call(i, "catchLoc"),
969
969
  u = n.call(i, "finallyLoc");
970
970
  if (c && u) {
971
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
971
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
972
972
  if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
973
973
  } else if (c) {
974
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
974
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
975
975
  } else {
976
976
  if (!u) throw Error("try statement without catch or finally");
977
977
  if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
@@ -2912,177 +2912,150 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
2912
2912
  var isSubmitDisabled = getFormHasformErrors() || getFormAreRequiredFieldsEmpty();
2913
2913
  var isShowPopup = servicePopupVariant === 'show';
2914
2914
  var isServiceUrlDisabled = isShowPopup || servicePopupVariant === 'edit';
2915
- return jsx(Dialog, {
2915
+ return jsx(CustomDialog, {
2916
2916
  open: isOpen,
2917
2917
  hideBackdrop: hideBackdrop,
2918
2918
  fullWidth: true,
2919
2919
  maxWidth: "xs",
2920
2920
  "data-testid": "servicePopup",
2921
+ title: getTitleForVariant(t, servicePopupVariant),
2921
2922
  sx: {
2922
2923
  '& .MuiDialog-paper': {
2923
2924
  backgroundColor: "geowebColors.cards.cardContainer",
2924
2925
  maxWidth: 458
2925
2926
  }
2926
2927
  },
2928
+ onClose: function onClose() {
2929
+ return closePopup && closePopup();
2930
+ },
2931
+ actions: isShowPopup ? jsx(Button, {
2932
+ onClick: function onClick() {
2933
+ return closePopup();
2934
+ },
2935
+ variant: "tertiary",
2936
+ sx: {
2937
+ width: {
2938
+ xs: '100%',
2939
+ sm: '117px'
2940
+ }
2941
+ },
2942
+ children: t('close')
2943
+ }) : jsxs(Fragment, {
2944
+ children: [jsx(Button, {
2945
+ onClick: closePopup,
2946
+ "data-testid": "closePopupButtonCancel",
2947
+ variant: "tertiary",
2948
+ sx: {
2949
+ width: {
2950
+ xs: '100%',
2951
+ sm: '117px'
2952
+ }
2953
+ },
2954
+ children: t('cancel')
2955
+ }), jsx(Button, {
2956
+ type: "submit",
2957
+ variant: "primary",
2958
+ form: "servicePopupForm",
2959
+ disabled: isSubmitDisabled || isLoading,
2960
+ "data-testid": "saveServiceButton",
2961
+ sx: {
2962
+ marginLeft: {
2963
+ xs: '0px!important',
2964
+ sm: '8px!important'
2965
+ },
2966
+ width: {
2967
+ xs: '100%',
2968
+ sm: '117px'
2969
+ }
2970
+ },
2971
+ children: t('save')
2972
+ })]
2973
+ }),
2927
2974
  children: jsxs("form", {
2975
+ id: "servicePopupForm",
2928
2976
  onSubmit: handleSubmit(function (formValues) {
2929
2977
  return addNewService(formValues);
2930
2978
  }),
2931
- children: [jsxs(DialogTitle, {
2979
+ children: [isLoading && jsx(Box, {
2932
2980
  sx: {
2933
- alignItems: 'center',
2934
- padding: '16px 16px 24px 16px'
2981
+ position: 'relative'
2935
2982
  },
2936
- children: [jsxs(Box, {
2983
+ children: jsx(LinearProgress, {
2984
+ "data-testid": "loadingIndicator",
2985
+ color: "secondary",
2937
2986
  sx: {
2938
- display: 'flex',
2939
- justifyContent: 'space-between',
2940
- alignItems: 'center',
2941
- ' span': {
2942
- fontSize: '1rem',
2943
- fontWeight: 500,
2944
- fontStyle: 'normal',
2945
- lineHeight: '1.38',
2946
- letterSpacing: '0.12px'
2947
- }
2948
- },
2949
- children: [jsx(Typography, {
2950
- variant: "h5",
2951
- component: "span",
2952
- children: getTitleForVariant(t, servicePopupVariant)
2953
- }), jsx(CustomIconButton, {
2954
- "aria-label": "close",
2955
- onClick: closePopup,
2956
- "data-testid": "closePopupButtonCross",
2957
- sx: {
2958
- marginTop: 'auto',
2959
- marginBottom: 'auto',
2960
- '&.MuiButtonBase-root': {
2961
- color: 'geowebColors.greys.accessible'
2962
- }
2963
- },
2964
- children: jsx(Close, {})
2965
- })]
2966
- }), isLoading && jsx(Box, {
2967
- sx: {
2968
- position: 'relative'
2969
- },
2970
- children: jsx(LinearProgress, {
2971
- "data-testid": "loadingIndicator",
2972
- color: "secondary",
2973
- sx: {
2974
- position: 'absolute',
2975
- width: '100%',
2976
- top: 8
2977
- }
2987
+ position: 'absolute',
2988
+ width: '100%',
2989
+ top: 8
2990
+ }
2991
+ })
2992
+ }), jsx(ReactHookFormTextField, {
2993
+ name: FormFields.serviceUrl,
2994
+ label: t('service-url-label'),
2995
+ onFocus: onFocusServiceUrl,
2996
+ autoFocus: !shouldDisableAutoFocus,
2997
+ onBlur: onBlurServiceUrl,
2998
+ onKeyDown: onKeyDownServiceUrl,
2999
+ sx: style.textField,
3000
+ rules: {
3001
+ required: true,
3002
+ validate: Object.assign({}, !isServiceUrlDisabled && {
3003
+ onValidateServiceUrl: onValidateServiceUrl
2978
3004
  })
2979
- })]
2980
- }), jsxs(DialogContent, {
2981
- sx: {
2982
- padding: '8px 16px'
2983
3005
  },
2984
- children: [jsx(ReactHookFormTextField, {
2985
- name: FormFields.serviceUrl,
2986
- label: t('service-url-label'),
2987
- onFocus: onFocusServiceUrl,
2988
- autoFocus: !shouldDisableAutoFocus,
2989
- onBlur: onBlurServiceUrl,
2990
- onKeyDown: onKeyDownServiceUrl,
2991
- sx: style.textField,
2992
- rules: {
2993
- required: true,
2994
- validate: Object.assign({}, !isServiceUrlDisabled && {
2995
- onValidateServiceUrl: onValidateServiceUrl
3006
+ disabled: isServiceUrlDisabled || isLoading,
3007
+ isReadOnly: isShowPopup,
3008
+ inputSlotProps: {
3009
+ disableUnderline: isShowPopup,
3010
+ endAdornment: isShowPopup && jsx(InputAdornment, {
3011
+ position: "end",
3012
+ children: jsx(CustomIconButton, {
3013
+ "aria-label": "copy url",
3014
+ onClick: function onClick() {
3015
+ void navigator.clipboard.writeText(serviceUrl);
3016
+ showSnackbar(t('copy-url-message'));
3017
+ },
3018
+ sx: {
3019
+ marginTop: 0.5
3020
+ },
3021
+ children: jsx(Copy, {})
2996
3022
  })
2997
- },
2998
- disabled: isServiceUrlDisabled || isLoading,
2999
- isReadOnly: isShowPopup,
3000
- inputSlotProps: {
3001
- disableUnderline: isShowPopup,
3002
- endAdornment: isShowPopup && jsx(InputAdornment, {
3003
- position: "end",
3004
- children: jsx(CustomIconButton, {
3005
- "aria-label": "copy url",
3006
- onClick: function onClick() {
3007
- void navigator.clipboard.writeText(serviceUrl);
3008
- showSnackbar(t('copy-url-message'));
3009
- },
3010
- sx: {
3011
- marginTop: 0.5
3012
- },
3013
- children: jsx(Copy, {})
3014
- })
3015
- })
3016
- },
3017
- defaultValue: serviceUrl
3018
- }), jsx(ReactHookFormTextField, {
3019
- name: FormFields.serviceName,
3020
- label: t('service-name-label'),
3021
- rules: {
3022
- required: true,
3023
- validate: {
3024
- onValidateServiceName: onValidateServiceName
3025
- }
3026
- },
3027
- disabled: isShowPopup || isLoading,
3028
- isReadOnly: isShowPopup,
3029
- inputSlotProps: {
3030
- disableUnderline: isShowPopup
3031
- },
3032
- sx: style.textField,
3033
- defaultValue: serviceName
3034
- }), jsx(ReactHookFormTextField, {
3035
- multiline: true,
3036
- rows: 4,
3037
- name: FormFields.serviceAbstracts,
3038
- label: t('service-abstracts-label'),
3039
- disabled: isShowPopup || isLoading,
3040
- isReadOnly: isShowPopup,
3041
- inputSlotProps: {
3042
- disableUnderline: isShowPopup
3043
- },
3044
- helperText: !isShowPopup ? t('service-popup-helper-text') : '',
3045
- sx: style.textField,
3046
- defaultValue: ""
3047
- }), !isServiceUrlDisabled && jsx(InitialValidationsTrigger, {
3048
- trigger: trigger,
3049
- getValues: getValues,
3050
- onValidField: fetchServiceData
3051
- })]
3052
- }), jsx(DialogActions, {
3053
- sx: {
3054
- padding: 2
3023
+ })
3055
3024
  },
3056
- children: isShowPopup ? jsx(Button, {
3057
- onClick: function onClick() {
3058
- return closePopup();
3059
- },
3060
- variant: "tertiary",
3061
- sx: {
3062
- width: '117px'
3063
- },
3064
- children: t('close')
3065
- }) : jsxs(Fragment, {
3066
- children: [jsx(Button, {
3067
- onClick: closePopup,
3068
- "data-testid": "closePopupButtonCancel",
3069
- variant: "tertiary",
3070
- sx: {
3071
- width: '117px'
3072
- },
3073
- children: t('cancel')
3074
- }), jsx(Button, {
3075
- type: "submit",
3076
- variant: "primary",
3077
- disabled: isSubmitDisabled || isLoading,
3078
- "data-testid": "saveServiceButton",
3079
- sx: {
3080
- width: '117px',
3081
- marginLeft: '16px!important'
3082
- },
3083
- children: t('save')
3084
- })]
3085
- })
3025
+ defaultValue: serviceUrl
3026
+ }), jsx(ReactHookFormTextField, {
3027
+ name: FormFields.serviceName,
3028
+ label: t('service-name-label'),
3029
+ rules: {
3030
+ required: true,
3031
+ validate: {
3032
+ onValidateServiceName: onValidateServiceName
3033
+ }
3034
+ },
3035
+ disabled: isShowPopup || isLoading,
3036
+ isReadOnly: isShowPopup,
3037
+ inputSlotProps: {
3038
+ disableUnderline: isShowPopup
3039
+ },
3040
+ sx: style.textField,
3041
+ defaultValue: serviceName
3042
+ }), jsx(ReactHookFormTextField, {
3043
+ multiline: true,
3044
+ rows: 4,
3045
+ name: FormFields.serviceAbstracts,
3046
+ label: t('service-abstracts-label'),
3047
+ disabled: isShowPopup || isLoading,
3048
+ isReadOnly: isShowPopup,
3049
+ inputSlotProps: {
3050
+ disableUnderline: isShowPopup
3051
+ },
3052
+ helperText: !isShowPopup ? t('service-popup-helper-text') : '',
3053
+ sx: style.textField,
3054
+ defaultValue: ""
3055
+ }), !isServiceUrlDisabled && jsx(InitialValidationsTrigger, {
3056
+ trigger: trigger,
3057
+ getValues: getValues,
3058
+ onValidField: fetchServiceData
3086
3059
  })]
3087
3060
  })
3088
3061
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/layer-select",
3
- "version": "12.1.1",
3
+ "version": "12.2.0",
4
4
  "description": "GeoWeb layer select library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,15 +8,15 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/shared": "12.1.1",
12
- "@opengeoweb/store": "12.1.1",
11
+ "@opengeoweb/shared": "12.2.0",
12
+ "@opengeoweb/store": "12.2.0",
13
13
  "react-redux": "^8.1.3",
14
- "@opengeoweb/theme": "12.1.1",
15
- "@opengeoweb/webmap-react": "12.1.1",
16
- "@opengeoweb/webmap": "12.1.1",
14
+ "@opengeoweb/theme": "12.2.0",
15
+ "@opengeoweb/webmap-react": "12.2.0",
16
+ "@opengeoweb/webmap": "12.2.0",
17
17
  "react-window": "^1.8.10",
18
- "@opengeoweb/snackbar": "12.1.1",
19
- "@opengeoweb/form-fields": "12.1.1",
18
+ "@opengeoweb/snackbar": "12.2.0",
19
+ "@opengeoweb/form-fields": "12.2.0",
20
20
  "react-hook-form": "^7.50.1",
21
21
  "@reduxjs/toolkit": "^1.9.7",
22
22
  "lodash": "^4.17.21",
@@ -1,47 +1,12 @@
1
- import * as React from 'react';
2
1
  import type { Meta, StoryObj } from '@storybook/react';
3
2
  import { ServicePopup } from './ServicePopup';
4
3
  declare const meta: Meta<typeof ServicePopup>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof ServicePopup>;
7
6
  export declare const Component: Story;
8
- export declare const ServicePopupAddLight: {
9
- (): React.ReactElement;
10
- tags: string[];
11
- parameters: {
12
- zeplinLink: {
13
- name: string;
14
- link: string;
15
- }[];
16
- };
17
- };
18
- export declare const ServicePopupAddDark: {
19
- (): React.ReactElement;
20
- tags: string[];
21
- parameters: {
22
- zeplinLink: {
23
- name: string;
24
- link: string;
25
- }[];
26
- };
27
- };
28
- export declare const ServicePopupShowLight: {
29
- (): React.ReactElement;
30
- tags: string[];
31
- parameters: {
32
- zeplinLink: {
33
- name: string;
34
- link: string;
35
- }[];
36
- };
37
- };
38
- export declare const ServicePopupShowDark: {
39
- (): React.ReactElement;
40
- tags: string[];
41
- parameters: {
42
- zeplinLink: {
43
- name: string;
44
- link: string;
45
- }[];
46
- };
47
- };
7
+ export declare const ServicePopupAddLight: Story;
8
+ export declare const ServicePopupAddDark: Story;
9
+ export declare const ServicePopupShowLight: Story;
10
+ export declare const ServicePopupShowDark: Story;
11
+ export declare const ServicePopupEditLight: Story;
12
+ export declare const ServicePopupEditDark: Story;