@gridsuite/commons-ui 0.208.0 → 0.210.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.
Files changed (74) hide show
  1. package/dist/components/filter/utils/filterFormUtils.js +2 -1
  2. package/dist/components/index.js +33 -3
  3. package/dist/components/inputs/reactHookForm/booleans/RadioInput.js +2 -2
  4. package/dist/components/network-modification-table/renderers/name-cell.d.ts +2 -1
  5. package/dist/components/network-modification-table/renderers/name-cell.js +136 -19
  6. package/dist/components/network-modifications/battery/creation/BatteryCreationForm.d.ts +4 -0
  7. package/dist/components/network-modifications/battery/creation/BatteryCreationForm.js +105 -0
  8. package/dist/components/network-modifications/battery/creation/batteryCreation.types.d.ts +26 -0
  9. package/dist/components/network-modifications/battery/creation/batteryCreation.types.js +1 -0
  10. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.d.ts +79 -0
  11. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.js +145 -0
  12. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.d.ts → battery/creation/index.d.ts} +3 -5
  13. package/dist/components/network-modifications/battery/creation/index.js +9 -0
  14. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation → battery}/index.d.ts +1 -1
  15. package/dist/components/network-modifications/battery/index.js +9 -0
  16. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -2
  17. package/dist/components/network-modifications/common/index.js +5 -2
  18. package/dist/components/network-modifications/common/reactiveLimits/index.js +5 -2
  19. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/index.js +2 -1
  20. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.d.ts +10 -1
  21. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +30 -27
  22. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.type.d.ts +3 -3
  23. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.d.ts +33 -0
  24. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +69 -35
  25. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +1 -1
  26. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.js +3 -3
  27. package/dist/components/network-modifications/index.d.ts +2 -0
  28. package/dist/components/network-modifications/index.js +33 -3
  29. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.d.ts +6 -0
  30. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.js +199 -0
  31. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.d.ts +64 -0
  32. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +90 -0
  33. package/dist/components/network-modifications/shunt-compensator/common/index.d.ts +10 -0
  34. package/dist/components/network-modifications/shunt-compensator/common/index.js +13 -0
  35. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.d.ts +20 -0
  36. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.js +1 -0
  37. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.d.ts +27 -0
  38. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.js +16 -0
  39. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.d.ts +3 -0
  40. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +82 -0
  41. package/dist/components/network-modifications/shunt-compensator/creation/index.d.ts +9 -0
  42. package/dist/components/network-modifications/shunt-compensator/creation/index.js +9 -0
  43. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.d.ts +20 -0
  44. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.js +1 -0
  45. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.d.ts +110 -0
  46. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +103 -0
  47. package/dist/components/network-modifications/shunt-compensator/index.d.ts +8 -0
  48. package/dist/components/network-modifications/shunt-compensator/index.js +20 -0
  49. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
  50. package/dist/components/network-modifications/voltageLevel/creation/index.d.ts +1 -0
  51. package/dist/components/network-modifications/voltageLevel/creation/index.js +3 -1
  52. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +6 -2
  53. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +22 -43
  54. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +1 -0
  55. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +2 -0
  56. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -1
  57. package/dist/components/network-modifications/voltageLevel/index.js +3 -1
  58. package/dist/index.js +33 -3
  59. package/dist/translations/en/networkModificationsEn.d.ts +24 -0
  60. package/dist/translations/en/networkModificationsEn.js +24 -0
  61. package/dist/translations/fr/networkModificationsFr.d.ts +24 -0
  62. package/dist/translations/fr/networkModificationsFr.js +24 -0
  63. package/dist/utils/constants/fieldConstants.d.ts +7 -0
  64. package/dist/utils/constants/fieldConstants.js +7 -0
  65. package/dist/utils/types/network-modification-metadata.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.d.ts +0 -11
  68. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js +0 -84
  69. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.d.ts +0 -6
  70. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.js +0 -11
  71. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +0 -61
  72. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.d.ts +0 -14
  73. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.js +0 -27
  74. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/index.js +0 -4
@@ -18,10 +18,10 @@ import { getActivePowerControlEmptyFormData, getActivePowerControlSchema } from
18
18
  import { ActivePowerControlForm } from "./common/activePowerControl/ActivePowerControlForm.js";
19
19
  import { getShortCircuitEmptyFormData, getShortCircuitFormData, getShortCircuitFormSchema } from "./common/shortCircuit/shortCircuitForm.utils.js";
20
20
  import { ShortCircuitForm } from "./common/shortCircuit/ShortCircuitForm.js";
