@opengeoweb/taf 4.17.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.esm.js +80 -19
  2. package/index.umd.js +92 -25
  3. package/package.json +8 -8
package/index.esm.js CHANGED
@@ -390,7 +390,10 @@ var getValidityTimeStamp = function getValidityTimeStamp(sectionType, sections,
390
390
 
391
391
 
392
392
  var parseValidToObject = function parseValidToObject(value, tafStart, tafEnd) {
393
- if (!value) return null; // Create valid object from passed string
393
+ if (!value) {
394
+ return null;
395
+ } // Create valid object from passed string
396
+
394
397
 
395
398
  var trimmedValue = value.trim();
396
399
  var tafStartMoment = moment.utc(tafStart);
@@ -453,7 +456,10 @@ var validateIsValidDates = function validateIsValidDates(value, tafStart, tafEnd
453
456
 
454
457
  var sectionValidationStart = validateValidSections(startSections, 'start'); // If invalid start - return with errors
455
458
 
456
- if (sectionValidationStart.length) return sectionValidationStart;
459
+ if (sectionValidationStart.length) {
460
+ return sectionValidationStart;
461
+ }
462
+
457
463
  var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment); // Validate start is within the taf validity bounds
458
464
 
459
465
  if (startTimestamp < tafStartMoment || startTimestamp > tafEndMoment) {
@@ -466,7 +472,10 @@ var validateIsValidDates = function validateIsValidDates(value, tafStart, tafEnd
466
472
 
467
473
  var sectionValidationEnd = validateValidSections(endSections, 'end'); // If invalid end - return with errors
468
474
 
469
- if (sectionValidationEnd.length) return sectionValidationEnd;
475
+ if (sectionValidationEnd.length) {
476
+ return sectionValidationEnd;
477
+ }
478
+
470
479
  var endTimestamp = getValidityTimeStamp('end', endSections, tafStartMoment, tafEndMoment); // Validate end is not before start
471
480
 
472
481
  if (endTimestamp < startTimestamp) {
@@ -604,7 +613,11 @@ var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentCh
604
613
 
605
614
  var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, nextChangeGroups, tafStart, tafEnd) {
606
615
  var valid = getFieldValue(currentChangeGroup.valid);
607
- if (!valid || !nextChangeGroups.length) return true;
616
+
617
+ if (!valid || !nextChangeGroups.length) {
618
+ return true;
619
+ }
620
+
608
621
  var validValue = parseValidToObject(valid, tafStart, tafEnd);
609
622
  var currentRowEndTime = moment(validValue.end);
610
623
  var firstFMChangeGroup = nextChangeGroups.find(function (nextChangeGroup) {
@@ -1650,14 +1663,20 @@ var validateWindField = function validateWindField(value, weatherfield1, weather
1650
1663
  };
1651
1664
 
1652
1665
  var formatSingleCloud = function formatSingleCloud(value) {
1653
- if (!value) return null;
1666
+ if (!value) {
1667
+ return null;
1668
+ }
1669
+
1654
1670
  return value.type ? "".concat(value.coverage).concat(prependZeroes(value.height, 3)).concat(value.type) : "".concat(value.coverage).concat(prependZeroes(value.height, 3));
1655
1671
  }; // TODO: clouds type = Clouds, but couldn't get it to work properly https://gitlab.com/opengeoweb/opengeoweb/-/issues/119
1656
1672
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1657
1673
 
1658
1674
 
1659
1675
  var formatCloudsToString = function formatCloudsToString(clouds) {
1660
- if (!clouds) return null;
1676
+ if (!clouds) {
1677
+ return null;
1678
+ }
1679
+
1661
1680
  return Object.keys(clouds).reduce(function (list, key) {
1662
1681
  // only format it if it has a value
1663
1682
  if (clouds[key]) {
@@ -1691,7 +1710,10 @@ var formatCloudsToString = function formatCloudsToString(clouds) {
1691
1710
  }; // parsers
1692
1711
 
1693
1712
  var parseSingleCloud = function parseSingleCloud(value) {
1694
- if (!value) return null;
1713
+ if (!value) {
1714
+ return null;
1715
+ }
1716
+
1695
1717
  var trimmedCloud = value.trim();
1696
1718
  var cloudType = trimmedCloud.substring(6, 9);
1697
1719
  return Object.assign({
@@ -1705,7 +1727,10 @@ var parseSingleCloud = function parseSingleCloud(value) {
1705
1727
 
1706
1728
 
1707
1729
  var parseCloudsToObject = function parseCloudsToObject(clouds) {
1708
- if (!clouds) return null;
1730
+ if (!clouds) {
1731
+ return null;
1732
+ }
1733
+
1709
1734
  return Object.keys(clouds).reduce(function (list, key) {
1710
1735
  // only parse it if it has a value
1711
1736
  if (clouds[key] && clouds[key].trim()) {
@@ -2554,7 +2579,11 @@ var useDragOrder = function useDragOrder(trigger, move) {
2554
2579
  var onChangeOrder = function onChangeOrder(_ref) {
2555
2580
  var oldIndex = _ref.oldIndex,
2556
2581
  newIndex = _ref.newIndex;
2557
- if (oldIndex === undefined || newIndex === undefined) return;
2582
+
2583
+ if (oldIndex === undefined || newIndex === undefined) {
2584
+ return;
2585
+ }
2586
+
2558
2587
  move(oldIndex, newIndex);
2559
2588
  onUpdatelastDragOrder([oldIndex, newIndex]);
2560
2589
  setActiveDraggingIndex(false);
@@ -2584,17 +2613,35 @@ var useDragOrder = function useDragOrder(trigger, move) {
2584
2613
  }; // dialog utils
2585
2614
 
2586
2615
  var getConfirmationDialogTitle = function getConfirmationDialogTitle(action) {
2587
- if (action === 'CLEAR') return 'Clear TAF';
2588
- if (action === 'PUBLISH') return 'Publish';
2589
- if (action === 'AMEND') return 'This TAF is an amendment';
2590
- if (action === 'CORRECT') return 'This TAF is a correction';
2591
- if (action === 'CANCEL') return 'Cancel TAF';
2616
+ if (action === 'CLEAR') {
2617
+ return 'Clear TAF';
2618
+ }
2619
+
2620
+ if (action === 'PUBLISH') {
2621
+ return 'Publish';
2622
+ }
2623
+
2624
+ if (action === 'AMEND') {
2625
+ return 'This TAF is an amendment';
2626
+ }
2627
+
2628
+ if (action === 'CORRECT') {
2629
+ return 'This TAF is a correction';
2630
+ }
2631
+
2632
+ if (action === 'CANCEL') {
2633
+ return 'Cancel TAF';
2634
+ }
2635
+
2592
2636
  return 'Cancel TAF';
2593
2637
  }; // Check if the amended/corrected TAF has been changed. Only compare the fields users are able to fill in
2594
2638
  // (i.e. exclude baseforecast valid time as that gets updated when doing an amendment automatically outside of the users influence)
2595
2639
 
2596
2640
  var isTafAmendedCorrectedChanged = function isTafAmendedCorrectedChanged(originalTaf, currentTaf) {
2597
- if (originalTaf === null || currentTaf === null) return false;
2641
+ if (originalTaf === null || currentTaf === null) {
2642
+ return false;
2643
+ }
2644
+
2598
2645
  var originalBaseF = originalTaf.baseForecast,
2599
2646
  originalChG = originalTaf.changeGroups;
2600
2647
  var currentBaseF = currentTaf.baseForecast,
@@ -2909,7 +2956,11 @@ var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
2909
2956
  var getErrorValues = function getErrorValues(fieldErrors) {
2910
2957
  var isChangeGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2911
2958
  var rowIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
2912
- if (!fieldErrors) return [];
2959
+
2960
+ if (!fieldErrors) {
2961
+ return [];
2962
+ }
2963
+
2913
2964
  return Object.keys(fieldErrors).reduce(function (list, key) {
2914
2965
  var error = Object.assign({}, fieldErrors[key]);
2915
2966
 
@@ -4643,7 +4694,10 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
4643
4694
  forceFallback: false,
4644
4695
  onStart: function onStart(event) {
4645
4696
  onStartDrag(event);
4646
- if (Sortable.ghost) Sortable.ghost.style.opacity = '1';
4697
+
4698
+ if (Sortable.ghost) {
4699
+ Sortable.ghost.style.opacity = '1';
4700
+ }
4647
4701
  }
4648
4702
  }, fields.map(function (item, index) {
4649
4703
  return /*#__PURE__*/React__default.createElement(TafFormRow, {
@@ -4933,7 +4987,11 @@ var getNewTafLocationIndex = function getNewTafLocationIndex(tafLocations, previ
4933
4987
  };
4934
4988
  var getPreviousTaf = function getPreviousTaf(tafList, currentTaf) {
4935
4989
  var previousId = currentTaf.taf.previousId;
4936
- if (!previousId) return null;
4990
+
4991
+ if (!previousId) {
4992
+ return null;
4993
+ }
4994
+
4937
4995
  var previousTaf = tafList.find(function (taf) {
4938
4996
  return taf.taf.uuid === previousId;
4939
4997
  });
@@ -5282,7 +5340,10 @@ var TacOverview = function TacOverview(_ref) {
5282
5340
  };
5283
5341
 
5284
5342
  var scrollToPosition = React__default.useCallback(function () {
5285
- if (!scrollRef.current) return;
5343
+ if (!scrollRef.current) {
5344
+ return;
5345
+ }
5346
+
5286
5347
  var containerTop = scrollRef.current.getBoundingClientRect().top;
5287
5348
  var firstLocation = scrollRef.current.querySelector("[data-location=\"".concat(activeLocation, "\"]"));
5288
5349
  var paddingTop = parseInt(getComputedStyle(scrollRef.current).paddingTop, 10);
package/index.umd.js CHANGED
@@ -384,7 +384,10 @@
384
384
 
385
385
 
386
386
  var parseValidToObject = function parseValidToObject(value, tafStart, tafEnd) {
387
- if (!value) return null; // Create valid object from passed string
387
+ if (!value) {
388
+ return null;
389
+ } // Create valid object from passed string
390
+
388
391
 
389
392
  var trimmedValue = value.trim();
390
393
  var tafStartMoment = moment__default["default"].utc(tafStart);
@@ -447,7 +450,10 @@
447
450
 
448
451
  var sectionValidationStart = validateValidSections(startSections, 'start'); // If invalid start - return with errors
449
452
 
450
- if (sectionValidationStart.length) return sectionValidationStart;
453
+ if (sectionValidationStart.length) {
454
+ return sectionValidationStart;
455
+ }
456
+
451
457
  var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment); // Validate start is within the taf validity bounds
452
458
 
453
459
  if (startTimestamp < tafStartMoment || startTimestamp > tafEndMoment) {
@@ -460,7 +466,10 @@
460
466
 
461
467
  var sectionValidationEnd = validateValidSections(endSections, 'end'); // If invalid end - return with errors
462
468
 
463
- if (sectionValidationEnd.length) return sectionValidationEnd;
469
+ if (sectionValidationEnd.length) {
470
+ return sectionValidationEnd;
471
+ }
472
+
464
473
  var endTimestamp = getValidityTimeStamp('end', endSections, tafStartMoment, tafEndMoment); // Validate end is not before start
465
474
 
466
475
  if (endTimestamp < startTimestamp) {
@@ -598,7 +607,11 @@
598
607
 
599
608
  var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, nextChangeGroups, tafStart, tafEnd) {
600
609
  var valid = getFieldValue(currentChangeGroup.valid);
601
- if (!valid || !nextChangeGroups.length) return true;
610
+
611
+ if (!valid || !nextChangeGroups.length) {
612
+ return true;
613
+ }
614
+
602
615
  var validValue = parseValidToObject(valid, tafStart, tafEnd);
603
616
  var currentRowEndTime = moment__default["default"](validValue.end);
604
617
  var firstFMChangeGroup = nextChangeGroups.find(function (nextChangeGroup) {
@@ -1648,14 +1661,20 @@
1648
1661
  };
1649
1662
 
1650
1663
  var formatSingleCloud = function formatSingleCloud(value) {
1651
- if (!value) return null;
1664
+ if (!value) {
1665
+ return null;
1666
+ }
1667
+
1652
1668
  return value.type ? "" + value.coverage + prependZeroes(value.height, 3) + value.type : "" + value.coverage + prependZeroes(value.height, 3);
1653
1669
  }; // TODO: clouds type = Clouds, but couldn't get it to work properly https://gitlab.com/opengeoweb/opengeoweb/-/issues/119
1654
1670
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1655
1671
 
1656
1672
 
1657
1673
  var formatCloudsToString = function formatCloudsToString(clouds) {
1658
- if (!clouds) return null;
1674
+ if (!clouds) {
1675
+ return null;
1676
+ }
1677
+
1659
1678
  return Object.keys(clouds).reduce(function (list, key) {
1660
1679
  // only format it if it has a value
1661
1680
  var _a, _b, _c, _d;
@@ -1691,7 +1710,10 @@
1691
1710
  }; // parsers
1692
1711
 
1693
1712
  var parseSingleCloud = function parseSingleCloud(value) {
1694
- if (!value) return null;
1713
+ if (!value) {
1714
+ return null;
1715
+ }
1716
+
1695
1717
  var trimmedCloud = value.trim();
1696
1718
  var cloudType = trimmedCloud.substring(6, 9);
1697
1719
  return __assign({
@@ -1705,7 +1727,10 @@
1705
1727
 
1706
1728
 
1707
1729
  var parseCloudsToObject = function parseCloudsToObject(clouds) {
1708
- if (!clouds) return null;
1730
+ if (!clouds) {
1731
+ return null;
1732
+ }
1733
+
1709
1734
  return Object.keys(clouds).reduce(function (list, key) {
1710
1735
  var _a, _b, _c, _d; // only parse it if it has a value
1711
1736
 
@@ -2555,7 +2580,11 @@
2555
2580
  var onChangeOrder = function onChangeOrder(_a) {
2556
2581
  var oldIndex = _a.oldIndex,
2557
2582
  newIndex = _a.newIndex;
2558
- if (oldIndex === undefined || newIndex === undefined) return;
2583
+
2584
+ if (oldIndex === undefined || newIndex === undefined) {
2585
+ return;
2586
+ }
2587
+
2559
2588
  move(oldIndex, newIndex);
2560
2589
  onUpdatelastDragOrder([oldIndex, newIndex]);
2561
2590
  setActiveDraggingIndex(false);
@@ -2585,17 +2614,35 @@
2585
2614
  }; // dialog utils
2586
2615
 
2587
2616
  var getConfirmationDialogTitle = function getConfirmationDialogTitle(action) {
2588
- if (action === 'CLEAR') return 'Clear TAF';
2589
- if (action === 'PUBLISH') return 'Publish';
2590
- if (action === 'AMEND') return 'This TAF is an amendment';
2591
- if (action === 'CORRECT') return 'This TAF is a correction';
2592
- if (action === 'CANCEL') return 'Cancel TAF';
2617
+ if (action === 'CLEAR') {
2618
+ return 'Clear TAF';
2619
+ }
2620
+
2621
+ if (action === 'PUBLISH') {
2622
+ return 'Publish';
2623
+ }
2624
+
2625
+ if (action === 'AMEND') {
2626
+ return 'This TAF is an amendment';
2627
+ }
2628
+
2629
+ if (action === 'CORRECT') {
2630
+ return 'This TAF is a correction';
2631
+ }
2632
+
2633
+ if (action === 'CANCEL') {
2634
+ return 'Cancel TAF';
2635
+ }
2636
+
2593
2637
  return 'Cancel TAF';
2594
2638
  }; // Check if the amended/corrected TAF has been changed. Only compare the fields users are able to fill in
2595
2639
  // (i.e. exclude baseforecast valid time as that gets updated when doing an amendment automatically outside of the users influence)
2596
2640
 
2597
2641
  var isTafAmendedCorrectedChanged = function isTafAmendedCorrectedChanged(originalTaf, currentTaf) {
2598
- if (originalTaf === null || currentTaf === null) return false;
2642
+ if (originalTaf === null || currentTaf === null) {
2643
+ return false;
2644
+ }
2645
+
2599
2646
  var originalBaseF = originalTaf.baseForecast,
2600
2647
  originalChG = originalTaf.changeGroups;
2601
2648
  var currentBaseF = currentTaf.baseForecast,
@@ -2922,7 +2969,10 @@
2922
2969
  rowIndex = -1;
2923
2970
  }
2924
2971
 
2925
- if (!fieldErrors) return [];
2972
+ if (!fieldErrors) {
2973
+ return [];
2974
+ }
2975
+
2926
2976
  return Object.keys(fieldErrors).reduce(function (list, key) {
2927
2977
  var error = __assign({}, fieldErrors[key]);
2928
2978
 
@@ -4662,7 +4712,10 @@
4662
4712
  forceFallback: false,
4663
4713
  onStart: function onStart(event) {
4664
4714
  onStartDrag(event);
4665
- if (Sortable__default["default"].ghost) Sortable__default["default"].ghost.style.opacity = '1';
4715
+
4716
+ if (Sortable__default["default"].ghost) {
4717
+ Sortable__default["default"].ghost.style.opacity = '1';
4718
+ }
4666
4719
  }
4667
4720
  }, fields.map(function (item, index) {
4668
4721
  return /*#__PURE__*/React__default["default"].createElement(TafFormRow, {
@@ -4947,7 +5000,11 @@
4947
5000
  };
4948
5001
  var getPreviousTaf = function getPreviousTaf(tafList, currentTaf) {
4949
5002
  var previousId = currentTaf.taf.previousId;
4950
- if (!previousId) return null;
5003
+
5004
+ if (!previousId) {
5005
+ return null;
5006
+ }
5007
+
4951
5008
  var previousTaf = tafList.find(function (taf) {
4952
5009
  return taf.taf.uuid === previousId;
4953
5010
  });
@@ -5307,7 +5364,10 @@
5307
5364
  };
5308
5365
 
5309
5366
  var scrollToPosition = React__default["default"].useCallback(function () {
5310
- if (!scrollRef.current) return;
5367
+ if (!scrollRef.current) {
5368
+ return;
5369
+ }
5370
+
5311
5371
  var containerTop = scrollRef.current.getBoundingClientRect().top;
5312
5372
  var firstLocation = scrollRef.current.querySelector("[data-location=\"" + activeLocation + "\"]");
5313
5373
  var paddingTop = parseInt(getComputedStyle(scrollRef.current).paddingTop, 10);
@@ -5695,9 +5755,12 @@
5695
5755
  case 2:
5696
5756
  _a.sent();
5697
5757
 
5698
- if (!isMounted.current) return [2
5699
- /*return*/
5700
- ];
5758
+ if (!isMounted.current) {
5759
+ return [2
5760
+ /*return*/
5761
+ ];
5762
+ }
5763
+
5701
5764
  setLoading(false);
5702
5765
  setError(null);
5703
5766
  return [3
@@ -5706,9 +5769,13 @@
5706
5769
 
5707
5770
  case 3:
5708
5771
  error_1 = _a.sent();
5709
- if (!isMounted.current) return [2
5710
- /*return*/
5711
- ];
5772
+
5773
+ if (!isMounted.current) {
5774
+ return [2
5775
+ /*return*/
5776
+ ];
5777
+ }
5778
+
5712
5779
  newErrorr = errorParser ? errorParser(error_1, params) : error_1;
5713
5780
  setLoading(false);
5714
5781
  setError(newErrorr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/taf",
3
- "version": "4.17.0",
3
+ "version": "4.18.0",
4
4
  "description": "GeoWeb TAF library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -12,21 +12,21 @@
12
12
  "typings": "./index.d.ts",
13
13
  "dependencies": {},
14
14
  "peerDependencies": {
15
- "@opengeoweb/api": "4.17.0",
15
+ "@opengeoweb/api": "4.18.0",
16
16
  "react": "^18.2.0",
17
17
  "axios": "^0.25.0",
18
- "@opengeoweb/shared": "4.17.0",
18
+ "@opengeoweb/shared": "4.18.0",
19
19
  "@mui/material": "^5.10.8",
20
- "@opengeoweb/theme": "4.17.0",
20
+ "@opengeoweb/theme": "4.18.0",
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
25
  "lodash": "^4.17.20",
26
26
  "date-fns": "^2.29.3",
27
- "@opengeoweb/core": "4.17.0",
27
+ "@opengeoweb/core": "4.18.0",
28
28
  "moment": "^2.29.0",
29
- "@opengeoweb/webmap": "4.17.0",
29
+ "@opengeoweb/webmap": "4.18.0",
30
30
  "throttle-debounce": "^3.0.1",
31
31
  "proj4": "^2.6.2",
32
32
  "react-intl": "^5.17.5",
@@ -34,7 +34,7 @@
34
34
  "sortablejs": "^1.15.0",
35
35
  "immer": "^9.0.15",
36
36
  "react-window": "^1.8.7",
37
- "@opengeoweb/form-fields": "4.17.0",
37
+ "@opengeoweb/form-fields": "4.18.0",
38
38
  "react-hook-form": "^7.41.5",
39
39
  "moment-timezone": "^0.5.31",
40
40
  "@mui/x-date-pickers": "^5.0.4",
@@ -47,7 +47,7 @@
47
47
  "@redux-eggs/redux-toolkit": "^2.2.0",
48
48
  "@redux-eggs/saga-extension": "^2.2.0",
49
49
  "react-dom": "^18.2.0",
50
- "@opengeoweb/authentication": "4.17.0",
50
+ "@opengeoweb/authentication": "4.18.0",
51
51
  "query-string": "^6.13.7",
52
52
  "@emotion/react": "^11.10.4"
53
53
  }