@opengeoweb/sigmet-airmet 12.4.2 → 12.6.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 +195 -102
- package/package.json +10 -10
- package/src/index.d.ts +1 -0
- package/src/lib/components/ProductForms/ProductFormFields/Levels.d.ts +2 -0
- package/src/lib/types.d.ts +2 -0
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { createApiInstance, useApiContext, useApi, ApiProvider, createFakeApiInstance } from '@opengeoweb/api';
|
|
3
|
-
import { PROJECTION, useIsMounted, dateUtils, CustomTooltip, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, CustomDialog, AlertBanner, isAxiosError, getAxiosErrorMessage, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
|
|
3
|
+
import { PROJECTION, useIsMounted, dateUtils, CustomTooltip, usePrevious, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, CustomDialog, AlertBanner, isAxiosError, getAxiosErrorMessage, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
|
|
4
4
|
import { Box as Box$1 } from '@mui/system';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { useRef, useEffect, useCallback } from 'react';
|
|
@@ -133,7 +133,7 @@ var en = {
|
|
|
133
133
|
"levels-upper-level-label": "Upper level",
|
|
134
134
|
"unit-label": "Unit",
|
|
135
135
|
"levels-lower-level-label": "Lower level",
|
|
136
|
-
"levels-tops-label": "
|
|
136
|
+
"levels-tops-label": "Top",
|
|
137
137
|
progress: "Progress",
|
|
138
138
|
"surface-visibility": "Visibility",
|
|
139
139
|
"surface-visibility-cause": "Cause",
|
|
@@ -383,7 +383,7 @@ var no = {
|
|
|
383
383
|
"levels-upper-level-label": "Øvre nivå",
|
|
384
384
|
"unit-label": "Enhet",
|
|
385
385
|
"levels-lower-level-label": "Nedre nivå",
|
|
386
|
-
"levels-tops-label": "
|
|
386
|
+
"levels-tops-label": "Topp",
|
|
387
387
|
progress: "Framgang",
|
|
388
388
|
"surface-visibility": "Sikt",
|
|
389
389
|
"surface-visibility-cause": "Grunn",
|
|
@@ -5469,12 +5469,17 @@ var _validateLevelUnitCombinations = function validateLevelUnitCombinations(t, l
|
|
|
5469
5469
|
}
|
|
5470
5470
|
return true;
|
|
5471
5471
|
};
|
|
5472
|
+
var tsPhenomena = new Set(['EMBD_TS', 'EMBD_TSGR', 'FRQ_TS', 'FRQ_TSGR', 'OBSC_TS', 'OBSC_TSGR', 'SQL_TS', 'SQL_TSGR', 'ISOL_TS', 'ISOL_TSGR', 'OCNL_TS', 'OCNL_TSGR']);
|
|
5473
|
+
var isTSPhenomenon = function isTSPhenomenon(phenomenon) {
|
|
5474
|
+
return !!phenomenon && tsPhenomena.has(phenomenon);
|
|
5475
|
+
};
|
|
5472
5476
|
var Levels = function Levels(_ref) {
|
|
5473
5477
|
var isDisabled = _ref.isDisabled,
|
|
5474
5478
|
isReadOnly = _ref.isReadOnly,
|
|
5475
5479
|
_ref$onChange = _ref.onChange,
|
|
5476
5480
|
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
5477
|
-
productConfig = _ref.productConfig
|
|
5481
|
+
productConfig = _ref.productConfig,
|
|
5482
|
+
productType = _ref.productType;
|
|
5478
5483
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
5479
5484
|
t = _useSigmetAirmetTrans.t;
|
|
5480
5485
|
var _useFormContext = useFormContext(),
|
|
@@ -5495,6 +5500,37 @@ var Levels = function Levels(_ref) {
|
|
|
5495
5500
|
var levelInfoMode = watch('levelInfoMode');
|
|
5496
5501
|
var isRadioactiveCloud = watch('phenomenon') === 'RDOACT_CLD';
|
|
5497
5502
|
var fieldsDisabled = isDisabled || isShortTest() || isRadioactiveCloud;
|
|
5503
|
+
var phenomenon = watch('phenomenon');
|
|
5504
|
+
var isTS = isTSPhenomenon(phenomenon);
|
|
5505
|
+
var isSigmetTS = productType === 'sigmet' && isTS;
|
|
5506
|
+
var prevPhenomenon = usePrevious(phenomenon);
|
|
5507
|
+
React__default.useEffect(function () {
|
|
5508
|
+
if (productType !== 'sigmet') {
|
|
5509
|
+
return;
|
|
5510
|
+
}
|
|
5511
|
+
if (isSigmetTS) {
|
|
5512
|
+
if (levelInfoMode === 'AT') {
|
|
5513
|
+
setValue('levelInfoMode', 'TOPS', {
|
|
5514
|
+
shouldDirty: true
|
|
5515
|
+
});
|
|
5516
|
+
} else if (levelInfoMode === 'ABV') {
|
|
5517
|
+
setValue('levelInfoMode', 'TOPS_ABV', {
|
|
5518
|
+
shouldDirty: true
|
|
5519
|
+
});
|
|
5520
|
+
}
|
|
5521
|
+
}
|
|
5522
|
+
if (!isTS && tsPhenomena.has(prevPhenomenon || '')) {
|
|
5523
|
+
if (levelInfoMode === 'TOPS') {
|
|
5524
|
+
setValue('levelInfoMode', 'AT', {
|
|
5525
|
+
shouldDirty: true
|
|
5526
|
+
});
|
|
5527
|
+
} else if (levelInfoMode === 'TOPS_ABV') {
|
|
5528
|
+
setValue('levelInfoMode', 'ABV', {
|
|
5529
|
+
shouldDirty: true
|
|
5530
|
+
});
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
}, [isSigmetTS, isTS, levelInfoMode, setValue, prevPhenomenon, productType]);
|
|
5498
5534
|
var getFIRValue = function getFIRValue() {
|
|
5499
5535
|
return getValues('locationIndicatorATSR');
|
|
5500
5536
|
};
|
|
@@ -5554,12 +5590,15 @@ var Levels = function Levels(_ref) {
|
|
|
5554
5590
|
control: jsx(Checkbox, {
|
|
5555
5591
|
checked: levelInfoMode === 'TOPS',
|
|
5556
5592
|
onChange: function onChange() {
|
|
5557
|
-
|
|
5593
|
+
if (isSigmetTS) {
|
|
5594
|
+
return;
|
|
5595
|
+
}
|
|
5596
|
+
setValue('levelInfoMode', levelInfoMode === 'AT' ? 'TOPS' : 'AT', {
|
|
5558
5597
|
shouldDirty: true
|
|
5559
5598
|
});
|
|
5560
5599
|
},
|
|
5561
5600
|
color: "secondary",
|
|
5562
|
-
disabled: isDisabled
|
|
5601
|
+
disabled: isDisabled || isSigmetTS
|
|
5563
5602
|
}),
|
|
5564
5603
|
"data-testid": "levels-TOPS",
|
|
5565
5604
|
label: t('levels-tops-label')
|
|
@@ -5870,11 +5909,14 @@ var Levels = function Levels(_ref) {
|
|
|
5870
5909
|
control: jsx(Checkbox, {
|
|
5871
5910
|
checked: levelInfoMode === 'TOPS_ABV',
|
|
5872
5911
|
onChange: function onChange() {
|
|
5873
|
-
|
|
5912
|
+
if (isSigmetTS) {
|
|
5913
|
+
return;
|
|
5914
|
+
}
|
|
5915
|
+
setValue('levelInfoMode', levelInfoMode === 'ABV' ? 'TOPS_ABV' : 'ABV', {
|
|
5874
5916
|
shouldDirty: true
|
|
5875
5917
|
});
|
|
5876
5918
|
},
|
|
5877
|
-
disabled: isDisabled
|
|
5919
|
+
disabled: isDisabled || isSigmetTS
|
|
5878
5920
|
}),
|
|
5879
5921
|
label: t('levels-tops-label'),
|
|
5880
5922
|
"data-testid": "levels-TOPS_ABV"
|
|
@@ -6727,7 +6769,9 @@ var ValidFrom = function ValidFrom(_ref) {
|
|
|
6727
6769
|
isDisabled = _ref.isDisabled,
|
|
6728
6770
|
isReadOnly = _ref.isReadOnly,
|
|
6729
6771
|
_ref$onChange = _ref.onChange,
|
|
6730
|
-
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange
|
|
6772
|
+
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
6773
|
+
_ref$onUserChange = _ref.onUserChange,
|
|
6774
|
+
onUserChange = _ref$onUserChange === void 0 ? function () {} : _ref$onUserChange;
|
|
6731
6775
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
6732
6776
|
t = _useSigmetAirmetTrans.t;
|
|
6733
6777
|
var _useFormContext = useFormContext(),
|
|
@@ -6753,11 +6797,13 @@ var ValidFrom = function ValidFrom(_ref) {
|
|
|
6753
6797
|
},
|
|
6754
6798
|
// The current time can be no more than 4 hours before the validity start (12 for VA/TC SIGMET)
|
|
6755
6799
|
isCurrentTimeXHoursBeforeValue: function isCurrentTimeXHoursBeforeValue(value) {
|
|
6756
|
-
|
|
6800
|
+
var isValid = isXHoursBefore(dateUtils.getCurrentTimeAsString(), value, getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig));
|
|
6801
|
+
return isValid ? true : getValidFromXHoursBeforeMessage(t, getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig));
|
|
6757
6802
|
}
|
|
6758
6803
|
}
|
|
6759
6804
|
},
|
|
6760
6805
|
onChange: function onChange() {
|
|
6806
|
+
onUserChange == null || onUserChange();
|
|
6761
6807
|
triggerValidations(['validDateEnd', 'observationOrForecastTime'], getValues, trigger);
|
|
6762
6808
|
_onChange();
|
|
6763
6809
|
},
|
|
@@ -6789,7 +6835,10 @@ var ValidUntil = function ValidUntil(_ref) {
|
|
|
6789
6835
|
isDisabled = _ref.isDisabled,
|
|
6790
6836
|
isReadOnly = _ref.isReadOnly,
|
|
6791
6837
|
_ref$onChange = _ref.onChange,
|
|
6792
|
-
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange
|
|
6838
|
+
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
6839
|
+
_ref$onUserChange = _ref.onUserChange,
|
|
6840
|
+
onUserChange = _ref$onUserChange === void 0 ? function () {} : _ref$onUserChange,
|
|
6841
|
+
hasUserChangedTime = _ref.hasUserChangedTime;
|
|
6793
6842
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
6794
6843
|
t = _useSigmetAirmetTrans.t;
|
|
6795
6844
|
var _useFormContext = useFormContext(),
|
|
@@ -6808,19 +6857,18 @@ var ValidUntil = function ValidUntil(_ref) {
|
|
|
6808
6857
|
var locationIndicatorATSR = watch('locationIndicatorATSR');
|
|
6809
6858
|
var validFrom = watch('validDateStart');
|
|
6810
6859
|
React__default.useEffect(function () {
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
}
|
|
6822
|
-
|
|
6823
|
-
}, [phenomenon, locationIndicatorATSR, validFrom, setValue, productConfig, trigger, defaultValidUntilValue]);
|
|
6860
|
+
if (hasUserChangedTime) {
|
|
6861
|
+
return;
|
|
6862
|
+
}
|
|
6863
|
+
var newDefaultValidUntilValue = getDefaultValidUntilValue(productConfig, phenomenon, locationIndicatorATSR, validFrom);
|
|
6864
|
+
if (newDefaultValidUntilValue !== defaultValidUntilValue) {
|
|
6865
|
+
setDefaultValidUntilValue(newDefaultValidUntilValue);
|
|
6866
|
+
setValue('validDateEnd', newDefaultValidUntilValue, {
|
|
6867
|
+
shouldValidate: false
|
|
6868
|
+
});
|
|
6869
|
+
void trigger('validDateEnd');
|
|
6870
|
+
}
|
|
6871
|
+
}, [phenomenon, locationIndicatorATSR, validFrom, setValue, productConfig, trigger, defaultValidUntilValue, hasUserChangedTime]);
|
|
6824
6872
|
return jsx(ProductFormFieldLayout, {
|
|
6825
6873
|
title: t('valid-until'),
|
|
6826
6874
|
children: jsx(ReactHookFormDateTime, {
|
|
@@ -6845,7 +6893,7 @@ var ValidUntil = function ValidUntil(_ref) {
|
|
|
6845
6893
|
disabled: isDisabled,
|
|
6846
6894
|
isReadOnly: isReadOnly,
|
|
6847
6895
|
onChange: function onChange() {
|
|
6848
|
-
|
|
6896
|
+
onUserChange == null || onUserChange(); // Track manual change
|
|
6849
6897
|
triggerValidations(['validDateStart', 'observationOrForecastTime'], getValues, trigger);
|
|
6850
6898
|
_onChange();
|
|
6851
6899
|
},
|
|
@@ -8221,10 +8269,13 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8221
8269
|
setValue = _useFormContext2.setValue,
|
|
8222
8270
|
handleSubmit = _useFormContext2.handleSubmit,
|
|
8223
8271
|
errors = _useFormContext2.formState.errors;
|
|
8272
|
+
var _React$useState = React__default.useState(false),
|
|
8273
|
+
hasUserChangedTime = _React$useState[0],
|
|
8274
|
+
setHasUserChangedTime = _React$useState[1];
|
|
8224
8275
|
var firBorderAtStart = initialSigmet ? initialSigmet.locationIndicatorATSR : productConfig.active_firs[0];
|
|
8225
|
-
var _React$
|
|
8226
|
-
phenomenaList = _React$
|
|
8227
|
-
setPhenomenaList = _React$
|
|
8276
|
+
var _React$useState2 = React__default.useState(getDefaultPhenomena(productConfig).phenomena),
|
|
8277
|
+
phenomenaList = _React$useState2[0],
|
|
8278
|
+
setPhenomenaList = _React$useState2[1];
|
|
8228
8279
|
var _useMapDrawTool = useMapDrawTool({
|
|
8229
8280
|
defaultDrawModes: getDrawTools(t, StartOrEndDrawing.start, getFir(productConfig, firBorderAtStart)),
|
|
8230
8281
|
defaultGeoJSON: !isCancelSigmet && initialSigmet && initialSigmet.startGeometry ? addFeatureProperties(initialSigmet.startGeometry, featurePropsStart) : undefined,
|
|
@@ -8335,9 +8386,9 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8335
8386
|
updateGeojson: updateStartGeoJson
|
|
8336
8387
|
}), getEndLayer('geoJSONIntersection', 'geojsonlayer-intersection-end'), getStartLayer('geoJSONIntersection', 'geojsonlayer-intersection-start')];
|
|
8337
8388
|
useFormLayers(layers);
|
|
8338
|
-
var _React$
|
|
8339
|
-
isDisabled = _React$
|
|
8340
|
-
setIsDisabled = _React$
|
|
8389
|
+
var _React$useState3 = React__default.useState(mode === 'view'),
|
|
8390
|
+
isDisabled = _React$useState3[0],
|
|
8391
|
+
setIsDisabled = _React$useState3[1];
|
|
8341
8392
|
var isReadOnly = mode === 'view';
|
|
8342
8393
|
var helperText = isReadOnly ? '' : 'Optional';
|
|
8343
8394
|
React__default.useEffect(function () {
|
|
@@ -8407,12 +8458,19 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8407
8458
|
productConfig: productConfig,
|
|
8408
8459
|
isDisabled: isDisabled,
|
|
8409
8460
|
isReadOnly: isReadOnly,
|
|
8410
|
-
onChange: onChangeForm
|
|
8461
|
+
onChange: onChangeForm,
|
|
8462
|
+
onUserChange: function onUserChange() {
|
|
8463
|
+
return setHasUserChangedTime(true);
|
|
8464
|
+
}
|
|
8411
8465
|
}), jsx(ValidUntil, {
|
|
8412
8466
|
productConfig: productConfig,
|
|
8413
8467
|
isDisabled: isDisabled,
|
|
8414
8468
|
isReadOnly: isReadOnly,
|
|
8415
|
-
onChange: onChangeForm
|
|
8469
|
+
onChange: onChangeForm,
|
|
8470
|
+
hasUserChangedTime: hasUserChangedTime,
|
|
8471
|
+
onUserChange: function onUserChange() {
|
|
8472
|
+
return setHasUserChangedTime(true);
|
|
8473
|
+
}
|
|
8416
8474
|
}), jsx(SelectFIR, {
|
|
8417
8475
|
productConfig: productConfig,
|
|
8418
8476
|
isDisabled: isDisabled,
|
|
@@ -8567,6 +8625,9 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8567
8625
|
var _React$useState = React__default.useState(getDefaultPhenomena(productConfig).phenomena),
|
|
8568
8626
|
phenomenaList = _React$useState[0],
|
|
8569
8627
|
setPhenomenaList = _React$useState[1];
|
|
8628
|
+
var _React$useState2 = React__default.useState(false),
|
|
8629
|
+
hasUserChangedTime = _React$useState2[0],
|
|
8630
|
+
setHasUserChangedTime = _React$useState2[1];
|
|
8570
8631
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
8571
8632
|
t = _useSigmetAirmetTrans.t;
|
|
8572
8633
|
var _useApiContext = useApiContext(),
|
|
@@ -8635,9 +8696,9 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8635
8696
|
updateGeojson: updateStartGeoJson
|
|
8636
8697
|
}), getStartLayer('geoJSONIntersection', 'geojsonlayer-intersection-start')];
|
|
8637
8698
|
useFormLayers(layers);
|
|
8638
|
-
var _React$
|
|
8639
|
-
isDisabled = _React$
|
|
8640
|
-
setIsDisabled = _React$
|
|
8699
|
+
var _React$useState3 = React__default.useState(mode === 'view'),
|
|
8700
|
+
isDisabled = _React$useState3[0],
|
|
8701
|
+
setIsDisabled = _React$useState3[1];
|
|
8641
8702
|
var isReadOnly = mode === 'view';
|
|
8642
8703
|
var helperText = isReadOnly ? '' : 'Optional';
|
|
8643
8704
|
React__default.useEffect(function () {
|
|
@@ -8707,15 +8768,22 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8707
8768
|
helperText: helperText,
|
|
8708
8769
|
onChange: onChangeForm
|
|
8709
8770
|
}), jsx(ValidFrom, {
|
|
8710
|
-
|
|
8771
|
+
productConfig: productConfig,
|
|
8711
8772
|
isDisabled: isDisabled,
|
|
8773
|
+
isReadOnly: isReadOnly,
|
|
8712
8774
|
onChange: onChangeForm,
|
|
8713
|
-
|
|
8775
|
+
onUserChange: function onUserChange() {
|
|
8776
|
+
return setHasUserChangedTime(true);
|
|
8777
|
+
}
|
|
8714
8778
|
}), jsx(ValidUntil, {
|
|
8715
|
-
|
|
8779
|
+
productConfig: productConfig,
|
|
8716
8780
|
isDisabled: isDisabled,
|
|
8781
|
+
isReadOnly: isReadOnly,
|
|
8717
8782
|
onChange: onChangeForm,
|
|
8718
|
-
|
|
8783
|
+
hasUserChangedTime: hasUserChangedTime,
|
|
8784
|
+
onUserChange: function onUserChange() {
|
|
8785
|
+
return setHasUserChangedTime(true);
|
|
8786
|
+
}
|
|
8719
8787
|
}), jsx(SelectFIR, {
|
|
8720
8788
|
isReadOnly: isReadOnly,
|
|
8721
8789
|
isDisabled: isDisabled,
|
|
@@ -8858,7 +8926,9 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
|
|
|
8858
8926
|
var _useFormContext = useFormContext(),
|
|
8859
8927
|
handleSubmit = _useFormContext.handleSubmit,
|
|
8860
8928
|
formState = _useFormContext.formState,
|
|
8861
|
-
watch = _useFormContext.watch
|
|
8929
|
+
watch = _useFormContext.watch,
|
|
8930
|
+
trigger = _useFormContext.trigger,
|
|
8931
|
+
getValues = _useFormContext.getValues;
|
|
8862
8932
|
var dirtyFields = formState.dirtyFields;
|
|
8863
8933
|
var isDirty = Object.keys(dirtyFields).length > 0;
|
|
8864
8934
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
@@ -8916,66 +8986,89 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
|
|
|
8916
8986
|
}) : null
|
|
8917
8987
|
});
|
|
8918
8988
|
};
|
|
8919
|
-
var onProductButtonPress = function
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
})["catch"](function (reason) {
|
|
8931
|
-
if (reason === 'CANCELLED') {
|
|
8932
|
-
// close without save
|
|
8989
|
+
var onProductButtonPress = /*#__PURE__*/function () {
|
|
8990
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(action) {
|
|
8991
|
+
var isDraft, formValues;
|
|
8992
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8993
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8994
|
+
case 0:
|
|
8995
|
+
_context.t0 = action;
|
|
8996
|
+
_context.next = _context.t0 === ProductAction.CLOSE ? 3 : _context.t0 === ProductAction.CANCEL ? 5 : _context.t0 === ProductAction.DISCARD ? 7 : _context.t0 === ProductAction.RENEW ? 9 : 11;
|
|
8997
|
+
break;
|
|
8998
|
+
case 3:
|
|
8999
|
+
if (mode === 'view' || !isDirty) {
|
|
8933
9000
|
onToggleDialog(false);
|
|
9001
|
+
} else {
|
|
9002
|
+
toggleIsDraft(true);
|
|
9003
|
+
showConfirmDialog(action).then(function () {
|
|
9004
|
+
void handleSubmit(function (formValues) {
|
|
9005
|
+
postProduct(formValues, 'DRAFT');
|
|
9006
|
+
})();
|
|
9007
|
+
})["catch"](function (reason) {
|
|
9008
|
+
if (reason === 'CANCELLED') {
|
|
9009
|
+
// close without save
|
|
9010
|
+
onToggleDialog(false);
|
|
9011
|
+
}
|
|
9012
|
+
});
|
|
8934
9013
|
}
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
break;
|
|
8938
|
-
case ProductAction.CANCEL:
|
|
8939
|
-
void showConfirmDialog(action).then(function () {
|
|
8940
|
-
// if volcanic sigmet - add to which FIR it's moving
|
|
8941
|
-
if (isVAPhenomenon(product, action)) {
|
|
8942
|
-
postProduct(prepareCancelSigmet(product, watch('vaSigmetMoveToFIR')), 'CANCELLED');
|
|
8943
|
-
} else {
|
|
8944
|
-
postProduct(product, 'CANCELLED');
|
|
8945
|
-
}
|
|
8946
|
-
});
|
|
8947
|
-
break;
|
|
8948
|
-
case ProductAction.DISCARD:
|
|
8949
|
-
void showConfirmDialog(action).then(function () {
|
|
8950
|
-
// If we're discarding a new SIGMET/AIRMET - just close the dialog
|
|
8951
|
-
if (mode === 'new' || !(product != null && product.uuid)) {
|
|
8952
|
-
onToggleDialog(false);
|
|
8953
|
-
} else {
|
|
8954
|
-
// If we're discarding an existing SIGMET/AIRMET - make call to BE
|
|
8955
|
-
postProduct(product, 'DISCARDED');
|
|
8956
|
-
}
|
|
8957
|
-
});
|
|
8958
|
-
break;
|
|
8959
|
-
case ProductAction.RENEW:
|
|
8960
|
-
onRenewClick();
|
|
8961
|
-
break;
|
|
8962
|
-
default:
|
|
8963
|
-
toggleIsDraft(action === ProductAction.SAVE);
|
|
8964
|
-
// validate form
|
|
8965
|
-
void handleSubmit(function (formValues) {
|
|
8966
|
-
if (action === ProductAction.SAVE) {
|
|
8967
|
-
// NO MODAL, SAVE DIRECTLY
|
|
8968
|
-
postProduct(formValues, 'DRAFT');
|
|
8969
|
-
} else {
|
|
8970
|
-
// YES MODAL
|
|
9014
|
+
return _context.abrupt("break", 22);
|
|
9015
|
+
case 5:
|
|
8971
9016
|
void showConfirmDialog(action).then(function () {
|
|
8972
|
-
|
|
9017
|
+
// if volcanic sigmet - add to which FIR it's moving
|
|
9018
|
+
if (isVAPhenomenon(product, action)) {
|
|
9019
|
+
postProduct(prepareCancelSigmet(product, watch('vaSigmetMoveToFIR')), 'CANCELLED');
|
|
9020
|
+
} else {
|
|
9021
|
+
postProduct(product, 'CANCELLED');
|
|
9022
|
+
}
|
|
8973
9023
|
});
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
9024
|
+
return _context.abrupt("break", 22);
|
|
9025
|
+
case 7:
|
|
9026
|
+
void showConfirmDialog(action).then(function () {
|
|
9027
|
+
// If we're discarding a new SIGMET/AIRMET - just close the dialog
|
|
9028
|
+
if (mode === 'new' || !(product != null && product.uuid)) {
|
|
9029
|
+
onToggleDialog(false);
|
|
9030
|
+
} else {
|
|
9031
|
+
// If we're discarding an existing SIGMET/AIRMET - make call to BE
|
|
9032
|
+
postProduct(product, 'DISCARDED');
|
|
9033
|
+
}
|
|
9034
|
+
});
|
|
9035
|
+
return _context.abrupt("break", 22);
|
|
9036
|
+
case 9:
|
|
9037
|
+
onRenewClick();
|
|
9038
|
+
return _context.abrupt("break", 22);
|
|
9039
|
+
case 11:
|
|
9040
|
+
isDraft = action === ProductAction.SAVE;
|
|
9041
|
+
toggleIsDraft(isDraft);
|
|
9042
|
+
if (!isDraft) {
|
|
9043
|
+
_context.next = 20;
|
|
9044
|
+
break;
|
|
9045
|
+
}
|
|
9046
|
+
_context.next = 16;
|
|
9047
|
+
return trigger();
|
|
9048
|
+
case 16:
|
|
9049
|
+
formValues = getValues(); // Save draft without blocking on validation
|
|
9050
|
+
postProduct(formValues, 'DRAFT');
|
|
9051
|
+
_context.next = 21;
|
|
9052
|
+
break;
|
|
9053
|
+
case 20:
|
|
9054
|
+
// Validate and submit normally (will block if invalid)
|
|
9055
|
+
void handleSubmit(function (formValues) {
|
|
9056
|
+
void showConfirmDialog(action).then(function () {
|
|
9057
|
+
postProduct(formValues, 'PUBLISHED');
|
|
9058
|
+
});
|
|
9059
|
+
})();
|
|
9060
|
+
case 21:
|
|
9061
|
+
return _context.abrupt("break", 22);
|
|
9062
|
+
case 22:
|
|
9063
|
+
case "end":
|
|
9064
|
+
return _context.stop();
|
|
9065
|
+
}
|
|
9066
|
+
}, _callee);
|
|
9067
|
+
}));
|
|
9068
|
+
return function onProductButtonPress(_x) {
|
|
9069
|
+
return _ref2.apply(this, arguments);
|
|
9070
|
+
};
|
|
9071
|
+
}();
|
|
8979
9072
|
var title = getDialogtitle(t, product, productType, productConfig);
|
|
8980
9073
|
return jsxs(CustomDialog, {
|
|
8981
9074
|
open: isOpen,
|
|
@@ -8986,7 +9079,7 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
|
|
|
8986
9079
|
disableEnforceFocus: true,
|
|
8987
9080
|
disableEscapeKeyDown: true,
|
|
8988
9081
|
onClose: function onClose() {
|
|
8989
|
-
|
|
9082
|
+
void onProductButtonPress(ProductAction.CLOSE);
|
|
8990
9083
|
},
|
|
8991
9084
|
headerActions: getLifecycleActions({
|
|
8992
9085
|
canBe: productCanBe,
|
|
@@ -9043,8 +9136,8 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
|
|
|
9043
9136
|
})]
|
|
9044
9137
|
});
|
|
9045
9138
|
};
|
|
9046
|
-
var Wrapper = function Wrapper(
|
|
9047
|
-
var props = Object.assign({}, (_objectDestructuringEmpty(
|
|
9139
|
+
var Wrapper = function Wrapper(_ref3) {
|
|
9140
|
+
var props = Object.assign({}, (_objectDestructuringEmpty(_ref3), _ref3));
|
|
9048
9141
|
return jsx(ReactHookFormProvider, {
|
|
9049
9142
|
options: Object.assign({}, defaultFormOptions, {
|
|
9050
9143
|
defaultValues: props.product,
|
|
@@ -10604,7 +10697,7 @@ var fakeSigmetList = [{
|
|
|
10604
10697
|
change: 'WKN',
|
|
10605
10698
|
type: 'NORMAL',
|
|
10606
10699
|
status: 'DRAFT',
|
|
10607
|
-
levelInfoMode: '
|
|
10700
|
+
levelInfoMode: 'TOPS',
|
|
10608
10701
|
level: {
|
|
10609
10702
|
value: 1000,
|
|
10610
10703
|
unit: 'FT'
|
|
@@ -11786,4 +11879,4 @@ var createApi = function createApi() {
|
|
|
11786
11879
|
return getApiRoutes(createFakeApiInstance());
|
|
11787
11880
|
};
|
|
11788
11881
|
|
|
11789
|
-
export { AirmetComponentsLookUp, AirmetForm, AirmetType, CancelSigmetVolcanicMovements, CloudLevelUnits, DEFAULT_MINIMUM_SURFACE_LEVEL, DEFAULT_MIN_MOVEMENT_SPEED, DEFAULT_MIN_VISIBILITY, DEFAULT_MIN_WIND_SPEED, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductAction, ProductFormDialog, Wrapper as ProductFormDialogContent, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createAirmetPostParameter, createApi$1 as createApi, createApi as createFakeApi, createSigmetPostParameter, extractUnitsToShow, fakeAirmetList, fakeSigmetList, firSelectionType, getActiveFIRArea, getAllFirAreas, getAllowedUnits, getBaseLayers, getConfirmationDialogButtonLabel, getConfirmationDialogCancelLabel, getConfirmationDialogContent, getConfirmationDialogTitle, getDefaultPhenomena, getDefaultValidUntilValue, getDefaultValidityMinutesFromConfig, getDialogtitle, getDrawTools, getFieldLabel, getFir, getFirArea, getFirOptions, getHoursBeforeValidity, getLevelInFeet, getLifecycleActions, getMaxCloudLevelValue, getMaxCloudLowerLevelValue, getMaxHoursOfValidity, getMaxLevelValue, getMaxMovementSpeedValue, getMaxPolygonPoints, getMaxVisibilityValue, getMaxWindSpeedValue, getMinCloudLevelValue, getMinCloudLowerLevelValue, getMinLevelValue, getMinMovementSpeedValue, getMinVisibilityValue, getMinWindSpeedValue, getOmitChangeFromConfig, getPhenomenon, getProductFormMode, getProductIssueDate, getProjection, getToolIcon, getValidFromDelayTimeMinutesFromConfig, hasMaxFeaturePoints, hasValue, isFir, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, isLevelLower, isVAPhenomenon, prepareCancelSigmet, prepareFormValues, prepareProductValues, sigmetAirmetTranslations as saTranslations, sigmetConfig, triggerValidations, updateDrawToolsWithFir, useDelayedFormValues, useFormLayers, useShortTestHelpers };
|
|
11882
|
+
export { AirmetComponentsLookUp, AirmetForm, AirmetType, CancelSigmetVolcanicMovements, CloudLevelUnits, DEFAULT_MINIMUM_SURFACE_LEVEL, DEFAULT_MIN_MOVEMENT_SPEED, DEFAULT_MIN_VISIBILITY, DEFAULT_MIN_WIND_SPEED, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductAction, ProductFormDialog, Wrapper as ProductFormDialogContent, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createAirmetPostParameter, createApi$1 as createApi, createApi as createFakeApi, createSigmetPostParameter, extractUnitsToShow, fakeAirmetList, fakeSigmetList, firSelectionType, getActiveFIRArea, getAllFirAreas, getAllowedUnits, getBaseLayers, getConfirmationDialogButtonLabel, getConfirmationDialogCancelLabel, getConfirmationDialogContent, getConfirmationDialogTitle, getDefaultPhenomena, getDefaultValidFromValue, getDefaultValidUntilValue, getDefaultValidityMinutesFromConfig, getDialogtitle, getDrawTools, getFieldLabel, getFir, getFirArea, getFirOptions, getHoursBeforeValidity, getLevelInFeet, getLifecycleActions, getMaxCloudLevelValue, getMaxCloudLowerLevelValue, getMaxHoursOfValidity, getMaxLevelValue, getMaxMovementSpeedValue, getMaxPolygonPoints, getMaxVisibilityValue, getMaxWindSpeedValue, getMinCloudLevelValue, getMinCloudLowerLevelValue, getMinLevelValue, getMinMovementSpeedValue, getMinVisibilityValue, getMinWindSpeedValue, getOmitChangeFromConfig, getPhenomenon, getProductFormMode, getProductIssueDate, getProjection, getToolIcon, getValidFromDelayTimeMinutesFromConfig, getValidFromXHoursBeforeMessage, hasMaxFeaturePoints, hasValue, isFir, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, isLevelLower, isVAPhenomenon, prepareCancelSigmet, prepareFormValues, prepareProductValues, sigmetAirmetTranslations as saTranslations, sigmetConfig, triggerValidations, updateDrawToolsWithFir, useDelayedFormValues, useFormLayers, useShortTestHelpers };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/sigmet-airmet",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.6.0",
|
|
4
4
|
"description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/api": "12.
|
|
12
|
-
"@opengeoweb/shared": "12.
|
|
13
|
-
"@opengeoweb/theme": "12.
|
|
14
|
-
"@opengeoweb/store": "12.
|
|
15
|
-
"@opengeoweb/webmap": "12.
|
|
16
|
-
"@opengeoweb/webmap-react": "12.
|
|
11
|
+
"@opengeoweb/api": "12.6.0",
|
|
12
|
+
"@opengeoweb/shared": "12.6.0",
|
|
13
|
+
"@opengeoweb/theme": "12.6.0",
|
|
14
|
+
"@opengeoweb/store": "12.6.0",
|
|
15
|
+
"@opengeoweb/webmap": "12.6.0",
|
|
16
|
+
"@opengeoweb/webmap-react": "12.6.0",
|
|
17
17
|
"react-redux": "^9.2.0",
|
|
18
|
-
"@opengeoweb/core": "12.
|
|
19
|
-
"@opengeoweb/authentication": "12.
|
|
18
|
+
"@opengeoweb/core": "12.6.0",
|
|
19
|
+
"@opengeoweb/authentication": "12.6.0",
|
|
20
20
|
"@mui/system": "^7.0.1",
|
|
21
|
-
"@opengeoweb/form-fields": "12.
|
|
21
|
+
"@opengeoweb/form-fields": "12.6.0",
|
|
22
22
|
"react-hook-form": "^7.50.1",
|
|
23
23
|
"axios": "^1.7.7",
|
|
24
24
|
"lodash": "^4.17.21",
|
package/src/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './lib/components/MetInfoWrapper';
|
|
|
5
5
|
export * from './lib/components/ProductForms';
|
|
6
6
|
export * from './lib/components/ProductForms/ProductFormDialog';
|
|
7
7
|
export * from './lib/components/ProductForms/ProductFormDialogContent';
|
|
8
|
+
export * from './lib/components/ProductForms/ProductFormFields/ValidFrom';
|
|
8
9
|
export * from './lib/components/ProductForms/ProductFormFields/ValidUntil';
|
|
9
10
|
export * from './lib/components/ProductForms/SigmetForm/SigmetCancelVolcanicMovements';
|
|
10
11
|
export * from './lib/components/ProductForms/utils';
|
|
@@ -10,5 +10,7 @@ export declare const getLevelInvalidStepsForMUnitMessage: (t: TFunction, value?:
|
|
|
10
10
|
export declare const getInvalidUnitMessage: (t: TFunction) => string;
|
|
11
11
|
export declare const validateLevels: (t: TFunction, value: string, unit: string, productConfig: ProductConfig, selectedFIR: string) => boolean | string;
|
|
12
12
|
export declare const validateLevelUnitCombinations: (t: TFunction, levelUnit: string, lowerLevelUnit: string) => boolean | string;
|
|
13
|
+
export declare const tsPhenomena: Set<string>;
|
|
14
|
+
export declare const isTSPhenomenon: (phenomenon?: string) => boolean;
|
|
13
15
|
declare const Levels: React.FC<ConfigurableFormFieldProps>;
|
|
14
16
|
export default Levels;
|
package/src/lib/types.d.ts
CHANGED
|
@@ -299,6 +299,8 @@ export interface FormFieldProps {
|
|
|
299
299
|
onChange?: (event?: React.ChangeEvent<HTMLInputElement>, phenomenaList?: AviationPhenomenon[]) => void;
|
|
300
300
|
isDisabled: boolean;
|
|
301
301
|
isReadOnly?: boolean;
|
|
302
|
+
onUserChange?: () => void;
|
|
303
|
+
hasUserChangedTime?: boolean;
|
|
302
304
|
}
|
|
303
305
|
export interface ConfigurableFormFieldProps extends FormFieldProps {
|
|
304
306
|
productConfig: ProductConfig;
|