@opengeoweb/taf 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 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, IS_JEST, 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
 
@@ -3181,7 +3183,7 @@ var useTafModuleState = function useTafModuleState(_ref) {
3181
3183
  onValidateForm = _React$useState2[0],
3182
3184
  registerValidateForm = _React$useState2[1];
3183
3185
 
3184
- var _React$useState3 = React.useState(),
3186
+ var _React$useState3 = React.useState(null),
3185
3187
  _React$useState4 = _slicedToArray(_React$useState3, 2),
3186
3188
  tafAction = _React$useState4[0],
3187
3189
  setTafAction = _React$useState4[1];
@@ -3283,13 +3285,16 @@ var ResponsiveWrapper = function ResponsiveWrapper(_ref) {
3283
3285
  return /*#__PURE__*/React.createElement(Box, {
3284
3286
  sx: {
3285
3287
  containerType: 'inline-size',
3286
- containerName: TAF_MODULE_ID
3288
+ containerName: TAF_MODULE_ID,
3289
+ height: '100%'
3287
3290
  }
3288
3291
  }, children);
3289
3292
  };
3290
3293
 
3291
3294
  var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
3292
- return Object.assign(Object.assign({
3295
+ var _ref;
3296
+
3297
+ return _ref = {
3293
3298
  // input
3294
3299
  marginBottom: '4px',
3295
3300
  width: '100%',
@@ -3341,15 +3346,13 @@ var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
3341
3346
  borderTopLeftRadius: '0px',
3342
3347
  borderTopRightRadius: '0px'
3343
3348
  }
3344
- }, !IS_JEST && _defineProperty({}, "@container ".concat(TAF_MODULE_ID, " (min-width: 1440px)"), {
3349
+ }, _defineProperty(_ref, "@container ".concat(TAF_MODULE_ID, " (min-width: 1440px)"), {
3345
3350
  '&.MuiFormControl-root.MuiTextField-root .inputText': {
3346
3351
  fontSize: 14
3347
3352
  }
3348
- })), {
3349
- '.inputText': {
3350
- fontSize: 12
3351
- }
3352
- });
3353
+ }), _defineProperty(_ref, '.inputText', {
3354
+ fontSize: 12
3355
+ }), _ref;
3353
3356
  };
3354
3357
 
3355
3358
  var getTafErrors = function getTafErrors(name, errors) {
@@ -3656,9 +3659,12 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
3656
3659
  field = _a$field === void 0 ? null : _a$field,
3657
3660
  _a$dragHandle = _a.dragHandle,
3658
3661
  dragHandle = _a$dragHandle === void 0 ? null : _a$dragHandle,
3659
- onAddChangeGroupBelow = _a.onAddChangeGroupBelow,
3660
- onAddChangeGroupAbove = _a.onAddChangeGroupAbove,
3661
- 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,
3662
3668
  props = __rest(_a, ["isNotRequiredForAction", "isChangeGroup", "disabled", "index", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroupBelow", "onAddChangeGroupAbove", "onClearRow"]);
3663
3669
 
3664
3670
  var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[".concat(index, "]");
@@ -4087,7 +4093,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
4087
4093
  addChangeGroupBelow: addChangeGroupBelow,
4088
4094
  addChangeGroupAbove: addChangeGroupAbove,
4089
4095
  removeChangeGroup: function removeChangeGroup() {
4090
- return onRemoveChangeGroup(index);
4096
+ return onRemoveChangeGroup === null || onRemoveChangeGroup === void 0 ? void 0 : onRemoveChangeGroup(index);
4091
4097
  },
4092
4098
  clearRow: clearRow,
4093
4099
  index: index
@@ -4127,7 +4133,7 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
4127
4133
  } : _ref$fetchNewTafList,
4128
4134
  _ref$previousTaf = _ref.previousTaf,
4129
4135
  previousTaf = _ref$previousTaf === void 0 ? null : _ref$previousTaf;
4130
- var formRef = React__default.useRef();
4136
+ var formRef = React__default.useRef(null);
4131
4137
  var originalTaf = tafFromBackend.taf,
4132
4138
  editor = tafFromBackend.editor;
4133
4139
 
@@ -4146,8 +4152,10 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
4146
4152
  var _useTafModuleContext = useTafModuleContext(),
4147
4153
  registerValidateForm = _useTafModuleContext.registerValidateForm,
4148
4154
  tafAction = _useTafModuleContext.tafAction,
4149
- setTafAction = _useTafModuleContext.setTafAction,
4150
- 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;
4151
4159
 
4152
4160
  var _useFormContext = useFormContext(),
4153
4161
  control = _useFormContext.control,
@@ -4553,9 +4561,15 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
4553
4561
  });
