@opengeoweb/taf 4.5.0 → 4.6.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 +33 -70
- package/index.umd.js +31 -56
- package/lib/components/IssuesPane/IssuesPane.d.ts +3 -5
- package/lib/components/IssuesPane/types.d.ts +5 -1
- package/lib/components/IssuesPane/utils.d.ts +5 -8
- package/lib/components/TafForm/TafFormRow/validations/wind.d.ts +1 -2
- package/package.json +12 -12
package/index.esm.js
CHANGED
|
@@ -52,10 +52,6 @@ function _slicedToArray(arr, i) {
|
|
|
52
52
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
function _toArray(arr) {
|
|
56
|
-
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
55
|
function _toConsumableArray(arr) {
|
|
60
56
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
61
57
|
}
|
|
@@ -1363,11 +1359,10 @@ var invalidWindDirectionStepMessage = 'Invalid wind direction, the direction mus
|
|
|
1363
1359
|
var invalidWindSpeedMessage = 'Invalid wind speed, expected a speed equal to 2 digits or P99';
|
|
1364
1360
|
var invalidWindGustsMessage = 'Invalid wind gusts, expected gusts equal to 2 digits or P99';
|
|
1365
1361
|
var invalidWindGustSpeedCombinationMessage = 'Invalid wind gusts, gusts must at least be 10 knots greater than the wind speed';
|
|
1366
|
-
var invalidWindGustSpeedBelow15Message = 'Invalid wind gusts, gusts are only allowed for a minimum wind speed of 15 knots';
|
|
1367
1362
|
var invalidGustForWindP99Message = 'Invalid wind speed and gust combination, if wind is P99, gusts can only be empty or P99';
|
|
1368
1363
|
var invalidWindSpeedForDirectionZeroMessage = 'Invalid wind speed, if direction is 000, speed can only be 00';
|
|
1369
1364
|
var invalidWindSpeedForDirectionNonZeroMessage = 'Invalid wind speed, if direction is not 000, speed can not be 00';
|
|
1370
|
-
var invalidWindVRBWindDirectionMessage = 'Invalid wind direction, VRB can only be used in combination with windspeeds smaller than
|
|
1365
|
+
var invalidWindVRBWindDirectionMessage = 'Invalid wind direction, VRB can only be used in combination with windspeeds smaller than 3 or in combination with gusts and showers'; // validations
|
|
1371
1366
|
|
|
1372
1367
|
var validateDirection = function validateDirection(value) {
|
|
1373
1368
|
// if not a number
|
|
@@ -1424,8 +1419,8 @@ var validateWindInterSection = function validateWindInterSection(speed, gust, di
|
|
|
1424
1419
|
return invalidWindSpeedForDirectionNonZeroMessage;
|
|
1425
1420
|
}
|
|
1426
1421
|
|
|
1427
|
-
if (direction === 'VRB' && (speed === 'P99' || parseInt(speed, 10) >
|
|
1428
|
-
// Only allow VRB for speeds smaller than
|
|
1422
|
+
if (direction === 'VRB' && (speed === 'P99' || parseInt(speed, 10) > 2)) {
|
|
1423
|
+
// Only allow VRB for speeds smaller than 3 or in combination with gusts and showers (SH, TS, SQ)
|
|
1429
1424
|
var allowedWeatherPhenom = ['SH', 'TS', 'SQ'];
|
|
1430
1425
|
if (gust === '' || !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1431
1426
|
return weather1Value.includes(allowedPhenom);
|
|
@@ -1445,10 +1440,6 @@ var validateWindInterSection = function validateWindInterSection(speed, gust, di
|
|
|
1445
1440
|
return invalidGustForWindP99Message;
|
|
1446
1441
|
}
|
|
1447
1442
|
|
|
1448
|
-
if (parseInt(speed, 10) < 15) {
|
|
1449
|
-
return invalidWindGustSpeedBelow15Message;
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
1443
|
if (gust !== 'P99' && parseInt(gust, 10) - parseInt(speed, 10) < 10) {
|
|
1453
1444
|
return invalidWindGustSpeedCombinationMessage;
|
|
1454
1445
|
}
|
|
@@ -3566,14 +3557,10 @@ var DragHandle = function DragHandle(_ref) {
|
|
|
3566
3557
|
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3567
3558
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3568
3559
|
* */
|
|
3569
|
-
var getCustomError = function getCustomError(error) {
|
|
3570
|
-
var name = error.ref.name;
|
|
3571
|
-
var isChangeGroup = name.includes('changeGroups');
|
|
3572
|
-
var matchRowNumber = name.match(/\[(.*?)\]/);
|
|
3573
|
-
var row = matchRowNumber ? parseInt(matchRowNumber[1], 10) : null;
|
|
3560
|
+
var getCustomError = function getCustomError(error, isChangeGroup, rowIndex) {
|
|
3574
3561
|
return Object.assign(Object.assign({}, error), {
|
|
3575
3562
|
isChangeGroup: isChangeGroup,
|
|
3576
|
-
|
|
3563
|
+
rowIndex: rowIndex
|
|
3577
3564
|
});
|
|
3578
3565
|
};
|
|
3579
3566
|
var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
@@ -3588,33 +3575,33 @@ var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
|
3588
3575
|
return "".concat(sumOfErrors, " issues");
|
|
3589
3576
|
}
|
|
3590
3577
|
};
|
|
3591
|
-
|
|
3592
3578
|
var getErrorValues = function getErrorValues(fieldErrors) {
|
|
3579
|
+
var isChangeGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3580
|
+
var rowIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
3593
3581
|
if (!fieldErrors) return [];
|
|
3594
3582
|
return Object.keys(fieldErrors).reduce(function (list, key) {
|
|
3595
3583
|
var error = Object.assign({}, fieldErrors[key]);
|
|
3596
3584
|
|
|
3597
3585
|
if (error.ref) {
|
|
3598
|
-
return list.concat(getCustomError(error));
|
|
3586
|
+
return list.concat(getCustomError(error, isChangeGroup, rowIndex));
|
|
3599
3587
|
}
|
|
3600
3588
|
|
|
3601
|
-
return list.concat(getErrorValues(error));
|
|
3589
|
+
return list.concat(getErrorValues(error, isChangeGroup, rowIndex));
|
|
3602
3590
|
}, []);
|
|
3603
3591
|
};
|
|
3604
|
-
|
|
3605
3592
|
var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
3606
3593
|
return errors.reduce(function (list, error) {
|
|
3607
3594
|
// check on type validateRequiredSub and validateRequiredMainOptional since these are giving 'duplicates'
|
|
3608
3595
|
if (error.type === 'validateRequiredSub') {
|
|
3609
3596
|
var exist = list.find(function (e) {
|
|
3610
|
-
return e.type === 'validateRequiredSub' && e.
|
|
3597
|
+
return e.type === 'validateRequiredSub' && e.rowIndex === error.rowIndex;
|
|
3611
3598
|
});
|
|
3612
3599
|
return exist ? list : list.concat(error);
|
|
3613
3600
|
}
|
|
3614
3601
|
|
|
3615
3602
|
if (error.type === 'validateRequiredMainOptional') {
|
|
3616
3603
|
var _exist = list.find(function (e) {
|
|
3617
|
-
return e.type === 'validateRequiredMainOptional' && e.
|
|
3604
|
+
return e.type === 'validateRequiredMainOptional' && e.rowIndex === error.rowIndex;
|
|
3618
3605
|
});
|
|
3619
3606
|
|
|
3620
3607
|
return _exist ? list : list.concat(error);
|
|
@@ -3625,16 +3612,17 @@ var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
|
3625
3612
|
};
|
|
3626
3613
|
var getErrors = function getErrors(errors) {
|
|
3627
3614
|
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3628
|
-
var errorValue = errors[key];
|
|
3615
|
+
var errorValue = errors[key]; // changeGroups
|
|
3629
3616
|
|
|
3630
3617
|
if (Array.isArray(errorValue)) {
|
|
3631
|
-
var errorValues = errorValue.reduce(function (
|
|
3632
|
-
return
|
|
3618
|
+
var errorValues = errorValue.reduce(function (changeGroupErrors, changeGroupError, index) {
|
|
3619
|
+
return changeGroupErrors.concat(getErrorValues(changeGroupError, true, index));
|
|
3633
3620
|
}, []);
|
|
3634
3621
|
return list.concat.apply(list, _toConsumableArray(errorValues));
|
|
3635
|
-
}
|
|
3622
|
+
} // baseForecast
|
|
3636
3623
|
|
|
3637
|
-
|
|
3624
|
+
|
|
3625
|
+
return list.concat(getErrorValues(errorValue, false, -1));
|
|
3638
3626
|
}, []);
|
|
3639
3627
|
return errorList;
|
|
3640
3628
|
};
|
|
@@ -3728,43 +3716,18 @@ var getPaneTitle = function getPaneTitle(sumOfErrors) {
|
|
|
3728
3716
|
}
|
|
3729
3717
|
};
|
|
3730
3718
|
|
|
3731
|
-
var
|
|
3732
|
-
|
|
3733
|
-
firstLetter = _ref2[0],
|
|
3734
|
-
restOfWord = _ref2.slice(1);
|
|
3735
|
-
|
|
3736
|
-
return firstLetter.toUpperCase() + restOfWord.join('');
|
|
3737
|
-
};
|
|
3738
|
-
var humanizeErrorMessage = function humanizeErrorMessage(nameAsString) {
|
|
3739
|
-
var nameWithoutBrackets = nameAsString.replace(/[[\]']+/g, '');
|
|
3740
|
-
var nameLowerCase = nameWithoutBrackets.toLowerCase();
|
|
3741
|
-
|
|
3742
|
-
var _nameLowerCase$split$ = nameLowerCase.split(/([0-9]+)/) // split num bers from field and build array
|
|
3743
|
-
.filter(function (s) {
|
|
3744
|
-
return s.length;
|
|
3745
|
-
}),
|
|
3746
|
-
_nameLowerCase$split$2 = _slicedToArray(_nameLowerCase$split$, 2),
|
|
3747
|
-
fieldName = _nameLowerCase$split$2[0],
|
|
3748
|
-
fieldNumberedValue = _nameLowerCase$split$2[1];
|
|
3749
|
-
|
|
3750
|
-
var nameCapitalized = capitalizeWord(fieldName);
|
|
3751
|
-
|
|
3752
|
-
if (fieldNumberedValue) {
|
|
3719
|
+
var humanizeErrorMessage = function humanizeErrorMessage(errorTitle, fieldNumberedValue) {
|
|
3720
|
+
if (fieldNumberedValue !== undefined && fieldNumberedValue >= 0) {
|
|
3753
3721
|
// when name contains a number we assume it's a formgroup and we add a index +1 for human readability
|
|
3754
|
-
var fieldNumber =
|
|
3755
|
-
return "".concat(
|
|
3722
|
+
var fieldNumber = fieldNumberedValue + 1;
|
|
3723
|
+
return "".concat(errorTitle, " ").concat(fieldNumber);
|
|
3756
3724
|
}
|
|
3757
3725
|
|
|
3758
|
-
return
|
|
3726
|
+
return errorTitle;
|
|
3759
3727
|
};
|
|
3760
3728
|
var getErrorMessage = function getErrorMessage(error, index) {
|
|
3761
|
-
var
|
|
3762
|
-
|
|
3763
|
-
var _name$split = name.split('.'),
|
|
3764
|
-
_name$split2 = _slicedToArray(_name$split, 1),
|
|
3765
|
-
firstNamePart = _name$split2[0];
|
|
3766
|
-
|
|
3767
|
-
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3729
|
+
var errorTitleCategory = error.isChangeGroup ? 'Changegroups' : 'Baseforecast';
|
|
3730
|
+
var fieldErrorTitle = humanizeErrorMessage(errorTitleCategory, error.rowIndex);
|
|
3768
3731
|
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(error.message);
|
|
3769
3732
|
};
|
|
3770
3733
|
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
@@ -3799,16 +3762,16 @@ var useIssuesPane = function useIssuesPane() {
|
|
|
3799
3762
|
};
|
|
3800
3763
|
};
|
|
3801
3764
|
|
|
3802
|
-
var IssuesPane = function IssuesPane(
|
|
3803
|
-
var
|
|
3804
|
-
errorList =
|
|
3805
|
-
isOpen =
|
|
3806
|
-
handleClose =
|
|
3807
|
-
|
|
3808
|
-
startPosition =
|
|
3765
|
+
var IssuesPane = function IssuesPane(_ref) {
|
|
3766
|
+
var _ref$errorList = _ref.errorList,
|
|
3767
|
+
errorList = _ref$errorList === void 0 ? [] : _ref$errorList,
|
|
3768
|
+
isOpen = _ref.isOpen,
|
|
3769
|
+
handleClose = _ref.handleClose,
|
|
3770
|
+
_ref$startPosition = _ref.startPosition,
|
|
3771
|
+
startPosition = _ref$startPosition === void 0 ? {
|
|
3809
3772
|
left: 20,
|
|
3810
3773
|
top: 50
|
|
3811
|
-
} :
|
|
3774
|
+
} : _ref$startPosition;
|
|
3812
3775
|
var rootElement = document.getElementById(MODAL_DIALOG_ELEMENT) || document.body;
|
|
3813
3776
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
3814
3777
|
startSize: {
|
|
@@ -7046,7 +7009,7 @@ var fakePublishedTaf = {
|
|
|
7046
7009
|
direction: 10,
|
|
7047
7010
|
speed: 10,
|
|
7048
7011
|
unit: 'KT',
|
|
7049
|
-
gust:
|
|
7012
|
+
gust: 15
|
|
7050
7013
|
},
|
|
7051
7014
|
cloud: {
|
|
7052
7015
|
cloud1: {
|
package/index.umd.js
CHANGED
|
@@ -1358,11 +1358,10 @@
|
|
|
1358
1358
|
var invalidWindSpeedMessage = 'Invalid wind speed, expected a speed equal to 2 digits or P99';
|
|
1359
1359
|
var invalidWindGustsMessage = 'Invalid wind gusts, expected gusts equal to 2 digits or P99';
|
|
1360
1360
|
var invalidWindGustSpeedCombinationMessage = 'Invalid wind gusts, gusts must at least be 10 knots greater than the wind speed';
|
|
1361
|
-
var invalidWindGustSpeedBelow15Message = 'Invalid wind gusts, gusts are only allowed for a minimum wind speed of 15 knots';
|
|
1362
1361
|
var invalidGustForWindP99Message = 'Invalid wind speed and gust combination, if wind is P99, gusts can only be empty or P99';
|
|
1363
1362
|
var invalidWindSpeedForDirectionZeroMessage = 'Invalid wind speed, if direction is 000, speed can only be 00';
|
|
1364
1363
|
var invalidWindSpeedForDirectionNonZeroMessage = 'Invalid wind speed, if direction is not 000, speed can not be 00';
|
|
1365
|
-
var invalidWindVRBWindDirectionMessage = 'Invalid wind direction, VRB can only be used in combination with windspeeds smaller than
|
|
1364
|
+
var invalidWindVRBWindDirectionMessage = 'Invalid wind direction, VRB can only be used in combination with windspeeds smaller than 3 or in combination with gusts and showers'; // validations
|
|
1366
1365
|
|
|
1367
1366
|
var validateDirection = function validateDirection(value) {
|
|
1368
1367
|
// if not a number
|
|
@@ -1419,8 +1418,8 @@
|
|
|
1419
1418
|
return invalidWindSpeedForDirectionNonZeroMessage;
|
|
1420
1419
|
}
|
|
1421
1420
|
|
|
1422
|
-
if (direction === 'VRB' && (speed === 'P99' || parseInt(speed, 10) >
|
|
1423
|
-
// Only allow VRB for speeds smaller than
|
|
1421
|
+
if (direction === 'VRB' && (speed === 'P99' || parseInt(speed, 10) > 2)) {
|
|
1422
|
+
// Only allow VRB for speeds smaller than 3 or in combination with gusts and showers (SH, TS, SQ)
|
|
1424
1423
|
var allowedWeatherPhenom = ['SH', 'TS', 'SQ'];
|
|
1425
1424
|
if (gust === '' || !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1426
1425
|
return weather1Value.includes(allowedPhenom);
|
|
@@ -1440,10 +1439,6 @@
|
|
|
1440
1439
|
return invalidGustForWindP99Message;
|
|
1441
1440
|
}
|
|
1442
1441
|
|
|
1443
|
-
if (parseInt(speed, 10) < 15) {
|
|
1444
|
-
return invalidWindGustSpeedBelow15Message;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
1442
|
if (gust !== 'P99' && parseInt(gust, 10) - parseInt(speed, 10) < 10) {
|
|
1448
1443
|
return invalidWindGustSpeedCombinationMessage;
|
|
1449
1444
|
}
|
|
@@ -3563,14 +3558,10 @@
|
|
|
3563
3558
|
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3564
3559
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3565
3560
|
* */
|
|
3566
|
-
var getCustomError = function getCustomError(error) {
|
|
3567
|
-
var name = error.ref.name;
|
|
3568
|
-
var isChangeGroup = name.includes('changeGroups');
|
|
3569
|
-
var matchRowNumber = name.match(/\[(.*?)\]/);
|
|
3570
|
-
var row = matchRowNumber ? parseInt(matchRowNumber[1], 10) : null;
|
|
3561
|
+
var getCustomError = function getCustomError(error, isChangeGroup, rowIndex) {
|
|
3571
3562
|
return __assign(__assign({}, error), {
|
|
3572
3563
|
isChangeGroup: isChangeGroup,
|
|
3573
|
-
|
|
3564
|
+
rowIndex: rowIndex
|
|
3574
3565
|
});
|
|
3575
3566
|
};
|
|
3576
3567
|
var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
@@ -3585,33 +3576,39 @@
|
|
|
3585
3576
|
return sumOfErrors + " issues";
|
|
3586
3577
|
}
|
|
3587
3578
|
};
|
|
3579
|
+
var getErrorValues = function getErrorValues(fieldErrors, isChangeGroup, rowIndex) {
|
|
3580
|
+
if (isChangeGroup === void 0) {
|
|
3581
|
+
isChangeGroup = false;
|
|
3582
|
+
}
|
|
3583
|
+
|
|
3584
|
+
if (rowIndex === void 0) {
|
|
3585
|
+
rowIndex = -1;
|
|
3586
|
+
}
|
|
3588
3587
|
|
|
3589
|
-
var getErrorValues = function getErrorValues(fieldErrors) {
|
|
3590
3588
|
if (!fieldErrors) return [];
|
|
3591
3589
|
return Object.keys(fieldErrors).reduce(function (list, key) {
|
|
3592
3590
|
var error = __assign({}, fieldErrors[key]);
|
|
3593
3591
|
|
|
3594
3592
|
if (error.ref) {
|
|
3595
|
-
return list.concat(getCustomError(error));
|
|
3593
|
+
return list.concat(getCustomError(error, isChangeGroup, rowIndex));
|
|
3596
3594
|
}
|
|
3597
3595
|
|
|
3598
|
-
return list.concat(getErrorValues(error));
|
|
3596
|
+
return list.concat(getErrorValues(error, isChangeGroup, rowIndex));
|
|
3599
3597
|
}, []);
|
|
3600
3598
|
};
|
|
3601
|
-
|
|
3602
3599
|
var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
3603
3600
|
return errors.reduce(function (list, error) {
|
|
3604
3601
|
// check on type validateRequiredSub and validateRequiredMainOptional since these are giving 'duplicates'
|
|
3605
3602
|
if (error.type === 'validateRequiredSub') {
|
|
3606
3603
|
var exist = list.find(function (e) {
|
|
3607
|
-
return e.type === 'validateRequiredSub' && e.
|
|
3604
|
+
return e.type === 'validateRequiredSub' && e.rowIndex === error.rowIndex;
|
|
3608
3605
|
});
|
|
3609
3606
|
return exist ? list : list.concat(error);
|
|
3610
3607
|
}
|
|
3611
3608
|
|
|
3612
3609
|
if (error.type === 'validateRequiredMainOptional') {
|
|
3613
3610
|
var exist = list.find(function (e) {
|
|
3614
|
-
return e.type === 'validateRequiredMainOptional' && e.
|
|
3611
|
+
return e.type === 'validateRequiredMainOptional' && e.rowIndex === error.rowIndex;
|
|
3615
3612
|
});
|
|
3616
3613
|
return exist ? list : list.concat(error);
|
|
3617
3614
|
}
|
|
@@ -3621,16 +3618,17 @@
|
|
|
3621
3618
|
};
|
|
3622
3619
|
var getErrors = function getErrors(errors) {
|
|
3623
3620
|
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3624
|
-
var errorValue = errors[key];
|
|
3621
|
+
var errorValue = errors[key]; // changeGroups
|
|
3625
3622
|
|
|
3626
3623
|
if (Array.isArray(errorValue)) {
|
|
3627
|
-
var errorValues = errorValue.reduce(function (
|
|
3628
|
-
return
|
|
3624
|
+
var errorValues = errorValue.reduce(function (changeGroupErrors, changeGroupError, index) {
|
|
3625
|
+
return changeGroupErrors.concat(getErrorValues(changeGroupError, true, index));
|
|
3629
3626
|
}, []);
|
|
3630
3627
|
return list.concat.apply(list, __spreadArray([], __read(errorValues)));
|
|
3631
|
-
}
|
|
3628
|
+
} // baseForecast
|
|
3632
3629
|
|
|
3633
|
-
|
|
3630
|
+
|
|
3631
|
+
return list.concat(getErrorValues(errorValue, false, -1));
|
|
3634
3632
|
}, []);
|
|
3635
3633
|
return errorList;
|
|
3636
3634
|
};
|
|
@@ -3724,41 +3722,18 @@
|
|
|
3724
3722
|
}
|
|
3725
3723
|
};
|
|
3726
3724
|
|
|
3727
|
-
var
|
|
3728
|
-
|
|
3729
|
-
firstLetter = _b[0],
|
|
3730
|
-
restOfWord = _b.slice(1);
|
|
3731
|
-
|
|
3732
|
-
return firstLetter.toUpperCase() + restOfWord.join('');
|
|
3733
|
-
};
|
|
3734
|
-
var humanizeErrorMessage = function humanizeErrorMessage(nameAsString) {
|
|
3735
|
-
var nameWithoutBrackets = nameAsString.replace(/[[\]']+/g, '');
|
|
3736
|
-
var nameLowerCase = nameWithoutBrackets.toLowerCase();
|
|
3737
|
-
|
|
3738
|
-
var _a = __read(nameLowerCase.split(/([0-9]+)/) // split num bers from field and build array
|
|
3739
|
-
.filter(function (s) {
|
|
3740
|
-
return s.length;
|
|
3741
|
-
}), 2),
|
|
3742
|
-
fieldName = _a[0],
|
|
3743
|
-
fieldNumberedValue = _a[1];
|
|
3744
|
-
|
|
3745
|
-
var nameCapitalized = capitalizeWord(fieldName);
|
|
3746
|
-
|
|
3747
|
-
if (fieldNumberedValue) {
|
|
3725
|
+
var humanizeErrorMessage = function humanizeErrorMessage(errorTitle, fieldNumberedValue) {
|
|
3726
|
+
if (fieldNumberedValue !== undefined && fieldNumberedValue >= 0) {
|
|
3748
3727
|
// when name contains a number we assume it's a formgroup and we add a index +1 for human readability
|
|
3749
|
-
var fieldNumber =
|
|
3750
|
-
return
|
|
3728
|
+
var fieldNumber = fieldNumberedValue + 1;
|
|
3729
|
+
return errorTitle + " " + fieldNumber;
|
|
3751
3730
|
}
|
|
3752
3731
|
|
|
3753
|
-
return
|
|
3732
|
+
return errorTitle;
|
|
3754
3733
|
};
|
|
3755
3734
|
var getErrorMessage = function getErrorMessage(error, index) {
|
|
3756
|
-
var
|
|
3757
|
-
|
|
3758
|
-
var _a = __read(name.split('.'), 1),
|
|
3759
|
-
firstNamePart = _a[0];
|
|
3760
|
-
|
|
3761
|
-
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3735
|
+
var errorTitleCategory = error.isChangeGroup ? 'Changegroups' : 'Baseforecast';
|
|
3736
|
+
var fieldErrorTitle = humanizeErrorMessage(errorTitleCategory, error.rowIndex);
|
|
3762
3737
|
return index + 1 + ". " + fieldErrorTitle + ": " + error.message;
|
|
3763
3738
|
};
|
|
3764
3739
|
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
@@ -7015,7 +6990,7 @@
|
|
|
7015
6990
|
direction: 10,
|
|
7016
6991
|
speed: 10,
|
|
7017
6992
|
unit: 'KT',
|
|
7018
|
-
gust:
|
|
6993
|
+
gust: 15
|
|
7019
6994
|
},
|
|
7020
6995
|
cloud: {
|
|
7021
6996
|
cloud1: {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const humanizeErrorMessage: (nameAsString: string) => string;
|
|
6
|
-
export declare const getErrorMessage: (error: FieldError, index: number) => string;
|
|
2
|
+
import { IssuesPaneProps, IssuesPanePosition, CustomErrorField } from './types';
|
|
3
|
+
export declare const humanizeErrorMessage: (errorTitle: string, fieldNumberedValue: number) => string;
|
|
4
|
+
export declare const getErrorMessage: (error: CustomErrorField, index: number) => string;
|
|
7
5
|
export declare const MODAL_DIALOG_ELEMENT = "modal-dialog";
|
|
8
6
|
export declare const useIssuesPane: () => {
|
|
9
7
|
isIssuesPaneOpen: boolean;
|
|
@@ -3,8 +3,12 @@ export declare type IssuesPanePosition = {
|
|
|
3
3
|
left: number;
|
|
4
4
|
top: number;
|
|
5
5
|
};
|
|
6
|
+
export interface CustomErrorField extends FieldError {
|
|
7
|
+
isChangeGroup: boolean;
|
|
8
|
+
rowIndex: number;
|
|
9
|
+
}
|
|
6
10
|
export interface IssuesPaneProps {
|
|
7
|
-
errorList?:
|
|
11
|
+
errorList?: CustomErrorField[];
|
|
8
12
|
isOpen: boolean;
|
|
9
13
|
handleClose: () => void;
|
|
10
14
|
startPosition?: IssuesPanePosition;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
row: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const getCustomError: (error: FieldError) => CustomErrorField;
|
|
1
|
+
import { FieldError } from 'react-hook-form';
|
|
2
|
+
import { CustomErrorField } from './types';
|
|
3
|
+
export declare const getCustomError: (error: FieldError, isChangeGroup: boolean, rowIndex: number) => CustomErrorField;
|
|
7
4
|
export declare const getIssuesLabel: (sumOfErrors: number) => string;
|
|
5
|
+
export declare const getErrorValues: (fieldErrors: FieldError, isChangeGroup?: boolean, rowIndex?: number) => FieldError[];
|
|
8
6
|
export declare const filterDuplicateErrors: (errors: CustomErrorField[]) => CustomErrorField[];
|
|
9
|
-
export declare const getErrors: (errors:
|
|
10
|
-
export {};
|
|
7
|
+
export declare const getErrors: (errors: Record<string, FieldError>) => CustomErrorField[];
|
|
@@ -9,9 +9,8 @@ export declare const invalidWindDirectionStepMessage = "Invalid wind direction,
|
|
|
9
9
|
export declare const invalidWindSpeedMessage = "Invalid wind speed, expected a speed equal to 2 digits or P99";
|
|
10
10
|
export declare const invalidWindGustsMessage = "Invalid wind gusts, expected gusts equal to 2 digits or P99";
|
|
11
11
|
export declare const invalidWindGustSpeedCombinationMessage = "Invalid wind gusts, gusts must at least be 10 knots greater than the wind speed";
|
|
12
|
-
export declare const invalidWindGustSpeedBelow15Message = "Invalid wind gusts, gusts are only allowed for a minimum wind speed of 15 knots";
|
|
13
12
|
export declare const invalidGustForWindP99Message = "Invalid wind speed and gust combination, if wind is P99, gusts can only be empty or P99";
|
|
14
13
|
export declare const invalidWindSpeedForDirectionZeroMessage = "Invalid wind speed, if direction is 000, speed can only be 00";
|
|
15
14
|
export declare const invalidWindSpeedForDirectionNonZeroMessage = "Invalid wind speed, if direction is not 000, speed can not be 00";
|
|
16
|
-
export declare const invalidWindVRBWindDirectionMessage = "Invalid wind direction, VRB can only be used in combination with windspeeds smaller than
|
|
15
|
+
export declare const invalidWindVRBWindDirectionMessage = "Invalid wind direction, VRB can only be used in combination with windspeeds smaller than 3 or in combination with gusts and showers";
|
|
17
16
|
export declare const validateWindField: (value: string, weatherfield1: string, weatherfield2: string, weatherfield3: string) => boolean | string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/taf",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"description": "GeoWeb TAF library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -12,26 +12,27 @@
|
|
|
12
12
|
"typings": "./index.d.ts",
|
|
13
13
|
"dependencies": {},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@opengeoweb/core": "4.
|
|
15
|
+
"@opengeoweb/core": "4.6.1",
|
|
16
16
|
"react": "^17.0.2",
|
|
17
|
-
"@opengeoweb/theme": "4.
|
|
17
|
+
"@opengeoweb/theme": "4.6.1",
|
|
18
18
|
"@mui/material": "^5.10.8",
|
|
19
19
|
"moment": "^2.29.0",
|
|
20
20
|
"react-redux": "^8.0.4",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"@opengeoweb/webmap": "4.6.1",
|
|
22
|
+
"throttle-debounce": "^3.0.1",
|
|
23
|
+
"proj4": "^2.6.2",
|
|
24
|
+
"axios": "^0.25.0",
|
|
25
|
+
"@opengeoweb/api": "4.6.1",
|
|
26
|
+
"@opengeoweb/shared": "4.6.1",
|
|
23
27
|
"react-draggable": "^4.4.5",
|
|
24
28
|
"re-resizable": "^6.9.0",
|
|
25
29
|
"@redux-eggs/core": "^2.2.0",
|
|
26
|
-
"@opengeoweb/form-fields": "4.
|
|
30
|
+
"@opengeoweb/form-fields": "4.6.1",
|
|
27
31
|
"react-hook-form": "^6.12.1",
|
|
28
32
|
"moment-timezone": "^0.5.31",
|
|
29
33
|
"@mui/x-date-pickers": "^5.0.4",
|
|
30
34
|
"lodash": "^4.17.20",
|
|
31
|
-
"
|
|
32
|
-
"@opengeoweb/webmap": "4.5.0",
|
|
33
|
-
"throttle-debounce": "^3.0.1",
|
|
34
|
-
"proj4": "^2.6.2",
|
|
35
|
+
"react-intl": "^5.17.5",
|
|
35
36
|
"react-sortablejs": "^6.1.4",
|
|
36
37
|
"sortablejs": "^1.15.0",
|
|
37
38
|
"react-window": "^1.8.7",
|
|
@@ -43,9 +44,8 @@
|
|
|
43
44
|
"redux-saga": "^1.2.1",
|
|
44
45
|
"@redux-eggs/redux-toolkit": "^2.2.0",
|
|
45
46
|
"@redux-eggs/saga-extension": "^2.2.0",
|
|
46
|
-
"@opengeoweb/api": "4.5.0",
|
|
47
47
|
"react-dom": "^17.0.2",
|
|
48
|
-
"@opengeoweb/authentication": "4.
|
|
48
|
+
"@opengeoweb/authentication": "4.6.1",
|
|
49
49
|
"react-router-dom": "^6.4.2",
|
|
50
50
|
"query-string": "^6.13.7"
|
|
51
51
|
}
|