@opengeoweb/shared 12.3.0 → 12.4.1
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 +60 -16
- package/package.json +3 -3
- package/src/lib/components/CustomSlider/CustomSlider.d.ts +2 -1
- package/src/lib/components/SearchField/SearchField.d.ts +2 -1
- package/src/lib/components/SearchField/SearchFieldButtonContainer.d.ts +1 -1
- package/src/lib/utils/dateUtils/dateUtils.d.ts +3 -2
package/index.esm.js
CHANGED
|
@@ -7,9 +7,10 @@ import { Resizable } from 're-resizable';
|
|
|
7
7
|
import { Resize, Options, Close, ChevronLeft, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Admin, useThemeContext, ThemeTypes, KeyOption, ArrowLeft, ArrowRight, KeyCommand, ArrowUp, ArrowDown, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
|
|
8
8
|
import 'i18next';
|
|
9
9
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
10
|
-
import { throttle, escapeRegExp, debounce } from 'lodash';
|
|
10
|
+
import { throttle, merge, escapeRegExp, debounce } from 'lodash';
|
|
11
11
|
import * as Sentry from '@sentry/react';
|
|
12
12
|
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';
|
|
13
|
+
import { fi as fi$1, nl as nl$1, nb, enGB } from 'date-fns/locale';
|
|
13
14
|
|
|
14
15
|
var en = {
|
|
15
16
|
"shared-choose-app-mode": "Choose your default app mode",
|
|
@@ -18,7 +19,7 @@ var en = {
|
|
|
18
19
|
"shared-viewer": "Viewer",
|
|
19
20
|
"shared-editor": "Editor",
|
|
20
21
|
"shared-reload-page": "Reload page",
|
|
21
|
-
"shared-search-
|
|
22
|
+
"shared-search-services": "Search through services or enter a service URL",
|
|
22
23
|
"shared-last-updated": "Last updated {{time}}",
|
|
23
24
|
"shared-click-to-refresh": "Click to refresh",
|
|
24
25
|
"shared-error-occurred": "Woops, an error has occurred. Please report the error shown below and reload the page if needed.",
|
|
@@ -81,7 +82,7 @@ var fi = {
|
|
|
81
82
|
"shared-viewer": "Katselu",
|
|
82
83
|
"shared-editor": "Muokkain",
|
|
83
84
|
"shared-reload-page": "Lataa sivu uudelleen",
|
|
84
|
-
"shared-search-
|
|
85
|
+
"shared-search-services": "Etsi palveluista tai lisää palvelun URL-osoite",
|
|
85
86
|
"shared-last-updated": "Päivitetty viimeksi {{time}}",
|
|
86
87
|
"shared-click-to-refresh": "Napsauta päivittääksesi",
|
|
87
88
|
"shared-error-occurred": "Hups, virhe havaittu. Ilmoita ongelmasta eteenpäin ja lataa sivu uudelleen tarvittaessa",
|
|
@@ -144,7 +145,7 @@ var no = {
|
|
|
144
145
|
"shared-viewer": "Viewer",
|
|
145
146
|
"shared-editor": "Editor",
|
|
146
147
|
"shared-reload-page": "Last inn på nytt",
|
|
147
|
-
"shared-search-
|
|
148
|
+
"shared-search-services": "Søk gjennom tjenester eller legg inn URL",
|
|
148
149
|
"shared-last-updated": "Sist oppdatert",
|
|
149
150
|
"shared-click-to-refresh": "Trykk for å laste inn på nytt",
|
|
150
151
|
"shared-error-occurred": "Woops, an error has occurred. Please report the error shown below and reload the page if needed.",
|
|
@@ -207,7 +208,7 @@ var nl = {
|
|
|
207
208
|
"shared-viewer": "Kijker",
|
|
208
209
|
"shared-editor": "Bewerker",
|
|
209
210
|
"shared-reload-page": "Pagina vernieuwen",
|
|
210
|
-
"shared-search-
|
|
211
|
+
"shared-search-services": "Zoek door services of voer een service-URL in",
|
|
211
212
|
"shared-last-updated": "Laatst bijgewerkt {{time}}",
|
|
212
213
|
"shared-click-to-refresh": "Klik om te vernieuwen",
|
|
213
214
|
"shared-error-occurred": "Oeps, er is een fout opgetreden. Rapporteer de onderstaande fout en herlaad de pagina indien nodig.",
|
|
@@ -3867,7 +3868,7 @@ var getInitials = function getInitials(name) {
|
|
|
3867
3868
|
}
|
|
3868
3869
|
};
|
|
3869
3870
|
|
|
3870
|
-
var _excluded$6 = ["value", "orientation", "shouldAutoFocus"];
|
|
3871
|
+
var _excluded$6 = ["value", "orientation", "shouldAutoFocus", "extraStyles"];
|
|
3871
3872
|
var sliderHeaderStyle = {
|
|
3872
3873
|
fontFamily: 'Roboto-Black, Roboto',
|
|
3873
3874
|
fontSize: 12,
|
|
@@ -3924,6 +3925,8 @@ var CustomSlider = function CustomSlider(_ref) {
|
|
|
3924
3925
|
orientation = _ref$orientation === void 0 ? 'vertical' : _ref$orientation,
|
|
3925
3926
|
_ref$shouldAutoFocus = _ref.shouldAutoFocus,
|
|
3926
3927
|
shouldAutoFocus = _ref$shouldAutoFocus === void 0 ? false : _ref$shouldAutoFocus,
|
|
3928
|
+
_ref$extraStyles = _ref.extraStyles,
|
|
3929
|
+
extraStyles = _ref$extraStyles === void 0 ? {} : _ref$extraStyles,
|
|
3927
3930
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
3928
3931
|
// Add custom class (for bold text) to label adjacent to thumb component.
|
|
3929
3932
|
// Material UI doesn't support highlighing only adjacent label
|
|
@@ -3953,8 +3956,9 @@ var CustomSlider = function CustomSlider(_ref) {
|
|
|
3953
3956
|
}
|
|
3954
3957
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3955
3958
|
}, []);
|
|
3959
|
+
var mergedStyles = merge(extraStyles, sliderStyle);
|
|
3956
3960
|
return jsx(Slider, Object.assign({
|
|
3957
|
-
sx:
|
|
3961
|
+
sx: mergedStyles,
|
|
3958
3962
|
ref: element,
|
|
3959
3963
|
value: value,
|
|
3960
3964
|
orientation: orientation,
|
|
@@ -4395,7 +4399,7 @@ var SearchFieldButton = function SearchFieldButton(_ref2) {
|
|
|
4395
4399
|
setPopupIsOpen = _ref2.setPopupIsOpen;
|
|
4396
4400
|
var _useSharedTranslation2 = useSharedTranslation(),
|
|
4397
4401
|
t = _useSharedTranslation2.t;
|
|
4398
|
-
if (isURL(localSearchString)) {
|
|
4402
|
+
if (isURL(localSearchString) && setPopupIsOpen) {
|
|
4399
4403
|
return jsxs(Fragment, {
|
|
4400
4404
|
children: [jsx("div", {
|
|
4401
4405
|
style: {
|
|
@@ -4429,11 +4433,33 @@ var SearchFieldButton = function SearchFieldButton(_ref2) {
|
|
|
4429
4433
|
});
|
|
4430
4434
|
};
|
|
4431
4435
|
|
|
4436
|
+
var stylesSmall = {
|
|
4437
|
+
'.MuiInputLabel-root': {
|
|
4438
|
+
lineHeight: '16px',
|
|
4439
|
+
fontSize: '12px',
|
|
4440
|
+
top: '-6px',
|
|
4441
|
+
transform: 'translate(12px, 7px) scale(1)',
|
|
4442
|
+
':not(.MuiInputLabel-shrink)': {
|
|
4443
|
+
transform: 'translate(12px, 10px) scale(1.6)'
|
|
4444
|
+
}
|
|
4445
|
+
},
|
|
4446
|
+
'.MuiFilledInput-input': {
|
|
4447
|
+
lineHeight: '20px',
|
|
4448
|
+
padding: '10px 0 1px 12px'
|
|
4449
|
+
},
|
|
4450
|
+
'.MuiButtonBase-root.MuiIconButton-root': {
|
|
4451
|
+
height: '32px!important',
|
|
4452
|
+
width: '32px!important',
|
|
4453
|
+
marginRight: '-4px!important'
|
|
4454
|
+
}
|
|
4455
|
+
};
|
|
4432
4456
|
var SearchField$1 = function SearchField(_ref) {
|
|
4433
4457
|
var searchFilter = _ref.searchFilter,
|
|
4434
4458
|
label = _ref.label,
|
|
4435
4459
|
setSearchFilter = _ref.setSearchFilter,
|
|
4436
|
-
onOpenServicePopup = _ref.onOpenServicePopup
|
|
4460
|
+
onOpenServicePopup = _ref.onOpenServicePopup,
|
|
4461
|
+
_ref$small = _ref.small,
|
|
4462
|
+
small = _ref$small === void 0 ? false : _ref$small;
|
|
4437
4463
|
var _React$useState = React.useState(''),
|
|
4438
4464
|
localSearchString = _React$useState[0],
|
|
4439
4465
|
setLocalSearchString = _React$useState[1];
|
|
@@ -4442,7 +4468,7 @@ var SearchField$1 = function SearchField(_ref) {
|
|
|
4442
4468
|
setUrlIsValid = _React$useState2[1];
|
|
4443
4469
|
var _useTranslation = useTranslation(SHARED_NAMESPACE),
|
|
4444
4470
|
t = _useTranslation.t;
|
|
4445
|
-
var translatedLabel = label || t('shared-search-
|
|
4471
|
+
var translatedLabel = label || (onOpenServicePopup ? t('shared-search-services') : t('shared-search'));
|
|
4446
4472
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4447
4473
|
var setSearchFilterDebounced = React.useCallback(debounce(setSearchFilter, 300), []);
|
|
4448
4474
|
var handleChange = function handleChange(text) {
|
|
@@ -4462,7 +4488,7 @@ var SearchField$1 = function SearchField(_ref) {
|
|
|
4462
4488
|
var keyDownHandler = function keyDownHandler(event) {
|
|
4463
4489
|
if (event.key === 'Enter') {
|
|
4464
4490
|
event.preventDefault();
|
|
4465
|
-
if (urlIsValid) {
|
|
4491
|
+
if (urlIsValid && onOpenServicePopup) {
|
|
4466
4492
|
onOpenServicePopup(localSearchString);
|
|
4467
4493
|
setLocalSearchString('');
|
|
4468
4494
|
}
|
|
@@ -4495,10 +4521,10 @@ var SearchField$1 = function SearchField(_ref) {
|
|
|
4495
4521
|
endAdornment: jsx(InputAdornment, {
|
|
4496
4522
|
position: "end",
|
|
4497
4523
|
children: jsx(SearchFieldButton, {
|
|
4498
|
-
setPopupIsOpen: function
|
|
4524
|
+
setPopupIsOpen: onOpenServicePopup ? function () {
|
|
4499
4525
|
onOpenServicePopup(localSearchString);
|
|
4500
4526
|
setLocalSearchString('');
|
|
4501
|
-
},
|
|
4527
|
+
} : undefined,
|
|
4502
4528
|
localSearchString: localSearchString,
|
|
4503
4529
|
onClickClear: function onClickClear() {
|
|
4504
4530
|
setLocalSearchString('');
|
|
@@ -4508,7 +4534,8 @@ var SearchField$1 = function SearchField(_ref) {
|
|
|
4508
4534
|
})
|
|
4509
4535
|
})
|
|
4510
4536
|
}
|
|
4511
|
-
}
|
|
4537
|
+
},
|
|
4538
|
+
sx: small ? stylesSmall : {}
|
|
4512
4539
|
});
|
|
4513
4540
|
};
|
|
4514
4541
|
|
|
@@ -5280,6 +5307,18 @@ var DATE_FORMAT_NAME_OF_DAY = 'eee dd/MM/yyyy HH:mm';
|
|
|
5280
5307
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
5281
5308
|
* */
|
|
5282
5309
|
// eslint-disable-next-line no-restricted-imports
|
|
5310
|
+
var getDateFnsLocale = function getDateFnsLocale(locale) {
|
|
5311
|
+
if (locale === 'fi') {
|
|
5312
|
+
return fi$1;
|
|
5313
|
+
}
|
|
5314
|
+
if (locale === 'nl') {
|
|
5315
|
+
return nl$1;
|
|
5316
|
+
}
|
|
5317
|
+
if (locale === 'no') {
|
|
5318
|
+
return nb;
|
|
5319
|
+
}
|
|
5320
|
+
return enGB;
|
|
5321
|
+
};
|
|
5283
5322
|
/**
|
|
5284
5323
|
* Parsing date strings with geoweb dateUtils:
|
|
5285
5324
|
*
|
|
@@ -5430,7 +5469,7 @@ var setUTCDate = function setUTCDate(inDate) {
|
|
|
5430
5469
|
* @example
|
|
5431
5470
|
* ``` dateToString(new Date(2022, 10, 12, 15, 30), 'dd MMM yyyy') ```
|
|
5432
5471
|
*/
|
|
5433
|
-
var dateToString = function dateToString(inDate, strFormat, utc) {
|
|
5472
|
+
var dateToString = function dateToString(inDate, strFormat, utc, locale) {
|
|
5434
5473
|
if (strFormat === void 0) {
|
|
5435
5474
|
strFormat = DATE_FORMAT_UTC;
|
|
5436
5475
|
}
|
|
@@ -5440,7 +5479,11 @@ var dateToString = function dateToString(inDate, strFormat, utc) {
|
|
|
5440
5479
|
if (!inDate || !isValid(inDate)) {
|
|
5441
5480
|
return undefined;
|
|
5442
5481
|
}
|
|
5443
|
-
var formattedDate = utc ? format(new Date(inDate.getUTCFullYear(), inDate.getUTCMonth(), inDate.getUTCDate(), inDate.getUTCHours(), inDate.getUTCMinutes(), inDate.getUTCSeconds()), strFormat
|
|
5482
|
+
var formattedDate = utc ? format(new Date(inDate.getUTCFullYear(), inDate.getUTCMonth(), inDate.getUTCDate(), inDate.getUTCHours(), inDate.getUTCMinutes(), inDate.getUTCSeconds()), strFormat, {
|
|
5483
|
+
locale: getDateFnsLocale(locale)
|
|
5484
|
+
}) : format(inDate, strFormat, {
|
|
5485
|
+
locale: getDateFnsLocale(locale)
|
|
5486
|
+
});
|
|
5444
5487
|
return formattedDate;
|
|
5445
5488
|
};
|
|
5446
5489
|
/**
|
|
@@ -5960,6 +6003,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
5960
6003
|
differenceInYears: differenceInYears,
|
|
5961
6004
|
fromUnix: fromUnix,
|
|
5962
6005
|
getCurrentTimeAsString: getCurrentTimeAsString,
|
|
6006
|
+
getDateFnsLocale: getDateFnsLocale,
|
|
5963
6007
|
getDay: getDay,
|
|
5964
6008
|
getDayOfYear: getDayOfYear,
|
|
5965
6009
|
getHours: getHours,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.4.1",
|
|
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,14 +8,14 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/theme": "12.
|
|
11
|
+
"@opengeoweb/theme": "12.4.1",
|
|
12
12
|
"react-draggable": "^4.4.6",
|
|
13
13
|
"re-resizable": "^6.9.11",
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
15
|
"axios": "^1.7.7",
|
|
16
16
|
"date-fns": "^4.1.0",
|
|
17
17
|
"react-i18next": "^15.1.1",
|
|
18
|
-
"i18next": "^
|
|
18
|
+
"i18next": "^25.0.1",
|
|
19
19
|
"@sentry/react": "^8.34.0",
|
|
20
20
|
"@mui/material": "^7.0.1"
|
|
21
21
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SliderProps } from '@mui/material';
|
|
2
|
+
import { SliderProps, SxProps } from '@mui/material';
|
|
3
3
|
export declare const sliderHeaderStyle: {
|
|
4
4
|
fontFamily: string;
|
|
5
5
|
fontSize: number;
|
|
@@ -8,6 +8,7 @@ export declare const sliderHeaderStyle: {
|
|
|
8
8
|
};
|
|
9
9
|
interface CustomSliderProps extends SliderProps {
|
|
10
10
|
shouldAutoFocus?: boolean;
|
|
11
|
+
extraStyles?: SxProps;
|
|
11
12
|
}
|
|
12
13
|
export declare const CustomSlider: React.FC<CustomSliderProps>;
|
|
13
14
|
export default CustomSlider;
|
|
@@ -3,7 +3,8 @@ interface SearchFieldProps {
|
|
|
3
3
|
searchFilter: string;
|
|
4
4
|
label?: string;
|
|
5
5
|
setSearchFilter: (filterText: string) => void;
|
|
6
|
-
onOpenServicePopup
|
|
6
|
+
onOpenServicePopup?: (url: string) => void;
|
|
7
|
+
small?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const SearchField: React.FC<SearchFieldProps>;
|
|
9
10
|
export {};
|
|
@@ -3,7 +3,7 @@ export declare const isURL: (string: string) => boolean;
|
|
|
3
3
|
interface FieldButtonProps {
|
|
4
4
|
localSearchString: string;
|
|
5
5
|
onClickClear: () => void;
|
|
6
|
-
setPopupIsOpen
|
|
6
|
+
setPopupIsOpen?: (value: boolean) => void;
|
|
7
7
|
}
|
|
8
8
|
export declare const SearchFieldButton: React.FC<FieldButtonProps>;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek, NearestMinutes } from 'date-fns';
|
|
1
|
+
import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek, NearestMinutes, Locale } from 'date-fns';
|
|
2
2
|
export interface DateValues {
|
|
3
3
|
year?: number;
|
|
4
4
|
month?: number;
|
|
@@ -8,6 +8,7 @@ export interface DateValues {
|
|
|
8
8
|
seconds?: number;
|
|
9
9
|
milliseconds?: number;
|
|
10
10
|
}
|
|
11
|
+
export declare const getDateFnsLocale: (locale?: string) => Locale;
|
|
11
12
|
/**
|
|
12
13
|
* Parsing date strings with geoweb dateUtils:
|
|
13
14
|
*
|
|
@@ -107,7 +108,7 @@ export declare const setUTCDate: (inDate: Date | undefined) => Date | undefined;
|
|
|
107
108
|
* @example
|
|
108
109
|
* ``` dateToString(new Date(2022, 10, 12, 15, 30), 'dd MMM yyyy') ```
|
|
109
110
|
*/
|
|
110
|
-
export declare const dateToString: (inDate: Date | undefined, strFormat?: string, utc?: boolean) => string | undefined;
|
|
111
|
+
export declare const dateToString: (inDate: Date | undefined, strFormat?: string, utc?: boolean, locale?: string) => string | undefined;
|
|
111
112
|
/**
|
|
112
113
|
* Find out if a date is between two other dates.
|
|
113
114
|
*
|