@gridsuite/commons-ui 0.209.0 → 0.211.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 (59) hide show
  1. package/dist/components/filter/utils/filterFormUtils.js +2 -1
  2. package/dist/components/index.js +21 -1
  3. package/dist/components/inputs/reactHookForm/booleans/RadioInput.js +1 -1
  4. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.js +3 -3
  5. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -2
  6. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +4 -3
  7. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +3 -3
  8. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +1 -1
  9. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.js +3 -3
  10. package/dist/components/network-modifications/index.d.ts +1 -0
  11. package/dist/components/network-modifications/index.js +21 -1
  12. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.d.ts +6 -0
  13. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.js +199 -0
  14. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.d.ts +64 -0
  15. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +90 -0
  16. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.d.ts → shunt-compensator/common/index.d.ts} +4 -5
  17. package/dist/components/network-modifications/shunt-compensator/common/index.js +13 -0
  18. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.d.ts +20 -0
  19. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.js +1 -0
  20. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.d.ts +27 -0
  21. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.js +16 -0
  22. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.d.ts +3 -0
  23. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +82 -0
  24. package/dist/components/network-modifications/shunt-compensator/creation/index.d.ts +9 -0
  25. package/dist/components/network-modifications/shunt-compensator/creation/index.js +9 -0
  26. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.d.ts +20 -0
  27. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.js +1 -0
  28. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.d.ts +110 -0
  29. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +103 -0
  30. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation → shunt-compensator}/index.d.ts +2 -1
  31. package/dist/components/network-modifications/shunt-compensator/index.js +20 -0
  32. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
  33. package/dist/components/network-modifications/voltageLevel/creation/index.d.ts +1 -0
  34. package/dist/components/network-modifications/voltageLevel/creation/index.js +3 -1
  35. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +6 -2
  36. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +22 -43
  37. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +1 -0
  38. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +2 -0
  39. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -1
  40. package/dist/components/network-modifications/voltageLevel/index.js +3 -1
  41. package/dist/components/parameters/sensi/columns-definitions.js +1 -1
  42. package/dist/components/parameters/short-circuit/columns-definition.js +1 -1
  43. package/dist/components/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -1
  44. package/dist/index.js +21 -1
  45. package/dist/translations/en/networkModificationsEn.d.ts +14 -0
  46. package/dist/translations/en/networkModificationsEn.js +14 -0
  47. package/dist/translations/fr/networkModificationsFr.d.ts +14 -0
  48. package/dist/translations/fr/networkModificationsFr.js +14 -0
  49. package/dist/utils/constants/fieldConstants.d.ts +7 -0
  50. package/dist/utils/constants/fieldConstants.js +7 -0
  51. package/package.json +1 -1
  52. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.d.ts +0 -11
  53. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js +0 -84
  54. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.d.ts +0 -6
  55. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.js +0 -11
  56. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +0 -61
  57. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.d.ts +0 -14
  58. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.js +0 -27
  59. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/index.js +0 -4
@@ -51,7 +51,8 @@ const CONTINGENCY_LIST_EQUIPMENTS = {
51
51
  };
52
52
  const FILTER_EQUIPMENTS = {
53
53
  ...BASE_EQUIPMENTS,
54
- [EquipmentType.HVDC_LINE]: ALL_EQUIPMENTS[EquipmentType.HVDC_LINE]
54
+ [EquipmentType.HVDC_LINE]: ALL_EQUIPMENTS[EquipmentType.HVDC_LINE],
55
+ [EquipmentType.VSC_CONVERTER_STATION]: ALL_EQUIPMENTS[EquipmentType.VSC_CONVERTER_STATION]
55
56
  };
