@opengeoweb/taf 4.12.0 → 4.13.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.
- package/README.md +0 -0
- package/index.d.ts +0 -0
- package/index.esm.js +116 -92
- package/index.umd.js +129 -106
- package/lib/TafDemo.stories.d.ts +0 -0
- package/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +0 -0
- package/lib/components/ComponentsLookUp/ComponentsLookUp.spec.d.ts +0 -0
- package/lib/components/ComponentsLookUp/index.d.ts +0 -0
- package/lib/components/IssuesPane/IssuesButton.d.ts +0 -0
- package/lib/components/IssuesPane/IssuesButton.spec.d.ts +0 -0
- package/lib/components/IssuesPane/IssuesPane.d.ts +0 -0
- package/lib/components/IssuesPane/IssuesPane.spec.d.ts +0 -0
- package/lib/components/IssuesPane/IssuesPane.stories.d.ts +0 -0
- package/lib/components/IssuesPane/IssuesPaneWrapper.d.ts +0 -0
- package/lib/components/IssuesPane/IssuesPaneWrapper.spec.d.ts +0 -0
- package/lib/components/IssuesPane/index.d.ts +0 -0
- package/lib/components/IssuesPane/types.d.ts +0 -0
- package/lib/components/IssuesPane/utils.d.ts +0 -0
- package/lib/components/IssuesPane/utils.spec.d.ts +0 -0
- package/lib/components/Providers/Providers.d.ts +0 -0
- package/lib/components/Providers/index.d.ts +0 -0
- package/lib/components/Spinner/Spinner.d.ts +0 -0
- package/lib/components/Spinner/Spinner.spec.d.ts +0 -0
- package/lib/components/Spinner/Spinner.stories.d.ts +0 -0
- package/lib/components/StatusIcon/StatusIcon.d.ts +0 -0
- package/lib/components/StatusIcon/StatusIcon.spec.d.ts +0 -0
- package/lib/components/SwitchButton/SwitchButton.d.ts +0 -0
- package/lib/components/SwitchButton/SwitchButton.spec.d.ts +0 -0
- package/lib/components/SwitchButton/index.d.ts +0 -0
- package/lib/components/TabPanel/TabPanel.d.ts +0 -0
- package/lib/components/TabPanel/TabPanel.spec.d.ts +0 -0
- package/lib/components/TabPanel/index.d.ts +0 -0
- package/lib/components/TafAvatar/TafAvatar.d.ts +0 -0
- package/lib/components/TafAvatar/index.d.ts +0 -0
- package/lib/components/TafForm/TafForm.d.ts +0 -0
- package/lib/components/TafForm/TafForm.spec.d.ts +0 -0
- package/lib/components/TafForm/TafForm.statusChanges.spec.d.ts +0 -0
- package/lib/components/TafForm/TafForm.stories.d.ts +0 -0
- package/lib/components/TafForm/TafFormButtons/TafFormButtons.d.ts +0 -0
- package/lib/components/TafForm/TafFormButtons/TafFormButtons.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.d.ts +0 -0
- package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/DragHandle.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/DragHandle.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/TafFormRow.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/TafFormRow.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/TafFormTextField.d.ts +5 -1
- package/lib/components/TafForm/TafFormRow/TafFormTextField.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/types.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/change.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/change.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/clouds.d.ts +3 -3
- package/lib/components/TafForm/TafFormRow/validations/clouds.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/probability.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/probability.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/utils.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/utils.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/validField.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/validField.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/visibility.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/visibility.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/weather.d.ts +3 -3
- package/lib/components/TafForm/TafFormRow/validations/weather.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/wind.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/validations/wind.spec.d.ts +0 -0
- package/lib/components/TafForm/index.d.ts +0 -0
- package/lib/components/TafForm/utils.d.ts +0 -0
- package/lib/components/TafForm/utils.spec.d.ts +0 -0
- package/lib/components/TafHeader/TafHeader.d.ts +0 -0
- package/lib/components/TafHeader/TafHeader.spec.d.ts +0 -0
- package/lib/components/TafLayout/LastUpdateTime/LastUpdateTime.d.ts +0 -0
- package/lib/components/TafLayout/LastUpdateTime/LastUpdateTime.spec.d.ts +0 -0
- package/lib/components/TafLayout/LastUpdateTime/LastUpdateTime.stories.d.ts +0 -0
- package/lib/components/TafLayout/LastUpdateTime/index.d.ts +0 -0
- package/lib/components/TafLayout/LocationTabs/LocationTabs.d.ts +0 -0
- package/lib/components/TafLayout/LocationTabs/LocationTabs.spec.d.ts +0 -0
- package/lib/components/TafLayout/LocationTabs/LocationTabs.stories.d.ts +0 -0
- package/lib/components/TafLayout/LocationTabs/index.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/AdverseWeatherTacMessage.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/AdverseWeatherTacMessage.spec.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/AdverseWeatherTacMessage.stories.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/ExportButton.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/ExportButton.spec.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacContainer.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacContainer.spec.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.spec.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.stories.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.spec.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.stories.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/index.d.ts +0 -0
- package/lib/components/TafLayout/TafLayout.d.ts +0 -0
- package/lib/components/TafLayout/TafLayout.spec.d.ts +0 -0
- package/lib/components/TafLayout/TafLayout.stories.d.ts +0 -0
- package/lib/components/TafLayout/TafPanel/TafPanel.d.ts +0 -0
- package/lib/components/TafLayout/TafPanel/TafPanel.spec.d.ts +0 -0
- package/lib/components/TafLayout/TafPanel/TafPanel.stories.d.ts +0 -0
- package/lib/components/TafLayout/TafPanel/index.d.ts +0 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +0 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.spec.d.ts +0 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.stories.d.ts +0 -0
- package/lib/components/TafLayout/TopTabs/index.d.ts +0 -0
- package/lib/components/TafLayout/utils.d.ts +0 -0
- package/lib/components/TafLayout/utils.spec.d.ts +0 -0
- package/lib/components/TafModule/TafModule.d.ts +0 -0
- package/lib/components/TafModule/TafModule.spec.d.ts +0 -0
- package/lib/components/TafModule/TafModule.stories.d.ts +0 -0
- package/lib/components/TafModule/TafModuleProvider.d.ts +0 -0
- package/lib/components/TafModule/index.d.ts +0 -0
- package/lib/components/TafWrapper/TafWrapper.d.ts +0 -0
- package/lib/components/TafWrapper/TafWrapper.spec.d.ts +0 -0
- package/lib/components/TafWrapper/index.d.ts +0 -0
- package/lib/storyshots/Storyshots.spec.d.ts +0 -0
- package/lib/types.d.ts +0 -0
- package/lib/utils/__mocks__/api.d.ts +0 -0
- package/lib/utils/api.d.ts +0 -0
- package/lib/utils/api.spec.d.ts +0 -0
- package/lib/utils/fakeApi.d.ts +0 -0
- package/lib/utils/fakeApi.spec.d.ts +0 -0
- package/lib/utils/mockdata/fakeTafList.d.ts +0 -0
- package/lib/utils/weatherPhenomena.d.ts +0 -0
- package/package.json +10 -9
package/README.md
CHANGED
|
File without changes
|
package/index.d.ts
CHANGED
|
File without changes
|
package/index.esm.js
CHANGED
|
@@ -13,6 +13,7 @@ import moment from 'moment';
|
|
|
13
13
|
import { isEqual } from 'lodash';
|
|
14
14
|
import { DragHandle as DragHandle$1, ThumbsUp, Add, Delete, Close, Clock, Cancel, Success, Edit, Export, ListItem, Cached } from '@opengeoweb/theme';
|
|
15
15
|
import ReactDOM from 'react-dom';
|
|
16
|
+
import { useTheme } from '@emotion/react';
|
|
16
17
|
import { useApiContext, createApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
17
18
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
18
19
|
import Box$1 from '@mui/material/Box';
|
|
@@ -322,8 +323,34 @@ var TafFormButtons = function TafFormButtons(_ref2) {
|
|
|
322
323
|
* See the License for the specific language governing permissions and
|
|
323
324
|
* limitations under the License.
|
|
324
325
|
*
|
|
325
|
-
* Copyright
|
|
326
|
-
* Copyright
|
|
326
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
327
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
328
|
+
* */
|
|
329
|
+
var prependZeroes = function prependZeroes(value, totalDigits) {
|
|
330
|
+
var valueAsString = value.toString();
|
|
331
|
+
return _toConsumableArray(Array(totalDigits - valueAsString.length)).reduce(function (newVal) {
|
|
332
|
+
return "0".concat(newVal);
|
|
333
|
+
}, valueAsString);
|
|
334
|
+
};
|
|
335
|
+
var getFieldValue = function getFieldValue(fieldValue) {
|
|
336
|
+
return fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.trim().toUpperCase();
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
/* *
|
|
340
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
341
|
+
* you may not use this file except in compliance with the License.
|
|
342
|
+
* You may obtain a copy of the License at
|
|
343
|
+
*
|
|
344
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
345
|
+
*
|
|
346
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
347
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
348
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
349
|
+
* See the License for the specific language governing permissions and
|
|
350
|
+
* limitations under the License.
|
|
351
|
+
*
|
|
352
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
353
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
327
354
|
* */
|
|
328
355
|
var FORMAT_DAYS_HOURS = 'DDHH';
|
|
329
356
|
var FORMAT_DAYS_HOURS_MINUTES = 'DDHHmm'; // formatters
|
|
@@ -457,7 +484,7 @@ var validateIsValidDates = function validateIsValidDates(value, tafStart, tafEnd
|
|
|
457
484
|
|
|
458
485
|
|
|
459
486
|
var validateValidField = function validateValidField(value, tafStart, tafEnd) {
|
|
460
|
-
var trimmedValue = value
|
|
487
|
+
var trimmedValue = getFieldValue(value);
|
|
461
488
|
|
|
462
489
|
if (!trimmedValue.length) {
|
|
463
490
|
return true;
|
|
@@ -480,9 +507,9 @@ var validateValidField = function validateValidField(value, tafStart, tafEnd) {
|
|
|
480
507
|
return true;
|
|
481
508
|
};
|
|
482
509
|
var validateValidChangeGroupInterField = function validateValidChangeGroupInterField(value, valueChange, valueProb, tafStart, tafEnd) {
|
|
483
|
-
var trimmedValue = value
|
|
484
|
-
var trimmedValueChange = valueChange
|
|
485
|
-
var trimmedValueProb = valueProb
|
|
510
|
+
var trimmedValue = getFieldValue(value);
|
|
511
|
+
var trimmedValueChange = getFieldValue(valueChange);
|
|
512
|
+
var trimmedValueProb = getFieldValue(valueProb);
|
|
486
513
|
|
|
487
514
|
if (!trimmedValue.length) {
|
|
488
515
|
return true;
|
|
@@ -532,16 +559,12 @@ var invalidPreviousChangeGroupOrderMessage = "When valid times are equal, the ch
|
|
|
532
559
|
var invalidPreviousChangeGroupHasSameValue = "When valid times are equal, probability/change can't have the same value as previous row value";
|
|
533
560
|
var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentChangeGroup, previousChangeGroup, tafStart, tafEnd) {
|
|
534
561
|
// extract the needed values from changeGroups
|
|
535
|
-
var valid = currentChangeGroup.valid
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
var
|
|
541
|
-
_previousChangeGroup$ = previousChangeGroup.change,
|
|
542
|
-
previousChange = _previousChangeGroup$ === void 0 ? '' : _previousChangeGroup$,
|
|
543
|
-
_previousChangeGroup$2 = previousChangeGroup.probability,
|
|
544
|
-
previousProbability = _previousChangeGroup$2 === void 0 ? '' : _previousChangeGroup$2; // get the parsed values
|
|
562
|
+
var valid = getFieldValue(currentChangeGroup.valid);
|
|
563
|
+
var change = getFieldValue(currentChangeGroup.change || '');
|
|
564
|
+
var probability = getFieldValue(currentChangeGroup.probability || '');
|
|
565
|
+
var previousValid = getFieldValue(previousChangeGroup.valid);
|
|
566
|
+
var previousChange = getFieldValue(previousChangeGroup.change || '');
|
|
567
|
+
var previousProbability = getFieldValue(previousChangeGroup.probability || ''); // get the parsed values
|
|
545
568
|
|
|
546
569
|
var validValue = parseValidToObject(valid, tafStart, tafEnd);
|
|
547
570
|
var previousValidValue = parseValidToObject(previousValid, tafStart, tafEnd);
|
|
@@ -578,12 +601,12 @@ var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentCh
|
|
|
578
601
|
}; // validate overlapping validity when one of the following changegroups is FM
|
|
579
602
|
|
|
580
603
|
var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, nextChangeGroups, tafStart, tafEnd) {
|
|
581
|
-
var valid = currentChangeGroup.valid;
|
|
604
|
+
var valid = getFieldValue(currentChangeGroup.valid);
|
|
582
605
|
if (!valid || !nextChangeGroups.length) return true;
|
|
583
606
|
var validValue = parseValidToObject(valid, tafStart, tafEnd);
|
|
584
607
|
var currentRowEndTime = moment(validValue.end);
|
|
585
608
|
var firstFMChangeGroup = nextChangeGroups.find(function (nextChangeGroup) {
|
|
586
|
-
return nextChangeGroup.change
|
|
609
|
+
return getFieldValue(nextChangeGroup.change) === 'FM';
|
|
587
610
|
});
|
|
588
611
|
|
|
589
612
|
if (firstFMChangeGroup && firstFMChangeGroup.valid) {
|
|
@@ -598,32 +621,6 @@ var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, n
|
|
|
598
621
|
return true;
|
|
599
622
|
};
|
|
600
623
|
|
|
601
|
-
/* *
|
|
602
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
603
|
-
* you may not use this file except in compliance with the License.
|
|
604
|
-
* You may obtain a copy of the License at
|
|
605
|
-
*
|
|
606
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
607
|
-
*
|
|
608
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
609
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
610
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
611
|
-
* See the License for the specific language governing permissions and
|
|
612
|
-
* limitations under the License.
|
|
613
|
-
*
|
|
614
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
615
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
616
|
-
* */
|
|
617
|
-
var prependZeroes = function prependZeroes(value, totalDigits) {
|
|
618
|
-
var valueAsString = value.toString();
|
|
619
|
-
return _toConsumableArray(Array(totalDigits - valueAsString.length)).reduce(function (newVal) {
|
|
620
|
-
return "0".concat(newVal);
|
|
621
|
-
}, valueAsString);
|
|
622
|
-
};
|
|
623
|
-
var getFieldValue = function getFieldValue(fieldValue) {
|
|
624
|
-
return fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.trim().toUpperCase();
|
|
625
|
-
};
|
|
626
|
-
|
|
627
624
|
var config$1 = [{
|
|
628
625
|
key: 'range',
|
|
629
626
|
size: 4
|
|
@@ -653,7 +650,7 @@ var formatVisibilityToString = function formatVisibilityToString(value) {
|
|
|
653
650
|
// returns object with validity if passed numbers - returns object with cavOK: true if passed CAVOK
|
|
654
651
|
|
|
655
652
|
var parseVisibilityToObject = function parseVisibilityToObject(value) {
|
|
656
|
-
var trimmedValue = value
|
|
653
|
+
var trimmedValue = getFieldValue(value);
|
|
657
654
|
|
|
658
655
|
if (trimmedValue === 'CAVOK') {
|
|
659
656
|
return {
|
|
@@ -701,7 +698,7 @@ var validateRange = function validateRange(value) {
|
|
|
701
698
|
|
|
702
699
|
|
|
703
700
|
var validateVisibilityField = function validateVisibilityField(value) {
|
|
704
|
-
var trimmedValue = value
|
|
701
|
+
var trimmedValue = getFieldValue(value);
|
|
705
702
|
|
|
706
703
|
if (!trimmedValue.length) {
|
|
707
704
|
return true;
|
|
@@ -714,7 +711,7 @@ var validateVisibilityField = function validateVisibilityField(value) {
|
|
|
714
711
|
|
|
715
712
|
|
|
716
713
|
if (!trimmedValue.match(/^[0-9]+$/)) {
|
|
717
|
-
return
|
|
714
|
+
return trimmedValue === 'CAVOK' || invalidVisibilityMessage;
|
|
718
715
|
} // validate range
|
|
719
716
|
|
|
720
717
|
|
|
@@ -1180,9 +1177,10 @@ var invalidWeatherBRVisibility = 'Invalid weather input, weather code BR needs t
|
|
|
1180
1177
|
var invalidWeatherFGVisibility = 'Invalid weather input, weather code FG needs to be combined with a visibility below 1000m'; // validations
|
|
1181
1178
|
|
|
1182
1179
|
var WeatherVisibilityBelow5000 = [WeatherPhenomena.FU, WeatherPhenomena.DU, WeatherPhenomena.HZ, WeatherPhenomena.DRDU, WeatherPhenomena.BLDU];
|
|
1183
|
-
var validateWeatherField = function validateWeatherField(value,
|
|
1180
|
+
var validateWeatherField = function validateWeatherField(value, visibilityFieldValue) {
|
|
1184
1181
|
var NSWAllowed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1185
|
-
var trimmedValue = value
|
|
1182
|
+
var trimmedValue = getFieldValue(value);
|
|
1183
|
+
var visibilityValue = getFieldValue(visibilityFieldValue); // if empty, validate as true
|
|
1186
1184
|
|
|
1187
1185
|
if (trimmedValue === '') {
|
|
1188
1186
|
return true;
|
|
@@ -1221,14 +1219,15 @@ var validateWeatherField = function validateWeatherField(value, visibilityValue)
|
|
|
1221
1219
|
|
|
1222
1220
|
return true;
|
|
1223
1221
|
};
|
|
1224
|
-
var validateSecondWeatherField = function validateSecondWeatherField(weather1Value, weather2Value,
|
|
1225
|
-
var trimmedWeather2Value = weather2Value
|
|
1222
|
+
var validateSecondWeatherField = function validateSecondWeatherField(weather1Value, weather2Value, visibilityFieldValue) {
|
|
1223
|
+
var trimmedWeather2Value = getFieldValue(weather2Value);
|
|
1224
|
+
var visibilityValue = getFieldValue(visibilityFieldValue); // Field can be left empty
|
|
1226
1225
|
|
|
1227
1226
|
if (!trimmedWeather2Value.length) {
|
|
1228
1227
|
return true;
|
|
1229
1228
|
}
|
|
1230
1229
|
|
|
1231
|
-
var trimmedWeather1Value = weather1Value
|
|
1230
|
+
var trimmedWeather1Value = getFieldValue(weather1Value); // If weather1 is NSW weather2 should be empty
|
|
1232
1231
|
|
|
1233
1232
|
if (trimmedWeather1Value === 'NSW' && trimmedWeather2Value !== '') {
|
|
1234
1233
|
return invalidWeatherNonEmptyNSWGroups;
|
|
@@ -1246,15 +1245,16 @@ var validateSecondWeatherField = function validateSecondWeatherField(weather1Val
|
|
|
1246
1245
|
|
|
1247
1246
|
return validateWeatherField(weather2Value, visibilityValue, false);
|
|
1248
1247
|
};
|
|
1249
|
-
var validateThirdWeatherField = function validateThirdWeatherField(weather1Value, weather2Value, weather3Value,
|
|
1250
|
-
var trimmedWeather3Value = weather3Value
|
|
1248
|
+
var validateThirdWeatherField = function validateThirdWeatherField(weather1Value, weather2Value, weather3Value, visibilityFieldValue) {
|
|
1249
|
+
var trimmedWeather3Value = getFieldValue(weather3Value);
|
|
1250
|
+
var visibilityValue = getFieldValue(visibilityFieldValue); // Field can be left empty
|
|
1251
1251
|
|
|
1252
1252
|
if (!trimmedWeather3Value.length) {
|
|
1253
1253
|
return true;
|
|
1254
1254
|
}
|
|
1255
1255
|
|
|
1256
|
-
var trimmedWeather1Value = weather1Value
|
|
1257
|
-
var trimmedWeather2Value = weather2Value
|
|
1256
|
+
var trimmedWeather1Value = getFieldValue(weather1Value);
|
|
1257
|
+
var trimmedWeather2Value = getFieldValue(weather2Value); // If weather1 is NSW weather3 should be empty
|
|
1258
1258
|
|
|
1259
1259
|
if (trimmedWeather1Value === 'NSW' && trimmedWeather3Value !== '') {
|
|
1260
1260
|
return invalidWeatherNonEmptyNSWGroups;
|
|
@@ -1617,10 +1617,10 @@ var validateWindInterSection = function validateWindInterSection(speed, gust, di
|
|
|
1617
1617
|
|
|
1618
1618
|
|
|
1619
1619
|
var validateWindField = function validateWindField(value, weatherfield1, weatherfield2, weatherfield3) {
|
|
1620
|
-
var trimmedWindValue = value
|
|
1621
|
-
var trimmedWeather1Value = weatherfield1
|
|
1622
|
-
var trimmedWeather2Value = weatherfield2
|
|
1623
|
-
var trimmedWeather3Value = weatherfield3
|
|
1620
|
+
var trimmedWindValue = getFieldValue(value);
|
|
1621
|
+
var trimmedWeather1Value = getFieldValue(weatherfield1);
|
|
1622
|
+
var trimmedWeather2Value = getFieldValue(weatherfield2);
|
|
1623
|
+
var trimmedWeather3Value = getFieldValue(weatherfield3);
|
|
1624
1624
|
|
|
1625
1625
|
if (!trimmedWindValue.length) {
|
|
1626
1626
|
return true;
|
|
@@ -1887,11 +1887,11 @@ var sharedCloudValidations = function sharedCloudValidations(_ref) {
|
|
|
1887
1887
|
};
|
|
1888
1888
|
|
|
1889
1889
|
var validateFirstCloud = function validateFirstCloud(value, visibilityValue, weatherfield1, weatherfield2, weatherfield3) {
|
|
1890
|
-
var trimmedValueFirstCloud = value
|
|
1891
|
-
var trimmedValueVisibility = visibilityValue
|
|
1892
|
-
var trimmedWeather1Value = weatherfield1
|
|
1893
|
-
var trimmedWeather2Value = weatherfield2
|
|
1894
|
-
var trimmedWeather3Value = weatherfield3
|
|
1890
|
+
var trimmedValueFirstCloud = getFieldValue(value);
|
|
1891
|
+
var trimmedValueVisibility = getFieldValue(visibilityValue);
|
|
1892
|
+
var trimmedWeather1Value = getFieldValue(weatherfield1);
|
|
1893
|
+
var trimmedWeather2Value = getFieldValue(weatherfield2);
|
|
1894
|
+
var trimmedWeather3Value = getFieldValue(weatherfield3); // Field can be left empty
|
|
1895
1895
|
|
|
1896
1896
|
if (!trimmedValueFirstCloud.length) {
|
|
1897
1897
|
return true;
|
|
@@ -1927,9 +1927,10 @@ var validateFirstCloud = function validateFirstCloud(value, visibilityValue, wea
|
|
|
1927
1927
|
|
|
1928
1928
|
return errorMessages.length ? errorMessages[0] : true;
|
|
1929
1929
|
};
|
|
1930
|
-
var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCloudValue,
|
|
1931
|
-
var trimmedValueFirstCloud = firstCloudValue
|
|
1932
|
-
var trimmedValueSecondCloud = secondCloudValue
|
|
1930
|
+
var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCloudValue, visibilityFieldValue) {
|
|
1931
|
+
var trimmedValueFirstCloud = getFieldValue(firstCloudValue);
|
|
1932
|
+
var trimmedValueSecondCloud = getFieldValue(secondCloudValue);
|
|
1933
|
+
var visibilityValue = getFieldValue(visibilityFieldValue); // Field can be left empty
|
|
1933
1934
|
|
|
1934
1935
|
if (!trimmedValueSecondCloud.length) {
|
|
1935
1936
|
return true;
|
|
@@ -1996,10 +1997,11 @@ var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCl
|
|
|
1996
1997
|
|
|
1997
1998
|
return true;
|
|
1998
1999
|
};
|
|
1999
|
-
var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondCloudValue, thirdCloudValue,
|
|
2000
|
-
var trimmedValueFirstCloud = firstCloudValue
|
|
2001
|
-
var trimmedValueSecondCloud = secondCloudValue
|
|
2002
|
-
var trimmedValueThirdCloud = thirdCloudValue
|
|
2000
|
+
var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondCloudValue, thirdCloudValue, visibilityFieldValue) {
|
|
2001
|
+
var trimmedValueFirstCloud = getFieldValue(firstCloudValue);
|
|
2002
|
+
var trimmedValueSecondCloud = getFieldValue(secondCloudValue);
|
|
2003
|
+
var trimmedValueThirdCloud = getFieldValue(thirdCloudValue);
|
|
2004
|
+
var visibilityValue = getFieldValue(visibilityFieldValue); // Field can be left empty
|
|
2003
2005
|
|
|
2004
2006
|
if (!trimmedValueThirdCloud.length) {
|
|
2005
2007
|
return true;
|
|
@@ -2074,11 +2076,12 @@ var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondClou
|
|
|
2074
2076
|
|
|
2075
2077
|
return true;
|
|
2076
2078
|
};
|
|
2077
|
-
var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCloudValue, thirdCloudValue, fourthCloudValue,
|
|
2078
|
-
var trimmedValueFirstCloud = firstCloudValue
|
|
2079
|
-
var trimmedValueSecondCloud = secondCloudValue
|
|
2080
|
-
var trimmedValueThirdCloud = thirdCloudValue
|
|
2081
|
-
var trimmedValueFourthCloud = fourthCloudValue
|
|
2079
|
+
var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCloudValue, thirdCloudValue, fourthCloudValue, visibilityFieldValue) {
|
|
2080
|
+
var trimmedValueFirstCloud = getFieldValue(firstCloudValue);
|
|
2081
|
+
var trimmedValueSecondCloud = getFieldValue(secondCloudValue);
|
|
2082
|
+
var trimmedValueThirdCloud = getFieldValue(thirdCloudValue);
|
|
2083
|
+
var trimmedValueFourthCloud = getFieldValue(fourthCloudValue);
|
|
2084
|
+
var visibilityValue = getFieldValue(visibilityFieldValue); // Field can be left empty
|
|
2082
2085
|
|
|
2083
2086
|
if (!trimmedValueFourthCloud.length) {
|
|
2084
2087
|
return true;
|
|
@@ -3257,7 +3260,7 @@ var TafAvatar = function TafAvatar(_ref) {
|
|
|
3257
3260
|
}, getInitials(editor))));
|
|
3258
3261
|
};
|
|
3259
3262
|
|
|
3260
|
-
var textFieldStyle = function textFieldStyle(theme) {
|
|
3263
|
+
var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
|
|
3261
3264
|
return {
|
|
3262
3265
|
// input
|
|
3263
3266
|
marginRight: '2px',
|
|
@@ -3266,6 +3269,7 @@ var textFieldStyle = function textFieldStyle(theme) {
|
|
|
3266
3269
|
height: 46,
|
|
3267
3270
|
input: {
|
|
3268
3271
|
textAlign: 'center',
|
|
3272
|
+
textTransform: shouldPreventUppercase ? 'none' : 'uppercase',
|
|
3269
3273
|
fontSize: 10,
|
|
3270
3274
|
fontWeight: 500,
|
|
3271
3275
|
paddingLeft: 0,
|
|
@@ -3330,11 +3334,17 @@ var getTafErrors = function getTafErrors(name, errors) {
|
|
|
3330
3334
|
var getDisplayValue = function getDisplayValue(value, disabled) {
|
|
3331
3335
|
return disabled && !value ? '-' : value;
|
|
3332
3336
|
};
|
|
3333
|
-
var BaseTextField = /*#__PURE__*/React__default.memo(function (
|
|
3337
|
+
var BaseTextField = /*#__PURE__*/React__default.memo(function (_a) {
|
|
3338
|
+
var _a$shouldPreventUpper = _a.shouldPreventUppercase,
|
|
3339
|
+
shouldPreventUppercase = _a$shouldPreventUpper === void 0 ? false : _a$shouldPreventUpper,
|
|
3340
|
+
props = __rest(_a, ["shouldPreventUppercase"]);
|
|
3341
|
+
|
|
3342
|
+
var theme = useTheme();
|
|
3343
|
+
var styling = textFieldStyle(theme, shouldPreventUppercase);
|
|
3334
3344
|
return /*#__PURE__*/React__default.createElement(TextField, Object.assign({
|
|
3335
3345
|
type: "text",
|
|
3336
3346
|
variant: "filled",
|
|
3337
|
-
sx:
|
|
3347
|
+
sx: styling
|
|
3338
3348
|
}, props));
|
|
3339
3349
|
}, function (prevProps, nextProps) {
|
|
3340
3350
|
return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name && prevProps.disabled === nextProps.disabled;
|
|
@@ -3358,7 +3368,9 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
3358
3368
|
_ref$autoComplete = _ref.autoComplete,
|
|
3359
3369
|
autoComplete = _ref$autoComplete === void 0 ? [] : _ref$autoComplete,
|
|
3360
3370
|
_ref$autoFocus = _ref.autoFocus,
|
|
3361
|
-
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus
|
|
3371
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
3372
|
+
_ref$shouldPreventUpp = _ref.shouldPreventUppercase,
|
|
3373
|
+
shouldPreventUppercase = _ref$shouldPreventUpp === void 0 ? false : _ref$shouldPreventUpp;
|
|
3362
3374
|
|
|
3363
3375
|
var _useFormContext = useFormContext(),
|
|
3364
3376
|
control = _useFormContext.control,
|
|
@@ -3395,9 +3407,10 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
3395
3407
|
}
|
|
3396
3408
|
}, [name, autoComplete, setValue]);
|
|
3397
3409
|
var onChangeField = React__default.useCallback(function (event, callback) {
|
|
3398
|
-
var
|
|
3410
|
+
var value = event.currentTarget.value;
|
|
3399
3411
|
|
|
3400
3412
|
if (autoComplete) {
|
|
3413
|
+
var valueUppercase = value.toUpperCase();
|
|
3401
3414
|
var exist = autoComplete.find(function (e) {
|
|
3402
3415
|
return e.value === valueUppercase;
|
|
3403
3416
|
});
|
|
@@ -3405,13 +3418,22 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
3405
3418
|
setMaxLength(newMaxLength);
|
|
3406
3419
|
}
|
|
3407
3420
|
|
|
3408
|
-
callback(
|
|
3409
|
-
onChange(
|
|
3421
|
+
callback(value);
|
|
3422
|
+
onChange(value);
|
|
3410
3423
|
}, [onChange, autoComplete]);
|
|
3411
|
-
var onBlurField = React__default.useCallback(function (callback) {
|
|
3424
|
+
var onBlurField = React__default.useCallback(function (event, callback) {
|
|
3425
|
+
var value = event.target.value;
|
|
3426
|
+
var valueUppercase = value.toUpperCase();
|
|
3427
|
+
|
|
3428
|
+
if (value !== valueUppercase && !shouldPreventUppercase) {
|
|
3429
|
+
setValue(name, valueUppercase, {
|
|
3430
|
+
shouldValidate: true
|
|
3431
|
+
});
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3412
3434
|
callback();
|
|
3413
3435
|
onBlur();
|
|
3414
|
-
}, [onBlur]);
|
|
3436
|
+
}, [onBlur, name, setValue, shouldPreventUppercase]);
|
|
3415
3437
|
var hasError = !!fieldErrors;
|
|
3416
3438
|
return /*#__PURE__*/React__default.createElement(Controller, {
|
|
3417
3439
|
render: function render(_ref2) {
|
|
@@ -3423,18 +3445,19 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
3423
3445
|
name: name,
|
|
3424
3446
|
value: displayValue,
|
|
3425
3447
|
inputRef: field.ref,
|
|
3426
|
-
onChange: function onChange(
|
|
3427
|
-
return onChangeField(
|
|
3448
|
+
onChange: function onChange(event) {
|
|
3449
|
+
return onChangeField(event, field.onChange);
|
|
3428
3450
|
},
|
|
3429
3451
|
onKeyDown: onKeyDown,
|
|
3430
3452
|
error: hasError,
|
|
3431
|
-
onBlur: function onBlur() {
|
|
3432
|
-
return onBlurField(field.onBlur);
|
|
3453
|
+
onBlur: function onBlur(event) {
|
|
3454
|
+
return onBlurField(event, field.onBlur);
|
|
3433
3455
|
},
|
|
3434
3456
|
inputProps: {
|
|
3435
3457
|
maxLength: maxLength
|
|
3436
3458
|
},
|
|
3437
|
-
autoFocus: autoFocus
|
|
3459
|
+
autoFocus: autoFocus,
|
|
3460
|
+
shouldPreventUppercase: shouldPreventUppercase
|
|
3438
3461
|
});
|
|
3439
3462
|
},
|
|
3440
3463
|
name: name,
|
|
@@ -3750,7 +3773,8 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3750
3773
|
formatter: formatIssueTime,
|
|
3751
3774
|
label: "Issue time",
|
|
3752
3775
|
name: "issueDate",
|
|
3753
|
-
disabled: true
|
|
3776
|
+
disabled: true,
|
|
3777
|
+
shouldPreventUppercase: true
|
|
3754
3778
|
})), isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
3755
3779
|
sx: {
|
|
3756
3780
|
width: 56,
|