@opengeoweb/taf 4.13.0 → 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 CHANGED
@@ -6,8 +6,8 @@ import { useDispatch } from 'react-redux';
6
6
  import { ReactSortable } from 'react-sortablejs';
7
7
  import Sortable from 'sortablejs';
8
8
  import { useAuthenticationContext } from '@opengeoweb/authentication';
9
- import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
10
- import { HIDDEN_INPUT_HELPER_IS_DRAFT, useIsMounted, CustomTooltip, ToolContainerDraggable, Avatar, getInitials, ToggleMenu, useConfirmationDialog, useDraftFormHelpers, usePreventBrowserClose, ToolButton, ToolHeader, AlertBanner, getErrorMessage as getErrorMessage$1, getWarningMessage, ConfirmationServiceProvider, usePoller, ErrorBoundary } from '@opengeoweb/shared';
9
+ import { HIDDEN_INPUT_HELPER_IS_DRAFT, getDeepProperty, useDraftFormHelpers, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
10
+ import { useIsMounted, CustomTooltip, ToolContainerDraggable, Avatar, getInitials, ToggleMenu, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, AlertBanner, getErrorMessage as getErrorMessage$1, getWarningMessage, ConfirmationServiceProvider, usePoller, ErrorBoundary } from '@opengeoweb/shared';
11
11
  import { snackbarActions } from '@opengeoweb/core';
12
12
  import moment from 'moment';
13
13
  import { isEqual } from 'lodash';
@@ -543,9 +543,11 @@ var validateValidChangeGroupInterField = function validateValidChangeGroupInterF
543
543
  var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment);
544
544
  var endSections = getSections(startEnd[1], FORMAT_DAYS_HOURS);
545
545
  var endTimestamp = getValidityTimeStamp('end', endSections, tafStartMoment, tafEndMoment);
546
- var timeDifference = endTimestamp.diff(startTimestamp, 'hours');
546
+ var timeDifference = endTimestamp.diff(startTimestamp, 'hours', true);
547
547
 
548
- if (![1, 2, 3, 4].includes(timeDifference)) {
548
+ if ( // For non-amendments we only accept 1 to 4 hours
549
+ timeDifference >= 1 && ![1, 2, 3, 4].includes(Math.ceil(timeDifference)) || // For amendments the time difference can be below one hour, accept this unless the minute difference is zero
550
+ timeDifference < 1 && endTimestamp.diff(startTimestamp, 'minutes') === 0) {
549
551
  return invalidBECMGDurationValidInterFieldMessage;
550
552
  }
551
553
  }