56
57
  export {
57
58
  CONTINGENCY_LIST_EQUIPMENTS,
@@ -232,12 +232,13 @@ import { substationCreationDtoToForm, substationCreationEmptyFormData, substatio
232
232
  import { SubstationModificationForm } from "./network-modifications/substation/modification/SubstationModificationForm.js";
233
233
  import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./network-modifications/substation/modification/substationModification.utils.js";
234
234
  import { SwitchesBetweenSections } from "./network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js";
235
+ import "react";
235
236
  import "react-hook-form";
236
237
  import "../utils/conversionUtils.js";
237
238
  import "../utils/types/equipmentType.js";
238
239
  import "@mui/icons-material";
239
240
  import "../utils/yupConfig.js";
240
- import "react";
241
+ import { MAX_SECTIONS_COUNT } from "./network-modifications/voltageLevel/creation/voltageLevel.constants.js";
241
242
  import { VoltageLevelCreationForm } from "./network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js";
242
243
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js";
243
244
  import { SwitchKind } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.types.js";
@@ -257,6 +258,11 @@ import { emptyModificationByAssignmentFormData, modificationByAssignmentDtoToFor
257
258
  import { DataType as DataType2 } from "./network-modifications/by-filter/assignment/assignment/assignment.type.js";
258
259
  import { batteryCreationDtoToForm, batteryCreationEmptyFormData, batteryCreationFormSchema, batteryCreationFormToDto } from "./network-modifications/battery/creation/batteryCreation.utils.js";
259
260
  import { BatteryCreationForm } from "./network-modifications/battery/creation/BatteryCreationForm.js";
261
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./network-modifications/shunt-compensator/common/shuntCompensator.utils.js";
262
+ import { CharacteristicsForm } from "./network-modifications/shunt-compensator/common/CharacteristicsForm.js";
263
+ import { getCharacteristicsCreateFormDataFromSearchCopy, getCharacteristicsEmptyFormData, getCharacteristicsFormData, getCharacteristicsFormValidationSchema } from "./network-modifications/shunt-compensator/common/characteristicsForm.utils.js";
264
+ import { ShuntCompensatorCreationForm } from "./network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js";
265
+ import { shuntCompensatorCreationDtoToForm, shuntCompensatorCreationEmptyFormData, shuntCompensatorCreationFormSchema, shuntCompensatorCreationFormToDto } from "./network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js";
260
266
  import { BuildStatusChip } from "./node/build-status-chip.js";
261
267
  import { BuildStatus } from "./node/constant.js";
262
268
  import { COLUMNS_WITHOUT_BORDER, DEPTH_CELL_WIDTH, DROP_FORBIDDEN_INDICATOR_BOTTOM, DROP_FORBIDDEN_INDICATOR_TOP, DROP_INDICATOR_BOTTOM, DROP_INDICATOR_TOP, MODIFICATION_ROW_HEIGHT, createCellBorderColor, createCellContentWrapperSx, createCellStyle, createEditDescriptionStyle, createHeaderCellStyle, createModificationNameCellStyle, createNameCellLabelBoxSx, createNameCellRootStyle, createRootNetworkChipCellSx, createRowSx, networkModificationTableStyles } from "./network-modification-table/network-modification-table-styles.js";
@@ -305,6 +311,7 @@ export {
305
311
  ByFilterDeletionForm,
306
312
  CALCULATION_TYPE,
307
313
  CENTER_LABEL,
314
+ CHARACTERISTICS_CHOICES,
308
315
  COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
309
316
  COLUMNS_DEFINITIONS_HVDCS,
310
317
  COLUMNS_DEFINITIONS_INJECTIONS,
@@ -328,6 +335,7 @@ export {
328
335
  CUSTOM_AGGRID_THEME,
329
336
  CancelButton,
330
337
  CardErrorBoundary,
338
+ CharacteristicsForm,
331
339
  CheckBoxList,
332
340
  CheckboxInput,
333
341
  CheckboxNullableInput,
@@ -487,6 +495,7 @@ export {
487
495
  MARGIN_CALCULATION_START_TIME,
488
496
  MAX_COMPOSITE_NESTING_DEPTH,
489
497
  MAX_ROWS_NUMBER,
498
+ MAX_SECTIONS_COUNT,
490
499
  MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION,
491
500
  MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION,
492
501
  MODIFICATION_ROW_HEIGHT,
@@ -601,6 +610,7 @@ export {
601
610
  SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS,
602
611
  SHUNT_COMPENSATORS_SELECTION_TYPE,
603
612
  SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
613
+ SHUNT_COMPENSATOR_TYPES,
604
614
  SHUNT_COMPENSATOR_TYPE_OPTIONS,
605
615
  SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON,
606
616
  SPECIFIC_PARAMETERS,
@@ -627,6 +637,7 @@ export {
627
637
  ShortCircuitForm,
628
638
  ShortCircuitParametersEditionDialog,
629
639
  ShortCircuitParametersInLine,
640
+ ShuntCompensatorCreationForm,
630
641
  ShuntCompensatorSelectionForm,
631
642
  SignInCallbackHandler,
632
643
  SilentRenewCallbackHandler,
@@ -687,6 +698,7 @@ export {
687
698
  byFilterDeletionDtoToForm,
688
699
  byFilterDeletionFormSchema,
689
700
  byFilterDeletionFormToDto,
701
+ computeSwitchedOnValue,
690
702
  computeTagMinSize,
691
703
  copyEquipmentPropertiesForCreation,
692
704
  countRules,
@@ -735,6 +747,10 @@ export {
735
747
  getBranchActiveReactivePowerEmptyFormDataProperties,
736
748
  getBranchActiveReactivePowerValidationSchema,
737
749
  getBranchActiveReactivePowerValidationSchemaProperties,
750
+ getCharacteristicsCreateFormDataFromSearchCopy,
751
+ getCharacteristicsEmptyFormData,
752
+ getCharacteristicsFormData,
753
+ getCharacteristicsFormValidationSchema,
738
754
  getCon1andCon2WithPositionValidationSchema,
739
755
  getConcatenatedProperties,
740
756
  getConnectivityBusBarSectionData,
@@ -837,6 +853,10 @@ export {
837
853
  saveExplicitNamingFilter,
838
854
  setCurrentReactiveCapabilityCurveTable,
839
855
  setSelectedReactiveLimits,
856
+ shuntCompensatorCreationDtoToForm,
857
+ shuntCompensatorCreationEmptyFormData,
858
+ shuntCompensatorCreationFormSchema,
859
+ shuntCompensatorCreationFormToDto,
840
860
  standardTextField,
841
861
  styles,
842
862
  substationCreationDtoToForm,
@@ -9,7 +9,7 @@ function RadioInput({ name, label, id, options, formProps }) {
9
9
  } = useController({ name, defaultValue: "" });
10
10
  return /* @__PURE__ */ jsxs(FormControl, { children: [
11
11
  label && /* @__PURE__ */ jsx(FormLabel, { id: id ?? label, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
12
- /* @__PURE__ */ jsx(RadioGroup, { row: true, "aria-labelledby": id ?? label, value, onChange, ...formProps, children: options.map((option) => /* @__PURE__ */ jsx(
12
+ /* @__PURE__ */ jsx(RadioGroup, { row: true, "aria-labelledby": id ?? label, value: value ?? "", onChange, ...formProps, children: options.map((option) => /* @__PURE__ */ jsx(
13
13
  FormControlLabel,
14
14
  {
15
15
  control: /* @__PURE__ */ jsx(Radio, {}),
@@ -1,6 +1,6 @@
1
1
  import { object, number, string } from "yup";
2
2
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
- import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
3
+ import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
4
  import "../../../../utils/conversionUtils.js";
5
5
  import { UNDEFINED_CONNECTION_DIRECTION } from "../../../../utils/types/equipmentType.js";
6
6
  import { ModificationType } from "../../../../utils/types/modificationType.js";
@@ -47,14 +47,14 @@ import { getReactiveLimitsValidationSchema, getReactiveLimitsEmptyFormDataProps,
47
47
  const batteryCreationFormSchema = object().shape({
48
48
  [FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED),
49
49
  [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
50
- [FieldConstants.MAXIMUM_ACTIVE_POWER]: number().nullable().required(YUP_REQUIRED).test("max-greater-than-min", "ActiveLimitsMinMaxInvalid", function checkMaxGreaterThanMin(value) {
50
+ [FieldConstants.MAXIMUM_ACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).test("max-greater-than-min", "ActiveLimitsMinMaxInvalid", function checkMaxGreaterThanMin(value) {
51
51
  const min = this.parent[FieldConstants.MINIMUM_ACTIVE_POWER];
52
52
  if (value != null && min != null) {
53
53
  return value >= min;
54
54
  }
55
55
  return true;
56
56
  }),
57
- [FieldConstants.MINIMUM_ACTIVE_POWER]: number().nullable().required(YUP_REQUIRED).test("min-less-than-max", "ActiveLimitsMinMaxInvalid", function checkMinLessThanMax(value) {
57
+ [FieldConstants.MINIMUM_ACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).test("min-less-than-max", "ActiveLimitsMinMaxInvalid", function checkMinLessThanMax(value) {
58
58
  const max = this.parent[FieldConstants.MAXIMUM_ACTIVE_POWER];
59
59
  if (value != null && max != null) {
60
60
  return value <= max;
@@ -1,6 +1,6 @@
1
1
  import { number, bool } from "yup";
2
2
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
- import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
3
+ import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
4
  import "../../../../utils/conversionUtils.js";
5
5
  import "../../../../utils/types/equipmentType.js";
6
6
  import "react/jsx-runtime";
@@ -15,7 +15,7 @@ const getActivePowerControlSchema = (isEquipmentModification = false) => ({
15
15
  is: () => !isEquipmentModification,
16
16
  then: (schema) => schema.required(YUP_REQUIRED)
17
17
  }),
18
- [FieldConstants.DROOP]: number().nullable().min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").when([FieldConstants.FREQUENCY_REGULATION], {
18
+ [FieldConstants.DROOP]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").when([FieldConstants.FREQUENCY_REGULATION], {
19
19
  is: (frequencyRegulation) => !isEquipmentModification && frequencyRegulation,
20
20
  then: (schema) => schema.required(YUP_REQUIRED)
21
21
  })
@@ -1,5 +1,6 @@
1
1
  import { array, object, number, ref, ValidationError } from "yup";
2
2
  import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
3
+ import { YUP_NOT_TYPE_NUMBER } from "../../../../../utils/constants/translationKeys.js";
3
4
  import "../../../../../utils/conversionUtils.js";
4
5
  import "../../../../../utils/types/equipmentType.js";
5
6
  import "react/jsx-runtime";
@@ -9,9 +10,9 @@ import "../../../../../utils/yupConfig.js";
9
10
  const INSERT = "INSERT";
10
11
  const REMOVE = "REMOVE";
11
12
  const getCreationRowSchema = () => object().shape({
12
- [FieldConstants.MAX_Q]: number().nullable().default(null),
13
- [FieldConstants.MIN_Q]: number().nullable().default(null).max(ref(FieldConstants.MAX_Q), "ReactiveCapabilityCurveCreationErrorQminPQmaxPIncoherence"),
14
- [FieldConstants.P]: number().nullable().default(null)
13
+ [FieldConstants.MAX_Q]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).default(null),
14
+ [FieldConstants.MIN_Q]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).default(null).max(ref(FieldConstants.MAX_Q), "ReactiveCapabilityCurveCreationErrorQminPQmaxPIncoherence"),
15
+ [FieldConstants.P]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).default(null)
15
16
  });
16
17
  const getRowEmptyFormData = () => ({
17
18
  [FieldConstants.P]: null,
@@ -1,7 +1,7 @@
1
1
  import { object, number, string } from "yup";
2
2
  import { getRowEmptyFormData, getReactiveCapabilityCurveValidationSchemaArray } from "./reactiveCapabilityCurve/reactiveCapability.utils.js";
3
3
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
4
- import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
+ import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
5
5
  import "../../../../utils/conversionUtils.js";
6
6
  import "../../../../utils/types/equipmentType.js";
7
7
  import "react/jsx-runtime";
@@ -50,7 +50,7 @@ const getReactiveLimitsEmptyFormData = (id = FieldConstants.REACTIVE_LIMITS) =>
50
50
  });
51
51
  const getReactiveLimitsValidationSchema = (isEquipmentModification = false, positiveAndNegativePExist = false) => object().shape({
52
52
  [FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: string().nullable().required(YUP_REQUIRED),
53
- [FieldConstants.MINIMUM_REACTIVE_POWER]: number().nullable().test(
53
+ [FieldConstants.MINIMUM_REACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).test(
54
54
  "min-reactive-power-required",
55
55
  "MinReactivePowerRequired",
56
56
  function validateMinReactivePowerRequired(value) {
@@ -67,7 +67,7 @@ const getReactiveLimitsValidationSchema = (isEquipmentModification = false, posi
67
67
  }
68
68
  return true;
69
69
  }),
70
- [FieldConstants.MAXIMUM_REACTIVE_POWER]: number().nullable().test(
70
+ [FieldConstants.MAXIMUM_REACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).test(
71
71
  "max-reactive-power-required",
72
72
  "MaxReactivePowerRequired",
73
73
  function validateMaxReactivePowerRequired(value) {
@@ -36,7 +36,7 @@ const getActivePowerSetPointSchema = (isEquipmentModification = false) => ({
36
36
  }).when([], {
37
37
  is: () => !isEquipmentModification,
38
38
  then: (schema) => {
39
- return schema.required(YUP_REQUIRED).nonNullable("FieldIsRequired").test(
39
+ return schema.required(YUP_REQUIRED).nonNullable(YUP_REQUIRED).test(
40
40
  "activePowerSetPoint",
41
41
  "ActivePowerMustBeZeroOrBetweenMinAndMaxActivePower",
42
42
  testValueWithinPowerIntervalOrEqualToZero
@@ -1,6 +1,6 @@
1
1
  import { number } from "yup";
2
2
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
- import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
3
+ import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
4
  import "../../../../utils/conversionUtils.js";
5
5
  import "../../../../utils/types/equipmentType.js";
6
6
  import "react/jsx-runtime";
@@ -14,8 +14,8 @@ const getShortCircuitEmptyFormData = () => {
14
14
  };
15
15
  const getShortCircuitFormSchema = (isEquipmentModification = false) => {
16
16
  return {
17
- [FieldConstants.TRANSFORMER_REACTANCE]: number().nullable(),
18
- [FieldConstants.TRANSIENT_REACTANCE]: number().nullable().when([FieldConstants.TRANSFORMER_REACTANCE], {
17
+ [FieldConstants.TRANSFORMER_REACTANCE]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER),
18
+ [FieldConstants.TRANSIENT_REACTANCE]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).when([FieldConstants.TRANSFORMER_REACTANCE], {
19
19
  is: (transformerReactance) => isEquipmentModification && transformerReactance != null,
20
20
  then: (schema) => schema.required(YUP_REQUIRED)
21
21
  })
@@ -13,3 +13,4 @@ export * from './load';
13
13
  export * from './by-filter';
14
14
  export * from './generator';
15
15
  export * from './battery';
16
+ export * from './shunt-compensator';
@@ -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";
@@ -90,6 +91,11 @@ import { emptyModificationByAssignmentFormData, modificationByAssignmentDtoToFor
90
91
  import { DataType } from "./by-filter/assignment/assignment/assignment.type.js";
91
92
  import { batteryCreationDtoToForm, batteryCreationEmptyFormData, batteryCreationFormSchema, batteryCreationFormToDto } from "./battery/creation/batteryCreation.utils.js";
92
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";
93
99
  export {
94
100
  ActivePowerControlForm,
95
101
  DataType as AssignmentDataType,
@@ -97,6 +103,8 @@ export {
97
103
  BranchActiveReactivePowerMeasurementsForm,
98
104
  BranchConnectivityForm,
99
105
  ByFilterDeletionForm,
106
+ CHARACTERISTICS_CHOICES,
107
+ CharacteristicsForm,
100
108
  ConnectivityForm,
101
109
  EQUIPMENT_TYPE_ORDER,
102
110
  EquipmentDeletionForm,
@@ -108,6 +116,7 @@ export {
108
116
  LoadDialogTabs,
109
117
  LoadDialogTabsContent,
110
118
  LoadForm,
119
+ MAX_SECTIONS_COUNT,
111
120
  ModificationByAssignmentForm,
112
121
  PowerMeasurementsForm,
113
122
  PowerWithValidityForm,
@@ -118,9 +127,11 @@ export {
118
127
  ReactiveCapabilityCurveRowForm,
119
128
  ReactiveCapabilityCurveTableForm,
120
129
  ReactiveLimitsForm,
130
+ SHUNT_COMPENSATOR_TYPES,
121
131
  SWITCH_TYPE,
122
132
  SetPointsForm,
123
133
  ShortCircuitForm,
134
+ ShuntCompensatorCreationForm,
124
135
  ShuntCompensatorSelectionForm,
125
136
  SubstationCreationForm,
126
137
  SubstationModificationForm,
@@ -137,6 +148,7 @@ export {
137
148
  byFilterDeletionDtoToForm,
138
149
  byFilterDeletionFormSchema,
139
150
  byFilterDeletionFormToDto,
151
+ computeSwitchedOnValue,
140
152
  copyEquipmentPropertiesForCreation,
141
153
  createConnectivityData,
142
154
  createPropertyModification,
@@ -159,6 +171,10 @@ export {
159
171
  getBranchActiveReactivePowerEmptyFormDataProperties,
160
172
  getBranchActiveReactivePowerValidationSchema,
161
173
  getBranchActiveReactivePowerValidationSchemaProperties,
174
+ getCharacteristicsCreateFormDataFromSearchCopy,
175
+ getCharacteristicsEmptyFormData,
176
+ getCharacteristicsFormData,
177
+ getCharacteristicsFormValidationSchema,
162
178
  getCon1andCon2WithPositionValidationSchema,
163
179
  getConcatenatedProperties,
164
180
  getConnectivityBusBarSectionData,
@@ -225,6 +241,10 @@ export {
225
241
  newEquipmentDeletionDto,
226
242
  setCurrentReactiveCapabilityCurveTable,
227
243
  setSelectedReactiveLimits,
244
+ shuntCompensatorCreationDtoToForm,
245
+ shuntCompensatorCreationEmptyFormData,
246
+ shuntCompensatorCreationFormSchema,
247
+ shuntCompensatorCreationFormToDto,
228
248
  standardTextField,
229
249
  substationCreationDtoToForm,
230
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
+ };