@opengeoweb/shared 14.3.0 → 14.4.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
@@ -5,7 +5,7 @@ import { initReactI18next, useTranslation } from 'react-i18next';
5
5
  import React, { useRef, useEffect, useState, Component } from 'react';
6
6
  import Draggable from 'react-draggable';
7
7
  import { Resizable } from 're-resizable';
8
- import { Resize, Options, Close, ChevronLeft, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Admin, useThemeContext, ThemeTypes, ArrowLeft, ArrowRight, KeyOption, KeyCommand, ArrowUp, ArrowDown, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
8
+ import { Resize, BORDER_RADIUS, Options, Close, ChevronLeft, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Admin, useThemeContext, ThemeTypes, ArrowLeft, ArrowRight, KeyOption, KeyCommand, ArrowUp, ArrowDown, ChevronDown, Search, Clear, Cached, Filter as Filter$1 } from '@opengeoweb/theme';
9
9
  import { throttle, merge, escapeRegExp, debounce } from 'lodash';
10
10
  import { addIntegration } from '@sentry/react';
11
11
  import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, roundToNearestMinutes as roundToNearestMinutes$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$1, getHours as getHours$1, startOfDay, addMinutes, addHours, setSeconds as setSeconds$1, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
@@ -53,6 +53,11 @@ var en = {
53
53
  "shared-shortcut-mouse-scroll": "+ Mouse scroll",
54
54
  "shared-shortcut-or": "or",
55
55
  "shared-shortcut-toggle-workspace-time-scroll": "Toggle workspace time scroll ON and OFF",
56
+ "shared-shortcut-open-location-search": "Open location search",
57
+ "shared-shortcut-zoom-to-location": "Zoom map to location",
58
+ "shared-shortcut-mouse-click": "+ Mouse click",
59
+ "shared-shortcut-split-button": "click split window button",
60
+ "shared-shortcut-copy-view-preset-content-split-window": "Copy over viewpreset content when splitting window",
56
61
  "shared-sentry-recording": "Sentry Recording",
57
62
  "shared-sentry-information": "For monitoring performance and errors, GeoWeb is logging usage information. In this process, no sensitive user information will leave the browser.",
58
63
  "shared-sentry-enable-message": "By enabling recording I understand that the recording related data will be send to Sentry´s servers for processing.",
@@ -75,7 +80,11 @@ var en = {
75
80
  "shared-filter-shared-view-presets": "Shared presets",
76
81
  "shared-filter-search": "Search",
77
82
  "shared-only": "ONLY",
78
- "shared-customdialog-back": "Back"
83
+ "shared-customdialog-back": "Back",
84
+ "shared-filter-hide-labels": "Close filter",
85
+ "shared-filter-show-labels": "Open filter",
86
+ "shared-shortcut-toggle-location-info": "Toggle location info dialog ON and OFF",
87
+ "shared-shortcut-toggle-measure-tool": "Toggle map measure tool ON and OFF"
79
88
  };
80
89
  var fi = {
81
90
  "shared-choose-app-mode": "Sovelluksen väriteema",
@@ -119,6 +128,11 @@ var fi = {
119
128
  "shared-shortcut-mouse-scroll": "+ hiiren rulla",
120
129
  "shared-shortcut-or": "tai",
121
130
  "shared-shortcut-toggle-workspace-time-scroll": "Aseta työtilan ajan scrollaus päälle tai pois päältä",
131
+ "shared-shortcut-open-location-search": "Avaa sijainnin haku",
132
+ "shared-shortcut-zoom-to-location": "Zoomaa kartta sijaintiin",
133
+ "shared-shortcut-mouse-click": "+ hiiren napsautus",
134
+ "shared-shortcut-split-button": "napsauta Jaa ikkuna -painiketta",
135
+ "shared-shortcut-copy-view-preset-content-split-window": "Kopioi näkymän sisältö, kun ikkuna jaetaan kahtia",
122
136
  "shared-sentry-recording": "Sentry Tallennus",
123
137
  "shared-sentry-information": "Geoweb tallentaa tietoja sovelluksen käytöstä monitoroidakseen suorituskykyä, sekä virhetilanteita. Arkaluonteista dataa ei kerätä tai lähetetä.",
124
138
  "shared-sentry-enable-message": "Ymmärrän, että laittamalla tallennuksen päälle tallennukseen liittyvää dataa lähetetään Sentryn palvelimille.",
@@ -141,7 +155,9 @@ var fi = {
141
155
  "shared-filter-shared-view-presets": "ei käännetty",
142
156
  "shared-filter-search": "Etsi",
143
157
  "shared-only": "Pelkästään",
144
- "shared-customdialog-back": "PALAA TAKAISIN"
158
+ "shared-customdialog-back": "PALAA TAKAISIN",
159
+ "shared-filter-hide-labels": "Hide labels",
160
+ "shared-filter-show-labels": "Show labels"
145
161
  };
146
162
  var no = {
147
163
  "shared-choose-app-mode": "Velg din standardmodus",
@@ -185,6 +201,11 @@ var no = {
185
201
  "shared-shortcut-mouse-scroll": "+ skroll",
186
202
  "shared-shortcut-or": "eller",
187
203
  "shared-shortcut-toggle-workspace-time-scroll": "ikke oversatt",
204
+ "shared-shortcut-open-location-search": "Åpne stedsøk",
205
+ "shared-shortcut-zoom-to-location": "Zoom kart til sted",
206
+ "shared-shortcut-mouse-click": "+ museklikk",
207
+ "shared-shortcut-copy-view-preset-content-split-window": "kopier over viewpreset innhold når vindu deles",
208
+ "shared-shortcut-split-button": "trykk del vindu knapp",
188
209
  "shared-sentry-recording": "Skjermopptak av Sentry",
189
210
  "shared-sentry-information": "GeoWeb tar opp brukerinformasjon for å monitorere ytelse og feilmeldinger. Underveis vil ingen sensitiv brukerinformasjon forlate nettleser.",
190
211
  "shared-sentry-enable-message": "Ved å bruke skjermopptak forstår jeg at opptaksdata vil bli sendt til Sentry for analysering",
@@ -207,7 +228,9 @@ var no = {
207
228
  "shared-filter-shared-view-presets": "Delte snarveier",
208
229
  "shared-filter-search": "Søk",
209
230
  "shared-only": "BARE",
210
- "shared-customdialog-back": "Tilbake"
231
+ "shared-customdialog-back": "Tilbake",
232
+ "shared-filter-hide-labels": "Skjul nøkkelord",
233
+ "shared-filter-show-labels": "Vis nøkkelord"
211
234
  };
212
235
  var nl = {
213
236
  "shared-choose-app-mode": "Kies je standaard app-modus",
@@ -250,7 +273,12 @@ var nl = {
250
273
  "shared-shortcut-home": "Home",
251
274
  "shared-shortcut-mouse-scroll": "+ Scroll",
252
275
  "shared-shortcut-or": "of",
253
- "shared-shortcut-toggle-workspace-time-scroll": "niet vertaald",
276
+ "shared-shortcut-copy-view-preset-content-split-window": "Kopieer viewpreset instellingen naar nieuw paneel",
277
+ "shared-shortcut-split-button": "klik splits paneel knop",
278
+ "shared-shortcut-toggle-workspace-time-scroll": "Zet workspace tijd scrollen AAN en UIT",
279
+ "shared-shortcut-open-location-search": "Open locatie zoeken",
280
+ "shared-shortcut-zoom-to-location": "Zoom kaart naar locatie",
281
+ "shared-shortcut-mouse-click": "+ Muisklik",
254
282
  "shared-sentry-recording": "Sentry Opname",
255
283
  "shared-sentry-information": "Om performance en fouten te monitoren, registreert GeoWeb gebruiksinformatie. Tijdens dit proces verlaat geen enkele gevoelige gebruikersinformatie de browser.",
256
284
  "shared-sentry-enable-message": "Door opname te starten, ga ik akkoord dat de opnamegerelateerde gegevens ter verwerking naar de servers van Sentry worden verzonden.",
@@ -273,7 +301,11 @@ var nl = {
273
301
  "shared-filter-shared-view-presets": "Gedeelde presets",
274
302
  "shared-filter-search": "Zoeken",
275
303
  "shared-only": "ALLEEN",
276
- "shared-customdialog-back": "Terug"
304
+ "shared-customdialog-back": "Terug",
305
+ "shared-filter-hide-labels": "Verberg labels",
306
+ "shared-filter-show-labels": "Toon labels",
307
+ "shared-shortcut-toggle-location-info": "Zet locatie informatie AAN en UIT",
308
+ "shared-shortcut-toggle-measure-tool": "Zet meten op de kaart AAN en UIT"
277
309
  };
278
310
  var sharedTranslations = {
279
311
  en: en,
@@ -881,7 +913,7 @@ var CustomTooltip = function CustomTooltip(props) {
881
913
  }));
882
914
  };
883
915
 
884
- var _excluded$b = ["tooltipTitle", "variant", "isSelected", "shouldShowAsDisabled", "size", "children", "className", "tooltipProps"];
916
+ var _excluded$b = ["tooltipTitle", "variant", "isSelected", "shouldShowAsDisabled", "size", "children", "className", "tooltipProps", "shouldShowExtraOptionsIndicator", "optionsActive"];
885
917
  var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
886
918
  var _defaultTooltipProps$;
887
919
  var _ref$tooltipTitle = _ref.tooltipTitle,
@@ -897,6 +929,10 @@ var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref)
897
929
  children = _ref.children,
898
930
  className = _ref.className,
899
931
  defaultTooltipProps = _ref.tooltipProps,
932
+ _ref$shouldShowExtraO = _ref.shouldShowExtraOptionsIndicator,
933
+ shouldShowExtraOptionsIndicator = _ref$shouldShowExtraO === void 0 ? false : _ref$shouldShowExtraO,
934
+ _ref$optionsActive = _ref.optionsActive,
935
+ optionsActive = _ref$optionsActive === void 0 ? false : _ref$optionsActive,
900
936
  props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
901
937
  var classNames = [].concat(className ? [className] : [], isSelected ? ['Mui-selected'] : [], [variant]).join(' ');
902
938
  var tooltipTitle = (_defaultTooltipProps$ = defaultTooltipProps == null ? void 0 : defaultTooltipProps.title) != null ? _defaultTooltipProps$ : defaultTooltipTitle;
@@ -911,7 +947,7 @@ var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref)
911
947
  });
912
948
  }, [defaultTooltipProps, tooltipTitle]);
