@opengeoweb/taf 2.1.2 → 2.1.3
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/lib/components/TafForm/TafFormRow/clouds.d.ts +8 -5
- package/lib/components/TafForm/TafFormRow/validField.d.ts +4 -2
- package/lib/components/TafForm/TafFormRow/wind.d.ts +2 -1
- package/lib/components/TafForm/TafFormWrapper.stories.d.ts +4 -0
- package/lib/utils/mockdata/fakeTafList.d.ts +1 -0
- package/lib/utils/testUtils.d.ts +6 -0
- package/package.json +5 -5
- package/taf.esm.js +267 -145
- package/taf.umd.js +261 -144
package/taf.esm.js
CHANGED
|
@@ -284,20 +284,20 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
284
284
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
285
285
|
* */
|
|
286
286
|
var FORMAT_DAYS_HOURS = 'DDHH';
|
|
287
|
-
var
|
|
287
|
+
var FORMAT_DAYS_HOURS_MINUTES = 'DDHHmm'; // formatters
|
|
288
288
|
|
|
289
289
|
var formatValidToString = function formatValidToString(valid) {
|
|
290
290
|
// Ensure end of valid period if midnight is shown as 24 and not 00
|
|
291
291
|
var endHours = moment.utc(valid.end).format('kk');
|
|
292
292
|
var endDate = endHours === '24' ? moment.utc(valid.end).add(-1, 'day').format('DD') : moment.utc(valid.end).format('DD');
|
|
293
|
-
return valid.end ? "".concat(moment.utc(valid.start).format(FORMAT_DAYS_HOURS), "/").concat(endDate).concat(endHours) : moment.utc(valid.start).format(
|
|
293
|
+
return valid.end ? "".concat(moment.utc(valid.start).format(FORMAT_DAYS_HOURS), "/").concat(endDate).concat(endHours) : moment.utc(valid.start).format(FORMAT_DAYS_HOURS_MINUTES);
|
|
294
294
|
};
|
|
295
295
|
|
|
296
296
|
var getSections = function getSections(value, format) {
|
|
297
297
|
return {
|
|
298
298
|
day: parseInt(value.substring(0, 2), 10),
|
|
299
299
|
hour: parseInt(value.substring(2, 4), 10),
|
|
300
|
-
min: format ===
|
|
300
|
+
min: format === FORMAT_DAYS_HOURS_MINUTES ? parseInt(value.substring(4), 10) : 0
|
|
301
301
|
};
|
|
302
302
|
};
|
|
303
303
|
|
|
@@ -327,7 +327,7 @@ var parseValidToObject = function parseValidToObject(value, tafStart, tafEnd) {
|
|
|
327
327
|
var tafStartMoment = moment.utc(tafStart);
|
|
328
328
|
var tafEndMoment = moment.utc(tafEnd);
|
|
329
329
|
var startEnd = trimmedValue.split('/');
|
|
330
|
-
var format = trimmedValue.indexOf('/') === -1 ?
|
|
330
|
+
var format = trimmedValue.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS;
|
|
331
331
|
var startSections = getSections(startEnd[0], format);
|
|
332
332
|
var start = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment).format('YYYY-MM-DDTHH:mm:ss[Z]'); // If we only have start value - return that otherwise, also get end time
|
|
333
333
|
|
|
@@ -352,7 +352,8 @@ var invalidValidityStartTimeMessage = 'Invalid validity start time, change group
|
|
|
352
352
|
var invalidValidityPeriodMessage = 'Invalid validity period, validity end time has to be after validity start time';
|
|
353
353
|
var invalidValidityEndTimeMessage = 'Invalid validity end time, change group validity must lie within the TAF validity period';
|
|
354
354
|
var invalidChangeValidInterFieldMessage = 'Invalid validity period, expected DDHH/DDHH for BECMG and TEMPO or DDHHmm for FM';
|
|
355
|
-
var invalidBECMGDurationValidInterFieldMessage = 'Invalid validity period, for BECMG only validity periods with a duration of 1, 2, 3 or 4 hours are allowed';
|
|
355
|
+
var invalidBECMGDurationValidInterFieldMessage = 'Invalid validity period, for BECMG only validity periods with a duration of 1, 2, 3 or 4 hours are allowed';
|
|
356
|
+
var invalidChangeGroupOverlapsWithFM = 'The valid time of a change group cannot overlap with the valid time of a following FM group. This change group should end before or at the hour of the start of the FM group'; // Validations
|
|
356
357
|
// Ensure all individual sections are correct (DD HH mm etc)
|
|
357
358
|
|
|
358
359
|
var validateValidSections = function validateValidSections(sections, isStartEnd) {
|
|
@@ -376,7 +377,7 @@ var validateIsValidDates = function validateIsValidDates(value, tafStart, tafEnd
|
|
|
376
377
|
var tafStartMoment = moment.utc(tafStart);
|
|
377
378
|
var tafEndMoment = moment.utc(tafEnd);
|
|
378
379
|
var startEnd = value.split('/');
|
|
379
|
-
var format = value.indexOf('/') === -1 ?
|
|
380
|
+
var format = value.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS;
|
|
380
381
|
var validateMsg = []; // Validate start time
|
|
381
382
|
|
|
382
383
|
var startSections = getSections(startEnd[0], format); // Validate individual sections for start
|
|
@@ -454,7 +455,7 @@ var validateValidChangeGroupInterField = function validateValidChangeGroupInterF
|
|
|
454
455
|
var tafStartMoment = moment.utc(tafStart);
|
|
455
456
|
var tafEndMoment = moment.utc(tafEnd);
|
|
456
457
|
var startEnd = trimmedValue.split('/');
|
|
457
|
-
var format = trimmedValue.indexOf('/') === -1 ?
|
|
458
|
+
var format = trimmedValue.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS; // Validate start time
|
|
458
459
|
|
|
459
460
|
var startSections = getSections(startEnd[0], format);
|
|
460
461
|
var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment);
|
|
@@ -474,18 +475,18 @@ var validProbChangeOrder = ['FM', 'BECMG', 'TEMPO', 'PROB40', 'PROB30', 'PROB40
|
|
|
474
475
|
var invalidPreviousChangeGroupIsBeforeMessage = 'Valid time should be after previous valid time';
|
|
475
476
|
var invalidPreviousChangeGroupOrderMessage = "When valid times are equal, the change/probability order should be: ".concat(validProbChangeOrder.join(', '));
|
|
476
477
|
var invalidPreviousChangeGroupHasSameValue = "When valid times are equal, probability/change can't have the same value as previous row value";
|
|
477
|
-
var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentChangeGroup,
|
|
478
|
+
var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentChangeGroup, previousChangeGroup, tafStart, tafEnd) {
|
|
478
479
|
// extract the needed values from changeGroups
|
|
479
480
|
var valid = currentChangeGroup.valid,
|
|
480
481
|
_currentChangeGroup$c = currentChangeGroup.change,
|
|
481
482
|
change = _currentChangeGroup$c === void 0 ? '' : _currentChangeGroup$c,
|
|
482
483
|
_currentChangeGroup$p = currentChangeGroup.probability,
|
|
483
484
|
probability = _currentChangeGroup$p === void 0 ? '' : _currentChangeGroup$p;
|
|
484
|
-
var previousValid =
|
|
485
|
-
|
|
486
|
-
previousChange =
|
|
487
|
-
|
|
488
|
-
previousProbability =
|
|
485
|
+
var previousValid = previousChangeGroup.valid,
|
|
486
|
+
_previousChangeGroup$ = previousChangeGroup.change,
|
|
487
|
+
previousChange = _previousChangeGroup$ === void 0 ? '' : _previousChangeGroup$,
|
|
488
|
+
_previousChangeGroup$2 = previousChangeGroup.probability,
|
|
489
|
+
previousProbability = _previousChangeGroup$2 === void 0 ? '' : _previousChangeGroup$2; // get the parsed values
|
|
489
490
|
|
|
490
491
|
var validValue = parseValidToObject(valid, tafStart, tafEnd);
|
|
491
492
|
var previousValidValue = parseValidToObject(previousValid, tafStart, tafEnd);
|
|
@@ -518,6 +519,27 @@ var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentCh
|
|
|
518
519
|
}
|
|
519
520
|
}
|
|
520
521
|
|
|
522
|
+
return true;
|
|
523
|
+
}; // validate overlapping validity when one of the following changegroups is FM
|
|
524
|
+
|
|
525
|
+
var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, nextChangeGroups, tafStart, tafEnd) {
|
|
526
|
+
var valid = currentChangeGroup.valid;
|
|
527
|
+
if (!valid || !nextChangeGroups.length) return true;
|
|
528
|
+
var validValue = parseValidToObject(valid, tafStart, tafEnd);
|
|
529
|
+
var currentRowEndTime = moment(validValue.end);
|
|
530
|
+
var firstFMChangeGroup = nextChangeGroups.find(function (nextChangeGroup) {
|
|
531
|
+
return nextChangeGroup.change.trim() === 'FM';
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
if (firstFMChangeGroup && firstFMChangeGroup.valid) {
|
|
535
|
+
var FMValidValue = parseValidToObject(firstFMChangeGroup.valid, tafStart, tafEnd);
|
|
536
|
+
var FMStartTime = moment(FMValidValue.start);
|
|
537
|
+
|
|
538
|
+
if (currentRowEndTime.isAfter(FMStartTime)) {
|
|
539
|
+
return invalidChangeGroupOverlapsWithFM;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
521
543
|
return true;
|
|
522
544
|
};
|
|
523
545
|
|
|
@@ -1450,7 +1472,8 @@ var invalidWindGustSpeedCombinationMessage = 'Invalid wind gusts, gusts must at
|
|
|
1450
1472
|
var invalidWindGustSpeedBelow15Message = 'Invalid wind gusts, gusts are only allowed for a minimum wind speed of 15 knots';
|
|
1451
1473
|
var invalidGustForWindP99Message = 'Invalid wind speed and gust combination, if wind is P99, gusts can only be empty or P99';
|
|
1452
1474
|
var invalidWindSpeedForDirectionZeroMessage = 'Invalid wind speed, if direction is 000, speed can only be 00';
|
|
1453
|
-
var invalidWindSpeedForDirectionNonZeroMessage = 'Invalid wind speed, if direction is not 000, speed can not be 00';
|
|
1475
|
+
var invalidWindSpeedForDirectionNonZeroMessage = 'Invalid wind speed, if direction is not 000, speed can not be 00';
|
|
1476
|
+
var invalidWindVRBWindDirectionMessage = 'Invalid wind direction, VRB can only be used in combination with windspeeds smaller than 4 or in combination with gusts and showers'; // validations
|
|
1454
1477
|
|
|
1455
1478
|
var validateDirection = function validateDirection(value) {
|
|
1456
1479
|
// if not a number
|
|
@@ -1498,7 +1521,7 @@ var validateUnit = function validateUnit(value) {
|
|
|
1498
1521
|
return value === 'KT' || value === '' || invalidWindMessage;
|
|
1499
1522
|
};
|
|
1500
1523
|
|
|
1501
|
-
var validateWindInterSection = function validateWindInterSection(speed, gust, direction) {
|
|
1524
|
+
var validateWindInterSection = function validateWindInterSection(speed, gust, direction, weather1Value, weather2Value, weather3Value) {
|
|
1502
1525
|
if (direction === '000' && speed !== '00') {
|
|
1503
1526
|
return invalidWindSpeedForDirectionZeroMessage;
|
|
1504
1527
|
}
|
|
@@ -1507,6 +1530,19 @@ var validateWindInterSection = function validateWindInterSection(speed, gust, di
|
|
|
1507
1530
|
return invalidWindSpeedForDirectionNonZeroMessage;
|
|
1508
1531
|
}
|
|
1509
1532
|
|
|
1533
|
+
if (direction === 'VRB' && (speed === 'P99' || parseInt(speed, 10) > 3)) {
|
|
1534
|
+
// Only allow VRB for speeds smaller than 4 or in combination with gusts and showers (SH, TS, SQ)
|
|
1535
|
+
var allowedWeatherPhenom = ['SH', 'TS', 'SQ'];
|
|
1536
|
+
if (gust === '' || !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1537
|
+
return weather1Value.includes(allowedPhenom);
|
|
1538
|
+
}) && !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1539
|
+
return weather2Value.includes(allowedPhenom);
|
|
1540
|
+
}) && !allowedWeatherPhenom.some(function (allowedPhenom) {
|
|
1541
|
+
return weather3Value.includes(allowedPhenom);
|
|
1542
|
+
})) return invalidWindVRBWindDirectionMessage;
|
|
1543
|
+
} // Validate gust
|
|
1544
|
+
|
|
1545
|
+
|
|
1510
1546
|
if (gust === '') {
|
|
1511
1547
|
return true;
|
|
1512
1548
|
}
|
|
@@ -1527,20 +1563,23 @@ var validateWindInterSection = function validateWindInterSection(speed, gust, di
|
|
|
1527
1563
|
}; // Main validation function
|
|
1528
1564
|
|
|
1529
1565
|
|
|
1530
|
-
var validateWindField = function validateWindField(value) {
|
|
1531
|
-
var
|
|
1566
|
+
var validateWindField = function validateWindField(value, weatherfield1, weatherfield2, weatherfield3) {
|
|
1567
|
+
var trimmedWindValue = value.trim();
|
|
1568
|
+
var trimmedWeather1Value = weatherfield1.trim();
|
|
1569
|
+
var trimmedWeather2Value = weatherfield2.trim();
|
|
1570
|
+
var trimmedWeather3Value = weatherfield3.trim();
|
|
1532
1571
|
|
|
1533
|
-
if (!
|
|
1572
|
+
if (!trimmedWindValue.length) {
|
|
1534
1573
|
return true;
|
|
1535
1574
|
} // Validate length and ensure it doesn't contain any other characters than numbers and VRB P KT and G
|
|
1536
1575
|
|
|
1537
1576
|
|
|
1538
|
-
if (
|
|
1577
|
+
if (trimmedWindValue.length < 5 || trimmedWindValue.length > 12 || !trimmedWindValue.match(/^[0-9VRBPGKT]+$/)) {
|
|
1539
1578
|
return invalidWindMessage;
|
|
1540
1579
|
} // First validate individual sections
|
|
1541
1580
|
|
|
1542
1581
|
|
|
1543
|
-
var windValidationIndv = extractValidateWindSections(
|
|
1582
|
+
var windValidationIndv = extractValidateWindSections(trimmedWindValue, true);
|
|
1544
1583
|
|
|
1545
1584
|
if (windValidationIndv.validations.length !== 0) {
|
|
1546
1585
|
return windValidationIndv.validations.find(function (error) {
|
|
@@ -1549,7 +1588,7 @@ var validateWindField = function validateWindField(value) {
|
|
|
1549
1588
|
} // Then do any intersection validation
|
|
1550
1589
|
|
|
1551
1590
|
|
|
1552
|
-
return validateWindInterSection(windValidationIndv.speed, windValidationIndv.gust, windValidationIndv.direction);
|
|
1591
|
+
return validateWindInterSection(windValidationIndv.speed, windValidationIndv.gust, windValidationIndv.direction, trimmedWeather1Value, trimmedWeather2Value, trimmedWeather3Value);
|
|
1553
1592
|
};
|
|
1554
1593
|
|
|
1555
1594
|
var formatSingleCloud = function formatSingleCloud(value) {
|
|
@@ -1596,10 +1635,10 @@ var formatCloudsToString = function formatCloudsToString(clouds) {
|
|
|
1596
1635
|
var parseSingleCloud = function parseSingleCloud(value) {
|
|
1597
1636
|
if (!value) return null;
|
|
1598
1637
|
var trimmedCloud = value.trim();
|
|
1599
|
-
var cloudType = trimmedCloud.
|
|
1638
|
+
var cloudType = trimmedCloud.substring(6, 9);
|
|
1600
1639
|
return Object.assign({
|
|
1601
|
-
coverage: trimmedCloud.
|
|
1602
|
-
height: parseInt(trimmedCloud.
|
|
1640
|
+
coverage: trimmedCloud.substring(0, 3),
|
|
1641
|
+
height: parseInt(trimmedCloud.substring(3, 6), 10)
|
|
1603
1642
|
}, cloudType && {
|
|
1604
1643
|
type: cloudType
|
|
1605
1644
|
});
|
|
@@ -1615,20 +1654,22 @@ var parseCloudsToObject = function parseCloudsToObject(clouds) {
|
|
|
1615
1654
|
switch (key) {
|
|
1616
1655
|
case 'cloud1':
|
|
1617
1656
|
{
|
|
1618
|
-
|
|
1657
|
+
var trimmedValue = clouds[key].trim();
|
|
1658
|
+
|
|
1659
|
+
if (isVerticalVisibility(trimmedValue)) {
|
|
1619
1660
|
// Parse Vertical Visibility
|
|
1620
1661
|
return Object.assign(Object.assign({}, list), _defineProperty({}, key, {
|
|
1621
|
-
verticalVisibility: parseInt(
|
|
1662
|
+
verticalVisibility: parseInt(trimmedValue.substring(2, 5), 10)
|
|
1622
1663
|
}));
|
|
1623
1664
|
}
|
|
1624
1665
|
|
|
1625
|
-
if (
|
|
1666
|
+
if (trimmedValue === 'NSC') {
|
|
1626
1667
|
// Parse No Significant Clouds
|
|
1627
|
-
return Object.assign(Object.assign({}, list), _defineProperty({}, key,
|
|
1668
|
+
return Object.assign(Object.assign({}, list), _defineProperty({}, key, trimmedValue));
|
|
1628
1669
|
} // Parse Cloud
|
|
1629
1670
|
|
|
1630
1671
|
|
|
1631
|
-
return Object.assign(Object.assign({}, list), _defineProperty({}, key, parseSingleCloud(
|
|
1672
|
+
return Object.assign(Object.assign({}, list), _defineProperty({}, key, parseSingleCloud(trimmedValue)));
|
|
1632
1673
|
}
|
|
1633
1674
|
|
|
1634
1675
|
default:
|
|
@@ -1656,16 +1697,19 @@ var invalidCloudHeightMessage = 'Invalid cloud height, expected a height consist
|
|
|
1656
1697
|
var invalidCloudHeightStepsMessage = 'Invalid cloud height, a height above 050 must be rounded to the nearest 1000ft';
|
|
1657
1698
|
var invalidCLoudTypeMessage = 'Invalid cloud type, expected CB or TCU';
|
|
1658
1699
|
var invalidHeightTypeCombinationMessage = 'Invalid cloud input, when cloud height is 050 or higher, CB or TCU is required';
|
|
1659
|
-
var invalidVerticalVisibilityMessage = 'Invalid vertical visibility, expected VV<value> with value consisting of 3 digits
|
|
1700
|
+
var invalidVerticalVisibilityMessage = 'Invalid vertical visibility, expected VV<value> with value consisting of 3 digits';
|
|
1701
|
+
var invalidVerticalVisibilityHeightMessage = 'Invalid vertical visibility, visibility should lie between 001 and 010';
|
|
1702
|
+
var invalidVerticalVisibilityHeightFGMessage = 'Invalid vertical visibility, in case of fog visibility should lie between 001 and 005';
|
|
1660
1703
|
var invalidCloudHeightComparedToPreviousMessage = 'Invalid cloud height, height must be greater than previous cloud group height';
|
|
1661
|
-
var invalidCloud2CoverageTypeCombinationMessage = 'Invalid cloud input, cloud
|
|
1704
|
+
var invalidCloud2CoverageTypeCombinationMessage = 'Invalid cloud input, for the second cloud group (excluding any significant convective cloud groups with CB/TCU) a coverage of FEW is not allowed';
|
|
1662
1705
|
var invalidCloud2WithVerticalVisibilityMessage = 'Invalid cloud input, cloud type is required when Vertical Visibility is given';
|
|
1663
|
-
var invalidCloud3CoverageTypeCombinationMessage = 'Invalid cloud input, cloud
|
|
1706
|
+
var invalidCloud3CoverageTypeCombinationMessage = 'Invalid cloud input, for the third cloud group (excluding any significant convective cloud groups with CB/TCU) a coverage of FEW or SCT is not allowed';
|
|
1664
1707
|
var invalidCloudWithVerticalVisibilityMessage = 'Invalid cloud input, third or fourth cloud group is not allowed when Vertical Visibility is given';
|
|
1665
1708
|
var invalidCloudWithPreviousEmptyCloud = 'Invalid cloud input, value is not allowed when previous cloud group is empty';
|
|
1666
1709
|
var invalidCloudWithNSCMessage = 'Invalid cloud input, other cloud groups are not allowed when No Significant Clouds is given';
|
|
1667
|
-
var
|
|
1668
|
-
var invalidCloudCAVOKMessage = 'Invalid cloud input, when CAVOK is used, cloud groups must be empty';
|
|
1710
|
+
var invalidCloudWithPreviousType = 'Invalid cloud input, only one significant convective cloud group with CB/TCU is allowed';
|
|
1711
|
+
var invalidCloudCAVOKMessage = 'Invalid cloud input, when CAVOK is used, cloud groups must be empty';
|
|
1712
|
+
var invalidCloud4TypeMissingMessage = 'Invalid cloud input for fourth group, CB or TCU required if no other significant convective cloud group present'; // validations
|
|
1669
1713
|
|
|
1670
1714
|
var isLengthValid = function isLengthValid(value) {
|
|
1671
1715
|
var onlyDigitsOrSpecificLetters = RegExp(/^[0-9FEWSCTBKNOVU]+$/);
|
|
@@ -1712,25 +1756,32 @@ var isHeightAllowedWithType = function isHeightAllowedWithType(height, type) {
|
|
|
1712
1756
|
};
|
|
1713
1757
|
|
|
1714
1758
|
var isVerticalVisibility = function isVerticalVisibility(value) {
|
|
1715
|
-
return value.
|
|
1759
|
+
return value.substring(0, 2) === 'VV';
|
|
1716
1760
|
};
|
|
1717
1761
|
|
|
1718
|
-
var isVerticalVisibilityValid = function isVerticalVisibilityValid(value) {
|
|
1762
|
+
var isVerticalVisibilityValid = function isVerticalVisibilityValid(value, weather1, weather2, weather3) {
|
|
1719
1763
|
// validate if its a number
|
|
1720
1764
|
if (!value.match(/^[0-9]+$/)) {
|
|
1721
|
-
return
|
|
1765
|
+
return invalidVerticalVisibilityMessage;
|
|
1722
1766
|
} // check if its 3 digits
|
|
1723
1767
|
|
|
1724
1768
|
|
|
1725
1769
|
if (value.length !== 3) {
|
|
1726
|
-
return
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1770
|
+
return invalidVerticalVisibilityMessage;
|
|
1771
|
+
}
|
|
1729
1772
|
|
|
1730
1773
|
var intValue = parseInt(value, 10);
|
|
1731
1774
|
|
|
1732
|
-
if (
|
|
1733
|
-
|
|
1775
|
+
if (weather1 !== 'FG' && weather2 !== 'FG' && weather3 !== 'FG') {
|
|
1776
|
+
// value should not be above 10
|
|
1777
|
+
if (intValue < 1 || intValue > 10) {
|
|
1778
|
+
return invalidVerticalVisibilityHeightMessage;
|
|
1779
|
+
}
|
|
1780
|
+
} else if (intValue < 1 || intValue > 5) {
|
|
1781
|
+
// Apply Dutch rule as national exception
|
|
1782
|
+
// In case of fog (FG) the vertical visibility can only be between VV001 up to and including VV005
|
|
1783
|
+
// HEIGHT_VV is: (001-(1)-005). Deze maxima zijn officiële Nederlandse afwijkingen van de WMO/ICAO regelgeving
|
|
1784
|
+
return invalidVerticalVisibilityHeightFGMessage;
|
|
1734
1785
|
}
|
|
1735
1786
|
|
|
1736
1787
|
return true;
|
|
@@ -1747,14 +1798,14 @@ var sharedCloudValidations = function sharedCloudValidations(_ref) {
|
|
|
1747
1798
|
} // Validate coverage
|
|
1748
1799
|
|
|
1749
1800
|
|
|
1750
|
-
var coverage = value.
|
|
1801
|
+
var coverage = value.substring(0, 3);
|
|
1751
1802
|
|
|
1752
1803
|
if (!isCoverageValid(coverage)) {
|
|
1753
1804
|
errorMessages.push(invalidCloudCoverageMessage);
|
|
1754
1805
|
} // Validate height
|
|
1755
1806
|
|
|
1756
1807
|
|
|
1757
|
-
var height = value.
|
|
1808
|
+
var height = value.substring(3, 6);
|
|
1758
1809
|
var isValidHeight = isHeightValid(height);
|
|
1759
1810
|
|
|
1760
1811
|
if (isValidHeight !== true) {
|
|
@@ -1763,7 +1814,7 @@ var sharedCloudValidations = function sharedCloudValidations(_ref) {
|
|
|
1763
1814
|
} // Validate type
|
|
1764
1815
|
|
|
1765
1816
|
|
|
1766
|
-
var type = value.
|
|
1817
|
+
var type = value.substring(6, 9);
|
|
1767
1818
|
|
|
1768
1819
|
if (!isTypeValid(type)) {
|
|
1769
1820
|
errorMessages.push(invalidCLoudTypeMessage);
|
|
@@ -1782,41 +1833,40 @@ var sharedCloudValidations = function sharedCloudValidations(_ref) {
|
|
|
1782
1833
|
};
|
|
1783
1834
|
};
|
|
1784
1835
|
|
|
1785
|
-
var validateFirstCloud = function validateFirstCloud(value, visibilityValue) {
|
|
1786
|
-
var
|
|
1836
|
+
var validateFirstCloud = function validateFirstCloud(value, visibilityValue, weatherfield1, weatherfield2, weatherfield3) {
|
|
1837
|
+
var trimmedValueFirstCloud = value.trim();
|
|
1838
|
+
var trimmedValueVisibility = visibilityValue.trim();
|
|
1839
|
+
var trimmedWeather1Value = weatherfield1.trim();
|
|
1840
|
+
var trimmedWeather2Value = weatherfield2.trim();
|
|
1841
|
+
var trimmedWeather3Value = weatherfield3.trim(); // Field can be left empty
|
|
1787
1842
|
|
|
1788
|
-
if (!
|
|
1843
|
+
if (!trimmedValueFirstCloud.length) {
|
|
1789
1844
|
return true;
|
|
1790
1845
|
}
|
|
1791
1846
|
|
|
1792
|
-
if (
|
|
1847
|
+
if (trimmedValueFirstCloud && trimmedValueVisibility === 'CAVOK') {
|
|
1793
1848
|
return invalidCloudCAVOKMessage;
|
|
1794
1849
|
} // Check for No Signicant Clouds
|
|
1795
1850
|
|
|
1796
1851
|
|
|
1797
|
-
if (
|
|
1852
|
+
if (trimmedValueFirstCloud === 'NSC') {
|
|
1798
1853
|
return true;
|
|
1799
1854
|
} // Validate Vertical Visibility
|
|
1800
1855
|
|
|
1801
1856
|
|
|
1802
|
-
if (isVerticalVisibility(
|
|
1857
|
+
if (isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1803
1858
|
if ( // Validate length of 5
|
|
1804
|
-
|
|
1805
|
-
!
|
|
1859
|
+
trimmedValueFirstCloud.length !== 5 || // Ensure it only contains digits or VV
|
|
1860
|
+
!trimmedValueFirstCloud.match(/^[0-9V]+$/)) {
|
|
1806
1861
|
return invalidVerticalVisibilityMessage;
|
|
1807
1862
|
}
|
|
1808
1863
|
|
|
1809
|
-
var verticalVisibilityValue =
|
|
1810
|
-
|
|
1811
|
-
if (!isVerticalVisibilityValid(verticalVisibilityValue)) {
|
|
1812
|
-
return invalidVerticalVisibilityMessage;
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
return true;
|
|
1864
|
+
var verticalVisibilityValue = trimmedValueFirstCloud.substring(2, 5);
|
|
1865
|
+
return isVerticalVisibilityValid(verticalVisibilityValue, trimmedWeather1Value, trimmedWeather2Value, trimmedWeather3Value);
|
|
1816
1866
|
}
|
|
1817
1867
|
|
|
1818
1868
|
var _sharedCloudValidatio = sharedCloudValidations({
|
|
1819
|
-
value:
|
|
1869
|
+
value: trimmedValueFirstCloud,
|
|
1820
1870
|
canBeNSC: true
|
|
1821
1871
|
}),
|
|
1822
1872
|
errorMessages = _sharedCloudValidatio.errorMessages; // Return first error if any
|
|
@@ -1825,15 +1875,26 @@ var validateFirstCloud = function validateFirstCloud(value, visibilityValue) {
|
|
|
1825
1875
|
return errorMessages.length ? errorMessages[0] : true;
|
|
1826
1876
|
};
|
|
1827
1877
|
var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCloudValue, visibilityValue) {
|
|
1828
|
-
var
|
|
1878
|
+
var trimmedValueFirstCloud = firstCloudValue.trim();
|
|
1879
|
+
var trimmedValueSecondCloud = secondCloudValue.trim(); // Field can be left empty
|
|
1829
1880
|
|
|
1830
|
-
if (!
|
|
1881
|
+
if (!trimmedValueSecondCloud.length) {
|
|
1831
1882
|
return true;
|
|
1883
|
+
} // If Cloud1 is NSC, Cloud2 has to be empty
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
if (trimmedValueFirstCloud === 'NSC' && trimmedValueSecondCloud !== '') {
|
|
1887
|
+
return invalidCloudWithNSCMessage;
|
|
1888
|
+
} // If Cloud1 is empty Cloud2 should be empty
|
|
1889
|
+
|
|
1890
|
+
|
|
1891
|
+
if (trimmedValueFirstCloud === '') {
|
|
1892
|
+
return invalidCloudWithPreviousEmptyCloud;
|
|
1832
1893
|
} // Generic validations
|
|
1833
1894
|
|
|
1834
1895
|
|
|
1835
1896
|
var _sharedCloudValidatio2 = sharedCloudValidations({
|
|
1836
|
-
value:
|
|
1897
|
+
value: trimmedValueSecondCloud
|
|
1837
1898
|
}),
|
|
1838
1899
|
coverage = _sharedCloudValidatio2.coverage,
|
|
1839
1900
|
height = _sharedCloudValidatio2.height,
|
|
@@ -1843,32 +1904,32 @@ var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCl
|
|
|
1843
1904
|
|
|
1844
1905
|
if (errorMessages.length) {
|
|
1845
1906
|
return errorMessages[0];
|
|
1846
|
-
} // Cloud2 specific validations
|
|
1847
|
-
// Without type, coverage can not be FEW
|
|
1907
|
+
} // Cloud2 specific validations - only to be applied when cloud1 does not contain type CB/TCU
|
|
1848
1908
|
|
|
1849
1909
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1910
|
+
var typeCloud1 = trimmedValueFirstCloud.substring(6, 9);
|
|
1911
|
+
|
|
1912
|
+
if (typeCloud1 !== 'CB' && typeCloud1 !== 'TCU') {
|
|
1913
|
+
// Without a type specified in cloud group 1, this group counts as #2 and coverage can not be FEW
|
|
1914
|
+
if (type === '' && coverage === 'FEW') {
|
|
1915
|
+
return invalidCloud2CoverageTypeCombinationMessage;
|
|
1916
|
+
}
|
|
1852
1917
|
} // If Cloud1 is not valid, skip further validation of Cloud2
|
|
1918
|
+
// No need to pass the weatherfields as their content does not influence what happens below
|
|
1853
1919
|
|
|
1854
1920
|
|
|
1855
|
-
if (validateFirstCloud(
|
|
1921
|
+
if (validateFirstCloud(trimmedValueFirstCloud, visibilityValue, '', '', '') !== true) {
|
|
1856
1922
|
return true;
|
|
1857
|
-
} // If Cloud1
|
|
1923
|
+
} // If Cloud1 contains a type, Cloud2 cannot contain a type
|
|
1858
1924
|
|
|
1859
1925
|
|
|
1860
|
-
if (
|
|
1861
|
-
return
|
|
1862
|
-
} // If Cloud1 is empty Cloud2 should be empty
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
if (firstCloudValue === '') {
|
|
1866
|
-
return invalidCloudWithPreviousEmptyCloud;
|
|
1926
|
+
if (type !== '' && typeCloud1 !== '') {
|
|
1927
|
+
return invalidCloudWithPreviousType;
|
|
1867
1928
|
} // Cloud2 height has to be greater than Cloud1 height
|
|
1868
1929
|
|
|
1869
1930
|
|
|
1870
|
-
if (!isVerticalVisibility(
|
|
1871
|
-
var cloud1Height =
|
|
1931
|
+
if (!isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1932
|
+
var cloud1Height = trimmedValueFirstCloud.substring(3, 6);
|
|
1872
1933
|
|
|
1873
1934
|
if (height <= cloud1Height) {
|
|
1874
1935
|
return invalidCloudHeightComparedToPreviousMessage;
|
|
@@ -1876,22 +1937,34 @@ var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCl
|
|
|
1876
1937
|
} // If Cloud1 contains Vertical Visibility then Cloud2 type is required
|
|
1877
1938
|
|
|
1878
1939
|
|
|
1879
|
-
if (isVerticalVisibility(
|
|
1940
|
+
if (isVerticalVisibility(trimmedValueFirstCloud) && type === '') {
|
|
1880
1941
|
return invalidCloud2WithVerticalVisibilityMessage;
|
|
1881
1942
|
}
|
|
1882
1943
|
|
|
1883
1944
|
return true;
|
|
1884
1945
|
};
|
|
1885
1946
|
var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondCloudValue, thirdCloudValue, visibilityValue) {
|
|
1886
|
-
var
|
|
1947
|
+
var trimmedValueFirstCloud = firstCloudValue.trim();
|
|
1948
|
+
var trimmedValueSecondCloud = secondCloudValue.trim();
|
|
1949
|
+
var trimmedValueThirdCloud = thirdCloudValue.trim(); // Field can be left empty
|
|
1887
1950
|
|
|
1888
|
-
if (!
|
|
1951
|
+
if (!trimmedValueThirdCloud.length) {
|
|
1889
1952
|
return true;
|
|
1953
|
+
} // If Cloud1 is NSC, Cloud3 has to be empty
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
if (trimmedValueFirstCloud === 'NSC' && trimmedValueThirdCloud !== '') {
|
|
1957
|
+
return invalidCloudWithNSCMessage;
|
|
1958
|
+
} // If Cloud1 or Cloud2 is empty Cloud3 should be empty
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
if (trimmedValueFirstCloud === '' || trimmedValueSecondCloud === '') {
|
|
1962
|
+
return invalidCloudWithPreviousEmptyCloud;
|
|
1890
1963
|
} // Generic validations
|
|
1891
1964
|
|
|
1892
1965
|
|
|
1893
1966
|
var _sharedCloudValidatio3 = sharedCloudValidations({
|
|
1894
|
-
value:
|
|
1967
|
+
value: trimmedValueThirdCloud
|
|
1895
1968
|
}),
|
|
1896
1969
|
coverage = _sharedCloudValidatio3.coverage,
|
|
1897
1970
|
height = _sharedCloudValidatio3.height,
|
|
@@ -1902,45 +1975,45 @@ var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondClou
|
|
|
1902
1975
|
if (errorMessages.length) {
|
|
1903
1976
|
return errorMessages[0];
|
|
1904
1977
|
} // Cloud3 specific validations
|
|
1905
|
-
// Without type, coverage can not be FEW or SCT
|
|
1978
|
+
// Without a type specified in cloud group 1 or 2, this group counts as #3 and coverage can not be FEW or SCT
|
|
1906
1979
|
|
|
1907
1980
|
|
|
1908
|
-
|
|
1909
|
-
|
|
1981
|
+
var typeCloud1 = trimmedValueFirstCloud.substring(6, 9);
|
|
1982
|
+
var typeCloud2 = trimmedValueSecondCloud.substring(6, 9);
|
|
1983
|
+
|
|
1984
|
+
if (typeCloud1 !== 'CB' && typeCloud1 !== 'TCU' && typeCloud2 !== 'CB' && typeCloud2 !== 'TCU') {
|
|
1985
|
+
if (type === '' && (coverage === 'FEW' || coverage === 'SCT')) {
|
|
1986
|
+
return invalidCloud3CoverageTypeCombinationMessage;
|
|
1987
|
+
}
|
|
1988
|
+
} else if (type === '' && coverage === 'FEW') {
|
|
1989
|
+
// In case we do have a CB/TCU group in one of the previous clouf groups. This cloudgroup should be evaluated as if it was the second group
|
|
1990
|
+
return invalidCloud2CoverageTypeCombinationMessage;
|
|
1910
1991
|
} // If Cloud1 is not valid, skip further validation of Cloud3
|
|
1992
|
+
// No need to pass the weatherfields as their content does not influence what happens below
|
|
1993
|
+
// Since in case of VV the third field should be empty anyways
|
|
1911
1994
|
|
|
1912
1995
|
|
|
1913
|
-
if (validateFirstCloud(
|
|
1996
|
+
if (validateFirstCloud(trimmedValueFirstCloud, visibilityValue, '', '', '') !== true) {
|
|
1914
1997
|
return true;
|
|
1915
|
-
} // If Cloud1 is empty Cloud3 should be empty
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
if (firstCloudValue === '') {
|
|
1919
|
-
return invalidCloudWithPreviousEmptyCloud;
|
|
1920
1998
|
} // If Cloud1 contains Vertical Visibility then Cloud3 should be empty
|
|
1921
1999
|
|
|
1922
2000
|
|
|
1923
|
-
if (isVerticalVisibility(
|
|
2001
|
+
if (isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1924
2002
|
return invalidCloudWithVerticalVisibilityMessage;
|
|
1925
|
-
} // If Cloud1 is NSC, Cloud3 has to be empty
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
if (firstCloudValue === 'NSC' && trimmedValue !== '') {
|
|
1929
|
-
return invalidCloudWithNSCMessage;
|
|
1930
2003
|
} // If Cloud2 is not valid, skip further validation of Cloud3
|
|
1931
2004
|
|
|
1932
2005
|
|
|
1933
|
-
if (validateSecondCloud(
|
|
2006
|
+
if (validateSecondCloud(trimmedValueFirstCloud, trimmedValueSecondCloud, visibilityValue) !== true) {
|
|
1934
2007
|
return true;
|
|
1935
|
-
} // If
|
|
2008
|
+
} // If one of the previous groups contains a type, Cloud3 cannot contain a type
|
|
1936
2009
|
|
|
1937
2010
|
|
|
1938
|
-
if (
|
|
1939
|
-
return
|
|
2011
|
+
if (type !== '' && (typeCloud1 !== '' || typeCloud2 !== '')) {
|
|
2012
|
+
return invalidCloudWithPreviousType;
|
|
1940
2013
|
} // Cloud3 height has to be greater than Cloud2 height
|
|
1941
2014
|
|
|
1942
2015
|
|
|
1943
|
-
var cloud2Height =
|
|
2016
|
+
var cloud2Height = trimmedValueSecondCloud.substring(3, 6);
|
|
1944
2017
|
|
|
1945
2018
|
if (height <= cloud2Height) {
|
|
1946
2019
|
return invalidCloudHeightComparedToPreviousMessage;
|
|
@@ -1949,17 +2022,31 @@ var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondClou
|
|
|
1949
2022
|
return true;
|
|
1950
2023
|
};
|
|
1951
2024
|
var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCloudValue, thirdCloudValue, fourthCloudValue, visibilityValue) {
|
|
1952
|
-
var
|
|
2025
|
+
var trimmedValueFirstCloud = firstCloudValue.trim();
|
|
2026
|
+
var trimmedValueSecondCloud = secondCloudValue.trim();
|
|
2027
|
+
var trimmedValueThirdCloud = thirdCloudValue.trim();
|
|
2028
|
+
var trimmedValueFourthCloud = fourthCloudValue.trim(); // Field can be left empty
|
|
1953
2029
|
|
|
1954
|
-
if (!
|
|
2030
|
+
if (!trimmedValueFourthCloud.length) {
|
|
1955
2031
|
return true;
|
|
2032
|
+
} // If Cloud1 is NSC, Cloud4 has to be empty
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
if (trimmedValueFirstCloud === 'NSC' && trimmedValueFourthCloud !== '') {
|
|
2036
|
+
return invalidCloudWithNSCMessage;
|
|
2037
|
+
} // If Cloud 1, 2 or 3 is empty Cloud4 should be empty
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
if (trimmedValueFirstCloud === '' || trimmedValueSecondCloud === '' || trimmedValueThirdCloud === '') {
|
|
2041
|
+
return invalidCloudWithPreviousEmptyCloud;
|
|
1956
2042
|
} // Generic validations
|
|
1957
2043
|
|
|
1958
2044
|
|
|
1959
2045
|
var _sharedCloudValidatio4 = sharedCloudValidations({
|
|
1960
|
-
value:
|
|
2046
|
+
value: trimmedValueFourthCloud
|
|
1961
2047
|
}),
|
|
1962
2048
|
height = _sharedCloudValidatio4.height,
|
|
2049
|
+
coverage = _sharedCloudValidatio4.coverage,
|
|
1963
2050
|
type = _sharedCloudValidatio4.type,
|
|
1964
2051
|
errorMessages = _sharedCloudValidatio4.errorMessages; // Return generic errors if any
|
|
1965
2052
|
|
|
@@ -1967,50 +2054,48 @@ var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCl
|
|
|
1967
2054
|
if (errorMessages.length) {
|
|
1968
2055
|
return errorMessages[0];
|
|
1969
2056
|
} // Cloud4 specific validations
|
|
1970
|
-
//
|
|
2057
|
+
// If none of the previous cloud groups contains a type, the fourth group must contain a type if not empty
|
|
2058
|
+
|
|
1971
2059
|
|
|
2060
|
+
var typeCloud1 = trimmedValueFirstCloud.substring(6, 9);
|
|
2061
|
+
var typeCloud2 = trimmedValueSecondCloud.substring(6, 9);
|
|
2062
|
+
var typeCloud3 = trimmedValueThirdCloud.substring(6, 9);
|
|
1972
2063
|
|
|
1973
|
-
if (
|
|
1974
|
-
|
|
2064
|
+
if (typeCloud1 !== 'CB' && typeCloud1 !== 'TCU' && typeCloud2 !== 'CB' && typeCloud2 !== 'TCU' && typeCloud3 !== 'CB' && typeCloud3 !== 'TCU') {
|
|
2065
|
+
if (type === '') {
|
|
2066
|
+
return invalidCloud4TypeMissingMessage;
|
|
2067
|
+
}
|
|
2068
|
+
} else if (coverage === 'FEW' || coverage === 'SCT') {
|
|
2069
|
+
// We have a CB/TCU group in one of the previous cloud groups. This group should be evaluated as if it was the third group
|
|
2070
|
+
return invalidCloud3CoverageTypeCombinationMessage;
|
|
1975
2071
|
} // If Cloud1 is not valid, skip further validation of Cloud4
|
|
2072
|
+
// No need to pass the weatherfields as their content does not influence what happens below
|
|
2073
|
+
// Since in case of VV the fourth field should be empty anyways
|
|
1976
2074
|
|
|
1977
2075
|
|
|
1978
|
-
if (validateFirstCloud(
|
|
2076
|
+
if (validateFirstCloud(trimmedValueFirstCloud, visibilityValue, '', '', '') !== true) {
|
|
1979
2077
|
return true;
|
|
1980
2078
|
} // If Cloud1 contains Vertical Visibility then Cloud4 should be empty
|
|
1981
2079
|
|
|
1982
2080
|
|
|
1983
|
-
if (isVerticalVisibility(
|
|
2081
|
+
if (isVerticalVisibility(trimmedValueFirstCloud)) {
|
|
1984
2082
|
return invalidCloudWithVerticalVisibilityMessage;
|
|
1985
|
-
} // If Cloud1 is NSC, Cloud4 has to be empty
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
if (firstCloudValue === 'NSC' && trimmedValue !== '') {
|
|
1989
|
-
return invalidCloudWithNSCMessage;
|
|
1990
|
-
} // If Cloud 1, 2 or 3 is empty Cloud4 should be empty
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
if (firstCloudValue === '' || secondCloudValue === '' || thirdCloudValue === '') {
|
|
1994
|
-
return invalidCloudWithPreviousEmptyCloud;
|
|
1995
2083
|
} // If Cloud3 is not valid, skip further validation of Cloud4
|
|
1996
2084
|
|
|
1997
2085
|
|
|
1998
|
-
if (validateThirdCloud(
|
|
2086
|
+
if (validateThirdCloud(trimmedValueFirstCloud, trimmedValueSecondCloud, trimmedValueThirdCloud, visibilityValue) !== true) {
|
|
1999
2087
|
return true;
|
|
2000
|
-
} // If
|
|
2001
|
-
|
|
2088
|
+
} // If one of the previous groups contains a type, Cloud4 cannot contain a type
|
|
2002
2089
|
|
|
2003
|
-
var cloud3Type = thirdCloudValue.substr(6, 3);
|
|
2004
2090
|
|
|
2005
|
-
if (
|
|
2006
|
-
return
|
|
2091
|
+
if (type !== '' && (typeCloud1 !== '' || typeCloud2 !== '' || typeCloud3 !== '')) {
|
|
2092
|
+
return invalidCloudWithPreviousType;
|
|
2007
2093
|
} // Cloud4 height has to be greater than Cloud3 height
|
|
2008
2094
|
|
|
2009
2095
|
|
|
2010
|
-
var cloud3Height =
|
|
2096
|
+
var cloud3Height = trimmedValueThirdCloud.substring(3, 6);
|
|
2011
2097
|
|
|
2012
2098
|
if (height <= cloud3Height) {
|
|
2013
|
-
// Because of the type validations this is automatically enforced for Cloud4, so impossible to end up here but leaving the check in just in case
|
|
2014
2099
|
return invalidCloudHeightComparedToPreviousMessage;
|
|
2015
2100
|
}
|
|
2016
2101
|
|
|
@@ -2855,11 +2940,40 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2855
2940
|
return true;
|
|
2856
2941
|
}, [index, isChangeGroup, getValues]);
|
|
2857
2942
|
|
|
2858
|
-
var
|
|
2859
|
-
var
|
|
2860
|
-
var
|
|
2861
|
-
|
|
2862
|
-
|
|
2943
|
+
var getFieldFromRow = function getFieldFromRow(fieldname, rowIndex) {
|
|
2944
|
+
var indexedFieldName = "changeGroups[".concat(rowIndex, "].").concat(fieldname);
|
|
2945
|
+
var rowValue = getValues(indexedFieldName);
|
|
2946
|
+
return rowValue ? [indexedFieldName] : [];
|
|
2947
|
+
};
|
|
2948
|
+
|
|
2949
|
+
var getValidFieldFromNextRow = function getValidFieldFromNextRow() {
|
|
2950
|
+
return getFieldFromRow('valid', index + 1);
|
|
2951
|
+
};
|
|
2952
|
+
|
|
2953
|
+
var validateNextRows = React__default.useCallback(function () {
|
|
2954
|
+
if (isChangeGroup) {
|
|
2955
|
+
var _getValues2 = getValues(),
|
|
2956
|
+
validDateEnd = _getValues2.validDateEnd,
|
|
2957
|
+
validDateStart = _getValues2.validDateStart,
|
|
2958
|
+
changeGroups = _getValues2.changeGroups;
|
|
2959
|
+
|
|
2960
|
+
var currentChangeGroup = changeGroups[index];
|
|
2961
|
+
var nextChangeGroups = changeGroups.slice(index + 1);
|
|
2962
|
+
return validateOverlapWithFM(currentChangeGroup, nextChangeGroups, validDateStart, validDateEnd);
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
return true;
|
|
2966
|
+
}, [index, isChangeGroup, getValues]);
|
|
2967
|
+
|
|
2968
|
+
var getPreviousValidFields = function getPreviousValidFields(rowIndex) {
|
|
2969
|
+
var _getValues3 = getValues(),
|
|
2970
|
+
changeGroups = _getValues3.changeGroups;
|
|
2971
|
+
|
|
2972
|
+
var previousChangeGroups = changeGroups.slice(0, rowIndex);
|
|
2973
|
+
var validFields = previousChangeGroups.map(function (_element, index) {
|
|
2974
|
+
return getFieldFromRow('valid', index)[0];
|
|
2975
|
+
});
|
|
2976
|
+
return validFields;
|
|
2863
2977
|
};
|
|
2864
2978
|
|
|
2865
2979
|
var addChangeGroup = React__default.useCallback(function () {
|
|
@@ -2908,7 +3022,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2908
3022
|
}],
|
|
2909
3023
|
onBlur: function onBlur() {
|
|
2910
3024
|
if (isChangeGroup) {
|
|
2911
|
-
var nextValidFieldName =
|
|
3025
|
+
var nextValidFieldName = getValidFieldFromNextRow();
|
|
2912
3026
|
trigger([].concat(_toConsumableArray(subFields), _toConsumableArray(mainOptionalFields), _toConsumableArray(mainFields), _toConsumableArray(nextValidFieldName)));
|
|
2913
3027
|
}
|
|
2914
3028
|
}
|
|
@@ -2938,8 +3052,9 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2938
3052
|
}],
|
|
2939
3053
|
onBlur: function onBlur() {
|
|
2940
3054
|
if (isChangeGroup) {
|
|
2941
|
-
var nextValidFieldName =
|
|
2942
|
-
|
|
3055
|
+
var nextValidFieldName = getValidFieldFromNextRow();
|
|
3056
|
+
var previousValidFieldNames = getPreviousValidFields(index);
|
|
3057
|
+
trigger([].concat(_toConsumableArray(subFields), _toConsumableArray(mainOptionalFields), _toConsumableArray(mainFields), _toConsumableArray(nextValidFieldName), _toConsumableArray(previousValidFieldNames)));
|
|
2943
3058
|
}
|
|
2944
3059
|
}
|
|
2945
3060
|
})), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
@@ -2957,13 +3072,15 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2957
3072
|
validateValidChangeGroupInterField: function validateValidChangeGroupInterField$1(value) {
|
|
2958
3073
|
return isChangeGroup ? validateValidChangeGroupInterField(value, getValues(fieldNames.change), getValues('validDateStart'), getValues('validDateEnd')) : true;
|
|
2959
3074
|
},
|
|
2960
|
-
validatePreviousRow: validatePreviousRow
|
|
3075
|
+
validatePreviousRow: validatePreviousRow,
|
|
3076
|
+
validateNextRows: validateNextRows
|
|
2961
3077
|
}
|
|
2962
3078
|
},
|
|
2963
3079
|
onBlur: function onBlur() {
|
|
2964
3080
|
if (isChangeGroup) {
|
|
2965
|
-
var nextValidFieldName =
|
|
2966
|
-
|
|
3081
|
+
var nextValidFieldName = getValidFieldFromNextRow();
|
|
3082
|
+
var previousValidFieldNames = getPreviousValidFields(index);
|
|
3083
|
+
trigger([].concat(_toConsumableArray(subFields), _toConsumableArray(mainOptionalFields), _toConsumableArray(mainFields), _toConsumableArray(nextValidFieldName), _toConsumableArray(previousValidFieldNames)));
|
|
2967
3084
|
}
|
|
2968
3085
|
}
|
|
2969
3086
|
}), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
@@ -2977,7 +3094,9 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2977
3094
|
return _validateRequiredMainFields(value, 'Wind');
|
|
2978
3095
|
},
|
|
2979
3096
|
validateRequiredSub: validateRequiredSub,
|
|
2980
|
-
validateWindField: validateWindField
|
|
3097
|
+
validateWindField: function validateWindField$1(value) {
|
|
3098
|
+
return validateWindField(value, getValues(fieldNames.weather1), getValues(fieldNames.weather2), getValues(fieldNames.weather3));
|
|
3099
|
+
}
|
|
2981
3100
|
}
|
|
2982
3101
|
},
|
|
2983
3102
|
onBlur: function onBlur() {
|
|
@@ -3026,7 +3145,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3026
3145
|
},
|
|
3027
3146
|
onBlur: function onBlur() {
|
|
3028
3147
|
var fields = isChangeGroup ? [].concat(_toConsumableArray(subFields), _toConsumableArray(mainFields)) : [];
|
|
3029
|
-
return trigger([].concat(_toConsumableArray(fields), [fieldNames.weather2, fieldNames.weather3]));
|
|
3148
|
+
return trigger([].concat(_toConsumableArray(fields), [fieldNames.weather2, fieldNames.weather3, fieldNames.wind, fieldNames.cloud1]));
|
|
3030
3149
|
}
|
|
3031
3150
|
}), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3032
3151
|
label: "Weather",
|
|
@@ -3042,7 +3161,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3042
3161
|
},
|
|
3043
3162
|
onBlur: function onBlur() {
|
|
3044
3163
|
var fields = isChangeGroup ? [].concat(_toConsumableArray(subFields), _toConsumableArray(mainFields)) : [];
|
|
3045
|
-
return trigger([].concat(_toConsumableArray(fields), [fieldNames.weather3]));
|
|
3164
|
+
return trigger([].concat(_toConsumableArray(fields), [fieldNames.weather3, fieldNames.wind, fieldNames.cloud1]));
|
|
3046
3165
|
}
|
|
3047
3166
|
}), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3048
3167
|
label: "Weather",
|
|
@@ -3055,6 +3174,9 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3055
3174
|
return validateThirdWeatherField(getValues(fieldNames.weather1), getValues(fieldNames.weather2), value, getValues(fieldNames.visibility));
|
|
3056
3175
|
}
|
|
3057
3176
|
}
|
|
3177
|
+
},
|
|
3178
|
+
onBlur: function onBlur() {
|
|
3179
|
+
return trigger([fieldNames.wind, fieldNames.cloud1]);
|
|
3058
3180
|
}
|
|
3059
3181
|
}), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3060
3182
|
label: "Cloud",
|
|
@@ -3068,7 +3190,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3068
3190
|
},
|
|
3069
3191
|
validateRequiredSub: validateRequiredSub,
|
|
3070
3192
|
validateFirstCloud: function validateFirstCloud$1(value) {
|
|
3071
|
-
return validateFirstCloud(value, getValues(fieldNames.visibility));
|
|
3193
|
+
return validateFirstCloud(value, getValues(fieldNames.visibility), getValues(fieldNames.weather1), getValues(fieldNames.weather2), getValues(fieldNames.weather3));
|
|
3072
3194
|
}
|
|
3073
3195
|
}
|
|
3074
3196
|
},
|
|
@@ -3139,7 +3261,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3139
3261
|
return onRemoveChangeGroup(index);
|
|
3140
3262
|
}
|
|
3141
3263
|
}, lastRow ? {
|
|
3142
|
-
tabIndex:
|
|
3264
|
+
tabIndex: -1
|
|
3143
3265
|
} : {}), /*#__PURE__*/React__default.createElement(Delete, null))));
|
|
3144
3266
|
});
|
|
3145
3267
|
|