@opengeoweb/shared 4.13.1 → 4.14.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 +1 -87
- package/index.umd.js +4 -76
- package/lib/hooks/index.d.ts +0 -1
- package/lib/utils/index.d.ts +0 -1
- package/package.json +2 -7
- package/lib/hooks/useDraftFormHelpers/useDraftFormHelpers.d.ts +0 -8
- package/lib/hooks/useDraftFormHelpers/useDraftFormHelpers.spec.d.ts +0 -1
- package/lib/utils/containerQueryHelper.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -2,8 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { useRef } from 'react';
|
|
3
3
|
import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, Grid, useTheme, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
|
|
4
4
|
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, Delete, VisibilityOff, Visibility, ChevronDown } from '@opengeoweb/theme';
|
|
5
|
-
import { useFormContext } from 'react-hook-form';
|
|
6
|
-
import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
|
|
7
5
|
import { throttle } from 'lodash';
|
|
8
6
|
import Draggable from 'react-draggable';
|
|
9
7
|
import { Resizable } from 're-resizable';
|
|
@@ -576,70 +574,6 @@ var useIsMounted = function useIsMounted() {
|
|
|
576
574
|
};
|
|
577
575
|
};
|
|
578
576
|
|
|
579
|
-
/* *
|
|
580
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
581
|
-
* you may not use this file except in compliance with the License.
|
|
582
|
-
* You may obtain a copy of the License at
|
|
583
|
-
*
|
|
584
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
585
|
-
*
|
|
586
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
587
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
588
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
589
|
-
* See the License for the specific language governing permissions and
|
|
590
|
-
* limitations under the License.
|
|
591
|
-
*
|
|
592
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
593
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
594
|
-
* */
|
|
595
|
-
|
|
596
|
-
var HIDDEN_INPUT_HELPER_IS_DRAFT = 'IS_DRAFT';
|
|
597
|
-
var useDraftFormHelpers = function useDraftFormHelpers() {
|
|
598
|
-
var isDefaultDraft = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
599
|
-
|
|
600
|
-
var _useFormContext = useFormContext(),
|
|
601
|
-
getValues = _useFormContext.getValues,
|
|
602
|
-
setValue = _useFormContext.setValue,
|
|
603
|
-
register = _useFormContext.register;
|
|
604
|
-
|
|
605
|
-
React.useEffect(function () {
|
|
606
|
-
setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDefaultDraft, {
|
|
607
|
-
shouldDirty: false
|
|
608
|
-
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
609
|
-
}, []);
|
|
610
|
-
|
|
611
|
-
var isDraft = function isDraft() {
|
|
612
|
-
return getValues(HIDDEN_INPUT_HELPER_IS_DRAFT) === true;
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
var isRequired = function isRequired(value) {
|
|
616
|
-
if (!isDraft() && isEmpty(value)) {
|
|
617
|
-
return errorMessages.required;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
return true;
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
var toggleIsDraft = function toggleIsDraft(isDraft) {
|
|
624
|
-
return setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDraft, {
|
|
625
|
-
shouldDirty: false
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
var DraftFieldHelper = function DraftFieldHelper() {
|
|
630
|
-
return /*#__PURE__*/React.createElement("input", Object.assign({}, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
|
|
631
|
-
type: "hidden"
|
|
632
|
-
}));
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
return {
|
|
636
|
-
isRequired: isRequired,
|
|
637
|
-
toggleIsDraft: toggleIsDraft,
|
|
638
|
-
isDraft: isDraft,
|
|
639
|
-
DraftFieldHelper: DraftFieldHelper
|
|
640
|
-
};
|
|
641
|
-
};
|
|
642
|
-
|
|
643
577
|
/* *
|
|
644
578
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
645
579
|
* you may not use this file except in compliance with the License.
|
|
@@ -3357,26 +3291,6 @@ var getWarningMessage = function getWarningMessage(error) {
|
|
|
3357
3291
|
return '';
|
|
3358
3292
|
};
|
|
3359
3293
|
|
|
3360
|
-
/* *
|
|
3361
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3362
|
-
* you may not use this file except in compliance with the License.
|
|
3363
|
-
* You may obtain a copy of the License at
|
|
3364
|
-
*
|
|
3365
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3366
|
-
*
|
|
3367
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3368
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3369
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3370
|
-
* See the License for the specific language governing permissions and
|
|
3371
|
-
* limitations under the License.
|
|
3372
|
-
*
|
|
3373
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3374
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3375
|
-
* */
|
|
3376
|
-
// TODO: https://gitlab.com/opengeoweb/geoweb-assets/-/issues/2350
|
|
3377
|
-
// temporary check until we get the unit test passing with container queries
|
|
3378
|
-
var IS_JEST = typeof jest !== 'undefined';
|
|
3379
|
-
|
|
3380
3294
|
/* *
|
|
3381
3295
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3382
3296
|
* you may not use this file except in compliance with the License.
|
|
@@ -3618,4 +3532,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3618
3532
|
createDate: createDate
|
|
3619
3533
|
});
|
|
3620
3534
|
|
|
3621
|
-
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary,
|
|
3535
|
+
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, ManagerButton, ManagerDeleteButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getPosition, getWarningMessage, isAxiosError, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
|
package/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.
|
|
5
|
-
})(this, (function (exports, React, material, theme,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('lodash'), require('react-draggable'), require('re-resizable'), require('react-redux'), require('date-fns')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', 'lodash', 'react-draggable', 're-resizable', 'react-redux', 'date-fns'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.lodash, global.Draggable, global.reResizable, global.reactRedux, global.dateFns));
|
|
5
|
+
})(this, (function (exports, React, material, theme, lodash, Draggable, reResizable, reactRedux, dateFns) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -459,55 +459,6 @@
|
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
461
|
|
|
462
|
-
var HIDDEN_INPUT_HELPER_IS_DRAFT = 'IS_DRAFT';
|
|
463
|
-
var useDraftFormHelpers = function useDraftFormHelpers(isDefaultDraft) {
|
|
464
|
-
if (isDefaultDraft === void 0) {
|
|
465
|
-
isDefaultDraft = false;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
var _a = reactHookForm.useFormContext(),
|
|
469
|
-
getValues = _a.getValues,
|
|
470
|
-
setValue = _a.setValue,
|
|
471
|
-
register = _a.register;
|
|
472
|
-
|
|
473
|
-
React__namespace.useEffect(function () {
|
|
474
|
-
setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDefaultDraft, {
|
|
475
|
-
shouldDirty: false
|
|
476
|
-
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
477
|
-
}, []);
|
|
478
|
-
|
|
479
|
-
var isDraft = function isDraft() {
|
|
480
|
-
return getValues(HIDDEN_INPUT_HELPER_IS_DRAFT) === true;
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
var isRequired = function isRequired(value) {
|
|
484
|
-
if (!isDraft() && formFields.isEmpty(value)) {
|
|
485
|
-
return formFields.errorMessages.required;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
return true;
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
var toggleIsDraft = function toggleIsDraft(isDraft) {
|
|
492
|
-
return setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDraft, {
|
|
493
|
-
shouldDirty: false
|
|
494
|
-
});
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
var DraftFieldHelper = function DraftFieldHelper() {
|
|
498
|
-
return /*#__PURE__*/React__namespace.createElement("input", __assign({}, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
|
|
499
|
-
type: "hidden"
|
|
500
|
-
}));
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
return {
|
|
504
|
-
isRequired: isRequired,
|
|
505
|
-
toggleIsDraft: toggleIsDraft,
|
|
506
|
-
isDraft: isDraft,
|
|
507
|
-
DraftFieldHelper: DraftFieldHelper
|
|
508
|
-
};
|
|
509
|
-
};
|
|
510
|
-
|
|
511
462
|
var adjustPosition = function adjustPosition(bbox, containingView, position, setPosition) {
|
|
512
463
|
var isHorizontallyLarger = bbox.width > containingView.width;
|
|
513
464
|
var isVerticallyLarger = bbox.height > containingView.height; // Check corner cases first
|
|
@@ -3226,26 +3177,6 @@
|
|
|
3226
3177
|
return '';
|
|
3227
3178
|
};
|
|
3228
3179
|
|
|
3229
|
-
/* *
|
|
3230
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3231
|
-
* you may not use this file except in compliance with the License.
|
|
3232
|
-
* You may obtain a copy of the License at
|
|
3233
|
-
*
|
|
3234
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3235
|
-
*
|
|
3236
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3237
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3238
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3239
|
-
* See the License for the specific language governing permissions and
|
|
3240
|
-
* limitations under the License.
|
|
3241
|
-
*
|
|
3242
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3243
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3244
|
-
* */
|
|
3245
|
-
// TODO: https://gitlab.com/opengeoweb/geoweb-assets/-/issues/2350
|
|
3246
|
-
// temporary check until we get the unit test passing with container queries
|
|
3247
|
-
var IS_JEST = typeof jest !== 'undefined';
|
|
3248
|
-
|
|
3249
3180
|
/* *
|
|
3250
3181
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3251
3182
|
* you may not use this file except in compliance with the License.
|
|
@@ -3527,8 +3458,6 @@
|
|
|
3527
3458
|
exports.Draggable = DraggableComponent$1;
|
|
3528
3459
|
exports.EnableButton = EnableButton;
|
|
3529
3460
|
exports.ErrorBoundary = ErrorBoundary;
|
|
3530
|
-
exports.HIDDEN_INPUT_HELPER_IS_DRAFT = HIDDEN_INPUT_HELPER_IS_DRAFT;
|
|
3531
|
-
exports.IS_JEST = IS_JEST;
|
|
3532
3461
|
exports.ManagerButton = ManagerButton;
|
|
3533
3462
|
exports.ManagerDeleteButton = ManagerDeleteButton;
|
|
3534
3463
|
exports.Resizable = ResizeComponent;
|
|
@@ -3560,7 +3489,6 @@
|
|
|
3560
3489
|
exports.useConfirmationDialog = useConfirmationDialog;
|
|
3561
3490
|
exports.useControlledTooltip = useControlledTooltip;
|
|
3562
3491
|
exports.useDialogActions = useDialogActions;
|
|
3563
|
-
exports.useDraftFormHelpers = useDraftFormHelpers;
|
|
3564
3492
|
exports.useIsMounted = useIsMounted;
|
|
3565
3493
|
exports.useMakeSureContainerStaysInsideWindow = useMakeSureContainerStaysInsideWindow;
|
|
3566
3494
|
exports.usePoller = usePoller;
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ export * from './usePreventBrowserClose/usePreventBrowserClose';
|
|
|
2
2
|
export * from './usePoller/usePoller';
|
|
3
3
|
export * from './usePrevious/usePrevious';
|
|
4
4
|
export * from './useIsMounted/useIsMounted';
|
|
5
|
-
export * from './useDraftFormHelpers/useDraftFormHelpers';
|
|
6
5
|
export * from './useMakeSureContainerStaysInsideWindow/useMakeSureContainerStaysInsideWindow';
|
package/lib/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.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": {
|
|
@@ -14,16 +14,11 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "^18.2.0",
|
|
16
16
|
"@mui/material": "^5.10.8",
|
|
17
|
-
"@opengeoweb/theme": "4.
|
|
17
|
+
"@opengeoweb/theme": "4.14.1",
|
|
18
18
|
"react-draggable": "^4.4.5",
|
|
19
19
|
"re-resizable": "^6.9.0",
|
|
20
20
|
"@redux-eggs/core": "^2.2.0",
|
|
21
21
|
"react-redux": "^8.0.4",
|
|
22
|
-
"@opengeoweb/form-fields": "4.13.1",
|
|
23
|
-
"react-hook-form": "^7.41.5",
|
|
24
|
-
"moment": "^2.29.0",
|
|
25
|
-
"moment-timezone": "^0.5.31",
|
|
26
|
-
"@mui/x-date-pickers": "^5.0.4",
|
|
27
22
|
"lodash": "^4.17.20",
|
|
28
23
|
"axios": "^0.25.0",
|
|
29
24
|
"date-fns": "^2.29.3"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const HIDDEN_INPUT_HELPER_IS_DRAFT = "IS_DRAFT";
|
|
3
|
-
export declare const useDraftFormHelpers: (isDefaultDraft?: boolean) => {
|
|
4
|
-
isRequired: (value: string) => boolean | string;
|
|
5
|
-
toggleIsDraft: (isDraft: boolean) => void;
|
|
6
|
-
isDraft: () => boolean;
|
|
7
|
-
DraftFieldHelper: () => React.ReactElement;
|
|
8
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const IS_JEST: boolean;
|