@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.
Files changed (123) hide show
  1. package/README.md +0 -0
  2. package/index.d.ts +0 -0
  3. package/index.esm.js +116 -92
  4. package/index.umd.js +129 -106
  5. package/lib/TafDemo.stories.d.ts +0 -0
  6. package/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +0 -0
  7. package/lib/components/ComponentsLookUp/ComponentsLookUp.spec.d.ts +0 -0
  8. package/lib/components/ComponentsLookUp/index.d.ts +0 -0
  9. package/lib/components/IssuesPane/IssuesButton.d.ts +0 -0
  10. package/lib/components/IssuesPane/IssuesButton.spec.d.ts +0 -0
  11. package/lib/components/IssuesPane/IssuesPane.d.ts +0 -0
  12. package/lib/components/IssuesPane/IssuesPane.spec.d.ts +0 -0
  13. package/lib/components/IssuesPane/IssuesPane.stories.d.ts +0 -0
  14. package/lib/components/IssuesPane/IssuesPaneWrapper.d.ts +0 -0
  15. package/lib/components/IssuesPane/IssuesPaneWrapper.spec.d.ts +0 -0
  16. package/lib/components/IssuesPane/index.d.ts +0 -0
  17. package/lib/components/IssuesPane/types.d.ts +0 -0
  18. package/lib/components/IssuesPane/utils.d.ts +0 -0
  19. package/lib/components/IssuesPane/utils.spec.d.ts +0 -0
  20. package/lib/components/Providers/Providers.d.ts +0 -0
  21. package/lib/components/Providers/index.d.ts +0 -0
  22. package/lib/components/Spinner/Spinner.d.ts +0 -0
  23. package/lib/components/Spinner/Spinner.spec.d.ts +0 -0
  24. package/lib/components/Spinner/Spinner.stories.d.ts +0 -0
  25. package/lib/components/StatusIcon/StatusIcon.d.ts +0 -0
  26. package/lib/components/StatusIcon/StatusIcon.spec.d.ts +0 -0
  27. package/lib/components/SwitchButton/SwitchButton.d.ts +0 -0
  28. package/lib/components/SwitchButton/SwitchButton.spec.d.ts +0 -0
  29. package/lib/components/SwitchButton/index.d.ts +0 -0
  30. package/lib/components/TabPanel/TabPanel.d.ts +0 -0
  31. package/lib/components/TabPanel/TabPanel.spec.d.ts +0 -0
  32. package/lib/components/TabPanel/index.d.ts +0 -0
  33. package/lib/components/TafAvatar/TafAvatar.d.ts +0 -0
  34. package/lib/components/TafAvatar/index.d.ts +0 -0
  35. package/lib/components/TafForm/TafForm.d.ts +0 -0
  36. package/lib/components/TafForm/TafForm.spec.d.ts +0 -0
  37. package/lib/components/TafForm/TafForm.statusChanges.spec.d.ts +0 -0
  38. package/lib/components/TafForm/TafForm.stories.d.ts +0 -0
  39. package/lib/components/TafForm/TafFormButtons/TafFormButtons.d.ts +0 -0
  40. package/lib/components/TafForm/TafFormButtons/TafFormButtons.spec.d.ts +0 -0
  41. package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.d.ts +0 -0
  42. package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.spec.d.ts +0 -0
  43. package/lib/components/TafForm/TafFormRow/DragHandle.d.ts +0 -0
  44. package/lib/components/TafForm/TafFormRow/DragHandle.spec.d.ts +0 -0
  45. package/lib/components/TafForm/TafFormRow/TafFormRow.d.ts +0 -0
  46. package/lib/components/TafForm/TafFormRow/TafFormRow.spec.d.ts +0 -0
  47. package/lib/components/TafForm/TafFormRow/TafFormTextField.d.ts +5 -1
  48. package/lib/components/TafForm/TafFormRow/TafFormTextField.spec.d.ts +0 -0
  49. package/lib/components/TafForm/TafFormRow/types.d.ts +0 -0
  50. package/lib/components/TafForm/TafFormRow/validations/change.d.ts +0 -0
  51. package/lib/components/TafForm/TafFormRow/validations/change.spec.d.ts +0 -0
  52. package/lib/components/TafForm/TafFormRow/validations/clouds.d.ts +3 -3
  53. package/lib/components/TafForm/TafFormRow/validations/clouds.spec.d.ts +0 -0
  54. package/lib/components/TafForm/TafFormRow/validations/probability.d.ts +0 -0
  55. package/lib/components/TafForm/TafFormRow/validations/probability.spec.d.ts +0 -0
  56. package/lib/components/TafForm/TafFormRow/validations/utils.d.ts +0 -0
  57. package/lib/components/TafForm/TafFormRow/validations/utils.spec.d.ts +0 -0
  58. package/lib/components/TafForm/TafFormRow/validations/validField.d.ts +0 -0
  59. package/lib/components/TafForm/TafFormRow/validations/validField.spec.d.ts +0 -0
  60. package/lib/components/TafForm/TafFormRow/validations/visibility.d.ts +0 -0
  61. package/lib/components/TafForm/TafFormRow/validations/visibility.spec.d.ts +0 -0
  62. package/lib/components/TafForm/TafFormRow/validations/weather.d.ts +3 -3
  63. package/lib/components/TafForm/TafFormRow/validations/weather.spec.d.ts +0 -0
  64. package/lib/components/TafForm/TafFormRow/validations/wind.d.ts +0 -0
  65. package/lib/components/TafForm/TafFormRow/validations/wind.spec.d.ts +0 -0
  66. package/lib/components/TafForm/index.d.ts +0 -0
  67. package/lib/components/TafForm/utils.d.ts +0 -0
  68. package/lib/components/TafForm/utils.spec.d.ts +0 -0
  69. package/lib/components/TafHeader/TafHeader.d.ts +0 -0
  70. package/lib/components/TafHeader/TafHeader.spec.d.ts +0 -0
  71. package/lib/components/TafLayout/LastUpdateTime/LastUpdateTime.d.ts +0 -0
  72. package/lib/components/TafLayout/LastUpdateTime/LastUpdateTime.spec.d.ts +0 -0
  73. package/lib/components/TafLayout/LastUpdateTime/LastUpdateTime.stories.d.ts +0 -0
  74. package/lib/components/TafLayout/LastUpdateTime/index.d.ts +0 -0
  75. package/lib/components/TafLayout/LocationTabs/LocationTabs.d.ts +0 -0
  76. package/lib/components/TafLayout/LocationTabs/LocationTabs.spec.d.ts +0 -0
  77. package/lib/components/TafLayout/LocationTabs/LocationTabs.stories.d.ts +0 -0
  78. package/lib/components/TafLayout/LocationTabs/index.d.ts +0 -0
  79. package/lib/components/TafLayout/TacOverview/AdverseWeatherTacMessage.d.ts +0 -0
  80. package/lib/components/TafLayout/TacOverview/AdverseWeatherTacMessage.spec.d.ts +0 -0
  81. package/lib/components/TafLayout/TacOverview/AdverseWeatherTacMessage.stories.d.ts +0 -0
  82. package/lib/components/TafLayout/TacOverview/ExportButton.d.ts +0 -0
  83. package/lib/components/TafLayout/TacOverview/ExportButton.spec.d.ts +0 -0
  84. package/lib/components/TafLayout/TacOverview/TacContainer.d.ts +0 -0
  85. package/lib/components/TafLayout/TacOverview/TacContainer.spec.d.ts +0 -0
  86. package/lib/components/TafLayout/TacOverview/TacOverview.d.ts +0 -0
  87. package/lib/components/TafLayout/TacOverview/TacOverview.spec.d.ts +0 -0
  88. package/lib/components/TafLayout/TacOverview/TacOverview.stories.d.ts +0 -0
  89. package/lib/components/TafLayout/TacOverview/TacOverviewMobile.d.ts +0 -0
  90. package/lib/components/TafLayout/TacOverview/TacOverviewMobile.spec.d.ts +0 -0
  91. package/lib/components/TafLayout/TacOverview/TacOverviewMobile.stories.d.ts +0 -0
  92. package/lib/components/TafLayout/TacOverview/index.d.ts +0 -0
  93. package/lib/components/TafLayout/TafLayout.d.ts +0 -0
  94. package/lib/components/TafLayout/TafLayout.spec.d.ts +0 -0
  95. package/lib/components/TafLayout/TafLayout.stories.d.ts +0 -0
  96. package/lib/components/TafLayout/TafPanel/TafPanel.d.ts +0 -0
  97. package/lib/components/TafLayout/TafPanel/TafPanel.spec.d.ts +0 -0
  98. package/lib/components/TafLayout/TafPanel/TafPanel.stories.d.ts +0 -0
  99. package/lib/components/TafLayout/TafPanel/index.d.ts +0 -0
  100. package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +0 -0
  101. package/lib/components/TafLayout/TopTabs/TopTabs.spec.d.ts +0 -0
  102. package/lib/components/TafLayout/TopTabs/TopTabs.stories.d.ts +0 -0
  103. package/lib/components/TafLayout/TopTabs/index.d.ts +0 -0
  104. package/lib/components/TafLayout/utils.d.ts +0 -0
  105. package/lib/components/TafLayout/utils.spec.d.ts +0 -0
  106. package/lib/components/TafModule/TafModule.d.ts +0 -0
  107. package/lib/components/TafModule/TafModule.spec.d.ts +0 -0
  108. package/lib/components/TafModule/TafModule.stories.d.ts +0 -0
  109. package/lib/components/TafModule/TafModuleProvider.d.ts +0 -0
  110. package/lib/components/TafModule/index.d.ts +0 -0
  111. package/lib/components/TafWrapper/TafWrapper.d.ts +0 -0
  112. package/lib/components/TafWrapper/TafWrapper.spec.d.ts +0 -0
  113. package/lib/components/TafWrapper/index.d.ts +0 -0
  114. package/lib/storyshots/Storyshots.spec.d.ts +0 -0
  115. package/lib/types.d.ts +0 -0
  116. package/lib/utils/__mocks__/api.d.ts +0 -0
  117. package/lib/utils/api.d.ts +0 -0
  118. package/lib/utils/api.spec.d.ts +0 -0
  119. package/lib/utils/fakeApi.d.ts +0 -0
  120. package/lib/utils/fakeApi.spec.d.ts +0 -0
  121. package/lib/utils/mockdata/fakeTafList.d.ts +0 -0
  122. package/lib/utils/weatherPhenomena.d.ts +0 -0
  123. package/package.json +10 -9