21
- import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js";
21
+ import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getReactiveCapabilityCurveValidationSchemaArray, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js";
22
22
  import { ReactiveCapabilityCurveRowForm } from "./common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js";
23
23
  import { ReactiveCapabilityCurveTableForm } from "./common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js";
24
- import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsFormData, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./common/reactiveLimits/reactiveLimits.utils.js";
24
+ import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsEmptyFormDataProps, getReactiveLimitsFormData, getReactiveLimitsFormDataProps, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./common/reactiveLimits/reactiveLimits.utils.js";
25
25
  import { ReactiveLimitsForm } from "./common/reactiveLimits/ReactiveLimitsForm.js";
26
26
  import { getHvdcLccDeletionSchema } from "./equipmentDeletion/hvdcLccDeletion/hvdcLccDeletion.utils.js";
27
27
  import { ShuntCompensatorSelectionForm } from "./equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js";
@@ -37,6 +37,7 @@ import { substationModificationDtoToForm, substationModificationEmptyFormData, s
37
37
  import { SwitchesBetweenSections } from "./voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js";
38
38
  import "react/jsx-runtime";
39
39
  import "@mui/material";
40
+ import "react";
40
41
  import "react-hook-form";
41
42
  import "react-intl";
42
43
  import "../overflowableText/OverflowableText.js";
@@ -44,7 +45,6 @@ import "../../utils/conversionUtils.js";
44
45
  import "../../utils/types/equipmentType.js";
45
46
  import "@mui/icons-material";
46
47
  import "../../utils/yupConfig.js";
47
- import "react";
48
48
  import "localized-countries";
49
49
  import "localized-countries/data/fr";
50
50
  import "localized-countries/data/en";
@@ -71,6 +71,7 @@ import "../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
71
71
  import "uuid";
72
72
  import "../inputs/reactQueryBuilder/PropertyValueEditor.js";
73
73
  import "react-querybuilder";
74
+ import { MAX_SECTIONS_COUNT } from "./voltageLevel/creation/voltageLevel.constants.js";
74
75
  import { VoltageLevelCreationForm } from "./voltageLevel/creation/VoltageLevelCreationForm.js";
75
76
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./voltageLevel/creation/voltageLevelCreation.utils.js";
76
77
  import { SwitchKind } from "./voltageLevel/creation/voltageLevelCreation.types.js";
@@ -88,12 +89,22 @@ import { EQUIPMENT_TYPE_ORDER, byFilterDeletionDtoToForm, byFilterDeletionFormSc
88
89
  import { ModificationByAssignmentForm } from "./by-filter/assignment/modification-by-assignment-form.js";
89
90
  import { emptyModificationByAssignmentFormData, modificationByAssignmentDtoToForm, modificationByAssignmentFormSchema, modificationByAssignmentFormToDto } from "./by-filter/assignment/modificationByAssignment.utils.js";
90
91
  import { DataType } from "./by-filter/assignment/assignment/assignment.type.js";
92
+ import { batteryCreationDtoToForm, batteryCreationEmptyFormData, batteryCreationFormSchema, batteryCreationFormToDto } from "./battery/creation/batteryCreation.utils.js";
93
+ import { BatteryCreationForm } from "./battery/creation/BatteryCreationForm.js";
94
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./shunt-compensator/common/shuntCompensator.utils.js";
95
+ import { CharacteristicsForm } from "./shunt-compensator/common/CharacteristicsForm.js";
96
+ import { getCharacteristicsCreateFormDataFromSearchCopy, getCharacteristicsEmptyFormData, getCharacteristicsFormData, getCharacteristicsFormValidationSchema } from "./shunt-compensator/common/characteristicsForm.utils.js";
97
+ import { ShuntCompensatorCreationForm } from "./shunt-compensator/creation/ShuntCompensatorCreationForm.js";
98
+ import { shuntCompensatorCreationDtoToForm, shuntCompensatorCreationEmptyFormData, shuntCompensatorCreationFormSchema, shuntCompensatorCreationFormToDto } from "./shunt-compensator/creation/shuntCompensatorCreation.utils.js";
91
99
  export {
92
100
  ActivePowerControlForm,
93
101
  DataType as AssignmentDataType,
102
+ BatteryCreationForm,
94
103
  BranchActiveReactivePowerMeasurementsForm,
95
104
  BranchConnectivityForm,
96
105
  ByFilterDeletionForm,
106
+ CHARACTERISTICS_CHOICES,
107
+ CharacteristicsForm,
97
108
  ConnectivityForm,
98
109
  EQUIPMENT_TYPE_ORDER,
99
110
  EquipmentDeletionForm,
@@ -105,6 +116,7 @@ export {
105
116
  LoadDialogTabs,
106
117
  LoadDialogTabsContent,
107
118
  LoadForm,
119
+ MAX_SECTIONS_COUNT,
108
120
  ModificationByAssignmentForm,
109
121
  PowerMeasurementsForm,
110
122
  PowerWithValidityForm,
@@ -115,9 +127,11 @@ export {
115
127
  ReactiveCapabilityCurveRowForm,
116
128
  ReactiveCapabilityCurveTableForm,
117
129
  ReactiveLimitsForm,
130
+ SHUNT_COMPENSATOR_TYPES,
118
131
  SWITCH_TYPE,
119
132
  SetPointsForm,
120
133
  ShortCircuitForm,
134
+ ShuntCompensatorCreationForm,
121
135
  ShuntCompensatorSelectionForm,
122
136
  SubstationCreationForm,
123
137
  SubstationModificationForm,
@@ -126,10 +140,15 @@ export {
126
140
  VoltageLevelConnectivityForm,
127
141
  VoltageLevelCreationForm,
128
142
  VoltageLevelModificationForm,
143
+ batteryCreationDtoToForm,
144
+ batteryCreationEmptyFormData,
145
+ batteryCreationFormSchema,
146
+ batteryCreationFormToDto,
129
147
  buildNewBusbarSections,
130
148
  byFilterDeletionDtoToForm,
131
149
  byFilterDeletionFormSchema,
132
150
  byFilterDeletionFormToDto,
151
+ computeSwitchedOnValue,
133
152
  copyEquipmentPropertiesForCreation,
134
153
  createConnectivityData,
135
154
  createPropertyModification,
@@ -152,6 +171,10 @@ export {
152
171
  getBranchActiveReactivePowerEmptyFormDataProperties,
153
172
  getBranchActiveReactivePowerValidationSchema,
154
173
  getBranchActiveReactivePowerValidationSchemaProperties,
174
+ getCharacteristicsCreateFormDataFromSearchCopy,
175
+ getCharacteristicsEmptyFormData,
176
+ getCharacteristicsFormData,
177
+ getCharacteristicsFormValidationSchema,
155
178
  getCon1andCon2WithPositionValidationSchema,
156
179
  getConcatenatedProperties,
157
180
  getConnectivityBusBarSectionData,
@@ -186,8 +209,11 @@ export {
186
209
  getPropertiesFromModification,
187
210
  getPropertyValue,
188
211
  getReactiveCapabilityCurveValidationSchema,
212
+ getReactiveCapabilityCurveValidationSchemaArray,
189
213
  getReactiveLimitsEmptyFormData,
214
+ getReactiveLimitsEmptyFormDataProps,
190
215
  getReactiveLimitsFormData,
216
+ getReactiveLimitsFormDataProps,
191
217
  getReactiveLimitsSchema,
192
218
  getReactiveLimitsValidationSchema,
193
219
  getReactivePowerSetPointSchema,
@@ -215,6 +241,10 @@ export {
215
241
  newEquipmentDeletionDto,
216
242
  setCurrentReactiveCapabilityCurveTable,
217
243
  setSelectedReactiveLimits,
244
+ shuntCompensatorCreationDtoToForm,
245
+ shuntCompensatorCreationEmptyFormData,
246
+ shuntCompensatorCreationFormSchema,
247
+ shuntCompensatorCreationFormToDto,
218
248
  standardTextField,
219
249
  substationCreationDtoToForm,
220
250
  substationCreationEmptyFormData,
@@ -0,0 +1,6 @@
1
+ import { ShuntCompensatorFormInfos } from './shuntCompensator.types';
2
+ export interface CharacteristicsFormProps {
3
+ previousValues?: ShuntCompensatorFormInfos;
4
+ isModification?: boolean;
5
+ }
6
+ export declare function CharacteristicsForm({ previousValues, isModification }: Readonly<CharacteristicsFormProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,199 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Grid, Box } from "@mui/material";
3
+ import { useFormContext, useWatch } from "react-hook-form";
4
+ import { useMemo, useCallback, useEffect } from "react";
5
+ import { useIntl } from "react-intl";
6
+ import { ReactivePowerAdornment, SusceptanceAdornment } from "../../../../utils/constants/adornments.js";
7
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
8
+ import "../../../../utils/conversionUtils.js";
9
+ import "../../../../utils/types/equipmentType.js";
10
+ import "@mui/icons-material";
11
+ import "../../../../utils/yupConfig.js";
12
+ import "../../../overflowableText/OverflowableText.js";
13
+ import "localized-countries";
14
+ import "localized-countries/data/fr";
15
+ import "localized-countries/data/en";
16
+ import "notistack";
17
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
18
+ import "yup";
19
+ import "../../../treeViewFinder/TreeViewFinder.js";
20
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
21
+ import "../../../customAGGrid/customAggrid.js";
22
+ import "ag-grid-community";
23
+ import "react-papaparse";
24
+ import "react-csv-downloader";
25
+ import { RadioInput } from "../../../inputs/reactHookForm/booleans/RadioInput.js";
26
+ import { FloatInput } from "../../../inputs/reactHookForm/numbers/FloatInput.js";
27
+ import { IntegerInput } from "../../../inputs/reactHookForm/numbers/IntegerInput.js";
28
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
29
+ import { SelectInput } from "../../../inputs/reactHookForm/selectInputs/SelectInput.js";
30
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
31
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
32
+ import "@material-symbols/svg-400/outlined/arrows_input.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 "../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
37
+ import "@react-querybuilder/material";
38
+ import "../../../filter/expert/expertFilterConstants.js";
39
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
40
+ import "uuid";
41
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
42
+ import "react-querybuilder";
43
+ import { SHUNT_COMPENSATOR_TYPES, CHARACTERISTICS_CHOICES } from "./shuntCompensator.utils.js";
44
+ function CharacteristicsForm({ previousValues, isModification = false }) {
45
+ const intl = useIntl();
46
+ const { setValue } = useFormContext();
47
+ const [sectionCount, maximumSectionCount, maxQAtNominalV, maxSusceptance, characteristicsChoice] = useWatch({
48
+ name: [
49
+ FieldConstants.SECTION_COUNT,
50
+ FieldConstants.MAXIMUM_SECTION_COUNT,
51
+ FieldConstants.MAX_Q_AT_NOMINAL_V,
52
+ FieldConstants.MAX_SUSCEPTANCE,
53
+ FieldConstants.CHARACTERISTICS_CHOICE
54
+ ]
55
+ });
56
+ const previousMaxQAtNominalV = useMemo(() => {
57
+ const prevValue = previousValues?.qAtNominalV && previousValues?.maximumSectionCount ? previousValues.qAtNominalV * previousValues.maximumSectionCount : void 0;
58
+ return Number.isNaN(prevValue) ? void 0 : prevValue;
59
+ }, [previousValues]);
60
+ const previousMaxSusceptance = useMemo(() => {
61
+ const prevValue = previousValues?.bPerSection && previousValues?.maximumSectionCount ? previousValues.bPerSection * previousValues.maximumSectionCount : void 0;
62
+ return Number.isNaN(prevValue) ? void 0 : prevValue;
63
+ }, [previousValues]);
64
+ const currentSectionCount = useMemo(
65
+ () => sectionCount ?? previousValues?.sectionCount,
66
+ [sectionCount, previousValues]
67
+ );
68
+ const currentMaximumSectionCount = useMemo(
69
+ () => maximumSectionCount ?? previousValues?.maximumSectionCount,
70
+ [maximumSectionCount, previousValues]
71
+ );
72
+ const currentMaxQAtNominalV = useMemo(
73
+ () => maxQAtNominalV ?? previousMaxQAtNominalV,
74
+ [maxQAtNominalV, previousMaxQAtNominalV]
75
+ );
76
+ const currentMaxSusceptance = useMemo(
77
+ () => maxSusceptance ?? previousMaxSusceptance,
78
+ [maxSusceptance, previousMaxSusceptance]
79
+ );
80
+ const previousShuntCompensatorType = useMemo(
81
+ () => previousValues?.bPerSection ? intl.formatMessage({
82
+ id: previousValues.bPerSection > 0 ? SHUNT_COMPENSATOR_TYPES.CAPACITOR.label : SHUNT_COMPENSATOR_TYPES.REACTOR.label
83
+ }) : "",
84
+ [previousValues?.bPerSection, intl]
85
+ );
86
+ const handleSwitchedOnValue = useCallback(
87
+ (currentLinkedSwitchedOnValue, switchedOnFieldName) => {
88
+ if ([currentSectionCount, currentMaximumSectionCount, currentLinkedSwitchedOnValue].every(
89
+ (v) => v !== null && v !== void 0
90
+ ) && currentMaximumSectionCount >= currentSectionCount) {
91
+ setValue(
92
+ switchedOnFieldName,
93
+ currentLinkedSwitchedOnValue / currentMaximumSectionCount * currentSectionCount
94
+ );
95
+ } else {
96
+ setValue(switchedOnFieldName, null);
97
+ }
98
+ },
99
+ [currentSectionCount, currentMaximumSectionCount, setValue]
100
+ );
101
+ useEffect(() => {
102
+ if (characteristicsChoice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id) {
103
+ handleSwitchedOnValue(currentMaxQAtNominalV, FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V);
104
+ } else if (characteristicsChoice === CHARACTERISTICS_CHOICES.SUSCEPTANCE.id) {
105
+ handleSwitchedOnValue(currentMaxSusceptance, FieldConstants.SWITCHED_ON_SUSCEPTANCE);
106
+ }
107
+ }, [characteristicsChoice, handleSwitchedOnValue, currentMaxQAtNominalV, currentMaxSusceptance]);
108
+ const maximumSectionCountField = /* @__PURE__ */ jsx(
109
+ IntegerInput,
110
+ {
111
+ name: FieldConstants.MAXIMUM_SECTION_COUNT,
112
+ label: "maximumSectionCount",
113
+ previousValue: previousValues?.maximumSectionCount ?? void 0,
114
+ clearable: isModification
115
+ }
116
+ );
117
+ const sectionCountField = /* @__PURE__ */ jsx(
118
+ IntegerInput,
119
+ {
120
+ name: FieldConstants.SECTION_COUNT,
121
+ label: "sectionCount",
122
+ previousValue: previousValues?.sectionCount ?? void 0,
123
+ clearable: isModification
124
+ }
125
+ );
126
+ const maxQAtNominalVField = /* @__PURE__ */ jsx(
127
+ FloatInput,
128
+ {
129
+ name: FieldConstants.MAX_Q_AT_NOMINAL_V,
130
+ label: "maxQAtNominalV",
131
+ adornment: ReactivePowerAdornment,
132
+ previousValue: previousMaxQAtNominalV,
133
+ clearable: isModification
134
+ }
135
+ );
136
+ const switchedOnMaxQAtNominalVField = /* @__PURE__ */ jsx(
137
+ FloatInput,
138
+ {
139
+ name: FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V,
140
+ label: "SwitchedOnMaxQAtNominalV",
141
+ adornment: ReactivePowerAdornment,
142
+ previousValue: previousValues?.qAtNominalV && previousValues?.sectionCount ? previousValues.qAtNominalV * previousValues.sectionCount : void 0,
143
+ formProps: {
144
+ disabled: true
145
+ }
146
+ }
147
+ );
148
+ const shuntCompensatorTypeField = /* @__PURE__ */ jsx(
149
+ SelectInput,
150
+ {
151
+ options: Object.values(SHUNT_COMPENSATOR_TYPES),
152
+ name: FieldConstants.SHUNT_COMPENSATOR_TYPE,
153
+ label: "Type",
154
+ size: "small",
155
+ previousValue: previousShuntCompensatorType
156
+ }
157
+ );
158
+ const maxSusceptanceField = /* @__PURE__ */ jsx(
159
+ FloatInput,
160
+ {
161
+ name: FieldConstants.MAX_SUSCEPTANCE,
162
+ label: "maxSusceptance",
163
+ adornment: SusceptanceAdornment,
164
+ previousValue: previousMaxSusceptance,
165
+ clearable: isModification
166
+ }
167
+ );
168
+ const switchedOnSusceptanceField = /* @__PURE__ */ jsx(
169
+ FloatInput,
170
+ {
171
+ name: FieldConstants.SWITCHED_ON_SUSCEPTANCE,
172
+ label: "SwitchedOnMaxSusceptance",
173
+ adornment: SusceptanceAdornment,
174
+ previousValue: previousValues?.bPerSection && previousValues.sectionCount ? previousValues.bPerSection * previousValues.sectionCount : void 0,
175
+ formProps: {
176
+ disabled: true
177
+ }
178
+ }
179
+ );
180
+ const characteristicsChoiceField = /* @__PURE__ */ jsx(RadioInput, { name: FieldConstants.CHARACTERISTICS_CHOICE, options: Object.values(CHARACTERISTICS_CHOICES) });
181
+ return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
182
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: maximumSectionCountField }),
183
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: sectionCountField }),
184
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: characteristicsChoiceField }),
185
+ characteristicsChoice === CHARACTERISTICS_CHOICES.SUSCEPTANCE.id && /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 2, children: [
186
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: maxSusceptanceField }),
187
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: switchedOnSusceptanceField })
188
+ ] }),
189
+ characteristicsChoice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id && /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 2, children: [
190
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: shuntCompensatorTypeField }),
191
+ /* @__PURE__ */ jsx(Box, { sx: { width: "100%" } }),
192
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: maxQAtNominalVField }),
193
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: switchedOnMaxQAtNominalVField })
194
+ ] })
195
+ ] });
196
+ }
197
+ export {
198
+ CharacteristicsForm
199
+ };
@@ -0,0 +1,64 @@
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 declare const getCharacteristicsFormValidationSchema: (isModification: boolean) => {
8
+ maxQAtNominalV: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, null, "d">;
9
+ maxSusceptance: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, null, "d">;
10
+ maximumSectionCount: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, null, "d">;
11
+ sectionCount: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, null, "d">;
12
+ switchedOnQAtNominalV: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, undefined, "">;
13
+ switchedOnSusceptance: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, undefined, "">;
14
+ characteristicsChoice: import('yup').StringSchema<string, import('yup').AnyObject, undefined, "">;
15
+ shuntCompensatorType: import('yup').StringSchema<string | null | undefined, import('yup').AnyObject, null, "d">;
16
+ } | {
17
+ maxQAtNominalV: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, null, "d">;
18
+ maxSusceptance: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, null, "d">;
19
+ maximumSectionCount: import('yup').NumberSchema<number, import('yup').AnyObject, undefined, "">;
20
+ sectionCount: import('yup').NumberSchema<number, import('yup').AnyObject, undefined, "">;
21
+ switchedOnQAtNominalV: import('yup').NumberSchema<import('yup').Maybe<number | undefined>, import('yup').AnyObject, undefined, "">;
22
+ switchedOnSusceptance: import('yup').NumberSchema<import('yup').Maybe<number | undefined>, import('yup').AnyObject, undefined, "">;
23
+ characteristicsChoice: import('yup').StringSchema<string, import('yup').AnyObject, undefined, "">;
24
+ shuntCompensatorType: import('yup').StringSchema<string | null | undefined, import('yup').AnyObject, null, "d">;
25
+ };
26
+ export declare const getCharacteristicsEmptyFormData: () => {
27
+ maximumSectionCount: null;
28
+ sectionCount: null;
29
+ characteristicsChoice: "Q_AT_NOMINAL_V";
30
+ maxSusceptance: null;
31
+ shuntCompensatorType: null;
32
+ maxQAtNominalV: null;
33
+ switchedOnQAtNominalV: null;
34
+ switchedOnSusceptance: null;
35
+ };
36
+ export declare const getCharacteristicsFormData: ({ maxSusceptance, maxQAtNominalV, shuntCompensatorType, sectionCount, maximumSectionCount, }: {
37
+ maxSusceptance: number | null;
38
+ maxQAtNominalV: number | null;
39
+ shuntCompensatorType?: string | null;
40
+ sectionCount?: number | null;
41
+ maximumSectionCount?: number | null;
42
+ }) => {
43
+ characteristicsChoice: "Q_AT_NOMINAL_V" | "SUSCEPTANCE";
44
+ maxSusceptance: number | null;
45
+ shuntCompensatorType: string | null;
46
+ maxQAtNominalV: number | null;
47
+ sectionCount: number | null;
48
+ maximumSectionCount: number | null;
49
+ switchedOnQAtNominalV: number | null;
50
+ switchedOnSusceptance: number | null;
51
+ };
52
+ export declare const getCharacteristicsCreateFormDataFromSearchCopy: ({ bPerSection, qAtNominalV, sectionCount, maximumSectionCount, }: {
53
+ bPerSection: number | null;
54
+ qAtNominalV: number | null;
55
+ sectionCount: number | null;
56
+ maximumSectionCount: number | null;
57
+ }) => {
58
+ characteristicsChoice: "Q_AT_NOMINAL_V";
59
+ maxSusceptance: number | null;
60
+ shuntCompensatorType: "CAPACITOR" | "REACTOR";
61
+ maxQAtNominalV: number | null;
62
+ sectionCount: number | null;
63
+ maximumSectionCount: number | null;
64
+ };
@@ -0,0 +1,90 @@
1
+ import { string, number, ref } from "yup";
2
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
+ import { YUP_REQUIRED, YUP_NOT_TYPE_NUMBER } from "../../../../utils/constants/translationKeys.js";
4
+ import "../../../../utils/conversionUtils.js";
5
+ import "../../../../utils/types/equipmentType.js";
6
+ import "react/jsx-runtime";
7
+ import "@mui/icons-material";
8
+ import "../../../../utils/yupConfig.js";
9
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./shuntCompensator.utils.js";
10
+ const getCharacteristicsCreateFormValidationSchema = () => ({
11
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
12
+ is: (characteristicsChoice) => characteristicsChoice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id,
13
+ then: (schema) => schema.min(0, "ShuntCompensatorErrorQAtNominalVoltageLessThanZero").required(YUP_REQUIRED)
14
+ }),
15
+ [FieldConstants.MAX_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
16
+ is: (characteristicsChoice) => characteristicsChoice === CHARACTERISTICS_CHOICES.SUSCEPTANCE.id,
17
+ then: (schema) => schema.required(YUP_REQUIRED)
18
+ }),
19
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).min(1, "MaximumSectionCountMustBeGreaterOrEqualToOne"),
20
+ [FieldConstants.SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).min(0, "SectionCountMustBeBetweenZeroAndMaximumSectionCount").max(ref(FieldConstants.MAXIMUM_SECTION_COUNT), "SectionCountMustBeBetweenZeroAndMaximumSectionCount"),
21
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).notRequired(),
22
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).notRequired()
23
+ });
24
+ const getCharacteristicsModificationFormValidationSchema = () => ({
25
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).min(0, "ShuntCompensatorErrorQAtNominalVoltageLessThanZero").nullable().default(null),
26
+ [FieldConstants.MAX_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().default(null),
27
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).min(1, "MaximumSectionCountMustBeGreaterOrEqualToOne").nullable().default(null),
28
+ [FieldConstants.SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).min(0, "SectionCountMustBeBetweenZeroAndMaximumSectionCount").nullable().default(null),
29
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable(),
30
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable()
31
+ });
32
+ const getCharacteristicsFormValidationSchema = (isModification) => {
33
+ const baseSchema = {
34
+ [FieldConstants.CHARACTERISTICS_CHOICE]: string().required(YUP_REQUIRED),
35
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: string().nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
36
+ is: (choice) => choice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id && !isModification,
37
+ then: (schema) => schema.oneOf([SHUNT_COMPENSATOR_TYPES.CAPACITOR.id, SHUNT_COMPENSATOR_TYPES.REACTOR.id]).required(YUP_REQUIRED)
38
+ })
39
+ };
40
+ const additionalSchema = isModification ? getCharacteristicsModificationFormValidationSchema() : getCharacteristicsCreateFormValidationSchema();
41
+ return {
42
+ ...baseSchema,
43
+ ...additionalSchema
44
+ };
45
+ };
46
+ const getCharacteristicsEmptyFormData = () => ({
47
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: null,
48
+ [FieldConstants.SECTION_COUNT]: null,
49
+ [FieldConstants.CHARACTERISTICS_CHOICE]: CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id,
50
+ [FieldConstants.MAX_SUSCEPTANCE]: null,
51
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: null,
52
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: null,
53
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: null,
54
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: null
55
+ });
56
+ const getCharacteristicsFormData = ({
57
+ maxSusceptance,
58
+ maxQAtNominalV,
59
+ shuntCompensatorType,
60
+ sectionCount,
61
+ maximumSectionCount
62
+ }) => ({
63
+ [FieldConstants.CHARACTERISTICS_CHOICE]: maxSusceptance == null ? CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id : CHARACTERISTICS_CHOICES.SUSCEPTANCE.id,
64
+ [FieldConstants.MAX_SUSCEPTANCE]: maxSusceptance,
65
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: shuntCompensatorType ?? null,
66
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: maxQAtNominalV,
67
+ [FieldConstants.SECTION_COUNT]: sectionCount ?? null,
68
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: maximumSectionCount ?? null,
69
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: maxQAtNominalV != null && sectionCount != null && maximumSectionCount != null ? computeSwitchedOnValue(sectionCount, maximumSectionCount, maxQAtNominalV) : null,
70
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: maxSusceptance != null && sectionCount != null && maximumSectionCount != null ? computeSwitchedOnValue(sectionCount, maximumSectionCount, maxSusceptance) : null
71
+ });
72
+ const getCharacteristicsCreateFormDataFromSearchCopy = ({
73
+ bPerSection,
74
+ qAtNominalV,
75
+ sectionCount,
76
+ maximumSectionCount
77
+ }) => ({
78
+ [FieldConstants.CHARACTERISTICS_CHOICE]: CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id,
79
+ [FieldConstants.MAX_SUSCEPTANCE]: bPerSection && maximumSectionCount && bPerSection * maximumSectionCount,
80
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: bPerSection && bPerSection > 0 ? SHUNT_COMPENSATOR_TYPES.CAPACITOR.id : SHUNT_COMPENSATOR_TYPES.REACTOR.id,
81
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: qAtNominalV && maximumSectionCount && qAtNominalV * maximumSectionCount,
82
+ [FieldConstants.SECTION_COUNT]: sectionCount,
83
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: maximumSectionCount
84
+ });
85
+ export {
86
+ getCharacteristicsCreateFormDataFromSearchCopy,
87
+ getCharacteristicsEmptyFormData,
88
+ getCharacteristicsFormData,
89
+ getCharacteristicsFormValidationSchema
90
+ };
@@ -0,0 +1,10 @@
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 './shuntCompensator.types';
8
+ export * from './shuntCompensator.utils';
9
+ export * from './CharacteristicsForm';
10
+ export * from './characteristicsForm.utils';
@@ -0,0 +1,13 @@
1
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./shuntCompensator.utils.js";
2
+ import { CharacteristicsForm } from "./CharacteristicsForm.js";
3
+ import { getCharacteristicsCreateFormDataFromSearchCopy, getCharacteristicsEmptyFormData, getCharacteristicsFormData, getCharacteristicsFormValidationSchema } from "./characteristicsForm.utils.js";
4
+ export {
5
+ CHARACTERISTICS_CHOICES,
6
+ CharacteristicsForm,
7
+ SHUNT_COMPENSATOR_TYPES,
8
+ computeSwitchedOnValue,
9
+ getCharacteristicsCreateFormDataFromSearchCopy,
10
+ getCharacteristicsEmptyFormData,
11
+ getCharacteristicsFormData,
12
+ getCharacteristicsFormValidationSchema
13
+ };
@@ -0,0 +1,20 @@
1
+ import { ConnectablePositionFormInfos } from '../../common/connectivity/connectivity.type';
2
+ import { MeasurementInfo } from '../../common/measurements/measurement.type';
3
+ export interface ShuntCompensatorFormInfos {
4
+ id: string;
5
+ name: string;
6
+ voltageLevelId: string;
7
+ terminalConnected: boolean | null;
8
+ busOrBusbarSectionId?: string;
9
+ connectablePosition: ConnectablePositionFormInfos;
10
+ q?: number;
11
+ targetV?: number;
12
+ targetDeadband?: number;
13
+ sectionCount: number;
14
+ bPerSection?: number;
15
+ qAtNominalV?: number;
16
+ maximumSectionCount: number;
17
+ isLinear?: boolean;
18
+ measurementQ: MeasurementInfo | undefined;
19
+ properties: Record<string, string> | undefined;
20
+ }
@@ -0,0 +1,27 @@
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 declare const SHUNT_COMPENSATOR_TYPES: {
8
+ readonly REACTOR: {
9
+ readonly id: "REACTOR";
10
+ readonly label: "Reactor";
11
+ };
12
+ readonly CAPACITOR: {
13
+ readonly id: "CAPACITOR";
14
+ readonly label: "Capacitor";
15
+ };
16
+ };
17
+ export declare const CHARACTERISTICS_CHOICES: {
18
+ readonly Q_AT_NOMINAL_V: {
19
+ readonly id: "Q_AT_NOMINAL_V";
20
+ readonly label: "QatNominalVLabel";
21
+ };
22
+ readonly SUSCEPTANCE: {
23
+ readonly id: "SUSCEPTANCE";
24
+ readonly label: "SusceptanceLabel";
25
+ };
26
+ };
27
+ export declare const computeSwitchedOnValue: (sectionCount: number, maximumSectionCount: number, linkedSwitchedOnValue: number) => number;
@@ -0,0 +1,16 @@
1
+ const SHUNT_COMPENSATOR_TYPES = {
2
+ REACTOR: { id: "REACTOR", label: "Reactor" },
3
+ CAPACITOR: { id: "CAPACITOR", label: "Capacitor" }
4
+ };
5
+ const CHARACTERISTICS_CHOICES = {
6
+ Q_AT_NOMINAL_V: { id: "Q_AT_NOMINAL_V", label: "QatNominalVLabel" },
7
+ SUSCEPTANCE: { id: "SUSCEPTANCE", label: "SusceptanceLabel" }
8
+ };
9
+ const computeSwitchedOnValue = (sectionCount, maximumSectionCount, linkedSwitchedOnValue) => {
10
+ return linkedSwitchedOnValue / maximumSectionCount * sectionCount;
11
+ };
12
+ export {
13
+ CHARACTERISTICS_CHOICES,
14
+ SHUNT_COMPENSATOR_TYPES,
15
+ computeSwitchedOnValue
16
+ };
@@ -0,0 +1,3 @@
1
+ import { ConnectivityNetworkProps } from '../../common/connectivity/connectivity.type';
2
+ export type ShuntCompensatorCreationFormProps = ConnectivityNetworkProps;
3
+ export declare function ShuntCompensatorCreationForm({ voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, }: Readonly<ShuntCompensatorCreationFormProps>): import("react/jsx-runtime").JSX.Element;