@opengeoweb/taf 6.1.1 → 7.0.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/index.esm.js +11 -17
- package/package.json +8 -8
- package/src/lib/components/IssuesPane/utils.d.ts +1 -1
- package/src/lib/components/TafForm/TafFormRow/TafFormTextField.d.ts +2 -2
- package/src/lib/components/TafForm/TafFormRow/validations/clouds.d.ts +2 -2
- package/src/lib/components/TafForm/TafFormRow/validations/weather.d.ts +2 -2
- package/src/lib/components/TafLayout/TafPanel/TafPanel.d.ts +1 -1
- package/src/lib/types.d.ts +20 -12
package/index.esm.js
CHANGED
|
@@ -28472,14 +28472,11 @@ var validateThirdWeatherField = function validateThirdWeatherField(weather1Value
|
|
|
28472
28472
|
}
|
|
28473
28473
|
return validateWeatherField(weather3Value, visibilityValue, false);
|
|
28474
28474
|
};
|
|
28475
|
-
// parser
|
|
28476
|
-
// TODO: value type = Weather, but couldn't get it to work properly https://gitlab.com/opengeoweb/opengeoweb/-/issues/119
|
|
28477
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
28478
28475
|
function parseWeatherToObject(value) {
|
|
28479
28476
|
var trimmedWeather = Object.keys(value).reduce(function (obj, key) {
|
|
28480
28477
|
// only parse it if it has a value
|
|
28481
|
-
if (value[key] && value[key].trim()) {
|
|
28482
|
-
return Object.assign(Object.assign({}, obj), _defineProperty$1({}, key, obj[key].trim()));
|
|
28478
|
+
if (value[key] && String(value[key]).trim()) {
|
|
28479
|
+
return Object.assign(Object.assign({}, obj), _defineProperty$1({}, key, String(obj[key]).trim()));
|
|
28483
28480
|
}
|
|
28484
28481
|
// if it doesn't have a value, remove it from the list
|
|
28485
28482
|
var _a = obj,
|
|
@@ -28798,8 +28795,6 @@ var formatSingleCloud = function formatSingleCloud(value) {
|
|
|
28798
28795
|
var height = !value.height ? '000' : prependZeroes(value.height, 3);
|
|
28799
28796
|
return value.type ? "".concat(value.coverage).concat(height).concat(value.type) : "".concat(value.coverage).concat(height);
|
|
28800
28797
|
};
|
|
28801
|
-
// TODO: clouds type = Clouds, but couldn't get it to work properly https://gitlab.com/opengeoweb/opengeoweb/-/issues/119
|
|
28802
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
28803
28798
|
var formatCloudsToString = function formatCloudsToString(clouds) {
|
|
28804
28799
|
if (!clouds) {
|
|
28805
28800
|
return null;
|
|
@@ -28845,19 +28840,17 @@ var parseSingleCloud = function parseSingleCloud(value) {
|
|
|
28845
28840
|
type: cloudType
|
|
28846
28841
|
});
|
|
28847
28842
|
};
|
|
28848
|
-
// TODO: clouds type = CloudStrings, but couldn't get it to work properly https://gitlab.com/opengeoweb/opengeoweb/-/issues/119
|
|
28849
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
28850
28843
|
var parseCloudsToObject = function parseCloudsToObject(clouds) {
|
|
28851
28844
|
if (!clouds) {
|
|
28852
28845
|
return null;
|
|
28853
28846
|
}
|
|
28854
28847
|
return Object.keys(clouds).reduce(function (list, key) {
|
|
28855
28848
|
// only parse it if it has a value
|
|
28856
|
-
if (clouds[key] && clouds[key].trim()) {
|
|
28849
|
+
if (clouds[key] && String(clouds[key]).trim()) {
|
|
28857
28850
|
switch (key) {
|
|
28858
28851
|
case 'cloud1':
|
|
28859
28852
|
{
|
|
28860
|
-
var trimmedValue = clouds[key].trim();
|
|
28853
|
+
var trimmedValue = String(clouds[key]).trim();
|
|
28861
28854
|
if (isVerticalVisibility(trimmedValue)) {
|
|
28862
28855
|
// Parse Vertical Visibility
|
|
28863
28856
|
return Object.assign(Object.assign({}, list), _defineProperty$1({}, key, {
|
|
@@ -28874,7 +28867,7 @@ var parseCloudsToObject = function parseCloudsToObject(clouds) {
|
|
|
28874
28867
|
default:
|
|
28875
28868
|
{
|
|
28876
28869
|
// Other cloud keys can only contain a cloud
|
|
28877
|
-
return Object.assign(Object.assign({}, list), _defineProperty$1({}, key, parseSingleCloud(clouds[key])));
|
|
28870
|
+
return Object.assign(Object.assign({}, list), _defineProperty$1({}, key, parseSingleCloud(String(clouds[key]))));
|
|
28878
28871
|
}
|
|
28879
28872
|
}
|
|
28880
28873
|
}
|
|
@@ -29305,7 +29298,6 @@ function formatFormValues(row) {
|
|
|
29305
29298
|
// parsers
|
|
29306
29299
|
function reduceRowValues(row, tafStart, tafEnd) {
|
|
29307
29300
|
return Object.keys(row).reduce(function (list, key) {
|
|
29308
|
-
var _a;
|
|
29309
29301
|
switch (key) {
|
|
29310
29302
|
case 'valid':
|
|
29311
29303
|
{
|
|
@@ -29339,7 +29331,7 @@ function reduceRowValues(row, tafStart, tafEnd) {
|
|
|
29339
29331
|
case 'change':
|
|
29340
29332
|
case 'probability':
|
|
29341
29333
|
{
|
|
29342
|
-
return Object.assign(Object.assign({}, list), _defineProperty$1({}, key, (
|
|
29334
|
+
return Object.assign(Object.assign({}, list), _defineProperty$1({}, key, String(list[key]).trim()));
|
|
29343
29335
|
}
|
|
29344
29336
|
default:
|
|
29345
29337
|
{
|
|
@@ -32371,7 +32363,9 @@ var getTafErrors = function getTafErrors(name, errors) {
|
|
|
32371
32363
|
if (errors.changeGroups) {
|
|
32372
32364
|
var changeGroupNum = nameAsArray[0].slice(13, nameAsArray[0].length - 1);
|
|
32373
32365
|
var restArray = nameAsArray.slice(1);
|
|
32374
|
-
return getDeepProperty(restArray,
|
|
32366
|
+
return getDeepProperty(restArray,
|
|
32367
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32368
|
+
errors.changeGroups[changeGroupNum]);
|
|
32375
32369
|
}
|
|
32376
32370
|
// No changegroup errors
|
|
32377
32371
|
return null;
|
|
@@ -32628,7 +32622,7 @@ var getDefaultValue = function getDefaultValue(fieldName, data) {
|
|
|
32628
32622
|
if (!data) {
|
|
32629
32623
|
return '';
|
|
32630
32624
|
}
|
|
32631
|
-
return getDeepProperty(fieldName.split('.'), data) || '';
|
|
32625
|
+
return String(getDeepProperty(fieldName.split('.'), data) || '');
|
|
32632
32626
|
};
|
|
32633
32627
|
var getRequiredCrossFields = function getRequiredCrossFields(fieldNames) {
|
|
32634
32628
|
return [[fieldNames.valid], [fieldNames.change, fieldNames.probability], [fieldNames.wind, fieldNames.visibility, fieldNames.weather1, fieldNames.cloud1] // sub fields
|
|
@@ -32667,7 +32661,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
32667
32661
|
mainOptionalFields = _getRequiredCrossFiel2[1],
|
|
32668
32662
|
subFields = _getRequiredCrossFiel2[2];
|
|
32669
32663
|
var hasFieldsValue = function hasFieldsValue(fields) {
|
|
32670
|
-
return fields.map(getValues).find(function (field) {
|
|
32664
|
+
return !!fields.map(getValues).find(function (field) {
|
|
32671
32665
|
return !!field;
|
|
32672
32666
|
});
|
|
32673
32667
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/taf",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "GeoWeb TAF library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@emotion/react": "11.11.1",
|
|
16
16
|
"@mui/material": "5.12.0",
|
|
17
|
-
"@opengeoweb/api": "
|
|
18
|
-
"@opengeoweb/authentication": "
|
|
19
|
-
"@opengeoweb/core": "
|
|
20
|
-
"@opengeoweb/form-fields": "
|
|
21
|
-
"@opengeoweb/shared": "
|
|
22
|
-
"@opengeoweb/store": "
|
|
23
|
-
"@opengeoweb/theme": "
|
|
17
|
+
"@opengeoweb/api": "7.0.0",
|
|
18
|
+
"@opengeoweb/authentication": "7.0.0",
|
|
19
|
+
"@opengeoweb/core": "7.0.0",
|
|
20
|
+
"@opengeoweb/form-fields": "7.0.0",
|
|
21
|
+
"@opengeoweb/shared": "7.0.0",
|
|
22
|
+
"@opengeoweb/store": "7.0.0",
|
|
23
|
+
"@opengeoweb/theme": "7.0.0",
|
|
24
24
|
"@reduxjs/toolkit": "1.9.5",
|
|
25
25
|
"axios": "1.5.0",
|
|
26
26
|
"lodash": "4.17.21",
|
|
@@ -2,6 +2,6 @@ import { FieldError, FieldErrors } from 'react-hook-form';
|
|
|
2
2
|
import { CustomErrorField } from './types';
|
|
3
3
|
export declare const getCustomError: (error: FieldError, isChangeGroup: boolean, rowIndex: number) => CustomErrorField;
|
|
4
4
|
export declare const getIssuesLabel: (sumOfErrors: number) => string;
|
|
5
|
-
export declare const getErrorValues: (fieldErrors:
|
|
5
|
+
export declare const getErrorValues: (fieldErrors: FieldErrors, isChangeGroup?: boolean, rowIndex?: number) => FieldError[];
|
|
6
6
|
export declare const filterDuplicateErrors: (errors: CustomErrorField[]) => CustomErrorField[];
|
|
7
7
|
export declare const getErrors: (errors: FieldErrors) => CustomErrorField[];
|
|
@@ -10,9 +10,9 @@ interface TafFormTextFieldProps {
|
|
|
10
10
|
label: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
name: string;
|
|
13
|
-
onChange?: (e:
|
|
13
|
+
onChange?: (e: string) => void;
|
|
14
14
|
defaultValue?: string;
|
|
15
|
-
formatter?: (value:
|
|
15
|
+
formatter?: (value: string) => string;
|
|
16
16
|
rules?: RegisterOptions;
|
|
17
17
|
autoComplete?: {
|
|
18
18
|
key: string;
|
|
@@ -5,8 +5,8 @@ type CloudStrings = {
|
|
|
5
5
|
cloud3?: string;
|
|
6
6
|
cloud4?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const formatCloudsToString: (clouds:
|
|
9
|
-
export declare const parseCloudsToObject: (clouds:
|
|
8
|
+
export declare const formatCloudsToString: (clouds: Clouds) => CloudStrings;
|
|
9
|
+
export declare const parseCloudsToObject: (clouds: CloudStrings) => Clouds;
|
|
10
10
|
export declare const invalidCloud1Message = "Invalid cloud input, expected either <coverage><height><type(optional)> with coverage FEW, SCT, BKN or OVC and height consisting of 3 digits or NSC";
|
|
11
11
|
export declare const invalidCloudMessage = "Invalid cloud input, expected <coverage><height><type(optional)> with coverage FEW, SCT, BKN or OVC and height consisting of 3 digits";
|
|
12
12
|
export declare const invalidCloudCoverageMessage = "Invalid cloud coverage, expected FEW, SCT, BKN or OVC";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Weather } from '../../../../types';
|
|
1
|
+
import { Weather, WeatherStrings } from '../../../../types';
|
|
2
2
|
export declare const invalidWeatherMessage = "Invalid weather input, expected NSW or a valid weather code";
|
|
3
3
|
export declare const invalidWeatherCodeMessage = "Invalid weather input, invalid weather code";
|
|
4
4
|
export declare const invalidWeatherNSWMessage = "Invalid weather input, NSW is not allowed in the baseforecast and can only be used in the first weather group";
|
|
@@ -12,4 +12,4 @@ export declare const invalidWeatherFGVisibility = "Invalid weather input, weathe
|
|
|
12
12
|
export declare const validateWeatherField: (value: string, visibilityFieldValue: string, NSWAllowed?: boolean) => boolean | string;
|
|
13
13
|
export declare const validateSecondWeatherField: (weather1Value: string, weather2Value: string, visibilityFieldValue: string) => boolean | string;
|
|
14
14
|
export declare const validateThirdWeatherField: (weather1Value: string, weather2Value: string, weather3Value: string, visibilityFieldValue: string) => boolean | string;
|
|
15
|
-
export declare function parseWeatherToObject(value:
|
|
15
|
+
export declare function parseWeatherToObject(value: WeatherStrings): Weather;
|
|
@@ -30,7 +30,7 @@ export declare const usePostTafRequest: (request: (params?: unknown) => Promise<
|
|
|
30
30
|
isLoading: boolean;
|
|
31
31
|
error: TafError | undefined;
|
|
32
32
|
setError: (newError: TafError) => void;
|
|
33
|
-
doRequest: (params?:
|
|
33
|
+
doRequest: (params?: TafFromFrontEnd) => Promise<void>;
|
|
34
34
|
};
|
|
35
35
|
declare const TafPanel: React.FC<TafPanelProps>;
|
|
36
36
|
export default TafPanel;
|
package/src/lib/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type CloudCoverage = 'FEW' | 'SCT' | 'BKN' | 'OVC';
|
|
|
19
19
|
export type CloudType = 'CB' | 'TCU';
|
|
20
20
|
export interface Cloud {
|
|
21
21
|
coverage: CloudCoverage;
|
|
22
|
-
height: number;
|
|
22
|
+
height: number | null;
|
|
23
23
|
type?: CloudType;
|
|
24
24
|
}
|
|
25
25
|
export type NSC = 'NSC';
|
|
@@ -76,17 +76,8 @@ export interface BaseForecastFormData {
|
|
|
76
76
|
valid: string;
|
|
77
77
|
visibility?: string;
|
|
78
78
|
wind?: string;
|
|
79
|
-
weather?:
|
|
80
|
-
|
|
81
|
-
weather2?: string;
|
|
82
|
-
weather3?: string;
|
|
83
|
-
};
|
|
84
|
-
cloud?: {
|
|
85
|
-
cloud1: string;
|
|
86
|
-
cloud2?: string;
|
|
87
|
-
cloud3?: string;
|
|
88
|
-
cloud4?: string;
|
|
89
|
-
};
|
|
79
|
+
weather?: WeatherStrings;
|
|
80
|
+
cloud?: CloudStrings;
|
|
90
81
|
cavOK?: boolean;
|
|
91
82
|
}
|
|
92
83
|
export interface ChangeGroupFormData extends BaseForecastFormData {
|
|
@@ -148,3 +139,20 @@ export type AdverseWeatherTAC = {
|
|
|
148
139
|
}[][];
|
|
149
140
|
};
|
|
150
141
|
export type TAC = string | AdverseWeatherTAC;
|
|
142
|
+
export type CloudStrings = {
|
|
143
|
+
cloud1: string;
|
|
144
|
+
cloud2?: string;
|
|
145
|
+
cloud3?: string;
|
|
146
|
+
cloud4?: string;
|
|
147
|
+
};
|
|
148
|
+
export type WeatherStrings = {
|
|
149
|
+
weather1: string;
|
|
150
|
+
weather2?: string;
|
|
151
|
+
weather3?: string;
|
|
152
|
+
};
|
|
153
|
+
export interface ConfigKey {
|
|
154
|
+
key: string;
|
|
155
|
+
size: number;
|
|
156
|
+
minSize?: number;
|
|
157
|
+
maxSize?: number;
|
|
158
|
+
}
|