4554
4562
  };
4555
4563
 
4556
- 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
+ }
4557
4572
 
4558
- setTafAction(fromStatusToAction(originalTaf.status));
4559
4573
  return function () {
4560
4574
  resetFormValues({});
4561
4575
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -5156,7 +5170,7 @@ var TacContainer = function TacContainer(_ref) {
5156
5170
  marginBottom: '20px'
5157
5171
  },
5158
5172
  "data-location": location,
5159
- className: isActive ? 'active' : null
5173
+ className: isActive ? 'active' : undefined
5160
5174
  }, /*#__PURE__*/React__default.createElement(Box, {
5161
5175
  sx: {
5162
5176
  display: 'flex',
@@ -5666,7 +5680,7 @@ var usePostTafRequest = function usePostTafRequest(request) {
5666
5680
  isLoading = _React$useState2[0],
5667
5681
  setLoading = _React$useState2[1];
5668
5682
 
5669
- var _React$useState3 = React__default.useState(null),
5683
+ var _React$useState3 = React__default.useState(),
5670
5684
  _React$useState4 = _slicedToArray(_React$useState3, 2),
5671
5685
  error = _React$useState4[0],
5672
5686
  setError = _React$useState4[1];
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
@@ -3205,7 +3207,7 @@
3205
3207
  onValidateForm = _b[0],
3206
3208
  registerValidateForm = _b[1];
3207
3209
 
3208
- var _c = __read(React__namespace.useState(), 2),
3210
+ var _c = __read(React__namespace.useState(null), 2),
3209
3211
  tafAction = _c[0],
3210
3212
  setTafAction = _c[1];
3211
3213
 
@@ -3290,7 +3292,8 @@
3290
3292
  return /*#__PURE__*/React__namespace.createElement(material.Box, {
3291
3293
  sx: {
3292
3294
  containerType: 'inline-size',
3293
- containerName: TAF_MODULE_ID
3295
+ containerName: TAF_MODULE_ID,
3296
+ height: '100%'
3294
3297
  }
3295
3298
  }, children);
3296
3299
  };
@@ -3298,7 +3301,7 @@
3298
3301
  var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
3299
3302
  var _a;
3300
3303
 
3301
- return __assign(__assign({
3304
+ return _a = {
3302
3305
  // input
3303
3306
  marginBottom: '4px',
3304
3307
  width: '100%',
@@ -3350,16 +3353,14 @@
3350
3353
  borderTopLeftRadius: '0px',
3351
3354
  borderTopRightRadius: '0px'
3352
3355
  }
3353
- }, !shared.IS_JEST && (_a = {}, // container queries
3356
+ }, // container queries
3354
3357
  _a["@container " + TAF_MODULE_ID + " (min-width: 1440px)"] = {
3355
3358
  '&.MuiFormControl-root.MuiTextField-root .inputText': {
3356
3359
  fontSize: 14
3357
3360
  }
3358
- }, _a)), {
3359
- '.inputText': {
3360
- fontSize: 12
3361
- }
3362
- });
3361
+ }, _a['.inputText'] = {
3362
+ fontSize: 12
3363
+ }, _a;
3363
3364
  };
3364
3365
 