913
949
  var renderIconButton = function renderIconButton() {
914
- return jsx(IconButton, Object.assign({
950
+ return jsxs(IconButton, Object.assign({
915
951
  "aria-label": tooltipTitle
916
952
  }, props, {
917
953
  "aria-pressed": isSelected,
@@ -926,7 +962,19 @@ var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref)
926
962
  color: "geowebColors.iconButtons." + variant + ".default.color"
927
963
  }
928
964
  }),
929
- children: children
965
+ children: [children, shouldShowExtraOptionsIndicator ? jsx(Box, {
966
+ "data-testid": "extra-options-indicator",
967
+ sx: {
968
+ position: 'absolute',
969
+ right: -1,
970
+ bottom: -1,
971
+ color: optionsActive ? "geowebColors.iconButtons." + variant + ".active.fill" : 'inherit',
972
+ borderBottom: '8px solid',
973
+ borderLeft: '8px solid transparent',
974
+ borderBottomRightRadius: BORDER_RADIUS,
975
+ pointerEvents: 'none'
976
+ }
977
+ }) : null]
930
978
  }));
931
979
  };
932
980
  return tooltipTitle && !props.disabled ? jsx(CustomTooltip, Object.assign({}, tooltipProps, {
@@ -3569,6 +3617,66 @@ var ShortcutList = function ShortcutList(_ref) {
3569
3617
  type: "icon",
3570
3618
  children: "S"
3571
3619
  })
3620
+ }, {
3621
+ titleKey: 'shared-shortcut-open-location-search',
3622
+ description: jsx(ShortCutSegment, {
3623
+ type: "icon",
3624
+ children: "F"
3625
+ }),
3626
+ descriptionMac: jsx(ShortCutSegment, {
3627
+ type: "icon",
3628
+ children: "F"
3629
+ })
3630
+ }, {
3631
+ titleKey: 'shared-shortcut-zoom-to-location',
3632
+ description: jsxs(Fragment, {
3633
+ children: [jsx(ShortCutSegment, {
3634
+ type: "icon",
3635
+ children: "Shift"
3636
+ }), jsxs(ShortCutSegment, {
3637
+ children: [" ", t('shared-shortcut-mouse-click')]
3638
+ })]
3639
+ }),
3640
+ descriptionMac: jsxs(Fragment, {
3641
+ children: [jsx(ShortCutSegment, {
3642
+ type: "icon",
3643
+ children: "Shift"
3644
+ }), jsxs(ShortCutSegment, {
3645
+ children: [" ", t('shared-shortcut-mouse-click')]
3646
+ })]
3647
+ })
3648
+ }, {
3649
+ titleKey: 'shared-shortcut-copy-view-preset-content-split-window',
3650
+ description: jsxs(Fragment, {
3651
+ children: [jsx(ShortCutSegment, {
3652
+ type: "icon",
3653
+ children: "Shift"
3654
+ }), jsx(ShortCutSegment, {
3655
+ children: " + "
3656
+ }), jsx(ShortCutSegment, {
3657
+ children: t('shared-shortcut-split-button')
3658
+ })]
3659
+ })
3660
+ }, {
3661
+ titleKey: 'shared-shortcut-toggle-location-info',
3662
+ description: jsx(ShortCutSegment, {
3663
+ type: "icon",
3664
+ children: "I"
3665
+ }),
3666
+ descriptionMac: jsx(ShortCutSegment, {
3667
+ type: "icon",
3668
+ children: "I"
3669
+ })
3670
+ }, {
3671
+ titleKey: 'shared-shortcut-toggle-measure-tool',
3672
+ description: jsx(ShortCutSegment, {
3673
+ type: "icon",
3674
+ children: "M"
3675
+ }),
3676
+ descriptionMac: jsx(ShortCutSegment, {
3677
+ type: "icon",
3678
+ children: "M"
3679
+ })
3572
3680
  }];