@@ -1391,7 +1393,7 @@ var extractValidateWindSections = function extractValidateWindSections(value) {
1391
1393
  if (validation) {
1392
1394
  var valDirection = validateDirection(direction); // If validated not ok - add validation feedback
1393
1395
 
1394
- var validations = valDirection !== true ? obj.validations.concat(valDirection) : obj.validations;
1396
+ var validations = typeof valDirection === 'string' ? obj.validations.concat(valDirection) : obj.validations;
1395
1397
  return Object.assign(Object.assign({}, obj), {
1396
1398
  direction: direction,
1397
1399
  remainder: remainder,
@@ -1419,7 +1421,7 @@ var extractValidateWindSections = function extractValidateWindSections(value) {
1419
1421
  if (validation) {
1420
1422
  var valSpeed = validateSpeed(speed); // If validated not ok - add validation feedback
1421
1423
 
1422
- var _validations = valSpeed !== true ? obj.validations.concat(valSpeed) : obj.validations;
1424
+ var _validations = typeof valSpeed === 'string' ? obj.validations.concat(valSpeed) : obj.validations;
1423
1425
 
1424
1426
  return Object.assign(Object.assign({}, obj), {
1425
1427
  speed: speed,
@@ -1453,9 +1455,9 @@ var extractValidateWindSections = function extractValidateWindSections(value) {
1453
1455
  if (validation) {
1454
1456
  var valGust = validateGust(gust); // If validated not ok - add validation feedback
1455
1457
 
1456
- valGust !== true && returnObj.validations.push(valGust);
1458
+ typeof valGust === 'string' && returnObj.validations.push(valGust);
1457
1459
 
1458
- var _validations2 = valGust !== true ? obj.validations.concat(valGust) : obj.validations;
1460
+ var _validations2 = typeof valGust === 'string' ? obj.validations.concat(valGust) : obj.validations;
1459
1461
 
1460
1462
  return Object.assign(Object.assign({}, obj), {
1461
1463
  gust: gust,
@@ -1479,7 +1481,7 @@ var extractValidateWindSections = function extractValidateWindSections(value) {
1479
1481
  // Validate units
1480
1482
  var valUnits = validateUnit(returnObj.remainder);
1481
1483
 
1482
- var _validations3 = valUnits !== true ? obj.validations.concat(valUnits) : obj.validations;
1484
+ var _validations3 = typeof valUnits === 'string' ? obj.validations.concat(valUnits) : obj.validations;
1483
1485
 
1484
1486
  return Object.assign(Object.assign({}, obj), {
1485
1487
  validations: _validations3
@@ -2497,7 +2499,7 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
2497
2499
  var _useIsMounted = useIsMounted(),
2498
2500
  isMounted = _useIsMounted.isMounted;
2499
2501
 
2500
- var controller = React__default.useRef(null);
2502
+ var controller = React__default.useRef();
2501
2503
 
2502
2504
  var onSetTac = function onSetTac(newTAC) {
2503
2505
  if (controller.current) {
@@ -2540,7 +2542,7 @@ var useDragOrder = function useDragOrder(trigger, move) {
2540
2542
  var _React$useState3 = React__default.useState(null),
2541
2543
  _React$useState4 = _slicedToArray(_React$useState3, 2),
2542
2544
  activeDraggingIndex = _React$useState4[0],
2543
- setIsDragging = _React$useState4[1];
2545
+ setActiveDraggingIndex = _React$useState4[1];
2544
2546
 
2545
2547
  var _React$useState5 = React__default.useState([null, null]),
2546
2548
  _React$useState6 = _slicedToArray(_React$useState5, 2),
@@ -2553,12 +2555,12 @@ var useDragOrder = function useDragOrder(trigger, move) {
2553
2555
  if (oldIndex === undefined || newIndex === undefined) return;
2554
2556
  move(oldIndex, newIndex);
2555
2557
  onUpdatelastDragOrder([oldIndex, newIndex]);
2556
- setIsDragging(false);
2558
+ setActiveDraggingIndex(false);
2557
2559
  };
2558
2560
 
2559
2561
  var onStartDrag = function onStartDrag(_ref2) {
2560
2562
  var oldIndex = _ref2.oldIndex;
2561
- return setIsDragging(oldIndex);
2563
+ return setActiveDraggingIndex(oldIndex);
2562
2564
  }; // triggers validation AFTER render of new sorted elements
2563
2565
 
2564
2566
 
@@ -3125,6 +3127,7 @@ var IssuesPane = function IssuesPane(_ref) {
3125
3127
  isOpen: isOpen,
3126
3128
  "data-testid": "moveable-issues-pane",
3127
3129
  bounds: "parent",
3130
+ cancel: "",
3128
3131
  onDragEnd: function onDragEnd(event) {
3129
3132
  if (event.x !== 0 && event.y !== 0) {
3130
3133
  onUserHasDragged();
@@ -3180,7 +3183,7 @@ var useTafModuleState = function useTafModuleState(_ref) {
3180
3183
  onValidateForm = _React$useState2[0],
3181
3184
  registerValidateForm = _React$useState2[1];
3182
3185
 
3183
- var _React$useState3 = React.useState(),
3186
+ var _React$useState3 = React.useState(null),
3184
3187
  _React$useState4 = _slicedToArray(_React$useState3, 2),
3185
3188
  tafAction = _React$useState4[0],
3186
3189
  setTafAction = _React$useState4[1];
@@ -3260,18 +3263,46 @@ var TafAvatar = function TafAvatar(_ref) {
3260
3263
  }, getInitials(editor))));
3261
3264
  };
3262
3265
 
3266
+ /* *
3267
+ * Licensed under the Apache License, Version 2.0 (the "License");
3268
+ * you may not use this file except in compliance with the License.
3269
+ * You may obtain a copy of the License at
3270
+ *
3271
+ * http://www.apache.org/licenses/LICENSE-2.0
3272
+ *
3273
+ * Unless required by applicable law or agreed to in writing, software
3274
+ * distributed under the License is distributed on an "AS IS" BASIS,
3275
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3276
+ * See the License for the specific language governing permissions and
3277
+ * limitations under the License.
3278
+ *
3279
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3280
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
3281
+ * */
3282
+ var TAF_MODULE_ID = 'tafmodule';
3283
+ var ResponsiveWrapper = function ResponsiveWrapper(_ref) {
3284
+ var children = _ref.children;
3285
+ return /*#__PURE__*/React.createElement(Box, {
3286
+ sx: {
3287
+ containerType: 'inline-size',
3288
+ containerName: TAF_MODULE_ID,
3289
+ height: '100%'
3290
+ }
3291
+ }, children);
3292
+ };
3293
+
3263
3294
  var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
3264
- return {
3295
+ var _ref;
3296
+
3297
+ return _ref = {
3265
3298
  // input
3266
- marginRight: '2px',
3267
3299
  marginBottom: '4px',
3268
- width: 56,
3300
+ width: '100%',
3269
3301
  height: 46,
3270
3302
  input: {
3271
3303
  textAlign: 'center',
3272
3304
  textTransform: shouldPreventUppercase ? 'none' : 'uppercase',
3273
- fontSize: 10,
3274
- fontWeight: 500,
3305
+ fontWeight: 'normal',
3275
3306
  paddingLeft: 0,
3276
3307
  paddingRight: 0,
3277
3308
  '&.Mui-disabled': {
@@ -3310,8 +3341,18 @@ var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
3310
3341
  '.Mui-disabled:before': {
3311
3342
  borderColor: 'transparent'
3312
3343
  }
3344
+ },
3345
+ '& .MuiFilledInput-root': {
3346
+ borderTopLeftRadius: '0px',
3347
+ borderTopRightRadius: '0px'
3313
3348
  }
3314
- };
3349
+ }, _defineProperty(_ref, "@container ".concat(TAF_MODULE_ID, " (min-width: 1440px)"), {
3350
+ '&.MuiFormControl-root.MuiTextField-root .inputText': {
3351
+ fontSize: 14
3352
+ }
3353
+ }), _defineProperty(_ref, '.inputText', {
3354
+ fontSize: 12
3355
+ }), _ref;
3315
3356
  };
3316
3357
 
3317
3358
  var getTafErrors = function getTafErrors(name, errors) {
@@ -3350,27 +3391,27 @@ var BaseTextField = /*#__PURE__*/React__default.memo(function (_a) {
3350
3391
  return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name && prevProps.disabled === nextProps.disabled;
3351
3392
  });
3352
3393
 
3353
- var TafFormTextField = function TafFormTextField(_ref) {
3354
- var label = _ref.label,
3355
- _ref$disabled = _ref.disabled,
3356
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
3357
- _ref$name = _ref.name,
3358
- name = _ref$name === void 0 ? '' : _ref$name,
3359
- _ref$onChange = _ref.onChange,
3360
- onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
3361
- _ref$onBlur = _ref.onBlur,
3362
- onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
3363
- _ref$defaultValue = _ref.defaultValue,
3364
- defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
3365
- _ref$formatter = _ref.formatter,
3366
- formatter = _ref$formatter === void 0 ? null : _ref$formatter,
3367
- rules = _ref.rules,
3368
- _ref$autoComplete = _ref.autoComplete,
3369
- autoComplete = _ref$autoComplete === void 0 ? [] : _ref$autoComplete,
3370
- _ref$autoFocus = _ref.autoFocus,
3371
- autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
3372
- _ref$shouldPreventUpp = _ref.shouldPreventUppercase,
3373
- shouldPreventUppercase = _ref$shouldPreventUpp === void 0 ? false : _ref$shouldPreventUpp;
3394
+ var TafFormTextField = function TafFormTextField(_ref2) {
3395
+ var label = _ref2.label,
3396
+ _ref2$disabled = _ref2.disabled,
3397
+ disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
3398
+ _ref2$name = _ref2.name,
3399
+ name = _ref2$name === void 0 ? '' : _ref2$name,
3400
+ _ref2$onChange = _ref2.onChange,
3401
+ onChange = _ref2$onChange === void 0 ? function () {} : _ref2$onChange,
3402
+ _ref2$onBlur = _ref2.onBlur,
3403
+ onBlur = _ref2$onBlur === void 0 ? function () {} : _ref2$onBlur,
3404
+ _ref2$defaultValue = _ref2.defaultValue,
3405
+ defaultValue = _ref2$defaultValue === void 0 ? '' : _ref2$defaultValue,
3406
+ _ref2$formatter = _ref2.formatter,
3407
+ formatter = _ref2$formatter === void 0 ? null : _ref2$formatter,
3408
+ rules = _ref2.rules,
3409
+ _ref2$autoComplete = _ref2.autoComplete,
3410
+ autoComplete = _ref2$autoComplete === void 0 ? [] : _ref2$autoComplete,
3411
+ _ref2$autoFocus = _ref2.autoFocus,
3412
+ autoFocus = _ref2$autoFocus === void 0 ? false : _ref2$autoFocus,
3413
+ _ref2$shouldPreventUp = _ref2.shouldPreventUppercase,
3414
+ shouldPreventUppercase = _ref2$shouldPreventUp === void 0 ? false : _ref2$shouldPreventUp;
3374
3415
 
3375
3416
  var _useFormContext = useFormContext(),
3376
3417
  control = _useFormContext.control,
@@ -3399,7 +3440,8 @@ var TafFormTextField = function TafFormTextField(_ref) {
3399
3440
 
3400
3441
  if (foundValue) {
3401
3442
  setValue(name, foundValue.value, {
3402
- shouldDirty: true
3443
+ shouldDirty: true,
3444
+ shouldValidate: true
3403
3445
  });
3404
3446
  setMaxLength(foundValue.value.length);
3405
3447
  event.preventDefault();
@@ -3435,9 +3477,15 @@ var TafFormTextField = function TafFormTextField(_ref) {
3435
3477
  onBlur();
3436
3478
  }, [onBlur, name, setValue, shouldPreventUppercase]);
3437
3479
  var hasError = !!fieldErrors;
3438
- return /*#__PURE__*/React__default.createElement(Controller, {
3439
- render: function render(_ref2) {
3440
- var field = _ref2.field;
3480
+ return /*#__PURE__*/React__default.createElement(Grid, {
3481
+ item: true,
3482
+ sx: {
3483
+ width: "".concat(100 / 13, "%"),
3484
+ minWidth: 60
3485
+ }
3486
+ }, /*#__PURE__*/React__default.createElement(Controller, {
3487
+ render: function render(_ref3) {
3488
+ var field = _ref3.field;
3441
3489
  var displayValue = formatter ? formatter(field.value) : getDisplayValue(field.value, disabled);
3442
3490
  return /*#__PURE__*/React__default.createElement(BaseTextField, {
3443
3491
  label: label,
@@ -3454,7 +3502,8 @@ var TafFormTextField = function TafFormTextField(_ref) {
3454
3502
  return onBlurField(event, field.onBlur);
3455
3503
  },
3456
3504
  inputProps: {
3457
- maxLength: maxLength
3505
+ maxLength: maxLength,
3506
+ className: 'inputText'
3458
3507
  },
3459
3508
  autoFocus: autoFocus,
3460
3509
  shouldPreventUppercase: shouldPreventUppercase
@@ -3464,7 +3513,7 @@ var TafFormTextField = function TafFormTextField(_ref) {
3464
3513
  control: control,
3465
3514
  defaultValue: defaultValue,
3466
3515
  rules: rules
3467
- });
3516
+ }));
3468
3517
  };
3469
3518
 
3470
3519
  /* *
@@ -3610,9 +3659,12 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
3610
3659
  field = _a$field === void 0 ? null : _a$field,
3611
3660
  _a$dragHandle = _a.dragHandle,
3612
3661
  dragHandle = _a$dragHandle === void 0 ? null : _a$dragHandle,
3613
- onAddChangeGroupBelow = _a.onAddChangeGroupBelow,
3614
- onAddChangeGroupAbove = _a.onAddChangeGroupAbove,
3615
- onClearRow = _a.onClearRow,
3662
+ _a$onAddChangeGroupBe = _a.onAddChangeGroupBelow,
3663
+ onAddChangeGroupBelow = _a$onAddChangeGroupBe === void 0 ? function () {} : _a$onAddChangeGroupBe,
3664
+ _a$onAddChangeGroupAb = _a.onAddChangeGroupAbove,
3665
+ onAddChangeGroupAbove = _a$onAddChangeGroupAb === void 0 ? function () {} : _a$onAddChangeGroupAb,
3666
+ _a$onClearRow = _a.onClearRow,
3667
+ onClearRow = _a$onClearRow === void 0 ? function () {} : _a$onClearRow,
3616
3668
  props = __rest(_a, ["isNotRequiredForAction", "isChangeGroup", "disabled", "index", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroupBelow", "onAddChangeGroupAbove", "onClearRow"]);
3617
3669
 
3618
3670
  var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[".concat(index, "]");
@@ -3741,6 +3793,14 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
3741
3793
  marginTop: '8px',
3742
3794
  backgroundColor: 'geowebColors.cards.cardContainer',
3743
3795
  position: 'relative',
3796
+ paddingLeft: {
3797
+ xs: '2px',
3798
+ lg: '10px'
3799
+ },
3800
+ paddingRight: {
3801
+ xs: '2px',
3802
+ lg: '10px'
3803
+ },
3744
3804
  '&.sortable-chosen': {
3745
3805
  boxShadow: 1
3746
3806
  },
@@ -3755,12 +3815,10 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
3755
3815
  }, props, {
3756
3816
  className: "formRow"
3757
3817
  }), /*#__PURE__*/React__default.createElement(Grid, {
3758
- columns: 24,
3759
3818
  item: true,
3760
3819
  container: true,
3761
3820
  justifyContent: "flex-end",
3762
- xs: 24,
3763
- sm: 23
3821
+ xs: true
3764
3822
  }, !isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TafFormTextField, {
3765
3823
  label: "Type",
3766
3824
  name: fieldNames.messageType,
@@ -3777,9 +3835,11 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
3777
3835
  shouldPreventUppercase: true
3778
3836
  })), isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
3779
3837
  sx: {
3780
- width: 56,
3781
- marginRight: '2px'
3782
- }
3838
+ marginRight: '2px',
3839
+ minWidth: 60
3840
+ },
3841
+ display: "flex",
3842
+ justifyContent: "center"
3783
3843
  }, !disabled && dragHandle), /*#__PURE__*/React__default.createElement(TafFormTextField, {
3784
3844
  label: "Prob",
3785
3845
  name: fieldNames.probability,
@@ -4023,18 +4083,17 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
4023
4083
  container: true,
4024
4084
  justifyContent: "flex-end",
4025
4085
  alignItems: "flex-end",
4026
- xs: 24,
4027
- sm: 1,
4028
4086
  sx: {
4029
- marginBottom: '16px'
4030
- },
4031
- columns: 24
4087
+ width: '3.5%',
4088
+ marginBottom: '14px',
4089
+ minWidth: 28
4090
+ }
4032
4091
  }, /*#__PURE__*/React__default.createElement(TafFormOptionsButton, {
4033
4092
  isChangeGroup: isChangeGroup,
4034
4093
  addChangeGroupBelow: addChangeGroupBelow,
4035
4094
  addChangeGroupAbove: addChangeGroupAbove,
4036
4095
  removeChangeGroup: function removeChangeGroup() {
4037
- return onRemoveChangeGroup(index);
4096
+ return onRemoveChangeGroup === null || onRemoveChangeGroup === void 0 ? void 0 : onRemoveChangeGroup(index);
4038
4097
  },
4039
4098
  clearRow: clearRow,
4040
4099
  index: index
@@ -4074,7 +4133,7 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
4074
4133
  } : _ref$fetchNewTafList,
4075
4134
  _ref$previousTaf = _ref.previousTaf,
4076
4135
  previousTaf = _ref$previousTaf === void 0 ? null : _ref$previousTaf;
4077
- var formRef = React__default.useRef();
4136
+ var formRef = React__default.useRef(null);
4078
4137
  var originalTaf = tafFromBackend.taf,
4079
4138
  editor = tafFromBackend.editor;
4080
4139
 
@@ -4093,8 +4152,10 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
4093
4152
  var _useTafModuleContext = useTafModuleContext(),
4094
4153
  registerValidateForm = _useTafModuleContext.registerValidateForm,
4095
4154
  tafAction = _useTafModuleContext.tafAction,
4096
- setTafAction = _useTafModuleContext.setTafAction,
4097
- onPreventCloseView = _useTafModuleContext.onPreventCloseView;
4155
+ _useTafModuleContext$ = _useTafModuleContext.setTafAction,
4156
+ setTafAction = _useTafModuleContext$ === void 0 ? function () {} : _useTafModuleContext$,
4157
+ _useTafModuleContext$2 = _useTafModuleContext.onPreventCloseView,
4158
+ onPreventCloseView = _useTafModuleContext$2 === void 0 ? function () {} : _useTafModuleContext$2;
4098
4159
 
4099
4160
  var _useFormContext = useFormContext(),
4100
4161
  control = _useFormContext.control,
@@ -4500,9 +4561,15 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
4500
4561
  });
4501
4562
  };
4502
4563
 
4503
- registerValidateForm(onValidateFormPromise); // set default taf action
4564
+ if (registerValidateForm) {
4565
+ registerValidateForm(onValidateFormPromise);
4566
+ } // set default taf action
4567
+
4568
+
4569
+ if (setTafAction) {
4570
+ setTafAction(fromStatusToAction(originalTaf.status));
4571
+ }
4504
4572
 
4505
- setTafAction(fromStatusToAction(originalTaf.status));
4506
4573
  return function () {
4507
4574
  resetFormValues({});
4508
4575
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -5103,7 +5170,7 @@ var TacContainer = function TacContainer(_ref) {
5103
5170
  marginBottom: '20px'
5104
5171
  },
5105
5172
  "data-location": location,
5106
- className: isActive ? 'active' : null
5173
+ className: isActive ? 'active' : undefined
5107
5174
  }, /*#__PURE__*/React__default.createElement(Box, {
5108
5175
  sx: {
5109
5176
  display: 'flex',
@@ -5270,7 +5337,12 @@ var TacOverview = function TacOverview(_ref) {
5270
5337
  }))), /*#__PURE__*/React__default.createElement(Box, {
5271
5338
  ref: scrollRef,
5272
5339
  sx: {
5273
- padding: '10px',
5340
+ padding: {
5341
+ xs: '12px',
5342
+ sm: '6px',
5343
+ md: '16px',
5344
+ lg: '24px'
5345
+ },
5274
5346
  maxHeight: '100%',
5275
5347
  overflow: 'auto'
5276
5348
  }
@@ -5608,7 +5680,7 @@ var usePostTafRequest = function usePostTafRequest(request) {
5608
5680
  isLoading = _React$useState2[0],
5609
5681
  setLoading = _React$useState2[1];
5610
5682
 
5611
- var _React$useState3 = React__default.useState(null),
5683
+ var _React$useState3 = React__default.useState(),
5612
5684
  _React$useState4 = _slicedToArray(_React$useState3, 2),
5613
5685
  error = _React$useState4[0],
5614
5686
  setError = _React$useState4[1];
@@ -6188,7 +6260,6 @@ var TafLayout = function TafLayout(_ref2) {
6188
6260
  }, /*#__PURE__*/React__default.createElement(Box, {
6189
6261
  sx: {
6190
6262
  minWidth: 320,
6191
- maxWidth: 1272,
6192
6263
  margin: 'auto',
6193
6264
  height: '100%',
6194
6265
  display: 'flex',
@@ -6397,7 +6468,7 @@ var TafModule = function TafModule() {
6397
6468
  }, []);
6398
6469
  usePoller([tafList, getTafListError], fetchNewTafList);
6399
6470
  var hasTafListError = getTafListError !== null;
6400
- return /*#__PURE__*/React.createElement(Box, {
6471
+ return /*#__PURE__*/React.createElement(ResponsiveWrapper, null, /*#__PURE__*/React.createElement(Box, {
6401
6472
  component: "div",
6402
6473
  id: "tafmodule",
6403
6474
  sx: {
@@ -6422,7 +6493,7 @@ var TafModule = function TafModule() {
6422
6493
  tafList: tafList,
6423
6494
  onUpdateTaf: onUpdateTaf,
6424
6495
  lastUpdateTime: lastUpdateTime
6425
- }));
6496
+ })));
6426
6497
  };
6427
6498
 
6428
6499
  var Wrapper = function Wrapper(props) {
package/index.umd.js CHANGED
@@ -537,9 +537,11 @@
537
537
  var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment);
538
538
  var endSections = getSections(startEnd[1], FORMAT_DAYS_HOURS);
539
539
  var endTimestamp = getValidityTimeStamp('end', endSections, tafStartMoment, tafEndMoment);
540
- var timeDifference = endTimestamp.diff(startTimestamp, 'hours');
540
+ var timeDifference = endTimestamp.diff(startTimestamp, 'hours', true);
541
541
 
542
- if (![1, 2, 3, 4].includes(timeDifference)) {
542
+ if ( // For non-amendments we only accept 1 to 4 hours
543
+ timeDifference >= 1 && ![1, 2, 3, 4].includes(Math.ceil(timeDifference)) || // For amendments the time difference can be below one hour, accept this unless the minute difference is zero
544
+ timeDifference < 1 && endTimestamp.diff(startTimestamp, 'minutes') === 0) {
543
545
  return invalidBECMGDurationValidInterFieldMessage;
544
546
  }
545
547
  }
@@ -1397,7 +1399,7 @@
1397
1399
  if (validation) {
1398
1400
  var valDirection = validateDirection(direction); // If validated not ok - add validation feedback
1399
1401
 
1400
- var validations = valDirection !== true ? obj.validations.concat(valDirection) : obj.validations;
1402
+ var validations = typeof valDirection === 'string' ? obj.validations.concat(valDirection) : obj.validations;
1401
1403
  return __assign(__assign({}, obj), {
1402
1404
  direction: direction,
1403
1405
  remainder: remainder,
@@ -1423,7 +1425,7 @@
1423
1425
  if (validation) {
1424
1426
  var valSpeed = validateSpeed(speed); // If validated not ok - add validation feedback
1425
1427
 
1426
- var validations = valSpeed !== true ? obj.validations.concat(valSpeed) : obj.validations;
1428
+ var validations = typeof valSpeed === 'string' ? obj.validations.concat(valSpeed) : obj.validations;
1427
1429
  return __assign(__assign({}, obj), {
1428
1430
  speed: speed,
1429
1431
  remainder: remainder,
@@ -1453,8 +1455,8 @@
1453
1455
  if (validation) {
1454
1456
  var valGust = validateGust(gust); // If validated not ok - add validation feedback
1455
1457
 
1456
- valGust !== true && returnObj.validations.push(valGust);
1457
- var validations = valGust !== true ? obj.validations.concat(valGust) : obj.validations;
1458
+ typeof valGust === 'string' && returnObj.validations.push(valGust);
1459
+ var validations = typeof valGust === 'string' ? obj.validations.concat(valGust) : obj.validations;
1458
1460
  return __assign(__assign({}, obj), {
1459
1461
  gust: gust,
1460
1462
  remainder: remainder,
@@ -1476,7 +1478,7 @@
1476
1478
  if (obj.remainder.length) {
1477
1479
  // Validate units
1478
1480
  var valUnits = validateUnit(returnObj.remainder);
1479
- var validations = valUnits !== true ? obj.validations.concat(valUnits) : obj.validations;
1481
+ var validations = typeof valUnits === 'string' ? obj.validations.concat(valUnits) : obj.validations;
1480
1482
  return __assign(__assign({}, obj), {
1481
1483
  validations: validations
1482
1484
  });
@@ -2500,7 +2502,7 @@
2500
2502
  setTAC = _a[1];
2501
2503
 
2502
2504
  var isMounted = shared.useIsMounted().isMounted;
2503
- var controller = React__default["default"].useRef(null);
2505
+ var controller = React__default["default"].useRef();
2504
2506
 
2505
2507
  var onSetTac = function onSetTac(newTAC) {
2506
2508
  if (controller.current) {
@@ -2542,7 +2544,7 @@
2542
2544
  var useDragOrder = function useDragOrder(trigger, move) {
2543
2545
  var _a = __read(React__default["default"].useState(null), 2),
2544
2546
  activeDraggingIndex = _a[0],
2545
- setIsDragging = _a[1];
2547
+ setActiveDraggingIndex = _a[1];
2546
2548
 
2547
2549
  var _b = __read(React__default["default"].useState([null, null]), 2),
2548
2550
  lastDragOrder = _b[0],
@@ -2554,12 +2556,12 @@
2554
2556
  if (oldIndex === undefined || newIndex === undefined) return;
2555
2557
  move(oldIndex, newIndex);
2556
2558
  onUpdatelastDragOrder([oldIndex, newIndex]);
2557
- setIsDragging(false);
2559
+ setActiveDraggingIndex(false);
2558
2560
  };
2559
2561
 
2560
2562
  var onStartDrag = function onStartDrag(_a) {
2561
2563
  var oldIndex = _a.oldIndex;
2562
- return setIsDragging(oldIndex);
2564
+ return setActiveDraggingIndex(oldIndex);
2563
2565
  }; // triggers validation AFTER render of new sorted elements
2564
2566
 
2565
2567
 
@@ -2773,7 +2775,7 @@
2773
2775
  messageType: getMessageType(taf, tafAction),
2774
2776
  baseForecast: baseForecast,
2775
2777
  changeGroups: changeGroups
2776
- }, _a[shared.HIDDEN_INPUT_HELPER_IS_DRAFT] = true, _a));
2778
+ }, _a[formFields.HIDDEN_INPUT_HELPER_IS_DRAFT] = true, _a));
2777
2779
  };
2778
2780
  var clearTafFormData = function clearTafFormData(tafFormValues) {
2779
2781
  // Remove all except for the validity times
@@ -3134,6 +3136,7 @@
3134
3136
  isOpen: isOpen,
3135
3137
  "data-testid": "moveable-issues-pane",
3136
3138
  bounds: "parent",
3139
+ cancel: "",
3137
3140
  onDragEnd: function onDragEnd(event) {
3138
3141
  if (event.x !== 0 && event.y !== 0) {
3139
3142
  onUserHasDragged();
@@ -3204,7 +3207,7 @@
3204
3207
  onValidateForm = _b[0],
3205
3208
  registerValidateForm = _b[1];
3206
3209
 
3207
- var _c = __read(React__namespace.useState(), 2),
3210
+ var _c = __read(React__namespace.useState(null), 2),
3208
3211
  tafAction = _c[0],
3209
3212
  setTafAction = _c[1];
3210
3213
 
@@ -3267,18 +3270,46 @@
3267
3270
  }, shared.getInitials(editor))));
3268
3271
  };
3269
3272
 
3273
+ /* *
3274
+ * Licensed under the Apache License, Version 2.0 (the "License");
3275
+ * you may not use this file except in compliance with the License.
3276
+ * You may obtain a copy of the License at
3277
+ *
3278
+ * http://www.apache.org/licenses/LICENSE-2.0
3279
+ *
3280
+ * Unless required by applicable law or agreed to in writing, software
3281
+ * distributed under the License is distributed on an "AS IS" BASIS,
3282
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3283
+ * See the License for the specific language governing permissions and
3284
+ * limitations under the License.
3285
+ *
3286
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3287
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
3288
+ * */
3289
+ var TAF_MODULE_ID = 'tafmodule';
3290
+ var ResponsiveWrapper = function ResponsiveWrapper(_a) {
3291
+ var children = _a.children;
3292
+ return /*#__PURE__*/React__namespace.createElement(material.Box, {
3293
+ sx: {
3294
+ containerType: 'inline-size',
3295
+ containerName: TAF_MODULE_ID,
3296
+ height: '100%'
3297
+ }
3298
+ }, children);
3299
+ };
3300
+
3270
3301
  var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
3271
- return {
3302
+ var _a;
3303
+
3304
+ return _a = {
3272
3305
  // input
3273
- marginRight: '2px',
3274
3306
  marginBottom: '4px',
3275
- width: 56,
3307
+ width: '100%',
3276
3308
  height: 46,
3277
3309
  input: {
3278
3310
  textAlign: 'center',
3279
3311
  textTransform: shouldPreventUppercase ? 'none' : 'uppercase',
3280
- fontSize: 10,
3281
- fontWeight: 500,
3312
+ fontWeight: 'normal',
3282
3313
  paddingLeft: 0,
3283
3314
  paddingRight: 0,
3284
3315
  '&.Mui-disabled': {
@@ -3317,8 +3348,19 @@
3317
3348
  '.Mui-disabled:before': {
3318
3349
  borderColor: 'transparent'
3319
3350
  }
3351
+ },
3352
+ '& .MuiFilledInput-root': {
3353
+ borderTopLeftRadius: '0px',
3354
+ borderTopRightRadius: '0px'
3320
3355
  }
3321
- };
3356
+ }, // container queries
3357
+ _a["@container " + TAF_MODULE_ID + " (min-width: 1440px)"] = {
3358
+ '&.MuiFormControl-root.MuiTextField-root .inputText': {
3359
+ fontSize: 14
3360
+ }
3361
+ }, _a['.inputText'] = {
3362
+ fontSize: 12
3363
+ }, _a;
3322
3364
  };
3323
3365
 
3324
3366
  var getTafErrors = function getTafErrors(name, errors) {
@@ -3405,7 +3447,8 @@
3405
3447
 
3406
3448
  if (foundValue) {
3407
3449
  setValue(name, foundValue.value, {
3408
- shouldDirty: true
3450
+ shouldDirty: true,
3451
+ shouldValidate: true
3409
3452
  });
3410
3453
  setMaxLength(foundValue.value.length);
3411
3454
  event.preventDefault();
@@ -3441,7 +3484,13 @@
3441
3484
  onBlur();
3442
3485
  }, [onBlur, name, setValue, shouldPreventUppercase]);
3443
3486
  var hasError = !!fieldErrors;
3444
- return /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
3487
+ return /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3488
+ item: true,
3489
+ sx: {
3490
+ width: 100 / 13 + "%",
3491
+ minWidth: 60
3492
+ }
3493
+ }, /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
3445
3494
  render: function render(_a) {
3446
3495
  var field = _a.field;
3447
3496
  var displayValue = formatter ? formatter(field.value) : getDisplayValue(field.value, disabled);
@@ -3460,7 +3509,8 @@
3460
3509
  return onBlurField(event, field.onBlur);
3461
3510
  },
3462
3511
  inputProps: {
3463
- maxLength: maxLength
3512
+ maxLength: maxLength,
3513
+ className: 'inputText'
3464
3514
  },
3465
3515
  autoFocus: autoFocus,
3466
3516
  shouldPreventUppercase: shouldPreventUppercase
@@ -3470,7 +3520,7 @@
3470
3520
  control: control,
3471
3521
  defaultValue: defaultValue,
3472
3522
  rules: rules
3473
- });
3523
+ }));
3474
3524
  };
3475
3525
 
3476
3526
  /* *
@@ -3616,23 +3666,26 @@
3616
3666
  field = _e === void 0 ? null : _e,
3617
3667
  _f = _a.dragHandle,
3618
3668
  dragHandle = _f === void 0 ? null : _f,
3619
- onAddChangeGroupBelow = _a.onAddChangeGroupBelow,
3620
- onAddChangeGroupAbove = _a.onAddChangeGroupAbove,
3621
- onClearRow = _a.onClearRow,
3669
+ _g = _a.onAddChangeGroupBelow,
3670
+ onAddChangeGroupBelow = _g === void 0 ? function () {} : _g,
3671
+ _h = _a.onAddChangeGroupAbove,
3672
+ onAddChangeGroupAbove = _h === void 0 ? function () {} : _h,
3673
+ _j = _a.onClearRow,
3674
+ onClearRow = _j === void 0 ? function () {} : _j,
3622
3675
  props = __rest(_a, ["isNotRequiredForAction", "isChangeGroup", "disabled", "index", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroupBelow", "onAddChangeGroupAbove", "onClearRow"]);
3623
3676
 
3624
3677
  var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[" + index + "]";
3625
3678
  var fieldNames = getFieldNames(isChangeGroup, index);
3626
3679
 
3627
- var _g = reactHookForm.useFormContext(),
3628
- getValues = _g.getValues,
3629
- trigger = _g.trigger; // cross-field required validation
3680
+ var _k = reactHookForm.useFormContext(),
3681
+ getValues = _k.getValues,
3682
+ trigger = _k.trigger; // cross-field required validation
3630
3683
 
3631
3684
 
3632
- var _h = __read(getRequiredCrossFields(fieldNames), 3),
3633
- mainFields = _h[0],
3634
- mainOptionalFields = _h[1],
3635
- subFields = _h[2];
3685
+ var _l = __read(getRequiredCrossFields(fieldNames), 3),
3686
+ mainFields = _l[0],
3687
+ mainOptionalFields = _l[1],
3688
+ subFields = _l[2];
3636
3689
 
3637
3690
  var hasFieldsValue = function hasFieldsValue(fields) {
3638
3691
  return fields.map(getValues).find(function (field) {
@@ -3744,6 +3797,14 @@
3744
3797
  marginTop: '8px',
3745
3798
  backgroundColor: 'geowebColors.cards.cardContainer',
3746
3799
  position: 'relative',
3800
+ paddingLeft: {
3801
+ xs: '2px',
3802
+ lg: '10px'
3803
+ },
3804
+ paddingRight: {
3805
+ xs: '2px',
3806
+ lg: '10px'
3807
+ },
3747
3808
  '&.sortable-chosen': {
3748
3809
  boxShadow: 1
3749
3810
  },
@@ -3758,12 +3819,10 @@
3758
3819
  }, props, {
3759
3820
  className: "formRow"
3760
3821
  }), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
3761
- columns: 24,
3762
3822
  item: true,
3763
3823
  container: true,
3764
3824
  justifyContent: "flex-end",
3765
- xs: 24,
3766
- sm: 23
3825
+ xs: true
3767
3826
  }, !isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
3768
3827
  label: "Type",
3769
3828
  name: fieldNames.messageType,
@@ -3780,9 +3839,11 @@
3780
3839
  shouldPreventUppercase: true
3781
3840
  })), isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Box, {
3782
3841
  sx: {
3783
- width: 56,
3784
- marginRight: '2px'
3785
- }
3842
+ marginRight: '2px',
3843
+ minWidth: 60
3844
+ },
3845
+ display: "flex",
3846
+ justifyContent: "center"
3786
3847
  }, !disabled && dragHandle), /*#__PURE__*/React__default["default"].createElement(TafFormTextField, {
3787
3848
  label: "Prob",
3788
3849
  name: fieldNames.probability,
@@ -4026,18 +4087,17 @@
4026
4087
  container: true,
4027
4088
  justifyContent: "flex-end",
4028
4089
  alignItems: "flex-end",
4029
- xs: 24,
4030
- sm: 1,
4031
4090
  sx: {
4032
- marginBottom: '16px'
4033
- },
4034
- columns: 24
4091
+ width: '3.5%',
4092
+ marginBottom: '14px',
4093
+ minWidth: 28
4094
+ }
4035
4095
  }, /*#__PURE__*/React__default["default"].createElement(TafFormOptionsButton, {
4036
4096
  isChangeGroup: isChangeGroup,
4037
4097
  addChangeGroupBelow: addChangeGroupBelow,
4038
4098
  addChangeGroupAbove: addChangeGroupAbove,
4039
4099
  removeChangeGroup: function removeChangeGroup() {
4040
- return onRemoveChangeGroup(index);
4100
+ return onRemoveChangeGroup === null || onRemoveChangeGroup === void 0 ? void 0 : onRemoveChangeGroup(index);
4041
4101
  },
4042
4102
  clearRow: clearRow,
4043
4103
  index: index
@@ -4077,7 +4137,7 @@
4077
4137
  } : _h,
4078
4138
  _j = _a.previousTaf,
4079
4139
  previousTaf = _j === void 0 ? null : _j;
4080
- var formRef = React__default["default"].useRef();
4140
+ var formRef = React__default["default"].useRef(null);
4081
4141
  var originalTaf = tafFromBackend.taf,
4082
4142
  editor = tafFromBackend.editor;
4083
4143
  var auth = authentication.useAuthenticationContext().auth;
@@ -4086,41 +4146,43 @@
4086
4146
  var isDefaultDisabled = getIsFormDefaultDisabled(originalTaf.status);
4087
4147
  var confirmDialog = shared.useConfirmationDialog();
4088
4148
 
4089
- var _k = shared.useDraftFormHelpers(),
4149
+ var _k = formFields.useDraftFormHelpers(),
4090
4150
  toggleIsDraft = _k.toggleIsDraft,
4091
4151
  isNotRequiredForAction = _k.isRequired;
4092
4152
 
4093
4153
  var _l = useTafModuleContext(),
4094
4154
  registerValidateForm = _l.registerValidateForm,
4095
4155
  tafAction = _l.tafAction,
4096
- setTafAction = _l.setTafAction,
4097
- onPreventCloseView = _l.onPreventCloseView;
4098
-
4099
- var _m = reactHookForm.useFormContext(),
4100
- control = _m.control,
4101
- handleSubmit = _m.handleSubmit,
4102
- trigger = _m.trigger,
4103
- formState = _m.formState,
4104
- getValues = _m.getValues,
4105
- setValue = _m.setValue,
4106
- resetField = _m.resetField; // added this ignore as the build is failing otherwise on: Type instantiation is excessively deep and possibly infinite.
4156
+ _m = _l.setTafAction,
4157
+ setTafAction = _m === void 0 ? function () {} : _m,
4158
+ _o = _l.onPreventCloseView,
4159
+ onPreventCloseView = _o === void 0 ? function () {} : _o;
4160
+
4161
+ var _p = reactHookForm.useFormContext(),
4162
+ control = _p.control,
4163
+ handleSubmit = _p.handleSubmit,
4164
+ trigger = _p.trigger,
4165
+ formState = _p.formState,
4166
+ getValues = _p.getValues,
4167
+ setValue = _p.setValue,
4168
+ resetField = _p.resetField; // added this ignore as the build is failing otherwise on: Type instantiation is excessively deep and possibly infinite.
4107
4169
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4108
4170
  // @ts-ignore
4109
4171
 
4110
4172
 
4111
- var _o = reactHookForm.useFieldArray({
4173
+ var _q = reactHookForm.useFieldArray({
4112
4174
  control: control,
4113
4175
  name: 'changeGroups'
4114
4176
  }),
4115
- fields = _o.fields,
4116
- insert = _o.insert,
4117
- remove = _o.remove,
4118
- move = _o.move;
4177
+ fields = _q.fields,
4178
+ insert = _q.insert,
4179
+ remove = _q.remove,
4180
+ move = _q.move;
4119
4181
 
4120
- var _p = useDragOrder(trigger, move),
4121
- onChangeOrder = _p.onChangeOrder,
4122
- onStartDrag = _p.onStartDrag,
4123
- activeDraggingIndex = _p.activeDraggingIndex;
4182
+ var _r = useDragOrder(trigger, move),
4183
+ onChangeOrder = _r.onChangeOrder,
4184
+ onStartDrag = _r.onStartDrag,
4185
+ activeDraggingIndex = _r.activeDraggingIndex;
4124
4186
 
4125
4187
  var dirtyFields = formState.dirtyFields,
4126
4188
  errors = formState.errors;
@@ -4130,7 +4192,7 @@
4130
4192
  React__default["default"].useEffect(function () {
4131
4193
  onPreventCloseView(isFormDirty$1); // eslint-disable-next-line react-hooks/exhaustive-deps
4132
4194
  }, [isFormDirty$1]);
4133
- var hiddenInputFields = ['baseTime', 'issueDate', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd', shared.HIDDEN_INPUT_HELPER_IS_DRAFT];
4195
+ var hiddenInputFields = ['baseTime', 'issueDate', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd', formFields.HIDDEN_INPUT_HELPER_IS_DRAFT];
4134
4196
 
4135
4197
  var onSubmit = function onSubmit(data) {
4136
4198
  // eslint-disable-next-line no-console
@@ -4494,9 +4556,9 @@
4494
4556
  });
4495
4557
  };
4496
4558
 
4497
- var _q = __read(React__default["default"].useState(false), 2),
4498
- shouldValidate = _q[0],
4499
- setShouldValidate = _q[1];
4559
+ var _s = __read(React__default["default"].useState(false), 2),
4560
+ shouldValidate = _s[0],
4561
+ setShouldValidate = _s[1];
4500
4562
 
4501
4563
  React__default["default"].useEffect(function () {
4502
4564
  setIsDisabled(!isEditor || isDefaultDisabled); // set validate flag to validate after the values have been set
@@ -4518,9 +4580,15 @@
4518
4580
  });
4519
4581
  };
4520
4582
 
4521
- registerValidateForm(onValidateFormPromise); // set default taf action
4583
+ if (registerValidateForm) {
4584
+ registerValidateForm(onValidateFormPromise);
4585
+ } // set default taf action
4586
+
4587
+
4588
+ if (setTafAction) {
4589
+ setTafAction(fromStatusToAction(originalTaf.status));
4590
+ }
4522
4591
 
4523
- setTafAction(fromStatusToAction(originalTaf.status));
4524
4592
  return function () {
4525
4593
  resetFormValues({});
4526
4594
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -5128,7 +5196,7 @@
5128
5196
  marginBottom: '20px'
5129
5197
  },
5130
5198
  "data-location": location,
5131
- className: isActive ? 'active' : null
5199
+ className: isActive ? 'active' : undefined
5132
5200
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
5133
5201
  sx: {
5134
5202
  display: 'flex',
@@ -5294,7 +5362,12 @@
5294
5362
  }))), /*#__PURE__*/React__default["default"].createElement(material.Box, {
5295
5363
  ref: scrollRef,
5296
5364
  sx: {
5297
- padding: '10px',
5365
+ padding: {
5366
+ xs: '12px',
5367
+ sm: '6px',
5368
+ md: '16px',
5369
+ lg: '24px'
5370
+ },
5298
5371
  maxHeight: '100%',
5299
5372
  overflow: 'auto'
5300
5373
  }
@@ -5592,7 +5665,7 @@
5592
5665
  isLoading = _a[0],
5593
5666
  setLoading = _a[1];
5594
5667
 
5595
- var _b = __read(React__default["default"].useState(null), 2),
5668
+ var _b = __read(React__default["default"].useState(), 2),
5596
5669
  error = _b[0],
5597
5670
  setError = _b[1];
5598
5671
 
@@ -6215,7 +6288,6 @@
6215
6288
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
6216
6289
  sx: {
6217
6290
  minWidth: 320,
6218
- maxWidth: 1272,
6219
6291
  margin: 'auto',
6220
6292
  height: '100%',
6221
6293
  display: 'flex',
@@ -6419,7 +6491,7 @@
6419
6491
  }, []);
6420
6492
  shared.usePoller([tafList, getTafListError], fetchNewTafList);
6421
6493
  var hasTafListError = getTafListError !== null;
6422
- return /*#__PURE__*/React__namespace.createElement(material.Box, {
6494
+ return /*#__PURE__*/React__namespace.createElement(ResponsiveWrapper, null, /*#__PURE__*/React__namespace.createElement(material.Box, {
6423
6495
  component: "div",
6424
6496
  id: "tafmodule",
6425
6497
  sx: {
@@ -6444,7 +6516,7 @@
6444
6516
  tafList: tafList,
6445
6517
  onUpdateTaf: onUpdateTaf,
6446
6518
  lastUpdateTime: lastUpdateTime
6447
- }));
6519
+ })));
6448
6520
  };
6449
6521
 
6450
6522
  var Wrapper = function Wrapper(props) {
@@ -7578,6 +7650,7 @@
7578
7650
  };
7579
7651
  var componentsLookUp = function componentsLookUp(payload, _a, // TODO: find a good way to type this module without the apps complaining
7580
7652
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
7653
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7581
7654
  ConnectedModuleWrapper) {
7582
7655
  var config = _a.config,
7583
7656
  auth = _a.auth,
@@ -13,7 +13,7 @@ export declare const tafScreenPreset: {
13
13
  };
14
14
  allIds: string[];
15
15
  };
16
- syncGroups: any[];
16
+ syncGroups: never[];
17
17
  mosaicNode: string;
18
18
  };
19
19
  declare type TafComponentType = 'TafModule';
@@ -23,7 +23,7 @@ export interface ComponentsLookUpPayload {
23
23
  title?: string;
24
24
  initialProps: Record<string, never>;
25
25
  }
26
- interface ApiModuleProps extends ApiModule {
26
+ export interface ApiModuleProps extends ApiModule {
27
27
  config: ApiUrls;
28
28
  onPreventCloseView?: (shouldPreventClose: boolean) => void;
29
29
  }
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { BoxProps } from '@mui/material';
3
+ export declare const TAF_MODULE_ID = "tafmodule";
4
+ export declare const ResponsiveWrapper: React.FC<BoxProps>;
@@ -0,0 +1 @@
1
+ export {};
@@ -31,14 +31,14 @@ export declare const TAC_NOT_AVAILABLE = "No TAC available";
31
31
  export declare const TAC_RETRIEVING_DATA = "Retrieving TAC";
32
32
  export declare const TAC_FAILED = "Failed to retrieve TAC";
33
33
  export declare const tacHasError: (tac: TAC) => boolean;
34
- export declare const useTACGenerator: (taf: Taf, requestTAC: (postTaf: Taf, getJSON?: boolean, abortSignal?: AbortSignal) => Promise<{
34
+ export declare const useTACGenerator: (taf: Taf, requestTAC: (postTaf: Taf, getJSON?: boolean | undefined, abortSignal?: AbortSignal | undefined) => Promise<{
35
35
  data: TAC;
36
36
  }>, getJSON?: boolean) => [TAC, (tafToPost: Taf) => void, (newTAC: TAC) => void];
37
37
  export declare type SortableField = {
38
38
  id: string;
39
39
  chosen: boolean;
40
40
  };
41
- export declare const useDragOrder: (trigger: (name?: string | string[]) => Promise<boolean>, move: (oldIndex: number, newIndex: number) => void) => {
41
+ export declare const useDragOrder: (trigger: (name?: string | string[] | undefined) => Promise<boolean>, move: (oldIndex: number, newIndex: number) => void) => {
42
42
  onChangeOrder: (event: Sortable.SortableEvent) => void;
43
43
  onStartDrag: (event: Sortable.SortableEvent) => void;
44
44
  activeDraggingIndex: number;
@@ -65,7 +65,7 @@ export declare const emptyChangegroup: {
65
65
  change: string;
66
66
  probability: string;
67
67
  };
68
- export declare const getTafStatusLabel: (status: TafStatus, action?: TafActions, isFormDisabled?: boolean) => string;
68
+ export declare const getTafStatusLabel: (status: TafStatus, action?: TafActions | undefined, isFormDisabled?: boolean | undefined) => string;
69
69
  export declare const getMessageType: (taf: Taf, tafAction: TafActions) => string;
70
70
  export declare const getAmendedCorrectedTafTimes: (taf: Taf, tafAction: TafActions) => Taf;
71
71
  export declare const createChangeGroup: (changeGroup: ChangeGroupFormData) => ChangeGroupFormData;
@@ -13,3 +13,7 @@ export declare const TafLayoutDarkSnap: {
13
13
  (): React.ReactElement;
14
14
  storyName: string;
15
15
  };
16
+ export declare const TafLayoutSmallSnap: {
17
+ (): React.ReactElement;
18
+ storyName: string;
19
+ };
@@ -28,8 +28,8 @@ interface TafPanelProps {
28
28
  export declare const isWarning: (error: TafError) => boolean;
29
29
  export declare const usePostTafRequest: (request: (params?: unknown) => Promise<void>, errorParser?: (error: AxiosError | Error, params: TafFromFrontEnd) => TafError) => {
30
30
  isLoading: boolean;
31
- error: TafError;
32
- setError: (newError: AxiosError) => void;
31
+ error: TafError | undefined;
32
+ setError: (newError: TafError) => void;
33
33
  doRequest: (params?: unknown) => Promise<void>;
34
34
  };
35
35
  declare const TafPanel: React.FC<TafPanelProps>;
@@ -8,11 +8,12 @@ export declare const getBaseTime: (baseTime: string, location: string) => {
8
8
  nextBaseTime: Moment;
9
9
  };
10
10
  export declare const getTafTimeSlot: (baseTime: string, location: string, status: TafStatus) => TimeSlot;
11
- export declare const sortTafTimeSlots: (tafList: TafFromBackend[]) => {
11
+ declare type TafTimeSlots = {
12
12
  current: TafFromBackend[];
13
13
  upcoming: TafFromBackend[];
14
14
  expired: TafFromBackend[];
15
15
  };
16
+ export declare const sortTafTimeSlots: (tafList: TafFromBackend[]) => TafTimeSlots;
16
17
  export declare const muiTabA11yProps: (index: number) => {
17
18
  id: string;
18
19
  'aria-controls': string;
@@ -20,3 +21,4 @@ export declare const muiTabA11yProps: (index: number) => {
20
21
  export declare const prepareTafExportValues: (tafToCopy: Taf, currentTaf: TafFormData) => TafFormData;
21
22
  export declare const getNewTafLocationIndex: (tafLocations: TafFromBackend[], previousTafLocationUUID: string) => number;
22
23
  export declare const getPreviousTaf: (tafList: TafFromBackend[], currentTaf: TafFromBackend) => Taf;
24
+ export {};
@@ -11,13 +11,7 @@ interface TafModuleContextState {
11
11
  setTafAction: (action: TafActions) => void;
12
12
  onPreventCloseView: (shouldPreventClose: boolean) => void;
13
13
  }
14
- declare const TafModuleContext: React.Context<{
15
- onValidateForm: any;
16
- registerValidateForm: any;
17
- tafAction: any;
18
- setTafAction: any;
19
- onPreventCloseView: any;
20
- }>;
14
+ declare const TafModuleContext: React.Context<TafModuleContextState>;
21
15
  export declare const useTafModuleContext: () => Partial<TafModuleContextState>;
22
16
  export declare const useTafModuleState: ({ onPreventCloseView, }: TafModuleMethods) => TafModuleContextState;
23
17
  export interface TafModuleProviderProps extends TafModuleMethods {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/taf",
3
- "version": "4.13.0",
3
+ "version": "4.14.1",
4
4
  "description": "GeoWeb TAF library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -12,25 +12,21 @@
12
12
  "typings": "./index.d.ts",
13
13
  "dependencies": {},
14
14
  "peerDependencies": {
15
- "@opengeoweb/api": "4.13.0",
15
+ "@opengeoweb/api": "4.14.1",
16
16
  "react": "^18.2.0",
17
17
  "axios": "^0.25.0",
18
- "@opengeoweb/shared": "4.13.0",
18
+ "@opengeoweb/shared": "4.14.1",
19
19
  "@mui/material": "^5.10.8",
20
- "@opengeoweb/theme": "4.13.0",
20
+ "@opengeoweb/theme": "4.14.1",
21
21
  "react-draggable": "^4.4.5",
22
22
  "re-resizable": "^6.9.0",
23
23
  "@redux-eggs/core": "^2.2.0",
24
24
  "react-redux": "^8.0.4",
25
- "@opengeoweb/form-fields": "4.13.0",
26
- "react-hook-form": "^7.41.5",
27
- "moment": "^2.29.0",
28
- "moment-timezone": "^0.5.31",
29
- "@mui/x-date-pickers": "^5.0.4",
30
25
  "lodash": "^4.17.20",
31
26
  "date-fns": "^2.29.3",
32
- "@opengeoweb/core": "4.13.0",
33
- "@opengeoweb/webmap": "4.13.0",
27
+ "@opengeoweb/core": "4.14.1",
28
+ "moment": "^2.29.0",
29
+ "@opengeoweb/webmap": "4.14.1",
34
30
  "throttle-debounce": "^3.0.1",
35
31
  "proj4": "^2.6.2",
36
32
  "react-intl": "^5.17.5",
@@ -38,6 +34,10 @@
38
34
  "sortablejs": "^1.15.0",
39
35
  "immer": "^9.0.15",
40
36
  "react-window": "^1.8.7",
37
+ "@opengeoweb/form-fields": "4.14.1",
38
+ "react-hook-form": "^7.41.5",
39
+ "moment-timezone": "^0.5.31",
40
+ "@mui/x-date-pickers": "^5.0.4",
41
41
  "@reduxjs/toolkit": "^1.8.3",
42
42
  "lodash.clonedeep": "^4.5.0",
43
43
  "@turf/turf": "^5.1.6",
@@ -46,7 +46,7 @@
46
46
  "@redux-eggs/redux-toolkit": "^2.2.0",
47
47
  "@redux-eggs/saga-extension": "^2.2.0",
48
48
  "react-dom": "^18.2.0",
49
- "@opengeoweb/authentication": "4.13.0",
49
+ "@opengeoweb/authentication": "4.14.1",
50
50
  "react-router-dom": "^6.4.2",
51
51
  "query-string": "^6.13.7",
52
52
  "@emotion/react": "^11.10.4"