3365
3366
  var getTafErrors = function getTafErrors(name, errors) {
@@ -3665,23 +3666,26 @@
3665
3666
  field = _e === void 0 ? null : _e,
3666
3667
  _f = _a.dragHandle,
3667
3668
  dragHandle = _f === void 0 ? null : _f,
3668
- onAddChangeGroupBelow = _a.onAddChangeGroupBelow,
3669
- onAddChangeGroupAbove = _a.onAddChangeGroupAbove,
3670
- 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,
3671
3675
  props = __rest(_a, ["isNotRequiredForAction", "isChangeGroup", "disabled", "index", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroupBelow", "onAddChangeGroupAbove", "onClearRow"]);
3672
3676
 
3673
3677
  var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[" + index + "]";
3674
3678
  var fieldNames = getFieldNames(isChangeGroup, index);
3675
3679
 
3676
- var _g = reactHookForm.useFormContext(),
3677
- getValues = _g.getValues,
3678
- trigger = _g.trigger; // cross-field required validation
3680
+ var _k = reactHookForm.useFormContext(),
3681
+ getValues = _k.getValues,
3682
+ trigger = _k.trigger; // cross-field required validation
3679
3683
 
3680
3684
 
3681
- var _h = __read(getRequiredCrossFields(fieldNames), 3),
3682
- mainFields = _h[0],
3683
- mainOptionalFields = _h[1],
3684
- subFields = _h[2];
3685
+ var _l = __read(getRequiredCrossFields(fieldNames), 3),
3686
+ mainFields = _l[0],
3687
+ mainOptionalFields = _l[1],
3688
+ subFields = _l[2];
3685
3689
 
3686
3690
  var hasFieldsValue = function hasFieldsValue(fields) {
3687
3691
  return fields.map(getValues).find(function (field) {
@@ -4093,7 +4097,7 @@
4093
4097
  addChangeGroupBelow: addChangeGroupBelow,
4094
4098
  addChangeGroupAbove: addChangeGroupAbove,
4095
4099
  removeChangeGroup: function removeChangeGroup() {
4096
- return onRemoveChangeGroup(index);
4100
+ return onRemoveChangeGroup === null || onRemoveChangeGroup === void 0 ? void 0 : onRemoveChangeGroup(index);
4097
4101
  },
4098
4102
  clearRow: clearRow,
4099
4103
  index: index
@@ -4133,7 +4137,7 @@
4133
4137
  } : _h,
4134
4138
  _j = _a.previousTaf,
4135
4139
  previousTaf = _j === void 0 ? null : _j;
4136
- var formRef = React__default["default"].useRef();
4140
+ var formRef = React__default["default"].useRef(null);
4137
4141
  var originalTaf = tafFromBackend.taf,
4138
4142
  editor = tafFromBackend.editor;
4139
4143
  var auth = authentication.useAuthenticationContext().auth;
@@ -4142,41 +4146,43 @@
4142
4146
  var isDefaultDisabled = getIsFormDefaultDisabled(originalTaf.status);
4143
4147
  var confirmDialog = shared.useConfirmationDialog();
4144
4148
 
4145
- var _k = shared.useDraftFormHelpers(),
4149
+ var _k = formFields.useDraftFormHelpers(),
4146
4150
  toggleIsDraft = _k.toggleIsDraft,
4147
4151
  isNotRequiredForAction = _k.isRequired;
4148
4152
 
4149
4153
  var _l = useTafModuleContext(),
4150
4154
  registerValidateForm = _l.registerValidateForm,
4151
4155
  tafAction = _l.tafAction,
4152
- setTafAction = _l.setTafAction,
4153
- onPreventCloseView = _l.onPreventCloseView;
4154
-
4155
- var _m = reactHookForm.useFormContext(),
4156
- control = _m.control,
4157
- handleSubmit = _m.handleSubmit,
4158
- trigger = _m.trigger,
4159
- formState = _m.formState,
4160
- getValues = _m.getValues,
4161
- setValue = _m.setValue,
4162
- 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.
4163
4169
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4164
4170
  // @ts-ignore
4165
4171
 
4166
4172
 
4167
- var _o = reactHookForm.useFieldArray({
4173
+ var _q = reactHookForm.useFieldArray({
4168
4174
  control: control,
4169
4175
  name: 'changeGroups'
4170
4176
  }),
4171
- fields = _o.fields,
4172
- insert = _o.insert,
4173
- remove = _o.remove,
4174
- move = _o.move;
4177
+ fields = _q.fields,
4178
+ insert = _q.insert,
4179
+ remove = _q.remove,
4180
+ move = _q.move;
4175
4181
 
4176
- var _p = useDragOrder(trigger, move),
4177
- onChangeOrder = _p.onChangeOrder,
4178
- onStartDrag = _p.onStartDrag,
4179
- activeDraggingIndex = _p.activeDraggingIndex;
4182
+ var _r = useDragOrder(trigger, move),
4183
+ onChangeOrder = _r.onChangeOrder,
4184
+ onStartDrag = _r.onStartDrag,
4185
+ activeDraggingIndex = _r.activeDraggingIndex;
4180
4186
 
4181
4187
  var dirtyFields = formState.dirtyFields,
4182
4188
  errors = formState.errors;
@@ -4186,7 +4192,7 @@
4186
4192
  React__default["default"].useEffect(function () {
4187
4193
  onPreventCloseView(isFormDirty$1); // eslint-disable-next-line react-hooks/exhaustive-deps
4188
4194
  }, [isFormDirty$1]);
4189
- 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];
4190
4196
 
4191
4197
  var onSubmit = function onSubmit(data) {
4192
4198
  // eslint-disable-next-line no-console
@@ -4550,9 +4556,9 @@
4550
4556
  });
4551
4557
  };
4552
4558
 
4553
- var _q = __read(React__default["default"].useState(false), 2),
4554
- shouldValidate = _q[0],
4555
- setShouldValidate = _q[1];
4559
+ var _s = __read(React__default["default"].useState(false), 2),
4560
+ shouldValidate = _s[0],
4561
+ setShouldValidate = _s[1];
4556
4562
 
4557
4563
  React__default["default"].useEffect(function () {
4558
4564
  setIsDisabled(!isEditor || isDefaultDisabled); // set validate flag to validate after the values have been set
@@ -4574,9 +4580,15 @@
4574
4580
  });
4575
4581
  };
4576
4582
 
4577
- 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
+ }
4578
4591
 
4579
- setTafAction(fromStatusToAction(originalTaf.status));
4580
4592
  return function () {
4581
4593
  resetFormValues({});
4582
4594
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -5184,7 +5196,7 @@
5184
5196
  marginBottom: '20px'
5185
5197
  },
5186
5198
  "data-location": location,
5187
- className: isActive ? 'active' : null
5199
+ className: isActive ? 'active' : undefined
5188
5200
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
5189
5201
  sx: {
5190
5202
  display: 'flex',
@@ -5653,7 +5665,7 @@
5653
5665
  isLoading = _a[0],
5654
5666
  setLoading = _a[1];
5655
5667
 
5656
- var _b = __read(React__default["default"].useState(null), 2),
5668
+ var _b = __read(React__default["default"].useState(), 2),
5657
5669
  error = _b[0],
5658
5670
  setError = _b[1];
5659
5671
 
@@ -7638,6 +7650,7 @@
7638
7650
  };
7639
7651
  var componentsLookUp = function componentsLookUp(payload, _a, // TODO: find a good way to type this module without the apps complaining
7640
7652
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
7653
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7641
7654
  ConnectedModuleWrapper) {
7642
7655
  var config = _a.config,
7643
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 @@
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.1",
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.1",
15
+ "@opengeoweb/api": "4.14.1",
16
16
  "react": "^18.2.0",
17
17
  "axios": "^0.25.0",
18
- "@opengeoweb/shared": "4.13.1",
18
+ "@opengeoweb/shared": "4.14.1",
19
19
  "@mui/material": "^5.10.8",
20
- "@opengeoweb/theme": "4.13.1",
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.1",
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.1",
33
- "@opengeoweb/webmap": "4.13.1",
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.1",
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"