@gridsuite/commons-ui 0.180.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 +33 -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/common/connectivity/ConnectivityForm.js +2 -2
- package/dist/components/network-modifications/common/measurements/injectionActiveReactivePowerForm.utils.js +1 -1
- 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 +29 -1
- package/dist/components/network-modifications/load/common/LoadDialogHeader.d.ts +1 -2
- package/dist/components/network-modifications/load/common/LoadDialogHeader.js +4 -7
- package/dist/components/network-modifications/load/common/LoadForm.d.ts +3 -2
- package/dist/components/network-modifications/load/common/LoadForm.js +1 -9
- package/dist/components/network-modifications/load/index.d.ts +1 -0
- package/dist/components/network-modifications/load/index.js +6 -1
- package/dist/components/network-modifications/load/modification/index.d.ts +8 -0
- package/dist/components/network-modifications/load/modification/index.js +7 -0
- package/dist/components/network-modifications/load/modification/loadModification.types.d.ts +21 -0
- package/dist/components/network-modifications/load/modification/loadModification.types.js +1 -0
- package/dist/components/network-modifications/load/modification/loadModification.utils.d.ts +69 -0
- package/dist/components/network-modifications/load/modification/loadModification.utils.js +106 -0
- 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 +42 -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 +12 -0
- package/dist/translations/en/networkModificationsEn.js +15 -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 +12 -0
- package/dist/translations/fr/networkModificationsFr.js +17 -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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { object, string } from "yup";
|
|
2
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { toModificationOperation } from "../../../../utils/conversionUtils.js";
|
|
4
|
+
import "../../../../utils/types/equipmentType.js";
|
|
5
|
+
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
import "@mui/icons-material";
|
|
8
|
+
import { sanitizeString } from "../../../../utils/ts-utils.js";
|
|
9
|
+
import "../../../../utils/yupConfig.js";
|
|
10
|
+
import "@mui/material";
|
|
11
|
+
import "react";
|
|
12
|
+
import "react-hook-form";
|
|
13
|
+
import { modificationPropertiesSchema, getPropertiesFromModification, toModificationProperties } from "../../common/properties/propertyUtils.js";
|
|
14
|
+
import "react-intl";
|
|
15
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
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
|
+
import { getInjectionActiveReactivePowerValidationSchemaProperties, getInjectionActiveReactivePowerEmptyFormDataProperties, getInjectionActiveReactivePowerEditDataProperties } from "../../common/measurements/injectionActiveReactivePowerForm.utils.js";
|
|
40
|
+
import { getSetPointsSchema } from "../../common/setpoints/setPoints.utils.js";
|
|
41
|
+
import { getConnectivityWithPositionSchema, getConnectivityWithPositionEmptyFormDataProps, getConnectivityFormDataProps } from "../../common/connectivity/connectivityForm.utils.js";
|
|
42
|
+
const loadModificationFormSchema = object().shape({
|
|
43
|
+
[FieldConstants.EQUIPMENT_ID]: string().required(),
|
|
44
|
+
[FieldConstants.EQUIPMENT_NAME]: string().nullable(),
|
|
45
|
+
[FieldConstants.LOAD_TYPE]: string().nullable(),
|
|
46
|
+
...getSetPointsSchema(true),
|
|
47
|
+
[FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(true),
|
|
48
|
+
[FieldConstants.STATE_ESTIMATION]: getInjectionActiveReactivePowerValidationSchemaProperties()
|
|
49
|
+
}).concat(modificationPropertiesSchema).required();
|
|
50
|
+
const loadModificationEmptyFormData = {
|
|
51
|
+
equipmentID: "",
|
|
52
|
+
equipmentName: "",
|
|
53
|
+
loadType: null,
|
|
54
|
+
activePowerSetpoint: null,
|
|
55
|
+
reactivePowerSetpoint: null,
|
|
56
|
+
connectivity: getConnectivityWithPositionEmptyFormDataProps(true),
|
|
57
|
+
stateEstimation: getInjectionActiveReactivePowerEmptyFormDataProperties(),
|
|
58
|
+
AdditionalProperties: []
|
|
59
|
+
};
|
|
60
|
+
const loadModificationDtoToForm = (loadDto, includePreviousValues = true) => {
|
|
61
|
+
return {
|
|
62
|
+
equipmentID: loadDto.equipmentId,
|
|
63
|
+
equipmentName: loadDto.equipmentName?.value ?? "",
|
|
64
|
+
loadType: loadDto?.loadType?.value ?? null,
|
|
65
|
+
activePowerSetpoint: loadDto.p0?.value ?? void 0,
|
|
66
|
+
reactivePowerSetpoint: loadDto.q0?.value ?? void 0,
|
|
67
|
+
connectivity: getConnectivityFormDataProps({
|
|
68
|
+
voltageLevelId: loadDto?.voltageLevelId?.value ?? null,
|
|
69
|
+
busbarSectionId: loadDto?.busOrBusbarSectionId?.value ?? null,
|
|
70
|
+
connectionName: loadDto?.connectionName?.value ?? "",
|
|
71
|
+
connectionDirection: loadDto?.connectionDirection?.value ?? null,
|
|
72
|
+
connectionPosition: loadDto?.connectionPosition?.value ?? null,
|
|
73
|
+
terminalConnected: loadDto?.terminalConnected?.value ?? null,
|
|
74
|
+
isEquipmentModification: true
|
|
75
|
+
}),
|
|
76
|
+
stateEstimation: getInjectionActiveReactivePowerEditDataProperties(loadDto),
|
|
77
|
+
...getPropertiesFromModification(loadDto?.properties, includePreviousValues)
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const loadModificationFormToDto = (loadForm) => {
|
|
81
|
+
return {
|
|
82
|
+
type: ModificationType.LOAD_MODIFICATION,
|
|
83
|
+
equipmentId: loadForm.equipmentID,
|
|
84
|
+
equipmentName: toModificationOperation(sanitizeString(loadForm?.equipmentName)),
|
|
85
|
+
loadType: toModificationOperation(loadForm?.loadType),
|
|
86
|
+
p0: toModificationOperation(loadForm?.activePowerSetpoint),
|
|
87
|
+
q0: toModificationOperation(loadForm?.reactivePowerSetpoint),
|
|
88
|
+
voltageLevelId: toModificationOperation(loadForm.connectivity?.voltageLevel?.id),
|
|
89
|
+
busOrBusbarSectionId: toModificationOperation(loadForm.connectivity?.busOrBusbarSection?.id),
|
|
90
|
+
connectionName: toModificationOperation(sanitizeString(loadForm.connectivity?.connectionName)),
|
|
91
|
+
connectionDirection: toModificationOperation(loadForm.connectivity?.connectionDirection),
|
|
92
|
+
connectionPosition: toModificationOperation(loadForm.connectivity?.connectionPosition),
|
|
93
|
+
terminalConnected: toModificationOperation(loadForm.connectivity?.terminalConnected),
|
|
94
|
+
pMeasurementValue: toModificationOperation(loadForm.stateEstimation?.measurementP?.value),
|
|
95
|
+
pMeasurementValidity: toModificationOperation(loadForm.stateEstimation?.measurementP?.validity),
|
|
96
|
+
qMeasurementValue: toModificationOperation(loadForm.stateEstimation?.measurementQ?.value),
|
|
97
|
+
qMeasurementValidity: toModificationOperation(loadForm.stateEstimation?.measurementQ?.validity),
|
|
98
|
+
properties: toModificationProperties(loadForm)
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
loadModificationDtoToForm,
|
|
103
|
+
loadModificationEmptyFormData,
|
|
104
|
+
loadModificationFormSchema,
|
|
105
|
+
loadModificationFormToDto
|
|
106
|
+
};
|
|
@@ -5,6 +5,8 @@ import { CouplingOmnibusCreation } from "./creation/coupling-omnibus/CouplingOmn
|
|
|
5
5
|
import { VoltageLevelCreationForm } from "./creation/VoltageLevelCreationForm.js";
|
|
6
6
|
import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./creation/voltageLevelCreation.utils.js";
|
|
7
7
|
import { SwitchKind } from "./creation/voltageLevelCreation.types.js";
|
|
8
|
+
import { VoltageLevelModificationForm } from "./modification/VoltageLevelModificationForm.js";
|
|
9
|
+
import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto } from "./modification/voltageLevelModification.utils.js";
|
|
8
10
|
export {
|
|
9
11
|
CouplingOmnibusCreation,
|
|
10
12
|
CouplingOmnibusForm,
|
|
@@ -13,6 +15,7 @@ export {
|
|
|
13
15
|
SwitchKind,
|
|
14
16
|
SwitchesBetweenSections,
|
|
15
17
|
VoltageLevelCreationForm,
|
|
18
|
+
VoltageLevelModificationForm,
|
|
16
19
|
buildNewBusbarSections,
|
|
17
20
|
getCreateSwitchesEmptyFormData,
|
|
18
21
|
getCreateSwitchesValidationSchema,
|
|
@@ -20,5 +23,9 @@ export {
|
|
|
20
23
|
voltageLevelCreationDtoToForm,
|
|
21
24
|
voltageLevelCreationEmptyFormData,
|
|
22
25
|
voltageLevelCreationFormSchema,
|
|
23
|
-
voltageLevelCreationFormToDto
|
|
26
|
+
voltageLevelCreationFormToDto,
|
|
27
|
+
voltageLevelModificationDtoToForm,
|
|
28
|
+
voltageLevelModificationEmptyFormData,
|
|
29
|
+
voltageLevelModificationFormSchema,
|
|
30
|
+
voltageLevelModificationFormToDto
|
|
24
31
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VoltageLevelDto } from './voltageLevelModification.types';
|
|
2
|
+
export interface VoltageLevelModificationFormProps {
|
|
3
|
+
voltageLevelToModify?: VoltageLevelDto | null;
|
|
4
|
+
}
|
|
5
|
+
export declare function VoltageLevelModificationForm({ voltageLevelToModify }: Readonly<VoltageLevelModificationFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TextField, Grid } from "@mui/material";
|
|
3
|
+
import { useWatch } from "react-hook-form";
|
|
4
|
+
import GridItem from "../../../grid/grid-item.js";
|
|
5
|
+
import GridSection from "../../../grid/grid-section.js";
|
|
6
|
+
import "react-intl";
|
|
7
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
8
|
+
import { VoltageAdornment, KiloAmpereAdornment } from "../../../../utils/constants/adornments.js";
|
|
9
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
10
|
+
import "../../../../utils/conversionUtils.js";
|
|
11
|
+
import "../../../../utils/types/equipmentType.js";
|
|
12
|
+
import "@mui/icons-material";
|
|
13
|
+
import "../../../../utils/yupConfig.js";
|
|
14
|
+
import "react";
|
|
15
|
+
import "localized-countries";
|
|
16
|
+
import "localized-countries/data/fr";
|
|
17
|
+
import "localized-countries/data/en";
|
|
18
|
+
import "notistack";
|
|
19
|
+
import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
20
|
+
import "yup";
|
|
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 { AutocompleteInput } from "../../../inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
|
|
28
|
+
import { FloatInput } from "../../../inputs/reactHookForm/numbers/FloatInput.js";
|
|
29
|
+
import { TextInput } from "../../../inputs/reactHookForm/text/TextInput.js";
|
|
30
|
+
import "../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
32
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
34
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
35
|
+
import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
36
|
+
import "@react-querybuilder/material";
|
|
37
|
+
import "../../../filter/expert/expertFilterConstants.js";
|
|
38
|
+
import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
39
|
+
import "uuid";
|
|
40
|
+
import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
41
|
+
import "react-querybuilder";
|
|
42
|
+
import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
|
|
43
|
+
import { filledTextField } from "../../common/form.utils.js";
|
|
44
|
+
import "../../common/properties/propertyUtils.js";
|
|
45
|
+
function VoltageLevelModificationForm({ voltageLevelToModify }) {
|
|
46
|
+
const equipmentId = useWatch({ name: FieldConstants.EQUIPMENT_ID });
|
|
47
|
+
const watchHideSubstationField = useWatch({ name: FieldConstants.HIDE_SUBSTATION_FIELD, defaultValue: true });
|
|
48
|
+
const voltageLevelIdField = /* @__PURE__ */ jsx(
|
|
49
|
+
TextField,
|
|
50
|
+
{
|
|
51
|
+
size: "small",
|
|
52
|
+
fullWidth: true,
|
|
53
|
+
label: "ID",
|
|
54
|
+
value: equipmentId ?? "",
|
|
55
|
+
InputProps: {
|
|
56
|
+
readOnly: true
|
|
57
|
+
},
|
|
58
|
+
disabled: true,
|
|
59
|
+
...filledTextField
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
const voltageLevelNameField = /* @__PURE__ */ jsx(
|
|
63
|
+
TextInput,
|
|
64
|
+
{
|
|
65
|
+
name: FieldConstants.EQUIPMENT_NAME,
|
|
66
|
+
label: "Name",
|
|
67
|
+
formProps: filledTextField,
|
|
68
|
+
clearable: true,
|
|
69
|
+
previousValue: voltageLevelToModify?.name ?? void 0
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
const substationField = /* @__PURE__ */ jsx(
|
|
73
|
+
AutocompleteInput,
|
|
74
|
+
{
|
|
75
|
+
allowNewValue: true,
|
|
76
|
+
forcePopupIcon: true,
|
|
77
|
+
name: FieldConstants.SUBSTATION_ID,
|
|
78
|
+
label: "SUBSTATION",
|
|
79
|
+
options: [voltageLevelToModify?.substationId ?? ""],
|
|
80
|
+
inputTransform: (value) => value === null ? "" : value,
|
|
81
|
+
outputTransform: (value) => value,
|
|
82
|
+
size: "small",
|
|
83
|
+
formProps: filledTextField,
|
|
84
|
+
disabled: true
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
const nominalVoltageField = /* @__PURE__ */ jsx(
|
|
88
|
+
FloatInput,
|
|
89
|
+
{
|
|
90
|
+
name: FieldConstants.NOMINAL_V,
|
|
91
|
+
label: "NominalVoltage",
|
|
92
|
+
adornment: VoltageAdornment,
|
|
93
|
+
clearable: true,
|
|
94
|
+
previousValue: voltageLevelToModify?.nominalV
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
const lowVoltageLimitField = /* @__PURE__ */ jsx(
|
|
98
|
+
FloatInput,
|
|
99
|
+
{
|
|
100
|
+
name: FieldConstants.LOW_VOLTAGE_LIMIT,
|
|
101
|
+
label: "LowVoltageLimit",
|
|
102
|
+
adornment: VoltageAdornment,
|
|
103
|
+
clearable: true,
|
|
104
|
+
previousValue: voltageLevelToModify?.lowVoltageLimit ?? void 0
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
const highVoltageLimitField = /* @__PURE__ */ jsx(
|
|
108
|
+
FloatInput,
|
|
109
|
+
{
|
|
110
|
+
name: FieldConstants.HIGH_VOLTAGE_LIMIT,
|
|
111
|
+
label: "HighVoltageLimit",
|
|
112
|
+
adornment: VoltageAdornment,
|
|
113
|
+
clearable: true,
|
|
114
|
+
previousValue: voltageLevelToModify?.highVoltageLimit ?? void 0
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
const lowShortCircuitCurrentLimitField = /* @__PURE__ */ jsx(
|
|
118
|
+
FloatInput,
|
|
119
|
+
{
|
|
120
|
+
name: FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
|
|
121
|
+
label: "LowShortCircuitCurrentLimit",
|
|
122
|
+
adornment: KiloAmpereAdornment,
|
|
123
|
+
clearable: true,
|
|
124
|
+
previousValue: voltageLevelToModify?.identifiableShortCircuit?.ipMin ?? void 0
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
const highShortCircuitCurrentLimitField = /* @__PURE__ */ jsx(
|
|
128
|
+
FloatInput,
|
|
129
|
+
{
|
|
130
|
+
name: FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
|
|
131
|
+
label: "HighShortCircuitCurrentLimit",
|
|
132
|
+
adornment: KiloAmpereAdornment,
|
|
133
|
+
clearable: true,
|
|
134
|
+
previousValue: voltageLevelToModify?.identifiableShortCircuit?.ipMax ?? void 0
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
138
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
139
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: voltageLevelIdField }),
|
|
140
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: voltageLevelNameField }),
|
|
141
|
+
!watchHideSubstationField && /* @__PURE__ */ jsx(GridItem, { size: 4, children: substationField })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsx(GridSection, { title: "VoltageText" }),
|
|
144
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
145
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: nominalVoltageField }),
|
|
146
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: lowVoltageLimitField }),
|
|
147
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: highVoltageLimitField })
|
|
148
|
+
] }),
|
|
149
|
+
/* @__PURE__ */ jsx(GridSection, { title: "ShortCircuit" }),
|
|
150
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
151
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: lowShortCircuitCurrentLimitField }),
|
|
152
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: highShortCircuitCurrentLimitField })
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel", isModification: true })
|
|
155
|
+
] });
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
VoltageLevelModificationForm
|
|
159
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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 './VoltageLevelModificationForm';
|
|
8
|
+
export * from './voltageLevelModification.types';
|
|
9
|
+
export * from './voltageLevelModification.utils';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VoltageLevelModificationForm } from "./VoltageLevelModificationForm.js";
|
|
2
|
+
import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto } from "./voltageLevelModification.utils.js";
|
|
3
|
+
export {
|
|
4
|
+
VoltageLevelModificationForm,
|
|
5
|
+
voltageLevelModificationDtoToForm,
|
|
6
|
+
voltageLevelModificationEmptyFormData,
|
|
7
|
+
voltageLevelModificationFormSchema,
|
|
8
|
+
voltageLevelModificationFormToDto
|
|
9
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { AttributeModification, ModificationType } from '../../../../utils';
|
|
3
|
+
import { Property } from '../../common';
|
|
4
|
+
import { SwitchKind } from '../creation/voltageLevelCreation.types';
|
|
5
|
+
export interface IdentifiableShortCircuitDto {
|
|
6
|
+
ipMin: number | null;
|
|
7
|
+
ipMax: number | null;
|
|
8
|
+
}
|
|
9
|
+
export interface VoltageLevelDto {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string | null;
|
|
12
|
+
topologyKind: string | null;
|
|
13
|
+
substationId: string | null;
|
|
14
|
+
nominalV: number;
|
|
15
|
+
lowVoltageLimit: number | null;
|
|
16
|
+
highVoltageLimit: number | null;
|
|
17
|
+
busbarCount: number | null;
|
|
18
|
+
sectionCount: number | null;
|
|
19
|
+
switchKinds: SwitchKind[] | null;
|
|
20
|
+
isSymmetrical: boolean | null;
|
|
21
|
+
identifiableShortCircuit: IdentifiableShortCircuitDto | null;
|
|
22
|
+
properties: Record<string, string> | null;
|
|
23
|
+
}
|
|
24
|
+
export interface VoltageLevelModificationDto {
|
|
25
|
+
uuid?: UUID;
|
|
26
|
+
equipmentId: string;
|
|
27
|
+
equipmentName?: AttributeModification<string> | null;
|
|
28
|
+
nominalV?: AttributeModification<number> | null;
|
|
29
|
+
lowVoltageLimit?: AttributeModification<number> | null;
|
|
30
|
+
highVoltageLimit?: AttributeModification<number> | null;
|
|
31
|
+
ipMin?: AttributeModification<number> | null;
|
|
32
|
+
ipMax?: AttributeModification<number> | null;
|
|
33
|
+
properties?: Property[] | null;
|
|
34
|
+
type?: ModificationType;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InferType } from 'yup';
|
|
2
|
+
import { VoltageLevelModificationDto } from './voltageLevelModification.types';
|
|
3
|
+
export declare const voltageLevelModificationFormSchema: import('yup').ObjectSchema<{
|
|
4
|
+
equipmentID: string;
|
|
5
|
+
equipmentName: string | null | undefined;
|
|
6
|
+
hideSubstationField: NonNullable<boolean | undefined>;
|
|
7
|
+
substationId: string | null | undefined;
|
|
8
|
+
nominalV: number | null | undefined;
|
|
9
|
+
lowVoltageLimit: number | null | undefined;
|
|
10
|
+
highVoltageLimit: number | null | undefined;
|
|
11
|
+
lowShortCircuitCurrentLimit: number | null | undefined;
|
|
12
|
+
highShortCircuitCurrentLimit: number | null | undefined;
|
|
13
|
+
} & {
|
|
14
|
+
AdditionalProperties: {
|
|
15
|
+
previousValue?: string | null | undefined;
|
|
16
|
+
value?: string | null | undefined;
|
|
17
|
+
added: NonNullable<boolean | undefined>;
|
|
18
|
+
deletionMark: NonNullable<boolean | undefined>;
|
|
19
|
+
name: string;
|
|
20
|
+
}[] | undefined;
|
|
21
|
+
}, import('yup').AnyObject, {
|
|
22
|
+
equipmentID: undefined;
|
|
23
|
+
equipmentName: undefined;
|
|
24
|
+
hideSubstationField: undefined;
|
|
25
|
+
substationId: undefined;
|
|
26
|
+
nominalV: undefined;
|
|
27
|
+
lowVoltageLimit: undefined;
|
|
28
|
+
highVoltageLimit: undefined;
|
|
29
|
+
lowShortCircuitCurrentLimit: undefined;
|
|
30
|
+
highShortCircuitCurrentLimit: undefined;
|
|
31
|
+
AdditionalProperties: "";
|
|
32
|
+
}, "">;
|
|
33
|
+
export type VoltageLevelModificationFormData = InferType<typeof voltageLevelModificationFormSchema>;
|
|
34
|
+
export declare const voltageLevelModificationEmptyFormData: VoltageLevelModificationFormData;
|
|
35
|
+
export declare const voltageLevelModificationFormToDto: (formData: VoltageLevelModificationFormData) => VoltageLevelModificationDto;
|
|
36
|
+
export declare const voltageLevelModificationDtoToForm: (voltageLevelDto: VoltageLevelModificationDto, includePreviousValues?: boolean) => VoltageLevelModificationFormData;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { object, number, string, boolean, ref } from "yup";
|
|
2
|
+
import { modificationPropertiesSchema, toModificationProperties, getPropertiesFromModification } from "../../common/properties/propertyUtils.js";
|
|
3
|
+
import { toModificationOperation, convertInputValue, convertOutputValue } from "../../../../utils/conversionUtils.js";
|
|
4
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
5
|
+
import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
|
|
6
|
+
import "../../../../utils/types/equipmentType.js";
|
|
7
|
+
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
8
|
+
import { FieldType } from "../../../../utils/types/fieldType.js";
|
|
9
|
+
import "react/jsx-runtime";
|
|
10
|
+
import "@mui/icons-material";
|
|
11
|
+
import { sanitizeString } from "../../../../utils/ts-utils.js";
|
|
12
|
+
import "../../../../utils/yupConfig.js";
|
|
13
|
+
const voltageLevelModificationFormSchema = object().shape({
|
|
14
|
+
[FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED),
|
|
15
|
+
[FieldConstants.EQUIPMENT_NAME]: string().nullable(),
|
|
16
|
+
[FieldConstants.HIDE_SUBSTATION_FIELD]: boolean().required(YUP_REQUIRED),
|
|
17
|
+
[FieldConstants.SUBSTATION_ID]: string().nullable(),
|
|
18
|
+
[FieldConstants.NOMINAL_V]: number().nullable().min(0, "mustBeGreaterOrEqualToZero"),
|
|
19
|
+
[FieldConstants.LOW_VOLTAGE_LIMIT]: number().nullable().min(0, "mustBeGreaterOrEqualToZero").when([FieldConstants.HIGH_VOLTAGE_LIMIT], {
|
|
20
|
+
is: (highVoltageLimit) => highVoltageLimit != null,
|
|
21
|
+
then: (schema) => schema.max(ref(FieldConstants.HIGH_VOLTAGE_LIMIT), "voltageLevelNominalVoltageMaxValueError")
|
|
22
|
+
}),
|
|
23
|
+
[FieldConstants.HIGH_VOLTAGE_LIMIT]: number().nullable().min(0, "mustBeGreaterOrEqualToZero"),
|
|
24
|
+
[FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").when([FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT], {
|
|
25
|
+
is: (highShortCircuitCurrentLimit) => highShortCircuitCurrentLimit != null,
|
|
26
|
+
then: (schema) => schema.max(
|
|
27
|
+
ref(FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT),
|
|
28
|
+
"ShortCircuitCurrentLimitMinMaxError"
|
|
29
|
+
)
|
|
30
|
+
}),
|
|
31
|
+
[FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero")
|
|
32
|
+
}).concat(modificationPropertiesSchema);
|
|
33
|
+
const voltageLevelModificationEmptyFormData = {
|
|
34
|
+
equipmentID: "",
|
|
35
|
+
equipmentName: "",
|
|
36
|
+
hideSubstationField: true,
|
|
37
|
+
nominalV: null,
|
|
38
|
+
lowVoltageLimit: null,
|
|
39
|
+
highVoltageLimit: null,
|
|
40
|
+
lowShortCircuitCurrentLimit: null,
|
|
41
|
+
highShortCircuitCurrentLimit: null,
|
|
42
|
+
AdditionalProperties: []
|
|
43
|
+
};
|
|
44
|
+
const voltageLevelModificationFormToDto = (formData) => ({
|
|
45
|
+
type: ModificationType.VOLTAGE_LEVEL_MODIFICATION,
|
|
46
|
+
equipmentId: formData.equipmentID,
|
|
47
|
+
equipmentName: toModificationOperation(sanitizeString(formData.equipmentName)),
|
|
48
|
+
nominalV: toModificationOperation(formData.nominalV ?? null),
|
|
49
|
+
lowVoltageLimit: toModificationOperation(formData.lowVoltageLimit ?? null),
|
|
50
|
+
highVoltageLimit: toModificationOperation(formData.highVoltageLimit ?? null),
|
|
51
|
+
ipMin: toModificationOperation(
|
|
52
|
+
convertOutputValue(FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT, formData.lowShortCircuitCurrentLimit)
|
|
53
|
+
),
|
|
54
|
+
ipMax: toModificationOperation(
|
|
55
|
+
convertOutputValue(FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT, formData.highShortCircuitCurrentLimit)
|
|
56
|
+
),
|
|
57
|
+
properties: toModificationProperties(formData)
|
|
58
|
+
});
|
|
59
|
+
const voltageLevelModificationDtoToForm = (voltageLevelDto, includePreviousValues = true) => ({
|
|
60
|
+
equipmentID: voltageLevelDto.equipmentId,
|
|
61
|
+
equipmentName: voltageLevelDto.equipmentName?.value ?? "",
|
|
62
|
+
hideSubstationField: true,
|
|
63
|
+
nominalV: voltageLevelDto.nominalV?.value ?? null,
|
|
64
|
+
lowVoltageLimit: voltageLevelDto.lowVoltageLimit?.value ?? null,
|
|
65
|
+
highVoltageLimit: voltageLevelDto.highVoltageLimit?.value ?? null,
|
|
66
|
+
lowShortCircuitCurrentLimit: convertInputValue(FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT, voltageLevelDto.ipMin?.value) ?? null,
|
|
67
|
+
highShortCircuitCurrentLimit: convertInputValue(FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT, voltageLevelDto.ipMax?.value) ?? null,
|
|
68
|
+
...getPropertiesFromModification(voltageLevelDto.properties, includePreviousValues)
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
voltageLevelModificationDtoToForm,
|
|
72
|
+
voltageLevelModificationEmptyFormData,
|
|
73
|
+
voltageLevelModificationFormSchema,
|
|
74
|
+
voltageLevelModificationFormToDto
|
|
75
|
+
};
|
|
@@ -203,6 +203,13 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
203
203
|
[parametersUuid, formatNewParams, snackError]
|
|
204
204
|
);
|
|
205
205
|
const resetForm = useEffectEvent((_params) => {
|
|
206
|
+
previousWatchProviderRef.current = _params.provider;
|
|
207
|
+
setSpecificParametersDescriptionForProvider(specificParamsDescription?.[_params.provider] ?? []);
|
|
208
|
+
if (_params.provider === PARAM_PROVIDER_OPENLOADFLOW) {
|
|
209
|
+
setLimitReductionNumber(_params.limitReductions?.at(0)?.temporaryLimitReductions?.length ?? 0);
|
|
210
|
+
} else {
|
|
211
|
+
setLimitReductionNumber(0);
|
|
212
|
+
}
|
|
206
213
|
reset(toLoadFlowFormValues(_params));
|
|
207
214
|
});
|
|
208
215
|
useEffect(() => {
|
|
@@ -215,21 +222,15 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
215
222
|
if (!watchProvider || watchProvider === previousWatchProviderRef.current) {
|
|
216
223
|
return;
|
|
217
224
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
setLimitReductions(watchProvider, defaultLimitReductions, formMethods);
|
|
221
|
-
}
|
|
225
|
+
setSpecificParameters(watchProvider, specificParamsDescription, formMethods);
|
|
226
|
+
setLimitReductions(watchProvider, defaultLimitReductions, formMethods);
|
|
222
227
|
if (watchProvider === PARAM_PROVIDER_OPENLOADFLOW) {
|
|
223
|
-
|
|
224
|
-
setLimitReductionNumber(defaultLimitReductions?.at(0)?.temporaryLimitReductions?.length ?? 0);
|
|
225
|
-
} else {
|
|
226
|
-
setLimitReductionNumber(params?.limitReductions?.at(0)?.temporaryLimitReductions?.length ?? 0);
|
|
227
|
-
}
|
|
228
|
+
setLimitReductionNumber(defaultLimitReductions?.at(0)?.temporaryLimitReductions?.length ?? 0);
|
|
228
229
|
} else {
|
|
229
230
|
setLimitReductionNumber(0);
|
|
230
231
|
}
|
|
231
232
|
previousWatchProviderRef.current = watchProvider;
|
|
232
|
-
}, [defaultLimitReductions, formMethods,
|
|
233
|
+
}, [defaultLimitReductions, formMethods, specificParamsDescription, watchProvider]);
|
|
233
234
|
return {
|
|
234
235
|
formMethods,
|
|
235
236
|
formSchema,
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { useFormatLabelWithUnit } from "./useFormatLabelWithUnit.js";
|
|
|
12
12
|
import { useSelectAppearance } from "./useSelectAppearance.js";
|
|
13
13
|
import { OptionalServicesStatus, useParametersBackend } from "./use-parameters-backend.js";
|
|
14
14
|
import { useCreateRowData } from "./use-create-row-data.js";
|
|
15
|
+
import { useGetLabelEquipmentTypes } from "./useGetLabelEquipmentTypes.js";
|
|
15
16
|
export {
|
|
16
17
|
OptionalServicesStatus,
|
|
17
18
|
getComputedLanguage,
|
|
@@ -20,6 +21,7 @@ export {
|
|
|
20
21
|
useCreateRowData,
|
|
21
22
|
useDebounce,
|
|
22
23
|
useFormatLabelWithUnit,
|
|
24
|
+
useGetLabelEquipmentTypes,
|
|
23
25
|
useIntlRef,
|
|
24
26
|
useLocalizedCountries,
|
|
25
27
|
useModificationLabelComputer,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import "../utils/conversionUtils.js";
|
|
4
|
+
import { EquipmentType } from "../utils/types/equipmentType.js";
|
|
5
|
+
import "react/jsx-runtime";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { getIdOrValue } from "../utils/ts-utils.js";
|
|
8
|
+
import "../utils/yupConfig.js";
|
|
9
|
+
function useGetLabelEquipmentTypes() {
|
|
10
|
+
const intl = useIntl();
|
|
11
|
+
return useMemo(
|
|
12
|
+
() => (equipmentType) => intl.formatMessage({
|
|
13
|
+
id: equipmentType === EquipmentType.HVDC_LINE ? "Hvdc" : getIdOrValue(equipmentType)
|
|
14
|
+
}),
|
|
15
|
+
[intl]
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
useGetLabelEquipmentTypes
|
|
20
|
+
};
|