@opengeoweb/taf 4.9.1 → 4.11.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 +139 -99
- package/index.umd.js +144 -101
- package/lib/components/StatusIcon/StatusIcon.d.ts +1 -1
- package/lib/components/TafForm/utils.d.ts +6 -1
- package/lib/types.d.ts +1 -1
- package/package.json +10 -10
package/index.esm.js
CHANGED
|
@@ -11,7 +11,7 @@ import { HIDDEN_INPUT_HELPER_IS_DRAFT, useIsMounted, ToggleMenu, CustomTooltip,
|
|
|
11
11
|
import { snackbarActions } from '@opengeoweb/core';
|
|
12
12
|
import moment from 'moment';
|
|
13
13
|
import { isEqual } from 'lodash';
|
|
14
|
-
import { Add, Delete, Close, DragHandle as DragHandle$1, ThumbsUp, Clock, Cancel,
|
|
14
|
+
import { Add, Delete, Close, DragHandle as DragHandle$1, ThumbsUp, Clock, Cancel, Success, Edit, Export, ListItem, Cached } from '@opengeoweb/theme';
|
|
15
15
|
import ReactDOM from 'react-dom';
|
|
16
16
|
import { useApiContext, createApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
17
17
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
@@ -2014,7 +2014,8 @@ var emptyBaseForecast = {
|
|
|
2014
2014
|
cloud3: '',
|
|
2015
2015
|
cloud4: ''
|
|
2016
2016
|
}
|
|
2017
|
-
};
|
|
2017
|
+
};
|
|
2018
|
+
var MIN_NUMBER_CHANGE_GROUP = 5; // formatters
|
|
2018
2019
|
|
|
2019
2020
|
var formatIssueTime = function formatIssueTime(issueDate) {
|
|
2020
2021
|
return issueDate ? "".concat(moment(issueDate).utc().format('DDHHmm'), "Z") : 'Not issued';
|
|
@@ -2421,7 +2422,7 @@ var useDragOrder = function useDragOrder(trigger, move) {
|
|
|
2421
2422
|
}; // dialog utils
|
|
2422
2423
|
|
|
2423
2424
|
var getConfirmationDialogTitle = function getConfirmationDialogTitle(action) {
|
|
2424
|
-
if (action === '
|
|
2425
|
+
if (action === 'CLEAR') return 'Clear TAF';
|
|
2425
2426
|
if (action === 'PUBLISH') return 'Publish';
|
|
2426
2427
|
if (action === 'AMEND') return 'This TAF is an amendment';
|
|
2427
2428
|
if (action === 'CORRECT') return 'This TAF is a correction';
|
|
@@ -2446,8 +2447,8 @@ var isTafAmendedCorrectedChanged = function isTafAmendedCorrectedChanged(isFormD
|
|
|
2446
2447
|
};
|
|
2447
2448
|
var getConfirmationDialogContent = function getConfirmationDialogContent(action, isFormDirty) {
|
|
2448
2449
|
switch (action) {
|
|
2449
|
-
case '
|
|
2450
|
-
return 'Are you sure you would like to
|
|
2450
|
+
case 'CLEAR':
|
|
2451
|
+
return 'Are you sure you would like to clear this TAF? All content will be lost';
|
|
2451
2452
|
|
|
2452
2453
|
case 'PUBLISH':
|
|
2453
2454
|
return 'Are you sure you want to publish this TAF?';
|
|
@@ -2462,9 +2463,9 @@ var getConfirmationDialogContent = function getConfirmationDialogContent(action,
|
|
|
2462
2463
|
};
|
|
2463
2464
|
var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel(action) {
|
|
2464
2465
|
switch (action) {
|
|
2465
|
-
case '
|
|
2466
|
+
case 'CLEAR':
|
|
2466
2467
|
{
|
|
2467
|
-
return '
|
|
2468
|
+
return 'Clear';
|
|
2468
2469
|
}
|
|
2469
2470
|
|
|
2470
2471
|
case 'CANCEL':
|
|
@@ -2555,7 +2556,7 @@ var createChangeGroup = function createChangeGroup(changeGroup) {
|
|
|
2555
2556
|
});
|
|
2556
2557
|
};
|
|
2557
2558
|
var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
2558
|
-
var
|
|
2559
|
+
var addEmptyChangeGroups = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2559
2560
|
|
|
2560
2561
|
var _a; // If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
|
|
2561
2562
|
// If action is AMEND/DRAFT_AMEND - update validity start time to current time
|
|
@@ -2568,18 +2569,44 @@ var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
|
2568
2569
|
cloud: Object.assign(Object.assign({}, emptyBaseForecast.cloud), formattedBaseForecast.cloud)
|
|
2569
2570
|
});
|
|
2570
2571
|
var formattedChangeGroups = ((_a = taf.changeGroups) === null || _a === void 0 ? void 0 : _a.map(formatFormValues)) || [];
|
|
2571
|
-
var changeGroups = formattedChangeGroups.map(createChangeGroup); //
|
|
2572
|
+
var changeGroups = formattedChangeGroups.map(createChangeGroup); // If addEmptyChangeGroups is true - ensure there are at least MIN_NUMBER_CHANGE_GROUP changegroups
|
|
2573
|
+
|
|
2574
|
+
if (addEmptyChangeGroups) {
|
|
2575
|
+
var changeGroupsToAdd = MIN_NUMBER_CHANGE_GROUP - changeGroups.length;
|
|
2572
2576
|
|
|
2573
|
-
|
|
2574
|
-
|
|
2577
|
+
if (changeGroupsToAdd > 0) {
|
|
2578
|
+
Array.from(Array(changeGroupsToAdd)).map(function () {
|
|
2579
|
+
return changeGroups.push(emptyChangegroup);
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2575
2582
|
}
|
|
2576
2583
|
|
|
2577
|
-
return Object.assign(Object.assign({
|
|
2584
|
+
return Object.assign(Object.assign({
|
|
2585
|
+
issueDate: '',
|
|
2586
|
+
previousId: null,
|
|
2587
|
+
previousValidDateStart: null,
|
|
2588
|
+
previousValidDateEnd: null
|
|
2589
|
+
}, taf), _defineProperty({
|
|
2578
2590
|
messageType: getMessageType(taf, tafAction),
|
|
2579
2591
|
baseForecast: baseForecast,
|
|
2580
2592
|
changeGroups: changeGroups
|
|
2581
2593
|
}, HIDDEN_INPUT_HELPER_IS_DRAFT, true));
|
|
2582
2594
|
};
|
|
2595
|
+
var clearTafFormData = function clearTafFormData(tafFormValues) {
|
|
2596
|
+
// Remove all except for the validity times
|
|
2597
|
+
var baseForecast = {
|
|
2598
|
+
valid: tafFormValues.baseForecast.valid
|
|
2599
|
+
};
|
|
2600
|
+
var emptyChangeGroups = [];
|
|
2601
|
+
Array.from(Array(MIN_NUMBER_CHANGE_GROUP)).map(function () {
|
|
2602
|
+
return emptyChangeGroups.push(emptyChangegroup);
|
|
2603
|
+
});
|
|
2604
|
+
return Object.assign(Object.assign({}, tafFormValues), {
|
|
2605
|
+
baseForecast: Object.assign(Object.assign({}, emptyBaseForecast), baseForecast),
|
|
2606
|
+
// Add empty change groups
|
|
2607
|
+
changeGroups: emptyChangeGroups
|
|
2608
|
+
});
|
|
2609
|
+
};
|
|
2583
2610
|
var getIsFormDefaultDisabled = function getIsFormDefaultDisabled(status) {
|
|
2584
2611
|
return !(status === 'NEW' || status === 'DRAFT' || status === 'DRAFT_AMENDED' || status === 'DRAFT_CORRECTED');
|
|
2585
2612
|
};
|
|
@@ -2610,6 +2637,9 @@ var fromStatusToAction = function fromStatusToAction(tafStatus) {
|
|
|
2610
2637
|
return 'NEW';
|
|
2611
2638
|
}
|
|
2612
2639
|
};
|
|
2640
|
+
var isFormDirty = function isFormDirty(dirtyFields) {
|
|
2641
|
+
return Object.keys(dirtyFields).length > 0;
|
|
2642
|
+
};
|
|
2613
2643
|
|
|
2614
2644
|
var textFieldStyle = function textFieldStyle(theme) {
|
|
2615
2645
|
return {
|
|
@@ -2740,7 +2770,9 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
2740
2770
|
}) || null;
|
|
2741
2771
|
|
|
2742
2772
|
if (foundValue) {
|
|
2743
|
-
setValue(name, foundValue.value
|
|
2773
|
+
setValue(name, foundValue.value, {
|
|
2774
|
+
shouldDirty: true
|
|
2775
|
+
});
|
|
2744
2776
|
setMaxLength(foundValue.value.length);
|
|
2745
2777
|
event.preventDefault();
|
|
2746
2778
|
}
|
|
@@ -3480,13 +3512,13 @@ var TafFormButtons = function TafFormButtons(_ref2) {
|
|
|
3480
3512
|
canBe: canBe,
|
|
3481
3513
|
onTafViewModeButtonPress: onTafViewModeButtonPress
|
|
3482
3514
|
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button, {
|
|
3483
|
-
"data-testid": "
|
|
3515
|
+
"data-testid": "cleartaf",
|
|
3484
3516
|
variant: "tertiary",
|
|
3485
3517
|
onClick: function onClick() {
|
|
3486
3518
|
// Simply discard the changes and close the dialog.
|
|
3487
|
-
onTafEditModeButtonPress('
|
|
3519
|
+
onTafEditModeButtonPress('CLEAR');
|
|
3488
3520
|
}
|
|
3489
|
-
}, "
|
|
3521
|
+
}, "Clear"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3490
3522
|
"data-testid": "savedrafttaf",
|
|
3491
3523
|
variant: "tertiary",
|
|
3492
3524
|
onClick: function onClick() {
|
|
@@ -3553,9 +3585,7 @@ var DragHandle = function DragHandle(_ref) {
|
|
|
3553
3585
|
'&:hover': {
|
|
3554
3586
|
backgroundColor: 'transparent'
|
|
3555
3587
|
},
|
|
3556
|
-
cursor:
|
|
3557
|
-
return isSorting ? 'grabbing' : 'grab';
|
|
3558
|
-
}
|
|
3588
|
+
cursor: isSorting ? 'grabbing' : 'grab'
|
|
3559
3589
|
}
|
|
3560
3590
|
}, /*#__PURE__*/React__default.createElement(DragHandle$1, null));
|
|
3561
3591
|
};
|
|
@@ -3994,7 +4024,7 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
3994
4024
|
formState = _useFormContext.formState,
|
|
3995
4025
|
getValues = _useFormContext.getValues,
|
|
3996
4026
|
setValue = _useFormContext.setValue,
|
|
3997
|
-
|
|
4027
|
+
resetField = _useFormContext.resetField; // added this ignore as the build is failing otherwise on: Type instantiation is excessively deep and possibly infinite.
|
|
3998
4028
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3999
4029
|
// @ts-ignore
|
|
4000
4030
|
|
|
@@ -4015,12 +4045,12 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4015
4045
|
|
|
4016
4046
|
var dirtyFields = formState.dirtyFields,
|
|
4017
4047
|
errors = formState.errors;
|
|
4018
|
-
var isFormDirty =
|
|
4019
|
-
usePreventBrowserClose(isFormDirty && !isDisabled); // Needed to be able to show a confirmation dialog on closing parent view
|
|
4048
|
+
var isFormDirty$1 = isFormDirty(dirtyFields);
|
|
4049
|
+
usePreventBrowserClose(isFormDirty$1 && !isDisabled); // Needed to be able to show a confirmation dialog on closing parent view
|
|
4020
4050
|
|
|
4021
4051
|
React__default.useEffect(function () {
|
|
4022
|
-
onPreventCloseView(isFormDirty); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4023
|
-
}, [isFormDirty]);
|
|
4052
|
+
onPreventCloseView(isFormDirty$1); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4053
|
+
}, [isFormDirty$1]);
|
|
4024
4054
|
var hiddenInputFields = ['baseTime', 'issueDate', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd', HIDDEN_INPUT_HELPER_IS_DRAFT];
|
|
4025
4055
|
|
|
4026
4056
|
var onSubmit = function onSubmit(data) {
|
|
@@ -4032,16 +4062,25 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4032
4062
|
return confirmDialog({
|
|
4033
4063
|
title: getConfirmationDialogTitle(action),
|
|
4034
4064
|
description: getConfirmationDialogContent(action, function () {
|
|
4035
|
-
return isTafAmendedCorrectedChanged(isFormDirty, originalTaf, convertTafValuesToObject(getValues()));
|
|
4065
|
+
return isTafAmendedCorrectedChanged(isFormDirty$1, originalTaf, convertTafValuesToObject(getValues()));
|
|
4036
4066
|
}),
|
|
4037
4067
|
confirmLabel: getConfirmationDialogButtonLabel(action)
|
|
4038
4068
|
});
|
|
4039
4069
|
};
|
|
4040
4070
|
|
|
4041
4071
|
var resetFormValues = function resetFormValues(formData) {
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4072
|
+
var keepDirty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4073
|
+
Object.keys(formData).forEach(function (key) {
|
|
4074
|
+
if (!keepDirty || key === 'changeGroups') {
|
|
4075
|
+
resetField(key, {
|
|
4076
|
+
keepDirty: keepDirty,
|
|
4077
|
+
defaultValue: formData[key]
|
|
4078
|
+
});
|
|
4079
|
+
}
|
|
4080
|
+
|
|
4081
|
+
setValue(key, formData[key], {
|
|
4082
|
+
shouldDirty: keepDirty
|
|
4083
|
+
});
|
|
4045
4084
|
});
|
|
4046
4085
|
};
|
|
4047
4086
|
|
|
@@ -4049,7 +4088,7 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4049
4088
|
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
4050
4089
|
var resetDisabled = arguments.length > 1 ? arguments[1] : undefined;
|
|
4051
4090
|
var tafToReset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : originalTaf;
|
|
4052
|
-
var shouldAddEmptyChangGroup = !
|
|
4091
|
+
var shouldAddEmptyChangGroup = !resetDisabled;
|
|
4053
4092
|
var newTaf = prepareTafValues(tafToReset, action, shouldAddEmptyChangGroup);
|
|
4054
4093
|
resetFormValues(newTaf);
|
|
4055
4094
|
setIsDisabled(resetDisabled);
|
|
@@ -4140,7 +4179,7 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4140
4179
|
var onSwitchMode = function onSwitchMode(event) {
|
|
4141
4180
|
var checked = event.target.checked;
|
|
4142
4181
|
|
|
4143
|
-
if (!checked && isFormDirty) {
|
|
4182
|
+
if (!checked && isFormDirty$1) {
|
|
4144
4183
|
confirmDialog({
|
|
4145
4184
|
title: 'Whoops',
|
|
4146
4185
|
description: 'Are you sure you want to switch to viewer mode? Your unsaved changes will be lost.',
|
|
@@ -4187,15 +4226,12 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4187
4226
|
})();
|
|
4188
4227
|
break;
|
|
4189
4228
|
|
|
4190
|
-
case '
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
}
|
|
4196
|
-
resetFormState(undefined, isDefaultDisabled);
|
|
4197
|
-
}
|
|
4198
|
-
|
|
4229
|
+
case 'CLEAR':
|
|
4230
|
+
showConfirmDialog(action).then(function () {
|
|
4231
|
+
var emptiedForm = clearTafFormData(getValues());
|
|
4232
|
+
resetFormValues(emptiedForm, true);
|
|
4233
|
+
showSnackbar('TAF has been cleared');
|
|
4234
|
+
});
|
|
4199
4235
|
break;
|
|
4200
4236
|
|
|
4201
4237
|
case 'AMEND':
|
|
@@ -4369,7 +4405,7 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4369
4405
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4370
4406
|
}, []);
|
|
4371
4407
|
React__default.useEffect(function () {
|
|
4372
|
-
var newValues = prepareTafValues(originalTaf, undefined, !isDefaultDisabled
|
|
4408
|
+
var newValues = prepareTafValues(originalTaf, undefined, !isDefaultDisabled); // set new form values when taf values changed
|
|
4373
4409
|
|
|
4374
4410
|
resetFormValues(newValues); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4375
4411
|
}, [originalTaf]);
|
|
@@ -4431,10 +4467,10 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4431
4467
|
handle: ".handle",
|
|
4432
4468
|
direction: "vertical",
|
|
4433
4469
|
// hover props
|
|
4434
|
-
forceFallback:
|
|
4470
|
+
forceFallback: false,
|
|
4435
4471
|
onStart: function onStart(event) {
|
|
4436
4472
|
onStartDrag(event);
|
|
4437
|
-
Sortable.ghost.style.opacity = '1';
|
|
4473
|
+
if (Sortable.ghost) Sortable.ghost.style.opacity = '1';
|
|
4438
4474
|
}
|
|
4439
4475
|
}, fields.map(function (item, index) {
|
|
4440
4476
|
return /*#__PURE__*/React__default.createElement(TafFormRow, {
|
|
@@ -4741,69 +4777,72 @@ var IconWithTooltip = function IconWithTooltip(_ref) {
|
|
|
4741
4777
|
children = _ref.children;
|
|
4742
4778
|
return /*#__PURE__*/React.createElement(CustomTooltip, {
|
|
4743
4779
|
title: title,
|
|
4744
|
-
placement: "right"
|
|
4780
|
+
placement: "right",
|
|
4781
|
+
"data-testid": "statusIcon-tooltip"
|
|
4745
4782
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
4746
4783
|
component: "span"
|
|
4747
4784
|
}, children));
|
|
4748
4785
|
};
|
|
4749
4786
|
|
|
4750
4787
|
var StatusIcon = function StatusIcon(_ref2) {
|
|
4751
|
-
var
|
|
4752
|
-
|
|
4788
|
+
var status = _ref2.status,
|
|
4789
|
+
timeSlot = _ref2.timeSlot;
|
|
4753
4790
|
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4791
|
+
switch (status) {
|
|
4792
|
+
case 'DRAFT':
|
|
4793
|
+
case 'DRAFT_AMENDED':
|
|
4794
|
+
case 'DRAFT_CORRECTED':
|
|
4795
|
+
return /*#__PURE__*/React.createElement(IconWithTooltip, {
|
|
4796
|
+
title: getTafStatusLabel(status)
|
|
4797
|
+
}, /*#__PURE__*/React.createElement(Edit, {
|
|
4798
|
+
"data-testid": "status-draft",
|
|
4799
|
+
sx: {
|
|
4800
|
+
color: 'geowebColors.buttons.tertiary.default.color'
|
|
4801
|
+
}
|
|
4802
|
+
}));
|
|
4757
4803
|
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4804
|
+
case 'PUBLISHED':
|
|
4805
|
+
case 'CORRECTED':
|
|
4806
|
+
case 'AMENDED':
|
|
4807
|
+
return /*#__PURE__*/React.createElement(IconWithTooltip, {
|
|
4808
|
+
title: getTafStatusLabel(status)
|
|
4809
|
+
}, timeSlot === 'ACTIVE' ? /*#__PURE__*/React.createElement(Success, {
|
|
4810
|
+
"data-testid": "status-active",
|
|
4811
|
+
sx: {
|
|
4812
|
+
color: 'geowebColors.functional.success'
|
|
4813
|
+
}
|
|
4814
|
+
}) : /*#__PURE__*/React.createElement(Clock, {
|
|
4815
|
+
"data-testid": "status-upcoming",
|
|
4816
|
+
sx: {
|
|
4817
|
+
color: 'geowebColors.functional.success'
|
|
4818
|
+
}
|
|
4819
|
+
}));
|
|
4769
4820
|
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
}
|
|
4821
|
+
case 'CANCELLED':
|
|
4822
|
+
return /*#__PURE__*/React.createElement(IconWithTooltip, {
|
|
4823
|
+
title: getTafStatusLabel(status)
|
|
4824
|
+
}, /*#__PURE__*/React.createElement(Cancel, {
|
|
4825
|
+
"data-testid": "status-cancelled",
|
|
4826
|
+
sx: {
|
|
4827
|
+
color: 'geowebColors.captions.captionError.rgba'
|
|
4828
|
+
}
|
|
4829
|
+
}));
|
|
4780
4830
|
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4831
|
+
case 'EXPIRED':
|
|
4832
|
+
return /*#__PURE__*/React.createElement(IconWithTooltip, {
|
|
4833
|
+
title: getTafStatusLabel(status)
|
|
4834
|
+
}, /*#__PURE__*/React.createElement(Clock, {
|
|
4835
|
+
"data-testid": "status-expired",
|
|
4836
|
+
sx: {
|
|
4837
|
+
transform: 'scaleX(-1)',
|
|
4838
|
+
color: 'geowebColors.buttons.tertiary.disabled.color'
|
|
4839
|
+
}
|
|
4840
|
+
}));
|
|
4791
4841
|
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
sx: {
|
|
4797
|
-
color: 'geowebColors.functional.success'
|
|
4798
|
-
}
|
|
4799
|
-
})) : /*#__PURE__*/React.createElement(IconWithTooltip, {
|
|
4800
|
-
title: "Upcoming"
|
|
4801
|
-
}, /*#__PURE__*/React.createElement(Clock, {
|
|
4802
|
-
"data-testid": "status-upcoming",
|
|
4803
|
-
sx: {
|
|
4804
|
-
color: 'geowebColors.functional.success'
|
|
4805
|
-
}
|
|
4806
|
-
}));
|
|
4842
|
+
case 'NEW':
|
|
4843
|
+
default:
|
|
4844
|
+
return null;
|
|
4845
|
+
}
|
|
4807
4846
|
};
|
|
4808
4847
|
|
|
4809
4848
|
/* *
|
|
@@ -4849,8 +4888,8 @@ var ExportButton = function ExportButton(_ref) {
|
|
|
4849
4888
|
* See the License for the specific language governing permissions and
|
|
4850
4889
|
* limitations under the License.
|
|
4851
4890
|
*
|
|
4852
|
-
* Copyright
|
|
4853
|
-
* Copyright
|
|
4891
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4892
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
4854
4893
|
* */
|
|
4855
4894
|
var AdverseWeatherTACMessage = function AdverseWeatherTACMessage(_ref) {
|
|
4856
4895
|
var TAC = _ref.TAC,
|
|
@@ -4881,7 +4920,8 @@ var AdverseWeatherTACMessage = function AdverseWeatherTACMessage(_ref) {
|
|
|
4881
4920
|
}, isActive && {
|
|
4882
4921
|
backgroundColor: 'geowebColors.functional.warningHighlight.rgba'
|
|
4883
4922
|
}), word.type === 'adverse' && {
|
|
4884
|
-
color: 'geowebColors.captions.captionError.rgba'
|
|
4923
|
+
color: 'geowebColors.captions.captionError.rgba',
|
|
4924
|
+
fontWeight: 'bold'
|
|
4885
4925
|
})
|
|
4886
4926
|
}, word.text === '=' ? "".concat(word.text) : " ".concat(word.text));
|
|
4887
4927
|
}));
|
|
@@ -5231,7 +5271,7 @@ var TopTabs = function TopTabs(_ref) {
|
|
|
5231
5271
|
var _useFormContext = useFormContext(),
|
|
5232
5272
|
dirtyFields = _useFormContext.formState.dirtyFields;
|
|
5233
5273
|
|
|
5234
|
-
var isDirty =
|
|
5274
|
+
var isDirty = isFormDirty(dirtyFields);
|
|
5235
5275
|
|
|
5236
5276
|
if (!tafFromBackend) {
|
|
5237
5277
|
return null;
|
|
@@ -5301,7 +5341,7 @@ var LocationTabs = function LocationTabs(_ref) {
|
|
|
5301
5341
|
var _useFormContext = useFormContext(),
|
|
5302
5342
|
dirtyFields = _useFormContext.formState.dirtyFields;
|
|
5303
5343
|
|
|
5304
|
-
var isDirty =
|
|
5344
|
+
var isDirty = isFormDirty(dirtyFields);
|
|
5305
5345
|
return /*#__PURE__*/React.createElement(MenuList, {
|
|
5306
5346
|
"data-testid": "location-tabs",
|
|
5307
5347
|
sx: {
|
package/index.umd.js
CHANGED
|
@@ -2015,7 +2015,8 @@
|
|
|
2015
2015
|
cloud3: '',
|
|
2016
2016
|
cloud4: ''
|
|
2017
2017
|
}
|
|
2018
|
-
};
|
|
2018
|
+
};
|
|
2019
|
+
var MIN_NUMBER_CHANGE_GROUP = 5; // formatters
|
|
2019
2020
|
|
|
2020
2021
|
var formatIssueTime = function formatIssueTime(issueDate) {
|
|
2021
2022
|
return issueDate ? moment__default["default"](issueDate).utc().format('DDHHmm') + "Z" : 'Not issued';
|
|
@@ -2423,7 +2424,7 @@
|
|
|
2423
2424
|
}; // dialog utils
|
|
2424
2425
|
|
|
2425
2426
|
var getConfirmationDialogTitle = function getConfirmationDialogTitle(action) {
|
|
2426
|
-
if (action === '
|
|
2427
|
+
if (action === 'CLEAR') return 'Clear TAF';
|
|
2427
2428
|
if (action === 'PUBLISH') return 'Publish';
|
|
2428
2429
|
if (action === 'AMEND') return 'This TAF is an amendment';
|
|
2429
2430
|
if (action === 'CORRECT') return 'This TAF is a correction';
|
|
@@ -2448,8 +2449,8 @@
|
|
|
2448
2449
|
};
|
|
2449
2450
|
var getConfirmationDialogContent = function getConfirmationDialogContent(action, isFormDirty) {
|
|
2450
2451
|
switch (action) {
|
|
2451
|
-
case '
|
|
2452
|
-
return 'Are you sure you would like to
|
|
2452
|
+
case 'CLEAR':
|
|
2453
|
+
return 'Are you sure you would like to clear this TAF? All content will be lost';
|
|
2453
2454
|
|
|
2454
2455
|
case 'PUBLISH':
|
|
2455
2456
|
return 'Are you sure you want to publish this TAF?';
|
|
@@ -2464,9 +2465,9 @@
|
|
|
2464
2465
|
};
|
|
2465
2466
|
var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel(action) {
|
|
2466
2467
|
switch (action) {
|
|
2467
|
-
case '
|
|
2468
|
+
case 'CLEAR':
|
|
2468
2469
|
{
|
|
2469
|
-
return '
|
|
2470
|
+
return 'Clear';
|
|
2470
2471
|
}
|
|
2471
2472
|
|
|
2472
2473
|
case 'CANCEL':
|
|
@@ -2556,13 +2557,13 @@
|
|
|
2556
2557
|
cloud: __assign(__assign({}, emptyChangegroup.cloud), changeGroup.cloud)
|
|
2557
2558
|
});
|
|
2558
2559
|
};
|
|
2559
|
-
var prepareTafValues = function prepareTafValues(_taf, tafAction,
|
|
2560
|
+
var prepareTafValues = function prepareTafValues(_taf, tafAction, addEmptyChangeGroups) {
|
|
2560
2561
|
var _a;
|
|
2561
2562
|
|
|
2562
2563
|
var _b;
|
|
2563
2564
|
|
|
2564
|
-
if (
|
|
2565
|
-
|
|
2565
|
+
if (addEmptyChangeGroups === void 0) {
|
|
2566
|
+
addEmptyChangeGroups = false;
|
|
2566
2567
|
} // If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
|
|
2567
2568
|
// If action is AMEND/DRAFT_AMEND - update validity start time to current time
|
|
2568
2569
|
|
|
@@ -2576,18 +2577,44 @@
|
|
|
2576
2577
|
});
|
|
2577
2578
|
|
|
2578
2579
|
var formattedChangeGroups = ((_b = taf.changeGroups) === null || _b === void 0 ? void 0 : _b.map(formatFormValues)) || [];
|
|
2579
|
-
var changeGroups = formattedChangeGroups.map(createChangeGroup); //
|
|
2580
|
+
var changeGroups = formattedChangeGroups.map(createChangeGroup); // If addEmptyChangeGroups is true - ensure there are at least MIN_NUMBER_CHANGE_GROUP changegroups
|
|
2581
|
+
|
|
2582
|
+
if (addEmptyChangeGroups) {
|
|
2583
|
+
var changeGroupsToAdd = MIN_NUMBER_CHANGE_GROUP - changeGroups.length;
|
|
2580
2584
|
|
|
2581
|
-
|
|
2582
|
-
|
|
2585
|
+
if (changeGroupsToAdd > 0) {
|
|
2586
|
+
Array.from(Array(changeGroupsToAdd)).map(function () {
|
|
2587
|
+
return changeGroups.push(emptyChangegroup);
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2583
2590
|
}
|
|
2584
2591
|
|
|
2585
|
-
return __assign(__assign({
|
|
2592
|
+
return __assign(__assign({
|
|
2593
|
+
issueDate: '',
|
|
2594
|
+
previousId: null,
|
|
2595
|
+
previousValidDateStart: null,
|
|
2596
|
+
previousValidDateEnd: null
|
|
2597
|
+
}, taf), (_a = {
|
|
2586
2598
|
messageType: getMessageType(taf, tafAction),
|
|
2587
2599
|
baseForecast: baseForecast,
|
|
2588
2600
|
changeGroups: changeGroups
|
|
2589
2601
|
}, _a[shared.HIDDEN_INPUT_HELPER_IS_DRAFT] = true, _a));
|
|
2590
2602
|
};
|
|
2603
|
+
var clearTafFormData = function clearTafFormData(tafFormValues) {
|
|
2604
|
+
// Remove all except for the validity times
|
|
2605
|
+
var baseForecast = {
|
|
2606
|
+
valid: tafFormValues.baseForecast.valid
|
|
2607
|
+
};
|
|
2608
|
+
var emptyChangeGroups = [];
|
|
2609
|
+
Array.from(Array(MIN_NUMBER_CHANGE_GROUP)).map(function () {
|
|
2610
|
+
return emptyChangeGroups.push(emptyChangegroup);
|
|
2611
|
+
});
|
|
2612
|
+
return __assign(__assign({}, tafFormValues), {
|
|
2613
|
+
baseForecast: __assign(__assign({}, emptyBaseForecast), baseForecast),
|
|
2614
|
+
// Add empty change groups
|
|
2615
|
+
changeGroups: emptyChangeGroups
|
|
2616
|
+
});
|
|
2617
|
+
};
|
|
2591
2618
|
var getIsFormDefaultDisabled = function getIsFormDefaultDisabled(status) {
|
|
2592
2619
|
return !(status === 'NEW' || status === 'DRAFT' || status === 'DRAFT_AMENDED' || status === 'DRAFT_CORRECTED');
|
|
2593
2620
|
};
|
|
@@ -2618,6 +2645,9 @@
|
|
|
2618
2645
|
return 'NEW';
|
|
2619
2646
|
}
|
|
2620
2647
|
};
|
|
2648
|
+
var isFormDirty = function isFormDirty(dirtyFields) {
|
|
2649
|
+
return Object.keys(dirtyFields).length > 0;
|
|
2650
|
+
};
|
|
2621
2651
|
|
|
2622
2652
|
var textFieldStyle = function textFieldStyle(theme) {
|
|
2623
2653
|
return {
|
|
@@ -2747,7 +2777,9 @@
|
|
|
2747
2777
|
}) || null;
|
|
2748
2778
|
|
|
2749
2779
|
if (foundValue) {
|
|
2750
|
-
setValue(name, foundValue.value
|
|
2780
|
+
setValue(name, foundValue.value, {
|
|
2781
|
+
shouldDirty: true
|
|
2782
|
+
});
|
|
2751
2783
|
setMaxLength(foundValue.value.length);
|
|
2752
2784
|
event.preventDefault();
|
|
2753
2785
|
}
|
|
@@ -3484,13 +3516,13 @@
|
|
|
3484
3516
|
canBe: canBe,
|
|
3485
3517
|
onTafViewModeButtonPress: onTafViewModeButtonPress
|
|
3486
3518
|
}) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
3487
|
-
"data-testid": "
|
|
3519
|
+
"data-testid": "cleartaf",
|
|
3488
3520
|
variant: "tertiary",
|
|
3489
3521
|
onClick: function onClick() {
|
|
3490
3522
|
// Simply discard the changes and close the dialog.
|
|
3491
|
-
onTafEditModeButtonPress('
|
|
3523
|
+
onTafEditModeButtonPress('CLEAR');
|
|
3492
3524
|
}
|
|
3493
|
-
}, "
|
|
3525
|
+
}, "Clear"), /*#__PURE__*/React__default["default"].createElement(material.Button, {
|
|
3494
3526
|
"data-testid": "savedrafttaf",
|
|
3495
3527
|
variant: "tertiary",
|
|
3496
3528
|
onClick: function onClick() {
|
|
@@ -3557,9 +3589,7 @@
|
|
|
3557
3589
|
'&:hover': {
|
|
3558
3590
|
backgroundColor: 'transparent'
|
|
3559
3591
|
},
|
|
3560
|
-
cursor:
|
|
3561
|
-
return isSorting ? 'grabbing' : 'grab';
|
|
3562
|
-
}
|
|
3592
|
+
cursor: isSorting ? 'grabbing' : 'grab'
|
|
3563
3593
|
}
|
|
3564
3594
|
}, /*#__PURE__*/React__default["default"].createElement(theme.DragHandle, null));
|
|
3565
3595
|
};
|
|
@@ -3996,7 +4026,7 @@
|
|
|
3996
4026
|
formState = _l.formState,
|
|
3997
4027
|
getValues = _l.getValues,
|
|
3998
4028
|
setValue = _l.setValue,
|
|
3999
|
-
|
|
4029
|
+
resetField = _l.resetField; // added this ignore as the build is failing otherwise on: Type instantiation is excessively deep and possibly infinite.
|
|
4000
4030
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4001
4031
|
// @ts-ignore
|
|
4002
4032
|
|
|
@@ -4017,12 +4047,12 @@
|
|
|
4017
4047
|
|
|
4018
4048
|
var dirtyFields = formState.dirtyFields,
|
|
4019
4049
|
errors = formState.errors;
|
|
4020
|
-
var isFormDirty =
|
|
4021
|
-
shared.usePreventBrowserClose(isFormDirty && !isDisabled); // Needed to be able to show a confirmation dialog on closing parent view
|
|
4050
|
+
var isFormDirty$1 = isFormDirty(dirtyFields);
|
|
4051
|
+
shared.usePreventBrowserClose(isFormDirty$1 && !isDisabled); // Needed to be able to show a confirmation dialog on closing parent view
|
|
4022
4052
|
|
|
4023
4053
|
React__default["default"].useEffect(function () {
|
|
4024
|
-
onPreventCloseView(isFormDirty); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4025
|
-
}, [isFormDirty]);
|
|
4054
|
+
onPreventCloseView(isFormDirty$1); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4055
|
+
}, [isFormDirty$1]);
|
|
4026
4056
|
var hiddenInputFields = ['baseTime', 'issueDate', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd', shared.HIDDEN_INPUT_HELPER_IS_DRAFT];
|
|
4027
4057
|
|
|
4028
4058
|
var onSubmit = function onSubmit(data) {
|
|
@@ -4034,16 +4064,28 @@
|
|
|
4034
4064
|
return confirmDialog({
|
|
4035
4065
|
title: getConfirmationDialogTitle(action),
|
|
4036
4066
|
description: getConfirmationDialogContent(action, function () {
|
|
4037
|
-
return isTafAmendedCorrectedChanged(isFormDirty, originalTaf, convertTafValuesToObject(getValues()));
|
|
4067
|
+
return isTafAmendedCorrectedChanged(isFormDirty$1, originalTaf, convertTafValuesToObject(getValues()));
|
|
4038
4068
|
}),
|
|
4039
4069
|
confirmLabel: getConfirmationDialogButtonLabel(action)
|
|
4040
4070
|
});
|
|
4041
4071
|
};
|
|
4042
4072
|
|
|
4043
|
-
var resetFormValues = function resetFormValues(formData) {
|
|
4044
|
-
|
|
4045
|
-
keepDirty
|
|
4046
|
-
|
|
4073
|
+
var resetFormValues = function resetFormValues(formData, keepDirty) {
|
|
4074
|
+
if (keepDirty === void 0) {
|
|
4075
|
+
keepDirty = false;
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
Object.keys(formData).forEach(function (key) {
|
|
4079
|
+
if (!keepDirty || key === 'changeGroups') {
|
|
4080
|
+
resetField(key, {
|
|
4081
|
+
keepDirty: keepDirty,
|
|
4082
|
+
defaultValue: formData[key]
|
|
4083
|
+
});
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
setValue(key, formData[key], {
|
|
4087
|
+
shouldDirty: keepDirty
|
|
4088
|
+
});
|
|
4047
4089
|
});
|
|
4048
4090
|
};
|
|
4049
4091
|
|
|
@@ -4056,7 +4098,7 @@
|
|
|
4056
4098
|
tafToReset = originalTaf;
|
|
4057
4099
|
}
|
|
4058
4100
|
|
|
4059
|
-
var shouldAddEmptyChangGroup = !
|
|
4101
|
+
var shouldAddEmptyChangGroup = !resetDisabled;
|
|
4060
4102
|
var newTaf = prepareTafValues(tafToReset, action, shouldAddEmptyChangGroup);
|
|
4061
4103
|
resetFormValues(newTaf);
|
|
4062
4104
|
setIsDisabled(resetDisabled);
|
|
@@ -4145,7 +4187,7 @@
|
|
|
4145
4187
|
var onSwitchMode = function onSwitchMode(event) {
|
|
4146
4188
|
var checked = event.target.checked;
|
|
4147
4189
|
|
|
4148
|
-
if (!checked && isFormDirty) {
|
|
4190
|
+
if (!checked && isFormDirty$1) {
|
|
4149
4191
|
confirmDialog({
|
|
4150
4192
|
title: 'Whoops',
|
|
4151
4193
|
description: 'Are you sure you want to switch to viewer mode? Your unsaved changes will be lost.',
|
|
@@ -4191,15 +4233,12 @@
|
|
|
4191
4233
|
})();
|
|
4192
4234
|
break;
|
|
4193
4235
|
|
|
4194
|
-
case '
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
}
|
|
4200
|
-
resetFormState(undefined, isDefaultDisabled);
|
|
4201
|
-
}
|
|
4202
|
-
|
|
4236
|
+
case 'CLEAR':
|
|
4237
|
+
showConfirmDialog(action).then(function () {
|
|
4238
|
+
var emptiedForm = clearTafFormData(getValues());
|
|
4239
|
+
resetFormValues(emptiedForm, true);
|
|
4240
|
+
showSnackbar('TAF has been cleared');
|
|
4241
|
+
});
|
|
4203
4242
|
break;
|
|
4204
4243
|
|
|
4205
4244
|
case 'AMEND':
|
|
@@ -4388,7 +4427,7 @@
|
|
|
4388
4427
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4389
4428
|
}, []);
|
|
4390
4429
|
React__default["default"].useEffect(function () {
|
|
4391
|
-
var newValues = prepareTafValues(originalTaf, undefined, !isDefaultDisabled
|
|
4430
|
+
var newValues = prepareTafValues(originalTaf, undefined, !isDefaultDisabled); // set new form values when taf values changed
|
|
4392
4431
|
|
|
4393
4432
|
resetFormValues(newValues); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4394
4433
|
}, [originalTaf]);
|
|
@@ -4450,10 +4489,10 @@
|
|
|
4450
4489
|
handle: ".handle",
|
|
4451
4490
|
direction: "vertical",
|
|
4452
4491
|
// hover props
|
|
4453
|
-
forceFallback:
|
|
4492
|
+
forceFallback: false,
|
|
4454
4493
|
onStart: function onStart(event) {
|
|
4455
4494
|
onStartDrag(event);
|
|
4456
|
-
Sortable__default["default"].ghost.style.opacity = '1';
|
|
4495
|
+
if (Sortable__default["default"].ghost) Sortable__default["default"].ghost.style.opacity = '1';
|
|
4457
4496
|
}
|
|
4458
4497
|
}, fields.map(function (item, index) {
|
|
4459
4498
|
return /*#__PURE__*/React__default["default"].createElement(TafFormRow, {
|
|
@@ -4755,69 +4794,72 @@
|
|
|
4755
4794
|
children = _a.children;
|
|
4756
4795
|
return /*#__PURE__*/React__namespace.createElement(shared.CustomTooltip, {
|
|
4757
4796
|
title: title,
|
|
4758
|
-
placement: "right"
|
|
4797
|
+
placement: "right",
|
|
4798
|
+
"data-testid": "statusIcon-tooltip"
|
|
4759
4799
|
}, /*#__PURE__*/React__namespace.createElement(material.Box, {
|
|
4760
4800
|
component: "span"
|
|
4761
4801
|
}, children));
|
|
4762
4802
|
};
|
|
4763
4803
|
|
|
4764
4804
|
var StatusIcon = function StatusIcon(_a) {
|
|
4765
|
-
var
|
|
4766
|
-
|
|
4805
|
+
var status = _a.status,
|
|
4806
|
+
timeSlot = _a.timeSlot;
|
|
4767
4807
|
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4808
|
+
switch (status) {
|
|
4809
|
+
case 'DRAFT':
|
|
4810
|
+
case 'DRAFT_AMENDED':
|
|
4811
|
+
case 'DRAFT_CORRECTED':
|
|
4812
|
+
return /*#__PURE__*/React__namespace.createElement(IconWithTooltip, {
|
|
4813
|
+
title: getTafStatusLabel(status)
|
|
4814
|
+
}, /*#__PURE__*/React__namespace.createElement(theme.Edit, {
|
|
4815
|
+
"data-testid": "status-draft",
|
|
4816
|
+
sx: {
|
|
4817
|
+
color: 'geowebColors.buttons.tertiary.default.color'
|
|
4818
|
+
}
|
|
4819
|
+
}));
|
|
4771
4820
|
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4821
|
+
case 'PUBLISHED':
|
|
4822
|
+
case 'CORRECTED':
|
|
4823
|
+
case 'AMENDED':
|
|
4824
|
+
return /*#__PURE__*/React__namespace.createElement(IconWithTooltip, {
|
|
4825
|
+
title: getTafStatusLabel(status)
|
|
4826
|
+
}, timeSlot === 'ACTIVE' ? /*#__PURE__*/React__namespace.createElement(theme.Success, {
|
|
4827
|
+
"data-testid": "status-active",
|
|
4828
|
+
sx: {
|
|
4829
|
+
color: 'geowebColors.functional.success'
|
|
4830
|
+
}
|
|
4831
|
+
}) : /*#__PURE__*/React__namespace.createElement(theme.Clock, {
|
|
4832
|
+
"data-testid": "status-upcoming",
|
|
4833
|
+
sx: {
|
|
4834
|
+
color: 'geowebColors.functional.success'
|
|
4835
|
+
}
|
|
4836
|
+
}));
|
|
4783
4837
|
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
}
|
|
4838
|
+
case 'CANCELLED':
|
|
4839
|
+
return /*#__PURE__*/React__namespace.createElement(IconWithTooltip, {
|
|
4840
|
+
title: getTafStatusLabel(status)
|
|
4841
|
+
}, /*#__PURE__*/React__namespace.createElement(theme.Cancel, {
|
|
4842
|
+
"data-testid": "status-cancelled",
|
|
4843
|
+
sx: {
|
|
4844
|
+
color: 'geowebColors.captions.captionError.rgba'
|
|
4845
|
+
}
|
|
4846
|
+
}));
|
|
4794
4847
|
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4848
|
+
case 'EXPIRED':
|
|
4849
|
+
return /*#__PURE__*/React__namespace.createElement(IconWithTooltip, {
|
|
4850
|
+
title: getTafStatusLabel(status)
|
|
4851
|
+
}, /*#__PURE__*/React__namespace.createElement(theme.Clock, {
|
|
4852
|
+
"data-testid": "status-expired",
|
|
4853
|
+
sx: {
|
|
4854
|
+
transform: 'scaleX(-1)',
|
|
4855
|
+
color: 'geowebColors.buttons.tertiary.disabled.color'
|
|
4856
|
+
}
|
|
4857
|
+
}));
|
|
4805
4858
|
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
sx: {
|
|
4811
|
-
color: 'geowebColors.functional.success'
|
|
4812
|
-
}
|
|
4813
|
-
})) : /*#__PURE__*/React__namespace.createElement(IconWithTooltip, {
|
|
4814
|
-
title: "Upcoming"
|
|
4815
|
-
}, /*#__PURE__*/React__namespace.createElement(theme.Clock, {
|
|
4816
|
-
"data-testid": "status-upcoming",
|
|
4817
|
-
sx: {
|
|
4818
|
-
color: 'geowebColors.functional.success'
|
|
4819
|
-
}
|
|
4820
|
-
}));
|
|
4859
|
+
case 'NEW':
|
|
4860
|
+
default:
|
|
4861
|
+
return null;
|
|
4862
|
+
}
|
|
4821
4863
|
};
|
|
4822
4864
|
|
|
4823
4865
|
/* *
|
|
@@ -4863,8 +4905,8 @@
|
|
|
4863
4905
|
* See the License for the specific language governing permissions and
|
|
4864
4906
|
* limitations under the License.
|
|
4865
4907
|
*
|
|
4866
|
-
* Copyright
|
|
4867
|
-
* Copyright
|
|
4908
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4909
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
4868
4910
|
* */
|
|
4869
4911
|
var AdverseWeatherTACMessage = function AdverseWeatherTACMessage(_a) {
|
|
4870
4912
|
var TAC = _a.TAC,
|
|
@@ -4895,7 +4937,8 @@
|
|
|
4895
4937
|
}, isActive && {
|
|
4896
4938
|
backgroundColor: 'geowebColors.functional.warningHighlight.rgba'
|
|
4897
4939
|
}), word.type === 'adverse' && {
|
|
4898
|
-
color: 'geowebColors.captions.captionError.rgba'
|
|
4940
|
+
color: 'geowebColors.captions.captionError.rgba',
|
|
4941
|
+
fontWeight: 'bold'
|
|
4899
4942
|
})
|
|
4900
4943
|
}, word.text === '=' ? "" + word.text : " " + word.text);
|
|
4901
4944
|
}));
|
|
@@ -5236,7 +5279,7 @@
|
|
|
5236
5279
|
}
|
|
5237
5280
|
} : _c;
|
|
5238
5281
|
var dirtyFields = reactHookForm.useFormContext().formState.dirtyFields;
|
|
5239
|
-
var isDirty =
|
|
5282
|
+
var isDirty = isFormDirty(dirtyFields);
|
|
5240
5283
|
|
|
5241
5284
|
if (!tafFromBackend) {
|
|
5242
5285
|
return null;
|
|
@@ -5303,7 +5346,7 @@
|
|
|
5303
5346
|
onChangeTab = _c === void 0 ? function () {} : _c,
|
|
5304
5347
|
timeSlot = _a.timeSlot;
|
|
5305
5348
|
var dirtyFields = reactHookForm.useFormContext().formState.dirtyFields;
|
|
5306
|
-
var isDirty =
|
|
5349
|
+
var isDirty = isFormDirty(dirtyFields);
|
|
5307
5350
|
return /*#__PURE__*/React__namespace.createElement(material.MenuList, {
|
|
5308
5351
|
"data-testid": "location-tabs",
|
|
5309
5352
|
sx: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TafStatus, TimeSlot } from '../../types';
|
|
3
3
|
interface StatusIconProps {
|
|
4
|
-
timeSlot: TimeSlot;
|
|
5
4
|
status: TafStatus;
|
|
5
|
+
timeSlot: TimeSlot;
|
|
6
6
|
}
|
|
7
7
|
declare const StatusIcon: React.FC<StatusIconProps>;
|
|
8
8
|
export default StatusIcon;
|
|
@@ -16,6 +16,7 @@ export declare const emptyBaseForecast: {
|
|
|
16
16
|
cloud4: string;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
+
export declare const MIN_NUMBER_CHANGE_GROUP = 5;
|
|
19
20
|
export declare const formatIssueTime: (issueDate: string) => string;
|
|
20
21
|
declare type BaseForecastOrChangeGroupFormData<T extends BaseForecast | ChangeGroup> = T extends ChangeGroup ? ChangeGroupFormData : BaseForecastFormData;
|
|
21
22
|
export declare function formatFormValues<T extends BaseForecast | ChangeGroup>(row: T): BaseForecastOrChangeGroupFormData<T>;
|
|
@@ -67,7 +68,11 @@ export declare const getTafStatusLabel: (status: TafStatus) => string;
|
|
|
67
68
|
export declare const getMessageType: (taf: Taf, tafAction: TafActions) => string;
|
|
68
69
|
export declare const getAmendedCorrectedTafTimes: (taf: Taf, tafAction: TafActions) => Taf;
|
|
69
70
|
export declare const createChangeGroup: (changeGroup: ChangeGroupFormData) => ChangeGroupFormData;
|
|
70
|
-
export declare const prepareTafValues: (_taf: Taf, tafAction: TafActions,
|
|
71
|
+
export declare const prepareTafValues: (_taf: Taf, tafAction: TafActions, addEmptyChangeGroups?: boolean) => TafFormData;
|
|
72
|
+
export declare const clearTafFormData: (tafFormValues: TafFormData) => TafFormData;
|
|
71
73
|
export declare const getIsFormDefaultDisabled: (status: TafStatus) => boolean;
|
|
72
74
|
export declare const fromStatusToAction: (tafStatus: TafStatus) => TafActions;
|
|
75
|
+
export declare const isFormDirty: (dirtyFields: Partial<Readonly<{
|
|
76
|
+
[x: string]: unknown;
|
|
77
|
+
}>>) => boolean;
|
|
73
78
|
export {};
|
package/lib/types.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface BaseTaf {
|
|
|
67
67
|
issueDate?: TafDate;
|
|
68
68
|
}
|
|
69
69
|
export declare type TafStatus = 'NEW' | 'DRAFT' | 'DRAFT_AMENDED' | 'DRAFT_CORRECTED' | 'PUBLISHED' | 'CORRECTED' | 'AMENDED' | 'CANCELLED' | 'EXPIRED';
|
|
70
|
-
export declare type TafActions = 'NEW' | 'DRAFT' | 'DRAFT_AMEND' | 'DRAFT_CORRECT' | 'PUBLISH' | 'CANCEL' | 'CORRECT' | 'AMEND' | 'CLOSE' | '
|
|
70
|
+
export declare type TafActions = 'NEW' | 'DRAFT' | 'DRAFT_AMEND' | 'DRAFT_CORRECT' | 'PUBLISH' | 'CANCEL' | 'CORRECT' | 'AMEND' | 'CLOSE' | 'CLEAR';
|
|
71
71
|
export declare type TafCanbe = 'DRAFTED' | 'DISCARDED' | 'PUBLISHED' | 'CANCELLED' | 'AMENDED' | 'CORRECTED';
|
|
72
72
|
export interface Taf extends BaseTaf {
|
|
73
73
|
status: TafStatus;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/taf",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "GeoWeb TAF library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -12,32 +12,32 @@
|
|
|
12
12
|
"typings": "./index.d.ts",
|
|
13
13
|
"dependencies": {},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@opengeoweb/
|
|
15
|
+
"@opengeoweb/api": "4.11.0",
|
|
16
16
|
"react": "^17.0.2",
|
|
17
|
-
"
|
|
17
|
+
"axios": "^0.25.0",
|
|
18
|
+
"@opengeoweb/shared": "4.11.0",
|
|
18
19
|
"@mui/material": "^5.10.8",
|
|
19
|
-
"@opengeoweb/theme": "4.
|
|
20
|
+
"@opengeoweb/theme": "4.11.0",
|
|
20
21
|
"react-draggable": "^4.4.5",
|
|
21
22
|
"re-resizable": "^6.9.0",
|
|
22
23
|
"@redux-eggs/core": "^2.2.0",
|
|
23
24
|
"react-redux": "^8.0.4",
|
|
24
|
-
"@opengeoweb/form-fields": "4.
|
|
25
|
+
"@opengeoweb/form-fields": "4.11.0",
|
|
25
26
|
"react-hook-form": "^7.41.5",
|
|
26
27
|
"moment": "^2.29.0",
|
|
27
28
|
"moment-timezone": "^0.5.31",
|
|
28
29
|
"@mui/x-date-pickers": "^5.0.4",
|
|
29
30
|
"lodash": "^4.17.20",
|
|
30
|
-
"axios": "^0.25.0",
|
|
31
31
|
"date-fns": "^2.29.3",
|
|
32
|
-
"@opengeoweb/
|
|
32
|
+
"@opengeoweb/core": "4.11.0",
|
|
33
|
+
"@opengeoweb/webmap": "4.11.0",
|
|
33
34
|
"throttle-debounce": "^3.0.1",
|
|
34
35
|
"proj4": "^2.6.2",
|
|
35
|
-
"@opengeoweb/api": "4.9.1",
|
|
36
36
|
"react-intl": "^5.17.5",
|
|
37
37
|
"react-sortablejs": "^6.1.4",
|
|
38
38
|
"sortablejs": "^1.15.0",
|
|
39
|
-
"react-window": "^1.8.7",
|
|
40
39
|
"immer": "^9.0.15",
|
|
40
|
+
"react-window": "^1.8.7",
|
|
41
41
|
"@reduxjs/toolkit": "^1.8.3",
|
|
42
42
|
"lodash.clonedeep": "^4.5.0",
|
|
43
43
|
"@turf/turf": "^5.1.6",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@redux-eggs/redux-toolkit": "^2.2.0",
|
|
47
47
|
"@redux-eggs/saga-extension": "^2.2.0",
|
|
48
48
|
"react-dom": "^17.0.2",
|
|
49
|
-
"@opengeoweb/authentication": "4.
|
|
49
|
+
"@opengeoweb/authentication": "4.11.0",
|
|
50
50
|
"react-router-dom": "^6.4.2",
|
|
51
51
|
"query-string": "^6.13.7"
|
|
52
52
|
}
|