3573
3681
  return jsx(List, {
3574
3682
  "data-testid": "list-" + platform,
@@ -5094,13 +5202,39 @@ var FilterChip = function FilterChip(_ref) {
5094
5202
  });
5095
5203
  };
5096
5204
 
5205
+ var FilterToggleButton = function FilterToggleButton(_ref) {
5206
+ var _t, _t2;
5207
+ var isOpen = _ref.isOpen,
5208
+ onToggle = _ref.onToggle;
5209
+ var _useSharedTranslation = useSharedTranslation(),
5210
+ t = _useSharedTranslation.t;
5211
+ var tooltipTitle = isOpen ? (_t = t('shared-filter-hide-labels')) != null ? _t : '' : (_t2 = t('shared-filter-show-labels')) != null ? _t2 : '';
5212
+ return jsx(Tooltip, {
5213
+ title: tooltipTitle,
5214
+ children: jsx(CustomIconButton, {
5215
+ "aria-pressed": isOpen,
5216
+ "data-testid": "workspace-label-filter-toggle",
5217
+ id: "labels-filter",
5218
+ isSelected: isOpen,
5219
+ onClick: onToggle,
5220
+ variant: "tool",
5221
+ children: jsx(Filter$1, {})
5222
+ })
5223
+ });
5224
+ };
5225
+
5097
5226
  var FilterList = function FilterList(_ref) {
5098
5227
  var _ref$filters = _ref.filters,
5099
5228
  filters = _ref$filters === void 0 ? [] : _ref$filters,
5100
5229
  _ref$onChipClick = _ref.onChipClick,
5101
5230
  onChipClick = _ref$onChipClick === void 0 ? function () {} : _ref$onChipClick,
5102
5231
  _ref$isAllSelected = _ref.isAllSelected,
5103
- isAllSelected = _ref$isAllSelected === void 0 ? false : _ref$isAllSelected;
5232
+ isAllSelected = _ref$isAllSelected === void 0 ? false : _ref$isAllSelected,
5233
+ _ref$showLabelFilterT = _ref.showLabelFilterToggle,
5234
+ showLabelFilterToggle = _ref$showLabelFilterT === void 0 ? false : _ref$showLabelFilterT,
5235
+ _ref$isLabelFilterOpe = _ref.isLabelFilterOpen,
5236
+ isLabelFilterOpen = _ref$isLabelFilterOpe === void 0 ? false : _ref$isLabelFilterOpe,
5237
+ onToggleLabelFilter = _ref.onToggleLabelFilter;
5104
5238
  var _useSharedTranslation = useSharedTranslation(),
5105
5239
  t = _useSharedTranslation.t;
5106
5240
  return jsxs(Stack, {
@@ -5110,9 +5244,13 @@ var FilterList = function FilterList(_ref) {
5110
5244
  flexWrap: "wrap",
5111
5245
  sx: {
5112
5246
  gap: 1,
5113
- rowGap: 1
5247
+ rowGap: 1,
5248
+ alignItems: 'center'
5114
5249
  },
5115
- children: [jsx(FilterChip, {
5250
+ children: [showLabelFilterToggle && onToggleLabelFilter ? jsx(FilterToggleButton, {
5251
+ isOpen: isLabelFilterOpen,
5252
+ onToggle: onToggleLabelFilter
5253
+ }) : null, jsx(FilterChip, {
5116
5254
  handleClick: function handleClick(key) {
5117
5255
  return onChipClick(key, !isAllSelected);
5118
5256
  },
@@ -5201,7 +5339,7 @@ var SearchField = function SearchField(_ref3) {
5201
5339
  });
5202
5340
  };
5203
5341
 
5204
- var _excluded$1 = ["filters", "onClickFilterChip", "onSearch", "isAllSelected", "searchQuery"];
5342
+ var _excluded$1 = ["filters", "onClickFilterChip", "onSearch", "isAllSelected", "searchQuery", "showLabelFilterToggle", "isLabelFilterOpen", "onToggleLabelFilter", "showSearchField"];
5205
5343
  var DEFAULT_FILTER_HEIGHT = 85;
5206
5344
  var Filter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
5207
5345
  var filters = _ref.filters,
@@ -5210,7 +5348,13 @@ var Filter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
5210
5348
  _ref$onSearch = _ref.onSearch,
5211
5349
  onSearch = _ref$onSearch === void 0 ? function () {} : _ref$onSearch,
5212
5350
  isAllSelected = _ref.isAllSelected,
5213
- searchQuery = _ref.searchQuery,
5351
+ searchQuery = _ref.searchQuery;
5352
+ _ref.showLabelFilterToggle;
5353
+ var _ref$isLabelFilterOpe = _ref.isLabelFilterOpen,
5354
+ isLabelFilterOpen = _ref$isLabelFilterOpe === void 0 ? false : _ref$isLabelFilterOpe,
5355
+ onToggleLabelFilter = _ref.onToggleLabelFilter,
5356
+ _ref$showSearchField = _ref.showSearchField,
5357
+ showSearchField = _ref$showSearchField === void 0 ? true : _ref$showSearchField,
5214
5358
  props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
5215
5359
  return jsx(Box, {
5216
5360
  ref: ref,
@@ -5220,13 +5364,16 @@ var Filter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
5220
5364
  }, Array.isArray(props.sx) ? Object.assign.apply(Object, [{}].concat(props.sx)) : props.sx),
5221
5365
  children: jsxs(Stack, {
5222
5366
  spacing: 1,
5223
- children: [jsx(SearchField, {
5367
+ children: [showSearchField ? jsx(SearchField, {
5224
5368
  value: searchQuery,
5225
5369
  valueChanged: onSearch
5226
- }), jsx(FilterList, {
5370
+ }) : null, jsx(FilterList, {
5227
5371
  filters: filters,
5228
5372
  isAllSelected: isAllSelected,
5229
- onChipClick: onClickFilterChip
5373
+ isLabelFilterOpen: isLabelFilterOpen,
5374
+ onChipClick: onClickFilterChip,
5375
+ onToggleLabelFilter: onToggleLabelFilter,
5376
+ showLabelFilterToggle: true
5230
5377
  })]
5231
5378
  })
5232
5379
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "14.3.0",
3
+ "version": "14.4.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": {
@@ -8,7 +8,7 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/theme": "14.3.0",
11
+ "@opengeoweb/theme": "14.4.0",
12
12
  "react-draggable": "^4.4.6",
13
13
  "re-resizable": "^6.9.11",
14
14
  "lodash": "^4.17.21",
@@ -8,6 +8,8 @@ export interface CustomIconProps extends IconButtonProps {
8
8
  isSelected?: boolean;
9
9
  shouldShowAsDisabled?: boolean;
10
10
  tooltipProps?: TooltipProps;
11
+ shouldShowExtraOptionsIndicator?: boolean;
12
+ optionsActive?: boolean;
11
13
  }
12
14
  export declare const CustomIconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<CustomIconProps, "ref"> & React.RefAttributes<HTMLButtonElement>>>;
13
15
  export {};
@@ -8,6 +8,10 @@ interface FilterProps extends BoxProps {
8
8
  onSearch?: (value: string) => void;
9
9
  isAllSelected?: boolean;
10
10
  searchQuery?: string;
11
+ showLabelFilterToggle?: boolean;
12
+ isLabelFilterOpen?: boolean;
13
+ onToggleLabelFilter?: () => void;
14
+ showSearchField?: boolean;
11
15
  }
12
16
  declare const Filter: React.ForwardRefExoticComponent<Omit<FilterProps, "ref"> & React.RefAttributes<HTMLElement>>;
13
17
  export default Filter;
@@ -10,6 +10,9 @@ interface FilterListProps {
10
10
  filters?: ListFilter[];
11
11
  onChipClick?: (id: string, selected: boolean) => void;
12
12
  isAllSelected?: boolean;
13
+ showLabelFilterToggle?: boolean;
14
+ isLabelFilterOpen?: boolean;
15
+ onToggleLabelFilter?: () => void;
13
16
  }
14
17
  declare const FilterList: React.FC<FilterListProps>;
15
18
  export default FilterList;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const FilterToggleButton: React.FC<{
3
+ isOpen: boolean;
4
+ onToggle: () => void;
5
+ }>;