package/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('react-hook-form'), require('react-redux'), require('react-sortablejs'), require('sortablejs'), require('@opengeoweb/authentication'), require('@opengeoweb/form-fields'), require('@opengeoweb/shared'), require('@opengeoweb/core'), require('moment'), require('lodash'), require('@opengeoweb/theme'), require('react-dom'), require('@opengeoweb/api'), require('@mui/material/LinearProgress'), require('@mui/material/Box')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', 'react-hook-form', 'react-redux', 'react-sortablejs', 'sortablejs', '@opengeoweb/authentication', '@opengeoweb/form-fields', '@opengeoweb/shared', '@opengeoweb/core', 'moment', 'lodash', '@opengeoweb/theme', 'react-dom', '@opengeoweb/api', '@mui/material/LinearProgress', '@mui/material/Box'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.material, global.reactHookForm, global.reactRedux, global.reactSortablejs, global.Sortable, global.authentication, global.formFields, global.shared, global.core, global.moment, global.lodash, global.theme, global.ReactDOM, global.api, global.LinearProgress, global.Box));
5
- })(this, (function (exports, React, material, reactHookForm, reactRedux, reactSortablejs, Sortable, authentication, formFields, shared, core, moment, lodash, theme, ReactDOM, api, LinearProgress, Box) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('react-hook-form'), require('react-redux'), require('react-sortablejs'), require('sortablejs'), require('@opengeoweb/authentication'), require('@opengeoweb/form-fields'), require('@opengeoweb/shared'), require('@opengeoweb/core'), require('moment'), require('lodash'), require('@opengeoweb/theme'), require('react-dom'), require('@emotion/react'), require('@opengeoweb/api'), require('@mui/material/LinearProgress'), require('@mui/material/Box')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', 'react-hook-form', 'react-redux', 'react-sortablejs', 'sortablejs', '@opengeoweb/authentication', '@opengeoweb/form-fields', '@opengeoweb/shared', '@opengeoweb/core', 'moment', 'lodash', '@opengeoweb/theme', 'react-dom', '@emotion/react', '@opengeoweb/api', '@mui/material/LinearProgress', '@mui/material/Box'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.material, global.reactHookForm, global.reactRedux, global.reactSortablejs, global.Sortable, global.authentication, global.formFields, global.shared, global.core, global.moment, global.lodash, global.theme, global.ReactDOM, global.emotionReact, global.api, global.LinearProgress, global.Box));
5
+ })(this, (function (exports, React, material, reactHookForm, reactRedux, reactSortablejs, Sortable, authentication, formFields, shared, core, moment, lodash, theme, ReactDOM, react, api, LinearProgress, Box) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -316,8 +316,35 @@
316
316
  * See the License for the specific language governing permissions and
317
317
  * limitations under the License.
318
318
  *
319
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
320
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
319
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
320
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
321
+ * */
322
+
323
+ var prependZeroes = function prependZeroes(value, totalDigits) {
324
+ var valueAsString = value.toString();
325
+ return __spreadArray([], __read(Array(totalDigits - valueAsString.length))).reduce(function (newVal) {
326
+ return "0" + newVal;
327
+ }, valueAsString);
328
+ };
329
+ var getFieldValue = function getFieldValue(fieldValue) {
330
+ return fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.trim().toUpperCase();
331
+ };
332
+
333
+ /* *
334
+ * Licensed under the Apache License, Version 2.0 (the "License");
335
+ * you may not use this file except in compliance with the License.
336
+ * You may obtain a copy of the License at
337
+ *
338
+ * http://www.apache.org/licenses/LICENSE-2.0
339
+ *
340
+ * Unless required by applicable law or agreed to in writing, software
341
+ * distributed under the License is distributed on an "AS IS" BASIS,
342
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
343
+ * See the License for the specific language governing permissions and
344
+ * limitations under the License.
345
+ *
346
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
347
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
321
348
  * */
322
349
  var FORMAT_DAYS_HOURS = 'DDHH';
323
350
  var FORMAT_DAYS_HOURS_MINUTES = 'DDHHmm'; // formatters
@@ -451,7 +478,7 @@
451
478
 
452
479
 
453
480
  var validateValidField = function validateValidField(value, tafStart, tafEnd) {
454
- var trimmedValue = value.trim();
481
+ var trimmedValue = getFieldValue(value);
455
482
 
456
483
  if (!trimmedValue.length) {
457
484
  return true;
@@ -474,9 +501,9 @@
474
501
  return true;
475
502
  };
476
503
  var validateValidChangeGroupInterField = function validateValidChangeGroupInterField(value, valueChange, valueProb, tafStart, tafEnd) {
477
- var trimmedValue = value.trim();
478
- var trimmedValueChange = valueChange.trim();
479
- var trimmedValueProb = valueProb.trim();
504
+ var trimmedValue = getFieldValue(value);
505
+ var trimmedValueChange = getFieldValue(valueChange);
506
+ var trimmedValueProb = getFieldValue(valueProb);
480
507
 
481
508
  if (!trimmedValue.length) {
482
509
  return true;
@@ -526,16 +553,12 @@
526
553
  var invalidPreviousChangeGroupHasSameValue = "When valid times are equal, probability/change can't have the same value as previous row value";
527
554
  var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentChangeGroup, previousChangeGroup, tafStart, tafEnd) {
528
555
  // extract the needed values from changeGroups
529
- var valid = currentChangeGroup.valid,
530
- _a = currentChangeGroup.change,
531
- change = _a === void 0 ? '' : _a,
532
- _b = currentChangeGroup.probability,
533
- probability = _b === void 0 ? '' : _b;
534
- var previousValid = previousChangeGroup.valid,
535
- _c = previousChangeGroup.change,
536
- previousChange = _c === void 0 ? '' : _c,
537
- _d = previousChangeGroup.probability,
538
- previousProbability = _d === void 0 ? '' : _d; // get the parsed values
556
+ var valid = getFieldValue(currentChangeGroup.valid);
557
+ var change = getFieldValue(currentChangeGroup.change || '');
558
+ var probability = getFieldValue(currentChangeGroup.probability || '');
559
+ var previousValid = getFieldValue(previousChangeGroup.valid);
560
+ var previousChange = getFieldValue(previousChangeGroup.change || '');
561
+ var previousProbability = getFieldValue(previousChangeGroup.probability || ''); // get the parsed values
539
562
 
540
563
  var validValue = parseValidToObject(valid, tafStart, tafEnd);
541
564
  var previousValidValue = parseValidToObject(previousValid, tafStart, tafEnd);
@@ -572,12 +595,12 @@
572
595
  }; // validate overlapping validity when one of the following changegroups is FM
573
596
 
574
597
  var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, nextChangeGroups, tafStart, tafEnd) {
575
- var valid = currentChangeGroup.valid;
598
+ var valid = getFieldValue(currentChangeGroup.valid);
576
599
  if (!valid || !nextChangeGroups.length) return true;
577
600
  var validValue = parseValidToObject(valid, tafStart, tafEnd);
578
601
  var currentRowEndTime = moment__default["default"](validValue.end);
579
602
  var firstFMChangeGroup = nextChangeGroups.find(function (nextChangeGroup) {
580
- return nextChangeGroup.change.trim() === 'FM';
603
+ return getFieldValue(nextChangeGroup.change) === 'FM';
581
604
  });
582
605
 
583
606
  if (firstFMChangeGroup && firstFMChangeGroup.valid) {
@@ -592,33 +615,6 @@
592
615
  return true;
593
616
  };
594
617
 
595
- /* *
596
- * Licensed under the Apache License, Version 2.0 (the "License");
597
- * you may not use this file except in compliance with the License.
598
- * You may obtain a copy of the License at
599
- *
600
- * http://www.apache.org/licenses/LICENSE-2.0
601
- *
602
- * Unless required by applicable law or agreed to in writing, software
603
- * distributed under the License is distributed on an "AS IS" BASIS,
604
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
605
- * See the License for the specific language governing permissions and
606
- * limitations under the License.
607
- *
608
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
609
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
610
- * */
611
-
612
- var prependZeroes = function prependZeroes(value, totalDigits) {
613
- var valueAsString = value.toString();
614
- return __spreadArray([], __read(Array(totalDigits - valueAsString.length))).reduce(function (newVal) {
615
- return "0" + newVal;
616
- }, valueAsString);
617
- };
618
- var getFieldValue = function getFieldValue(fieldValue) {
619
- return fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.trim().toUpperCase();
620
- };
621
-
622
618
  var config$1 = [{
623
619
  key: 'range',
624
620
  size: 4
@@ -650,7 +646,7 @@
650
646
  // returns object with validity if passed numbers - returns object with cavOK: true if passed CAVOK
651
647
 
652
648
  var parseVisibilityToObject = function parseVisibilityToObject(value) {
653
- var trimmedValue = value.trim();
649
+ var trimmedValue = getFieldValue(value);
654
650
 
655
651
  if (trimmedValue === 'CAVOK') {
656
652
  return {
@@ -698,7 +694,7 @@
698
694
 
699
695
 
700
696
  var validateVisibilityField = function validateVisibilityField(value) {
701
- var trimmedValue = value.trim();
697
+ var trimmedValue = getFieldValue(value);
702
698
 
703
699
  if (!trimmedValue.length) {
704
700
  return true;
@@ -711,7 +707,7 @@
711
707
 
712
708
 
713
709
  if (!trimmedValue.match(/^[0-9]+$/)) {
714
- return value === 'CAVOK' || invalidVisibilityMessage;
710
+ return trimmedValue === 'CAVOK' || invalidVisibilityMessage;
715
711
  } // validate range
716
712
 
717
713
 
@@ -1177,12 +1173,13 @@
1177
1173
  var invalidWeatherFGVisibility = 'Invalid weather input, weather code FG needs to be combined with a visibility below 1000m'; // validations
1178
1174
 
1179
1175
  var WeatherVisibilityBelow5000 = [WeatherPhenomena.FU, WeatherPhenomena.DU, WeatherPhenomena.HZ, WeatherPhenomena.DRDU, WeatherPhenomena.BLDU];
1180
- var validateWeatherField = function validateWeatherField(value, visibilityValue, NSWAllowed) {
1176
+ var validateWeatherField = function validateWeatherField(value, visibilityFieldValue, NSWAllowed) {
1181
1177
  if (NSWAllowed === void 0) {
1182
1178
  NSWAllowed = true;
1183
1179
  }
1184
1180
 
1185
- var trimmedValue = value.trim(); // if empty, validate as true
1181
+ var trimmedValue = getFieldValue(value);
1182
+ var visibilityValue = getFieldValue(visibilityFieldValue); // if empty, validate as true
1186
1183
 
1187
1184
  if (trimmedValue === '') {
1188
1185
  return true;
@@ -1221,14 +1218,15 @@
1221
1218
 
1222
1219
  return true;
1223
1220
  };
1224
- var validateSecondWeatherField = function validateSecondWeatherField(weather1Value, weather2Value, visibilityValue) {
1225
- var trimmedWeather2Value = weather2Value.trim(); // Field can be left empty
1221
+ var validateSecondWeatherField = function validateSecondWeatherField(weather1Value, weather2Value, visibilityFieldValue) {
1222
+ var trimmedWeather2Value = getFieldValue(weather2Value);
1223
+ var visibilityValue = getFieldValue(visibilityFieldValue); // Field can be left empty
1226
1224
 
1227
1225
  if (!trimmedWeather2Value.length) {
1228
1226
  return true;
1229
1227
  }
1230
1228
 
1231
- var trimmedWeather1Value = weather1Value.trim(); // If weather1 is NSW weather2 should be empty
1229
+ var trimmedWeather1Value = getFieldValue(weather1Value); // If weather1 is NSW weather2 should be empty
1232
1230
 
1233
1231
  if (trimmedWeather1Value === 'NSW' && trimmedWeather2Value !== '') {
1234
1232
  return invalidWeatherNonEmptyNSWGroups;
@@ -1246,15 +1244,16 @@
1246
1244
 
1247
1245
  return validateWeatherField(weather2Value, visibilityValue, false);
1248
1246
  };
1249
- var validateThirdWeatherField = function validateThirdWeatherField(weather1Value, weather2Value, weather3Value, visibilityValue) {
1250
- var trimmedWeather3Value = weather3Value.trim(); // Field can be left empty
1247
+ var validateThirdWeatherField = function validateThirdWeatherField(weather1Value, weather2Value, weather3Value, visibilityFieldValue) {
1248
+ var trimmedWeather3Value = getFieldValue(weather3Value);
1249
+ var visibilityValue = getFieldValue(visibilityFieldValue); // Field can be left empty
1251
1250
 
1252
1251
  if (!trimmedWeather3Value.length) {
1253
1252
  return true;
1254
1253
  }
1255
1254
 
1256
- var trimmedWeather1Value = weather1Value.trim();
1257
- var trimmedWeather2Value = weather2Value.trim(); // If weather1 is NSW weather3 should be empty
1255
+ var trimmedWeather1Value = getFieldValue(weather1Value);
1256
+ var trimmedWeather2Value = getFieldValue(weather2Value); // If weather1 is NSW weather3 should be empty
1258
1257
 
1259
1258
  if (trimmedWeather1Value === 'NSW' && trimmedWeather3Value !== '') {
1260
1259
  return invalidWeatherNonEmptyNSWGroups;
@@ -1616,10 +1615,10 @@
1616
1615
 
1617
1616
 
1618
1617
  var validateWindField = function validateWindField(value, weatherfield1, weatherfield2, weatherfield3) {
1619
- var trimmedWindValue = value.trim();
1620
- var trimmedWeather1Value = weatherfield1.trim();
1621
- var trimmedWeather2Value = weatherfield2.trim();
1622
- var trimmedWeather3Value = weatherfield3.trim();
1618
+ var trimmedWindValue = getFieldValue(value);
1619
+ var trimmedWeather1Value = getFieldValue(weatherfield1);
1620
+ var trimmedWeather2Value = getFieldValue(weatherfield2);
1621
+ var trimmedWeather3Value = getFieldValue(weatherfield3);
1623
1622
 
1624
1623
  if (!trimmedWindValue.length) {
1625
1624
  return true;
@@ -1890,11 +1889,11 @@
1890
1889
  };
1891
1890
 
1892
1891
  var validateFirstCloud = function validateFirstCloud(value, visibilityValue, weatherfield1, weatherfield2, weatherfield3) {
1893
- var trimmedValueFirstCloud = value.trim();
1894
- var trimmedValueVisibility = visibilityValue.trim();
1895
- var trimmedWeather1Value = weatherfield1.trim();
1896
- var trimmedWeather2Value = weatherfield2.trim();
1897
- var trimmedWeather3Value = weatherfield3.trim(); // Field can be left empty
1892
+ var trimmedValueFirstCloud = getFieldValue(value);
1893
+ var trimmedValueVisibility = getFieldValue(visibilityValue);
1894
+ var trimmedWeather1Value = getFieldValue(weatherfield1);
1895
+ var trimmedWeather2Value = getFieldValue(weatherfield2);
1896
+ var trimmedWeather3Value = getFieldValue(weatherfield3); // Field can be left empty
1898
1897
 
1899
1898
  if (!trimmedValueFirstCloud.length) {
1900
1899
  return true;
@@ -1928,9 +1927,10 @@
1928
1927
 
1929
1928
  return errorMessages.length ? errorMessages[0] : true;
1930
1929
  };
1931
- var validateSecondCloud = function validateSecondCloud(firstCloudValue, secondCloudValue, visibilityValue) {
1932
- var trimmedValueFirstCloud = firstCloudValue.trim();
1933
- var trimmedValueSecondCloud = secondCloudValue.trim(); // Field can be left empty
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
1934
1934
 
1935
1935
  if (!trimmedValueSecondCloud.length) {
1936
1936
  return true;
@@ -1997,10 +1997,11 @@
1997
1997
 
1998
1998
  return true;
1999
1999
  };
2000
- var validateThirdCloud = function validateThirdCloud(firstCloudValue, secondCloudValue, thirdCloudValue, visibilityValue) {
2001
- var trimmedValueFirstCloud = firstCloudValue.trim();
2002
- var trimmedValueSecondCloud = secondCloudValue.trim();
2003
- var trimmedValueThirdCloud = thirdCloudValue.trim(); // Field can be left empty
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
2004
2005
 
2005
2006
  if (!trimmedValueThirdCloud.length) {
2006
2007
  return true;
@@ -2075,11 +2076,12 @@
2075
2076
 
2076
2077
  return true;
2077
2078
  };
2078
- var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCloudValue, thirdCloudValue, fourthCloudValue, visibilityValue) {
2079
- var trimmedValueFirstCloud = firstCloudValue.trim();
2080
- var trimmedValueSecondCloud = secondCloudValue.trim();
2081
- var trimmedValueThirdCloud = thirdCloudValue.trim();
2082
- var trimmedValueFourthCloud = fourthCloudValue.trim(); // Field can be left empty
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
2083
2085
 
2084
2086
  if (!trimmedValueFourthCloud.length) {
2085
2087
  return true;
@@ -3265,7 +3267,7 @@
3265
3267
  }, shared.getInitials(editor))));
3266
3268
  };
3267
3269
 
3268
- var textFieldStyle = function textFieldStyle(theme) {
3270
+ var textFieldStyle = function textFieldStyle(theme, shouldPreventUppercase) {
3269
3271
  return {
3270
3272
  // input
3271
3273
  marginRight: '2px',
@@ -3274,6 +3276,7 @@
3274
3276
  height: 46,
3275
3277
  input: {
3276
3278
  textAlign: 'center',
3279
+ textTransform: shouldPreventUppercase ? 'none' : 'uppercase',
3277
3280
  fontSize: 10,
3278
3281
  fontWeight: 500,
3279
3282
  paddingLeft: 0,
@@ -3338,11 +3341,17 @@
3338
3341
  var getDisplayValue = function getDisplayValue(value, disabled) {
3339
3342
  return disabled && !value ? '-' : value;
3340
3343
  };
3341
- var BaseTextField = /*#__PURE__*/React__default["default"].memo(function (props) {
3344
+ var BaseTextField = /*#__PURE__*/React__default["default"].memo(function (_a) {
3345
+ var _b = _a.shouldPreventUppercase,
3346
+ shouldPreventUppercase = _b === void 0 ? false : _b,
3347
+ props = __rest(_a, ["shouldPreventUppercase"]);
3348
+
3349
+ var theme = react.useTheme();
3350
+ var styling = textFieldStyle(theme, shouldPreventUppercase);
3342
3351
  return /*#__PURE__*/React__default["default"].createElement(material.TextField, __assign({
3343
3352
  type: "text",
3344
3353
  variant: "filled",
3345
- sx: textFieldStyle
3354
+ sx: styling
3346
3355
  }, props));
3347
3356
  }, function (prevProps, nextProps) {
3348
3357
  return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name && prevProps.disabled === nextProps.disabled;
@@ -3366,18 +3375,20 @@
3366
3375
  _h = _a.autoComplete,
3367
3376
  autoComplete = _h === void 0 ? [] : _h,
3368
3377
  _j = _a.autoFocus,
3369
- autoFocus = _j === void 0 ? false : _j;
3378
+ autoFocus = _j === void 0 ? false : _j,
3379
+ _k = _a.shouldPreventUppercase,
3380
+ shouldPreventUppercase = _k === void 0 ? false : _k;
3370
3381
 
3371
- var _k = reactHookForm.useFormContext(),
3372
- control = _k.control,
3373
- setValue = _k.setValue,
3374
- errors = _k.formState.errors;
3382
+ var _l = reactHookForm.useFormContext(),
3383
+ control = _l.control,
3384
+ setValue = _l.setValue,
3385
+ errors = _l.formState.errors;
3375
3386
 
3376
3387
  var fieldErrors = getTafErrors(name, errors);
3377
3388
 
3378
- var _l = __read(React__default["default"].useState(null), 2),
3379
- maxLength = _l[0],
3380
- setMaxLength = _l[1];
3389
+ var _m = __read(React__default["default"].useState(null), 2),
3390
+ maxLength = _m[0],
3391
+ setMaxLength = _m[1];
3381
3392
 
3382
3393
  var onKeyDown = React__default["default"].useCallback(function (event) {
3383
3394
  var target = event.target;
@@ -3402,23 +3413,33 @@
3402
3413
  }
3403
3414
  }, [name, autoComplete, setValue]);
3404
3415
  var onChangeField = React__default["default"].useCallback(function (event, callback) {
3405
- var valueUppercase = event.currentTarget.value.toUpperCase();
3416
+ var value = event.currentTarget.value;
3406
3417
 
3407
3418
  if (autoComplete) {
3419
+ var valueUppercase_1 = value.toUpperCase();
3408
3420
  var exist = autoComplete.find(function (e) {
3409
- return e.value === valueUppercase;
3421
+ return e.value === valueUppercase_1;
3410
3422
  });
3411
- var newMaxLength = exist ? valueUppercase.length : null;
3423
+ var newMaxLength = exist ? valueUppercase_1.length : null;
3412
3424
  setMaxLength(newMaxLength);
3413
3425
  }
3414
3426
 
3415
- callback(valueUppercase);
3416
- onChange(valueUppercase);
3427
+ callback(value);
3428
+ onChange(value);
3417
3429
  }, [onChange, autoComplete]);
3418
- var onBlurField = React__default["default"].useCallback(function (callback) {
3430
+ var onBlurField = React__default["default"].useCallback(function (event, callback) {
3431
+ var value = event.target.value;
3432
+ var valueUppercase = value.toUpperCase();
3433
+
3434
+ if (value !== valueUppercase && !shouldPreventUppercase) {
3435
+ setValue(name, valueUppercase, {
3436
+ shouldValidate: true
3437
+ });
3438
+ }
3439
+
3419
3440
  callback();
3420
3441
  onBlur();
3421
- }, [onBlur]);
3442
+ }, [onBlur, name, setValue, shouldPreventUppercase]);
3422
3443
  var hasError = !!fieldErrors;
3423
3444
  return /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
3424
3445
  render: function render(_a) {
@@ -3430,18 +3451,19 @@
3430
3451
  name: name,
3431
3452
  value: displayValue,
3432
3453
  inputRef: field.ref,
3433
- onChange: function onChange(e) {
3434
- return onChangeField(e, field.onChange);
3454
+ onChange: function onChange(event) {
3455
+ return onChangeField(event, field.onChange);
3435
3456
  },
3436
3457
  onKeyDown: onKeyDown,
3437
3458
  error: hasError,
3438
- onBlur: function onBlur() {
3439
- return onBlurField(field.onBlur);
3459
+ onBlur: function onBlur(event) {
3460
+ return onBlurField(event, field.onBlur);
3440
3461
  },
3441
3462
  inputProps: {
3442
3463
  maxLength: maxLength
3443
3464
  },
3444
- autoFocus: autoFocus
3465
+ autoFocus: autoFocus,
3466
+ shouldPreventUppercase: shouldPreventUppercase
3445
3467
  });
3446
3468
  },
3447
3469
  name: name,
@@ -3754,7 +3776,8 @@
3754
3776
  formatter: formatIssueTime,
3755
3777
  label: "Issue time",
3756
3778
  name: "issueDate",
3757
- disabled: true
3779
+ disabled: true,
3780
+ shouldPreventUppercase: true
3758
3781
  })), isChangeGroup && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Box, {
3759
3782
  sx: {
3760
3783
  width: 56,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,7 +2,10 @@ import { TextFieldProps } from '@mui/material';
2
2
  import React from 'react';
3
3
  import { RegisterOptions } from 'react-hook-form';
4
4
  export declare const getDisplayValue: (value: string, disabled: boolean) => string;
5
- export declare const BaseTextField: React.FC<TextFieldProps>;
5
+ declare type BaseTextFieldProps = TextFieldProps & {
6
+ shouldPreventUppercase?: boolean;
7
+ };
8
+ export declare const BaseTextField: React.FC<BaseTextFieldProps>;
6
9
  interface TafFormTextFieldProps {
7
10
  label: string;
8
11
  disabled?: boolean;
@@ -17,6 +20,7 @@ interface TafFormTextFieldProps {
17
20
  }[];
18
21
  onBlur?: () => void;
19
22
  autoFocus?: boolean;
23
+ shouldPreventUppercase?: boolean;
20
24
  }
21
25
  declare const TafFormTextField: React.FC<TafFormTextFieldProps>;
22
26
  export default TafFormTextField;
File without changes
@@ -28,7 +28,7 @@ export declare const invalidCloudWithPreviousType = "Invalid cloud input, only o
28
28
  export declare const invalidCloudCAVOKMessage = "Invalid cloud input, when CAVOK is used, cloud groups must be empty";
29
29
  export declare const invalidCloud4TypeMissingMessage = "Invalid cloud input for fourth group, CB or TCU required if no other significant convective cloud group present";
30
30
  export declare const validateFirstCloud: (value: string, visibilityValue: string, weatherfield1: string, weatherfield2: string, weatherfield3: string) => boolean | string;
31
- export declare const validateSecondCloud: (firstCloudValue: string, secondCloudValue: string, visibilityValue: string) => boolean | string;
32
- export declare const validateThirdCloud: (firstCloudValue: string, secondCloudValue: string, thirdCloudValue: string, visibilityValue: string) => boolean | string;
33
- export declare const validateFourthCloud: (firstCloudValue: string, secondCloudValue: string, thirdCloudValue: string, fourthCloudValue: string, visibilityValue: string) => boolean | string;
31
+ export declare const validateSecondCloud: (firstCloudValue: string, secondCloudValue: string, visibilityFieldValue: string) => boolean | string;
32
+ export declare const validateThirdCloud: (firstCloudValue: string, secondCloudValue: string, thirdCloudValue: string, visibilityFieldValue: string) => boolean | string;
33
+ export declare const validateFourthCloud: (firstCloudValue: string, secondCloudValue: string, thirdCloudValue: string, fourthCloudValue: string, visibilityFieldValue: string) => boolean | string;
34
34
  export {};
@@ -9,7 +9,7 @@ export declare const invalidWeatherCAVOKMessage = "Invalid weather input, when C
9
9
  export declare const invalidWeatherVisibilityBelow5000 = "Invalid weather input, weather codes FU, DU, HZ, DRDU and BLDU need to be combined with a visibility of 5000m or less";
10
10
  export declare const invalidWeatherBRVisibility = "Invalid weather input, weather code BR needs to be combined with a visibility between 1000 and 5000m";
11
11
  export declare const invalidWeatherFGVisibility = "Invalid weather input, weather code FG needs to be combined with a visibility below 1000m";
12
- export declare const validateWeatherField: (value: string, visibilityValue: string, NSWAllowed?: boolean) => boolean | string;
13
- export declare const validateSecondWeatherField: (weather1Value: string, weather2Value: string, visibilityValue: string) => boolean | string;
14
- export declare const validateThirdWeatherField: (weather1Value: string, weather2Value: string, weather3Value: string, visibilityValue: string) => boolean | string;
12
+ export declare const validateWeatherField: (value: string, visibilityFieldValue: string, NSWAllowed?: boolean) => boolean | string;
13
+ export declare const validateSecondWeatherField: (weather1Value: string, weather2Value: string, visibilityFieldValue: string) => boolean | string;
14
+ export declare const validateThirdWeatherField: (weather1Value: string, weather2Value: string, weather3Value: string, visibilityFieldValue: string) => boolean | string;
15
15
  export declare function parseWeatherToObject(value: any): Weather;