@gridsuite/commons-ui 0.181.0 → 0.182.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/dist/components/index.js +28 -1
- package/dist/components/inputs/index.js +4 -0
- package/dist/components/inputs/reactHookForm/index.d.ts +1 -0
- package/dist/components/inputs/reactHookForm/index.js +4 -0
- package/dist/components/inputs/reactHookForm/readOnly/ButtonReadOnlyInput.d.ts +7 -0
- package/dist/components/inputs/reactHookForm/readOnly/ButtonReadOnlyInput.js +50 -0
- package/dist/components/inputs/reactHookForm/readOnly/ReadOnlyInput.d.ts +12 -0
- package/dist/components/inputs/reactHookForm/readOnly/ReadOnlyInput.js +35 -0
- package/dist/components/inputs/reactHookForm/readOnly/index.d.ts +8 -0
- package/dist/components/inputs/reactHookForm/readOnly/index.js +6 -0
- package/dist/components/network-modifications/equipmentDeletion/EquipmentDeletionForm.d.ts +9 -0
- package/dist/components/network-modifications/equipmentDeletion/EquipmentDeletionForm.js +173 -0
- package/dist/components/network-modifications/equipmentDeletion/equipmentDeletion.types.d.ts +17 -0
- package/dist/components/network-modifications/equipmentDeletion/equipmentDeletion.types.js +1 -0
- package/dist/components/network-modifications/equipmentDeletion/equipmentDeletion.utils.d.ts +33 -0
- package/dist/components/network-modifications/equipmentDeletion/equipmentDeletion.utils.js +78 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/HvdcLccDeletionSpecificForm.d.ts +7 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/HvdcLccDeletionSpecificForm.js +43 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.d.ts +13 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js +58 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/hvdcLccDeletion.utils.d.ts +21 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/hvdcLccDeletion.utils.js +22 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/index.d.ts +10 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/index.js +10 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/useHvdcLccDeletion.d.ts +8 -0
- package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/useHvdcLccDeletion.js +85 -0
- package/dist/components/network-modifications/equipmentDeletion/index.d.ts +10 -0
- package/dist/components/network-modifications/equipmentDeletion/index.js +18 -0
- package/dist/components/network-modifications/index.d.ts +1 -0
- package/dist/components/network-modifications/index.js +24 -1
- package/dist/components/network-modifications/voltage-level/index.d.ts +1 -0
- package/dist/components/network-modifications/voltage-level/index.js +8 -1
- package/dist/components/network-modifications/voltage-level/modification/VoltageLevelModificationForm.d.ts +5 -0
- package/dist/components/network-modifications/voltage-level/modification/VoltageLevelModificationForm.js +159 -0
- package/dist/components/network-modifications/voltage-level/modification/index.d.ts +9 -0
- package/dist/components/network-modifications/voltage-level/modification/index.js +9 -0
- package/dist/components/network-modifications/voltage-level/modification/voltageLevelModification.types.d.ts +35 -0
- package/dist/components/network-modifications/voltage-level/modification/voltageLevelModification.types.js +1 -0
- package/dist/components/network-modifications/voltage-level/modification/voltageLevelModification.utils.d.ts +36 -0
- package/dist/components/network-modifications/voltage-level/modification/voltageLevelModification.utils.js +75 -0
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +11 -10
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useGetLabelEquipmentTypes.d.ts +2 -0
- package/dist/hooks/useGetLabelEquipmentTypes.js +20 -0
- package/dist/index.js +37 -1
- package/dist/translations/en/equipmentTypesEn.d.ts +30 -0
- package/dist/translations/en/equipmentTypesEn.js +27 -0
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/en/networkModificationsEn.d.ts +7 -0
- package/dist/translations/en/networkModificationsEn.js +10 -3
- package/dist/translations/fr/equipmentTypesFr.d.ts +30 -0
- package/dist/translations/fr/equipmentTypesFr.js +27 -0
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +7 -0
- package/dist/translations/fr/networkModificationsFr.js +12 -5
- package/dist/utils/constants/fieldConstants.d.ts +7 -0
- package/dist/utils/constants/fieldConstants.js +7 -0
- package/dist/utils/index.js +4 -1
- package/dist/utils/ts-utils.d.ts +3 -0
- package/dist/utils/ts-utils.js +10 -0
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -81,6 +81,8 @@ import { SliderInput } from "./inputs/reactHookForm/numbers/SliderInput.js";
|
|
|
81
81
|
import { isFloatNumber, isIntegerNumber } from "./inputs/reactHookForm/numbers/utils.js";
|
|
82
82
|
import { CustomFormContext, CustomFormProvider } from "./inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
83
83
|
import { useCustomFormContext } from "./inputs/reactHookForm/provider/useCustomFormContext.js";
|
|
84
|
+
import { ReadOnlyInput } from "./inputs/reactHookForm/readOnly/ReadOnlyInput.js";
|
|
85
|
+
import { ButtonReadOnlyInput } from "./inputs/reactHookForm/readOnly/ButtonReadOnlyInput.js";
|
|
84
86
|
import { CountriesInput } from "./inputs/reactHookForm/selectInputs/CountriesInput.js";
|
|
85
87
|
import { InputWithPopupConfirmation } from "./inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
|
|
86
88
|
import { MuiSelectInput } from "./inputs/reactHookForm/selectInputs/MuiSelectInput.js";
|
|
@@ -201,6 +203,12 @@ import { SetPointsForm } from "./network-modifications/common/setpoints/SetPoint
|
|
|
201
203
|
import { createConnectivityData, getCon1andCon2WithPositionValidationSchema, getConnectivityBusBarSectionData, getConnectivityData, getConnectivityFormData, getConnectivityFormDataProps, getConnectivityPropertiesData, getConnectivityPropertiesEmptyFormData, getConnectivityPropertiesValidationSchema, getConnectivityVoltageLevelData, getConnectivityWithPositionEmptyFormData, getConnectivityWithPositionEmptyFormDataProps, getConnectivityWithPositionSchema, getConnectivityWithPositionValidationSchema, getConnectivityWithoutPositionEmptyFormData, getConnectivityWithoutPositionValidationSchema, getCont1Cont2WithPositionEmptyFormData, getNewVoltageLevelData } from "./network-modifications/common/connectivity/connectivityForm.utils.js";
|
|
202
204
|
import { ConnectivityForm } from "./network-modifications/common/connectivity/ConnectivityForm.js";
|
|
203
205
|
import { BranchConnectivityForm } from "./network-modifications/common/connectivity/BranchConnectivityForm.js";
|
|
206
|
+
import { getHvdcLccDeletionSchema } from "./network-modifications/equipmentDeletion/hvdcLccDeletion/hvdcLccDeletion.utils.js";
|
|
207
|
+
import { ShuntCompensatorSelectionForm } from "./network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js";
|
|
208
|
+
import { useHvdcLccDeletion } from "./network-modifications/equipmentDeletion/hvdcLccDeletion/useHvdcLccDeletion.js";
|
|
209
|
+
import { HvdcLccDeletionSpecificForm } from "./network-modifications/equipmentDeletion/hvdcLccDeletion/HvdcLccDeletionSpecificForm.js";
|
|
210
|
+
import { equipmentDeletionDtoToForm, equipmentDeletionEmptyFormData, equipmentDeletionFormSchema, equipmentDeletionFormToDto, newEquipmentDeletionDto } from "./network-modifications/equipmentDeletion/equipmentDeletion.utils.js";
|
|
211
|
+
import { EquipmentDeletionForm } from "./network-modifications/equipmentDeletion/EquipmentDeletionForm.js";
|
|
204
212
|
import { SubstationCreationForm } from "./network-modifications/substation/creation/SubstationCreationForm.js";
|
|
205
213
|
import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./network-modifications/substation/creation/substationCreation.utils.js";
|
|
206
214
|
import { SubstationModificationForm } from "./network-modifications/substation/modification/SubstationModificationForm.js";
|
|
@@ -212,6 +220,8 @@ import { CouplingOmnibusCreation } from "./network-modifications/voltage-level/c
|
|
|
212
220
|
import { VoltageLevelCreationForm } from "./network-modifications/voltage-level/creation/VoltageLevelCreationForm.js";
|
|
213
221
|
import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./network-modifications/voltage-level/creation/voltageLevelCreation.utils.js";
|
|
214
222
|
import { SwitchKind } from "./network-modifications/voltage-level/creation/voltageLevelCreation.types.js";
|
|
223
|
+
import { VoltageLevelModificationForm } from "./network-modifications/voltage-level/modification/VoltageLevelModificationForm.js";
|
|
224
|
+
import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto } from "./network-modifications/voltage-level/modification/voltageLevelModification.utils.js";
|
|
215
225
|
import { LoadDialogTab } from "./network-modifications/load/common/load.utils.js";
|
|
216
226
|
import { LoadDialogTabs } from "./network-modifications/load/common/LoadDialogTabs.js";
|
|
217
227
|
import { LoadDialogTabsContent } from "./network-modifications/load/common/LoadDialogTabsContent.js";
|
|
@@ -239,6 +249,7 @@ export {
|
|
|
239
249
|
BottomRightButtons,
|
|
240
250
|
BranchActiveReactivePowerMeasurementsForm,
|
|
241
251
|
BranchConnectivityForm,
|
|
252
|
+
ButtonReadOnlyInput,
|
|
242
253
|
CALCULATION_TYPE,
|
|
243
254
|
CENTER_LABEL,
|
|
244
255
|
COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
|
|
@@ -332,6 +343,7 @@ export {
|
|
|
332
343
|
ElementSearchInput,
|
|
333
344
|
ElementValueEditor,
|
|
334
345
|
EnumInput,
|
|
346
|
+
EquipmentDeletionForm,
|
|
335
347
|
EquipmentItem,
|
|
336
348
|
EquipmentsSelectionType,
|
|
337
349
|
ErrorCellRenderer,
|
|
@@ -364,6 +376,7 @@ export {
|
|
|
364
376
|
HVDC_AC_EMULATION,
|
|
365
377
|
HVDC_EQUIPMENT_TYPES,
|
|
366
378
|
HelperPreviousValue,
|
|
379
|
+
HvdcLccDeletionSpecificForm,
|
|
367
380
|
INJECTIONS_EQUIPMENT_TYPES,
|
|
368
381
|
INJECTION_DISTRIBUTION_TYPES,
|
|
369
382
|
INTL_LINE_FLOW_MODE_OPTIONS,
|
|
@@ -491,6 +504,7 @@ export {
|
|
|
491
504
|
RangeInput,
|
|
492
505
|
RangeType,
|
|
493
506
|
RawReadOnlyInput,
|
|
507
|
+
ReadOnlyInput,
|
|
494
508
|
RemoveButton,
|
|
495
509
|
ResizeHandle,
|
|
496
510
|
RuleValueEditor,
|
|
@@ -540,6 +554,7 @@ export {
|
|
|
540
554
|
SetPointsForm,
|
|
541
555
|
ShortCircuitParametersEditionDialog,
|
|
542
556
|
ShortCircuitParametersInLine,
|
|
557
|
+
ShuntCompensatorSelectionForm,
|
|
543
558
|
SignInCallbackHandler,
|
|
544
559
|
SilentRenewCallbackHandler,
|
|
545
560
|
SliderInput,
|
|
@@ -587,6 +602,7 @@ export {
|
|
|
587
602
|
VoltageInitParametersInLine,
|
|
588
603
|
VoltageInitTabValues,
|
|
589
604
|
VoltageLevelCreationForm,
|
|
605
|
+
VoltageLevelModificationForm,
|
|
590
606
|
WRITE_SLACK_BUS,
|
|
591
607
|
alertThresholdMarks,
|
|
592
608
|
buildNewBusbarSections,
|
|
@@ -598,6 +614,10 @@ export {
|
|
|
598
614
|
dispatchUser,
|
|
599
615
|
doesNodeHasChildren,
|
|
600
616
|
emptyProperties,
|
|
617
|
+
equipmentDeletionDtoToForm,
|
|
618
|
+
equipmentDeletionEmptyFormData,
|
|
619
|
+
equipmentDeletionFormSchema,
|
|
620
|
+
equipmentDeletionFormToDto,
|
|
601
621
|
expertFilterSchema,
|
|
602
622
|
explicitNamingFilterSchema,
|
|
603
623
|
exportExpertRules,
|
|
@@ -638,6 +658,7 @@ export {
|
|
|
638
658
|
getExpertFilterEmptyFormData,
|
|
639
659
|
getExplicitNamingFilterEmptyFormData,
|
|
640
660
|
getFilledPropertiesFromModification,
|
|
661
|
+
getHvdcLccDeletionSchema,
|
|
641
662
|
getInjectionActiveReactivePowerEditData,
|
|
642
663
|
getInjectionActiveReactivePowerEditDataProperties,
|
|
643
664
|
getInjectionActiveReactivePowerEmptyFormData,
|
|
@@ -686,6 +707,7 @@ export {
|
|
|
686
707
|
logout,
|
|
687
708
|
mergeModificationAndEquipmentProperties,
|
|
688
709
|
modificationPropertiesSchema,
|
|
710
|
+
newEquipmentDeletionDto,
|
|
689
711
|
onlyStartedGeneratorsOptions,
|
|
690
712
|
queryValidator,
|
|
691
713
|
recursiveRemove,
|
|
@@ -715,11 +737,16 @@ export {
|
|
|
715
737
|
useCustomFormContext,
|
|
716
738
|
useElementSearch,
|
|
717
739
|
useGlobalAnnouncement,
|
|
740
|
+
useHvdcLccDeletion,
|
|
718
741
|
useListenerManager,
|
|
719
742
|
useNotificationsListener,
|
|
720
743
|
useValid,
|
|
721
744
|
voltageLevelCreationDtoToForm,
|
|
722
745
|
voltageLevelCreationEmptyFormData,
|
|
723
746
|
voltageLevelCreationFormSchema,
|
|
724
|
-
voltageLevelCreationFormToDto
|
|
747
|
+
voltageLevelCreationFormToDto,
|
|
748
|
+
voltageLevelModificationDtoToForm,
|
|
749
|
+
voltageLevelModificationEmptyFormData,
|
|
750
|
+
voltageLevelModificationFormSchema,
|
|
751
|
+
voltageLevelModificationFormToDto
|
|
725
752
|
};
|
|
@@ -24,6 +24,8 @@ import { SliderInput } from "./reactHookForm/numbers/SliderInput.js";
|
|
|
24
24
|
import { isFloatNumber, isIntegerNumber } from "./reactHookForm/numbers/utils.js";
|
|
25
25
|
import { CustomFormContext, CustomFormProvider } from "./reactHookForm/provider/CustomFormProvider.js";
|
|
26
26
|
import { useCustomFormContext } from "./reactHookForm/provider/useCustomFormContext.js";
|
|
27
|
+
import { ReadOnlyInput } from "./reactHookForm/readOnly/ReadOnlyInput.js";
|
|
28
|
+
import { ButtonReadOnlyInput } from "./reactHookForm/readOnly/ButtonReadOnlyInput.js";
|
|
27
29
|
import { CountriesInput } from "./reactHookForm/selectInputs/CountriesInput.js";
|
|
28
30
|
import { InputWithPopupConfirmation } from "./reactHookForm/selectInputs/InputWithPopupConfirmation.js";
|
|
29
31
|
import { MuiSelectInput } from "./reactHookForm/selectInputs/MuiSelectInput.js";
|
|
@@ -70,6 +72,7 @@ export {
|
|
|
70
72
|
AutocompleteWithFavorites,
|
|
71
73
|
BooleanInput,
|
|
72
74
|
BottomRightButtons,
|
|
75
|
+
ButtonReadOnlyInput,
|
|
73
76
|
CancelButton,
|
|
74
77
|
CheckboxInput,
|
|
75
78
|
CheckboxNullableInput,
|
|
@@ -112,6 +115,7 @@ export {
|
|
|
112
115
|
RangeInput,
|
|
113
116
|
RangeType,
|
|
114
117
|
RawReadOnlyInput,
|
|
118
|
+
ReadOnlyInput,
|
|
115
119
|
RemoveButton,
|
|
116
120
|
RuleValueEditor,
|
|
117
121
|
SelectClearable,
|
|
@@ -23,6 +23,8 @@ import { SliderInput } from "./numbers/SliderInput.js";
|
|
|
23
23
|
import { isFloatNumber, isIntegerNumber } from "./numbers/utils.js";
|
|
24
24
|
import { CustomFormContext, CustomFormProvider } from "./provider/CustomFormProvider.js";
|
|
25
25
|
import { useCustomFormContext } from "./provider/useCustomFormContext.js";
|
|
26
|
+
import { ReadOnlyInput } from "./readOnly/ReadOnlyInput.js";
|
|
27
|
+
import { ButtonReadOnlyInput } from "./readOnly/ButtonReadOnlyInput.js";
|
|
26
28
|
import { CountriesInput } from "./selectInputs/CountriesInput.js";
|
|
27
29
|
import { InputWithPopupConfirmation } from "./selectInputs/InputWithPopupConfirmation.js";
|
|
28
30
|
import { MuiSelectInput } from "./selectInputs/MuiSelectInput.js";
|
|
@@ -49,6 +51,7 @@ export {
|
|
|
49
51
|
AutocompleteInput,
|
|
50
52
|
BooleanInput,
|
|
51
53
|
BottomRightButtons,
|
|
54
|
+
ButtonReadOnlyInput,
|
|
52
55
|
CancelButton,
|
|
53
56
|
CheckboxInput,
|
|
54
57
|
CheckboxNullableInput,
|
|
@@ -85,6 +88,7 @@ export {
|
|
|
85
88
|
RangeInput,
|
|
86
89
|
RangeType,
|
|
87
90
|
RawReadOnlyInput,
|
|
91
|
+
ReadOnlyInput,
|
|
88
92
|
SelectInput,
|
|
89
93
|
SliderInput,
|
|
90
94
|
SubmitButton,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
interface ButtonReadOnlyInputProps extends PropsWithChildren {
|
|
3
|
+
name: string;
|
|
4
|
+
isNumerical?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function ButtonReadOnlyInput({ name, isNumerical, children }: Readonly<ButtonReadOnlyInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useController } from "react-hook-form";
|
|
3
|
+
import { useTheme, TextField, InputAdornment } from "@mui/material";
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "react";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { genHelperError } from "../utils/functions.js";
|
|
8
|
+
function ButtonReadOnlyInput({ name, isNumerical = false, children }) {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const {
|
|
11
|
+
field: { value },
|
|
12
|
+
fieldState: { error }
|
|
13
|
+
} = useController({ name });
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
TextField,
|
|
16
|
+
{
|
|
17
|
+
InputProps: {
|
|
18
|
+
readOnly: true,
|
|
19
|
+
sx: isNumerical ? {
|
|
20
|
+
"& input": {
|
|
21
|
+
textAlign: "right"
|
|
22
|
+
}
|
|
23
|
+
} : {},
|
|
24
|
+
endAdornment: /* @__PURE__ */ jsx(
|
|
25
|
+
InputAdornment,
|
|
26
|
+
{
|
|
27
|
+
sx: {
|
|
28
|
+
"& button": {
|
|
29
|
+
borderRadius: 0,
|
|
30
|
+
borderLeft: "1px solid",
|
|
31
|
+
borderColor: theme.palette.action.disabled,
|
|
32
|
+
marginRight: "-14px",
|
|
33
|
+
marginLeft: "-8px"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
position: "end",
|
|
37
|
+
children
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
},
|
|
41
|
+
size: "small",
|
|
42
|
+
fullWidth: true,
|
|
43
|
+
value,
|
|
44
|
+
...genHelperError(error?.message)
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
ButtonReadOnlyInput
|
|
50
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
interface ReadOnlyInputProps {
|
|
8
|
+
name: string;
|
|
9
|
+
isNumerical?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function ReadOnlyInput({ name, isNumerical }: Readonly<ReadOnlyInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default ReadOnlyInput;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useController } from "react-hook-form";
|
|
3
|
+
import { TextField } from "@mui/material";
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "react";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { genHelperError } from "../utils/functions.js";
|
|
8
|
+
function ReadOnlyInput({ name, isNumerical = false }) {
|
|
9
|
+
const {
|
|
10
|
+
field: { value },
|
|
11
|
+
fieldState: { error }
|
|
12
|
+
} = useController({ name });
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
TextField,
|
|
15
|
+
{
|
|
16
|
+
InputProps: {
|
|
17
|
+
readOnly: true,
|
|
18
|
+
disableUnderline: true,
|
|
19
|
+
sx: isNumerical ? {
|
|
20
|
+
"& input": {
|
|
21
|
+
textAlign: "right"
|
|
22
|
+
}
|
|
23
|
+
} : {}
|
|
24
|
+
},
|
|
25
|
+
fullWidth: true,
|
|
26
|
+
value,
|
|
27
|
+
variant: "standard",
|
|
28
|
+
...genHelperError(error?.message)
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
ReadOnlyInput,
|
|
34
|
+
ReadOnlyInput as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './ReadOnlyInput';
|
|
8
|
+
export * from './ButtonReadOnlyInput';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { EquipmentDeletionDto, LccDeletionDto } from './equipmentDeletion.types';
|
|
3
|
+
import { EquipmentType } from '../../../utils';
|
|
4
|
+
export interface EquipmentDeletionFormProps {
|
|
5
|
+
editData?: EquipmentDeletionDto;
|
|
6
|
+
fetchEquipmentIds?: (eqptType: EquipmentType) => Promise<string[]>;
|
|
7
|
+
fetchHvdcWithShuntCompensators?: (hvdcLineId: UUID) => Promise<LccDeletionDto>;
|
|
8
|
+
}
|
|
9
|
+
export declare function EquipmentDeletionForm({ editData, fetchEquipmentIds, fetchHvdcWithShuntCompensators, }: Readonly<EquipmentDeletionFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Grid } from "@mui/material";
|
|
3
|
+
import { useRef, useState, useMemo, useEffect, useCallback } from "react";
|
|
4
|
+
import { useWatch, useFormContext } from "react-hook-form";
|
|
5
|
+
import { useHvdcLccDeletion } from "./hvdcLccDeletion/useHvdcLccDeletion.js";
|
|
6
|
+
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
7
|
+
import "../../../utils/conversionUtils.js";
|
|
8
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
9
|
+
import { EquipmentType } from "../../../utils/types/equipmentType.js";
|
|
10
|
+
import "@mui/icons-material";
|
|
11
|
+
import { richTypeEquals, getObjectId, areIdsEqual } from "../../../utils/ts-utils.js";
|
|
12
|
+
import "../../../utils/yupConfig.js";
|
|
13
|
+
import { filledTextField } from "../common/form.utils.js";
|
|
14
|
+
import "../common/properties/propertyUtils.js";
|
|
15
|
+
import GridItem from "../../grid/grid-item.js";
|
|
16
|
+
import "react-intl";
|
|
17
|
+
import "../../overflowableText/OverflowableText.js";
|
|
18
|
+
import "localized-countries";
|
|
19
|
+
import "localized-countries/data/fr";
|
|
20
|
+
import "localized-countries/data/en";
|
|
21
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
22
|
+
import { useGetLabelEquipmentTypes } from "../../../hooks/useGetLabelEquipmentTypes.js";
|
|
23
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
24
|
+
import "yup";
|
|
25
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
26
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
27
|
+
import "../../customAGGrid/customAggrid.js";
|
|
28
|
+
import "ag-grid-community";
|
|
29
|
+
import "react-papaparse";
|
|
30
|
+
import "react-csv-downloader";
|
|
31
|
+
import { AutocompleteInput } from "../../inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
|
|
32
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
34
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
35
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
36
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
37
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
38
|
+
import "@react-querybuilder/material";
|
|
39
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
40
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
41
|
+
import "uuid";
|
|
42
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
43
|
+
import "react-querybuilder";
|
|
44
|
+
import { HvdcLccDeletionSpecificForm } from "./hvdcLccDeletion/HvdcLccDeletionSpecificForm.js";
|
|
45
|
+
const NULL_UUID = "00000000-0000-0000-0000-000000000000";
|
|
46
|
+
const EQUIPMENT_TYPE_ORDER = [
|
|
47
|
+
EquipmentType.SUBSTATION,
|
|
48
|
+
EquipmentType.VOLTAGE_LEVEL,
|
|
49
|
+
EquipmentType.LINE,
|
|
50
|
+
EquipmentType.TWO_WINDINGS_TRANSFORMER,
|
|
51
|
+
EquipmentType.THREE_WINDINGS_TRANSFORMER,
|
|
52
|
+
EquipmentType.HVDC_LINE,
|
|
53
|
+
EquipmentType.GENERATOR,
|
|
54
|
+
EquipmentType.BATTERY,
|
|
55
|
+
EquipmentType.LOAD,
|
|
56
|
+
EquipmentType.SHUNT_COMPENSATOR,
|
|
57
|
+
EquipmentType.DANGLING_LINE,
|
|
58
|
+
EquipmentType.STATIC_VAR_COMPENSATOR
|
|
59
|
+
];
|
|
60
|
+
function EquipmentDeletionForm({
|
|
61
|
+
editData,
|
|
62
|
+
fetchEquipmentIds,
|
|
63
|
+
fetchHvdcWithShuntCompensators
|
|
64
|
+
}) {
|
|
65
|
+
const { snackError } = useSnackMessage();
|
|
66
|
+
const editedIdRef = useRef(null);
|
|
67
|
+
const currentTypeRef = useRef(null);
|
|
68
|
+
const watchType = useWatch({
|
|
69
|
+
name: FieldConstants.TYPE
|
|
70
|
+
});
|
|
71
|
+
const watchEquipmentId = useWatch({
|
|
72
|
+
name: FieldConstants.EQUIPMENT_ID
|
|
73
|
+
});
|
|
74
|
+
const watchSpecificData = useWatch({
|
|
75
|
+
name: FieldConstants.DELETION_SPECIFIC_DATA
|
|
76
|
+
});
|
|
77
|
+
const { specificUpdate: hvdcLccSpecificUpdate } = useHvdcLccDeletion({ fetchHvdcWithShuntCompensators });
|
|
78
|
+
const {
|
|
79
|
+
setValue,
|
|
80
|
+
formState: { isDirty, dirtyFields }
|
|
81
|
+
} = useFormContext();
|
|
82
|
+
const getOptionLabel = useGetLabelEquipmentTypes();
|
|
83
|
+
const [equipmentsOptions, setEquipmentsOptions] = useState([]);
|
|
84
|
+
const typesOptions = useMemo(() => {
|
|
85
|
+
return Object.values(EQUIPMENT_TYPE_ORDER);
|
|
86
|
+
}, []);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
setEquipmentsOptions([]);
|
|
89
|
+
let ignore = false;
|
|
90
|
+
if (watchType !== currentTypeRef.current) {
|
|
91
|
+
currentTypeRef.current = watchType;
|
|
92
|
+
}
|
|
93
|
+
if (watchType && fetchEquipmentIds) {
|
|
94
|
+
fetchEquipmentIds(watchType).then((equipmentIds) => {
|
|
95
|
+
if (!ignore) {
|
|
96
|
+
setEquipmentsOptions(
|
|
97
|
+
equipmentIds.toSorted((equipment1, equipment2) => equipment1.localeCompare(equipment2))
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}).catch((error) => {
|
|
101
|
+
snackWithFallback(snackError, error, { headerId: "equipmentsLoadingError" });
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return () => {
|
|
105
|
+
ignore = true;
|
|
106
|
+
};
|
|
107
|
+
}, [fetchEquipmentIds, snackError, watchType]);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!fetchHvdcWithShuntCompensators && isDirty && dirtyFields[FieldConstants.EQUIPMENT_ID]) {
|
|
110
|
+
setValue(FieldConstants.DELETION_SPECIFIC_DATA, null);
|
|
111
|
+
}
|
|
112
|
+
}, [fetchHvdcWithShuntCompensators, isDirty, dirtyFields, setValue]);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!fetchHvdcWithShuntCompensators) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (editData?.equipmentId) {
|
|
118
|
+
if (editedIdRef.current === null) {
|
|
119
|
+
editedIdRef.current = editData.equipmentId;
|
|
120
|
+
} else if (watchEquipmentId !== editedIdRef.current && editedIdRef.current !== NULL_UUID) {
|
|
121
|
+
editedIdRef.current = NULL_UUID;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (watchEquipmentId && currentTypeRef.current === EquipmentType.HVDC_LINE) {
|
|
125
|
+
hvdcLccSpecificUpdate(watchEquipmentId, watchEquipmentId === editedIdRef.current ? editData : void 0);
|
|
126
|
+
} else {
|
|
127
|
+
setValue(FieldConstants.DELETION_SPECIFIC_DATA, null);
|
|
128
|
+
}
|
|
129
|
+
}, [editData, fetchHvdcWithShuntCompensators, hvdcLccSpecificUpdate, setValue, snackError, watchEquipmentId]);
|
|
130
|
+
const handleTypeChange = useCallback(() => {
|
|
131
|
+
setValue(FieldConstants.EQUIPMENT_ID, null);
|
|
132
|
+
}, [setValue]);
|
|
133
|
+
const equipmentTypeField = /* @__PURE__ */ jsx(
|
|
134
|
+
AutocompleteInput,
|
|
135
|
+
{
|
|
136
|
+
isOptionEqualToValue: richTypeEquals,
|
|
137
|
+
name: FieldConstants.TYPE,
|
|
138
|
+
label: "Type",
|
|
139
|
+
options: typesOptions,
|
|
140
|
+
onChangeCallback: handleTypeChange,
|
|
141
|
+
getOptionLabel,
|
|
142
|
+
size: "small",
|
|
143
|
+
inputTransform: (value) => typesOptions.find((option) => option === value) || value,
|
|
144
|
+
formProps: filledTextField
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
const equipmentField = /* @__PURE__ */ jsx(
|
|
148
|
+
AutocompleteInput,
|
|
149
|
+
{
|
|
150
|
+
isOptionEqualToValue: areIdsEqual,
|
|
151
|
+
allowNewValue: true,
|
|
152
|
+
forcePopupIcon: true,
|
|
153
|
+
name: FieldConstants.EQUIPMENT_ID,
|
|
154
|
+
label: "ID",
|
|
155
|
+
options: equipmentsOptions,
|
|
156
|
+
getOptionLabel: getObjectId,
|
|
157
|
+
inputTransform: (value) => value ?? "",
|
|
158
|
+
outputTransform: (value) => value === "" ? null : getObjectId(value),
|
|
159
|
+
size: "small",
|
|
160
|
+
formProps: filledTextField
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
164
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
165
|
+
/* @__PURE__ */ jsx(GridItem, { children: equipmentTypeField }),
|
|
166
|
+
/* @__PURE__ */ jsx(GridItem, { children: equipmentField })
|
|
167
|
+
] }),
|
|
168
|
+
watchSpecificData?.specificType === FieldConstants.HVDC_LINE_LCC_DELETION_SPECIFIC_TYPE && /* @__PURE__ */ jsx(HvdcLccDeletionSpecificForm, {})
|
|
169
|
+
] });
|
|
170
|
+
}
|
|
171
|
+
export {
|
|
172
|
+
EquipmentDeletionForm
|
|
173
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { EquipmentType, ModificationType } from '../../../utils';
|
|
3
|
+
export interface LccShuntCompensatorConnectionDto {
|
|
4
|
+
id: string;
|
|
5
|
+
connectedToHvdc: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface LccDeletionDto {
|
|
8
|
+
specificType: string;
|
|
9
|
+
mcsOnSide1: LccShuntCompensatorConnectionDto[];
|
|
10
|
+
mcsOnSide2: LccShuntCompensatorConnectionDto[];
|
|
11
|
+
}
|
|
12
|
+
export type EquipmentDeletionDto = {
|
|
13
|
+
type: ModificationType;
|
|
14
|
+
equipmentId: UUID;
|
|
15
|
+
equipmentType: EquipmentType;
|
|
16
|
+
equipmentInfos?: LccDeletionDto;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { InferType } from 'yup';
|
|
2
|
+
import { UUID } from 'node:crypto';
|
|
3
|
+
import { EquipmentType } from '../../../utils/types/equipmentType';
|
|
4
|
+
import { DeepNullable } from '../../../utils';
|
|
5
|
+
import { EquipmentDeletionDto } from './equipmentDeletion.types';
|
|
6
|
+
export declare const equipmentDeletionFormSchema: import('yup').ObjectSchema<{
|
|
7
|
+
equipmentID: string;
|
|
8
|
+
type: NonNullable<EquipmentType | null | undefined>;
|
|
9
|
+
equipmentInfos: {
|
|
10
|
+
specificType: string;
|
|
11
|
+
mcsOnSide1: {
|
|
12
|
+
id: string;
|
|
13
|
+
connectedToHvdc: NonNullable<boolean | undefined>;
|
|
14
|
+
}[];
|
|
15
|
+
mcsOnSide2: {
|
|
16
|
+
id: string;
|
|
17
|
+
connectedToHvdc: NonNullable<boolean | undefined>;
|
|
18
|
+
}[];
|
|
19
|
+
} | null | undefined;
|
|
20
|
+
}, import('yup').AnyObject, {
|
|
21
|
+
equipmentID: undefined;
|
|
22
|
+
type: undefined;
|
|
23
|
+
equipmentInfos: {
|
|
24
|
+
specificType: undefined;
|
|
25
|
+
mcsOnSide1: "";
|
|
26
|
+
mcsOnSide2: "";
|
|
27
|
+
};
|
|
28
|
+
}, "">;
|
|
29
|
+
export type EquipmentDeletionFormData = InferType<typeof equipmentDeletionFormSchema>;
|
|
30
|
+
export declare const equipmentDeletionEmptyFormData: DeepNullable<EquipmentDeletionFormData>;
|
|
31
|
+
export declare const equipmentDeletionFormToDto: (form: EquipmentDeletionFormData) => EquipmentDeletionDto;
|
|
32
|
+
export declare const newEquipmentDeletionDto: (equipmentType: EquipmentType, equipmentId: UUID) => EquipmentDeletionDto;
|
|
33
|
+
export declare const equipmentDeletionDtoToForm: (dto: EquipmentDeletionDto) => EquipmentDeletionFormData;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { object, mixed, string } from "yup";
|
|
2
|
+
import { EquipmentType } from "../../../utils/types/equipmentType.js";
|
|
3
|
+
import { getHvdcLccDeletionSchema } from "./hvdcLccDeletion/hvdcLccDeletion.utils.js";
|
|
4
|
+
import "react/jsx-runtime";
|
|
5
|
+
import "react-intl";
|
|
6
|
+
import "@mui/material";
|
|
7
|
+
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
8
|
+
import { YUP_REQUIRED } from "../../../utils/constants/translationKeys.js";
|
|
9
|
+
import "../../../utils/conversionUtils.js";
|
|
10
|
+
import { ModificationType } from "../../../utils/types/modificationType.js";
|
|
11
|
+
import "@mui/icons-material";
|
|
12
|
+
import "../../../utils/yupConfig.js";
|
|
13
|
+
import "../../overflowableText/OverflowableText.js";
|
|
14
|
+
import "react";
|
|
15
|
+
import "react-hook-form";
|
|
16
|
+
import "localized-countries";
|
|
17
|
+
import "localized-countries/data/fr";
|
|
18
|
+
import "localized-countries/data/en";
|
|
19
|
+
import "notistack";
|
|
20
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
21
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
22
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
23
|
+
import "../../customAGGrid/customAggrid.js";
|
|
24
|
+
import "ag-grid-community";
|
|
25
|
+
import "react-papaparse";
|
|
26
|
+
import "react-csv-downloader";
|
|
27
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
32
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
33
|
+
import "@react-querybuilder/material";
|
|
34
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
35
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
36
|
+
import "uuid";
|
|
37
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
38
|
+
import "react-querybuilder";
|
|
39
|
+
const equipmentDeletionFormSchema = object().shape({
|
|
40
|
+
[FieldConstants.EQUIPMENT_ID]: string().nullable().required(YUP_REQUIRED),
|
|
41
|
+
[FieldConstants.TYPE]: mixed().oneOf(Object.values(EquipmentType)).nullable().required(YUP_REQUIRED),
|
|
42
|
+
[FieldConstants.DELETION_SPECIFIC_DATA]: getHvdcLccDeletionSchema()
|
|
43
|
+
}).required();
|
|
44
|
+
const equipmentDeletionEmptyFormData = {
|
|
45
|
+
equipmentID: "",
|
|
46
|
+
type: null,
|
|
47
|
+
equipmentInfos: null
|
|
48
|
+
};
|
|
49
|
+
const equipmentDeletionFormToDto = (form) => {
|
|
50
|
+
return {
|
|
51
|
+
type: ModificationType.EQUIPMENT_DELETION,
|
|
52
|
+
equipmentId: form.equipmentID,
|
|
53
|
+
equipmentType: form.type,
|
|
54
|
+
equipmentInfos: form.equipmentInfos ?? void 0
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const newEquipmentDeletionDto = (equipmentType, equipmentId) => {
|
|
58
|
+
return {
|
|
59
|
+
type: ModificationType.EQUIPMENT_DELETION,
|
|
60
|
+
equipmentId,
|
|
61
|
+
equipmentType,
|
|
62
|
+
equipmentInfos: void 0
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const equipmentDeletionDtoToForm = (dto) => {
|
|
66
|
+
return {
|
|
67
|
+
equipmentID: dto.equipmentId,
|
|
68
|
+
type: dto.equipmentType,
|
|
69
|
+
equipmentInfos: dto.equipmentInfos
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
equipmentDeletionDtoToForm,
|
|
74
|
+
equipmentDeletionEmptyFormData,
|
|
75
|
+
equipmentDeletionFormSchema,
|
|
76
|
+
equipmentDeletionFormToDto,
|
|
77
|
+
newEquipmentDeletionDto
|
|
78
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export declare function HvdcLccDeletionSpecificForm(): import("react/jsx-runtime").JSX.Element;
|