@gridsuite/commons-ui 0.182.0 → 0.184.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 (23) hide show
  1. package/dist/components/network-modifications/common/connectivity/ConnectivityForm.d.ts +1 -4
  2. package/dist/components/network-modifications/common/connectivity/ConnectivityForm.js +33 -22
  3. package/dist/components/network-modifications/common/connectivity/connectivity.type.d.ts +12 -2
  4. package/dist/components/network-modifications/common/connectivity/connectivityForm.utils.js +2 -1
  5. package/dist/components/network-modifications/common/measurements/powerWithValidity.utils.js +2 -1
  6. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +3 -2
  7. package/dist/components/network-modifications/load/creation/loadCreation.utils.js +3 -3
  8. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.js +53 -27
  9. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.js +8 -8
  10. package/dist/components/network-modifications/voltage-level/modification/voltageLevelModification.utils.js +6 -6
  11. package/dist/components/parameters/common/contingency-table/contingency-table.js +4 -1
  12. package/dist/components/parameters/security-analysis/columns-definitions.js +1 -1
  13. package/dist/hooks/useModificationLabelComputer.js +2 -0
  14. package/dist/index.js +2 -1
  15. package/dist/translations/en/networkModificationsEn.d.ts +2 -0
  16. package/dist/translations/en/networkModificationsEn.js +2 -0
  17. package/dist/translations/fr/networkModificationsFr.d.ts +2 -0
  18. package/dist/translations/fr/networkModificationsFr.js +2 -0
  19. package/dist/utils/constants/index.js +2 -1
  20. package/dist/utils/constants/translationKeys.d.ts +1 -0
  21. package/dist/utils/constants/translationKeys.js +2 -0
  22. package/dist/utils/index.js +2 -1
  23. package/package.json +1 -1
@@ -1,6 +1,5 @@
1
1
  import { GridDirection } from '@mui/material';
2
2
  import { ConnectablePositionFormInfos, ConnectivityNetworkProps } from './connectivity.type';
3
- import { Option } from '../../../../utils';
4
3
  /**
5
4
  * Hook to handle a 'connectivity value' (voltage level, bus or bus bar section)
6
5
  * @param id optional id that has to be defined if the component is used more than once in a form
@@ -8,7 +7,6 @@ import { Option } from '../../../../utils';
8
7
  * @param direction direction of placement. Either 'row' or 'column', 'row' by default.
9
8
  * @param withDirectionsInfos
10
9
  * @param withPosition
11
- * @param newBusOrBusbarSectionOptions list of bus or bus bar sections for the newly created voltage level
12
10
  * @param onVoltageLevelChangeCallback callback to be called when the voltage level changes
13
11
  * @param isEquipmentModification connectivity form is used in a modification form or not
14
12
  * @param previousValues previous values of connectivity form's fields
@@ -23,7 +21,6 @@ interface ConnectivityFormProps extends ConnectivityNetworkProps {
23
21
  direction?: GridDirection;
24
22
  withDirectionsInfos?: boolean;
25
23
  withPosition: boolean;
26
- newBusOrBusbarSectionOptions?: Option[];
27
24
  onVoltageLevelChangeCallback?: () => void;
28
25
  isEquipmentModification?: boolean;
29
26
  previousValues?: {
@@ -33,5 +30,5 @@ interface ConnectivityFormProps extends ConnectivityNetworkProps {
33
30
  terminalConnected?: boolean | null;
34
31
  };
35
32
  }
36
- export declare function ConnectivityForm({ id, voltageLevelSelectLabel, direction, withDirectionsInfos, withPosition, newBusOrBusbarSectionOptions, onVoltageLevelChangeCallback, isEquipmentModification, previousValues, voltageLevelOptions, PositionDiagramPane, fetchBusesOrBusbarSections, }: Readonly<ConnectivityFormProps>): import("react/jsx-runtime").JSX.Element;
33
+ export declare function ConnectivityForm({ id, voltageLevelSelectLabel, direction, withDirectionsInfos, withPosition, onVoltageLevelChangeCallback, isEquipmentModification, previousValues, voltageLevelOptions, PositionDiagramPane, fetchBusesOrBusbarSections, }: Readonly<ConnectivityFormProps>): import("react/jsx-runtime").JSX.Element;
37
34
  export {};
@@ -5,6 +5,7 @@ import { useState, useRef, useMemo, useEffect, useCallback } from "react";
5
5
  import { useWatch } from "react-hook-form";
6
6
  import { useIntl } from "react-intl";
7
7
  import { getConnectivityVoltageLevelData, getConnectivityBusBarSectionData } from "./connectivityForm.utils.js";
8
+ import { fetchBusBarSectionsForNewCoupler } from "../../../../services/networkModification.js";
8
9
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
9
10
  import "../../../../utils/conversionUtils.js";
10
11
  import { getConnectionDirectionLabel, CONNECTION_DIRECTIONS } from "../../../../utils/types/equipmentType.js";
@@ -48,7 +49,6 @@ function ConnectivityForm({
48
49
  direction = "row",
49
50
  withDirectionsInfos = true,
50
51
  withPosition = false,
51
- newBusOrBusbarSectionOptions = [],
52
52
  onVoltageLevelChangeCallback = void 0,
53
53
  isEquipmentModification = false,
54
54
  previousValues,
@@ -67,26 +67,42 @@ function ConnectivityForm({
67
67
  const vlOptions = useMemo(
68
68
  () => voltageLevelOptions.map((item) => ({
69
69
  id: item.id,
70
- label: item.name ?? ""
70
+ label: item.name ?? "",
71
+ exist: item.exist
71
72
  })),
72
73
  [voltageLevelOptions]
73
74
  );
74
75
  useEffect(() => {
75
- if (!fetchBusesOrBusbarSections) {
76
- return;
77
- }
78
76
  if (watchVoltageLevelId) {
79
- const existingVoltageLevelOption = voltageLevelOptions.find((option) => option.id === watchVoltageLevelId);
80
- if (existingVoltageLevelOption) {
81
- fetchBusesOrBusbarSections(watchVoltageLevelId).then((busesOrbusbarSections) => {
82
- lastFetchedBusesVlIds.current = watchVoltageLevelId;
83
- setBusOrBusbarSectionOptions(
84
- busesOrbusbarSections?.map((busesOrbusbarSection) => ({
85
- id: busesOrbusbarSection.id,
86
- label: busesOrbusbarSection?.name ?? ""
87
- })) || []
88
- );
89
- });
77
+ const selectedOption = voltageLevelOptions.find((option) => option.id === watchVoltageLevelId);
78
+ if (selectedOption) {
79
+ if (selectedOption.exist === false) {
80
+ fetchBusBarSectionsForNewCoupler(
81
+ watchVoltageLevelId,
82
+ selectedOption.busbarCount,
83
+ selectedOption.sectionCount,
84
+ selectedOption.switchKinds
85
+ ).then((ids) => {
86
+ lastFetchedBusesVlIds.current = watchVoltageLevelId;
87
+ setBusOrBusbarSectionOptions(ids.map((bbsId) => ({ id: bbsId, label: "" })));
88
+ }).catch((error) => {
89
+ console.error("Failed to fetch busbar sections for new coupler:", error);
90
+ setBusOrBusbarSectionOptions([]);
91
+ });
92
+ } else if (fetchBusesOrBusbarSections) {
93
+ fetchBusesOrBusbarSections(watchVoltageLevelId).then((busesOrbusbarSections) => {
94
+ lastFetchedBusesVlIds.current = watchVoltageLevelId;
95
+ setBusOrBusbarSectionOptions(
96
+ busesOrbusbarSections?.map((busesOrbusbarSection) => ({
97
+ id: busesOrbusbarSection.id,
98
+ label: busesOrbusbarSection?.name ?? ""
99
+ })) || []
100
+ );
101
+ }).catch((error) => {
102
+ console.error("Failed to fetch buses or busbar sections:", error);
103
+ setBusOrBusbarSectionOptions([]);
104
+ });
105
+ }
90
106
  }
91
107
  if (watchVoltageLevelId !== lastFetchedBusesVlIds.current) {
92
108
  setBusOrBusbarSectionOptions([]);
@@ -94,12 +110,7 @@ function ConnectivityForm({
94
110
  } else {
95
111
  setBusOrBusbarSectionOptions([]);
96
112
  }
97
- }, [id, fetchBusesOrBusbarSections, voltageLevelOptions, watchVoltageLevelId]);
98
- useEffect(() => {
99
- if (newBusOrBusbarSectionOptions?.length > 0) {
100
- setBusOrBusbarSectionOptions(newBusOrBusbarSectionOptions);
101
- }
102
- }, [newBusOrBusbarSectionOptions]);
113
+ }, [fetchBusesOrBusbarSections, voltageLevelOptions, watchVoltageLevelId]);
103
114
  const handleChangeVoltageLevel = useCallback(() => {
104
115
  onVoltageLevelChangeCallback?.();
105
116
  setValue(`${id}.${FieldConstants.BUS_OR_BUSBAR_SECTION}`, null);
@@ -26,9 +26,19 @@ type PositionDiagramPaneType = React.ComponentType<{
26
26
  onClose: () => void;
27
27
  voltageLevelId: string;
28
28
  }>;
29
+ interface NewVoltageLevelOption extends Identifiable {
30
+ exist: false;
31
+ busbarCount: number;
32
+ sectionCount: number;
33
+ switchKinds: string[];
34
+ }
35
+ interface ExistingVoltageLevelOption extends Identifiable {
36
+ exist?: true;
37
+ }
38
+ export type VoltageLevelOption = NewVoltageLevelOption | ExistingVoltageLevelOption;
29
39
  export interface ConnectivityNetworkProps {
30
- voltageLevelOptions?: Identifiable[];
40
+ voltageLevelOptions: VoltageLevelOption[];
31
41
  PositionDiagramPane?: PositionDiagramPaneType;
32
- fetchBusesOrBusbarSections?: (voltageLevelId: string) => Promise<Identifiable[]>;
42
+ fetchBusesOrBusbarSections: (voltageLevelId: string) => Promise<Identifiable[]>;
33
43
  }
34
44
  export {};
@@ -1,5 +1,6 @@
1
1
  import { object, bool, number, string } 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";
@@ -35,7 +36,7 @@ const getConnectivityPropertiesValidationSchema = (isEquipmentModification = fal
35
36
  const getConnectivityWithPositionSchema = (isEquipmentModification = false) => object().shape({
36
37
  [FieldConstants.CONNECTION_DIRECTION]: string().nullable(),
37
38
  [FieldConstants.CONNECTION_NAME]: string(),
38
- [FieldConstants.CONNECTION_POSITION]: number().nullable(),
39
+ [FieldConstants.CONNECTION_POSITION]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable(),
39
40
  [FieldConstants.CONNECTED]: bool().nullable().when([], {
40
41
  is: () => !isEquipmentModification,
41
42
  then: (schema) => schema.required()
@@ -1,5 +1,6 @@
1
1
  import { object, boolean, number } 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";
@@ -16,7 +17,7 @@ function getPowerWithValidityEmptyFormData(id) {
16
17
  function getPowerWithValidityValidationSchema(id) {
17
18
  return {
18
19
  [id]: object().shape({
19
- [FieldConstants.VALUE]: number().nullable(),
20
+ [FieldConstants.VALUE]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable(),
20
21
  [FieldConstants.VALIDITY]: boolean().nullable()
21
22
  })
22
23
  };
@@ -1,5 +1,6 @@
1
1
  import { number } 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";
@@ -27,7 +28,7 @@ const testValueWithinPowerIntervalOrEqualToZero = (value, context) => {
27
28
  return testValueWithinPowerInterval(value, context);
28
29
  };
29
30
  const getActivePowerSetPointSchema = (isEquipmentModification = false) => ({
30
- [FieldConstants.ACTIVE_POWER_SET_POINT]: number().when([], {
31
+ [FieldConstants.ACTIVE_POWER_SET_POINT]: number().typeError(YUP_NOT_TYPE_NUMBER).when([], {
31
32
  is: () => isEquipmentModification,
32
33
  then: (schema) => {
33
34
  return schema.nullable();
@@ -44,7 +45,7 @@ const getActivePowerSetPointSchema = (isEquipmentModification = false) => ({
44
45
  })
45
46
  });
46
47
  const getReactivePowerSetPointSchema = (isEquipmentModification = false) => ({
47
- [FieldConstants.REACTIVE_POWER_SET_POINT]: number().nullable().when([FieldConstants.VOLTAGE_REGULATION], {
48
+ [FieldConstants.REACTIVE_POWER_SET_POINT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().when([FieldConstants.VOLTAGE_REGULATION], {
48
49
  is: (value) => !isEquipmentModification && !value,
49
50
  then: (schema) => schema.required()
50
51
  })
@@ -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, UNDEFINED_LOAD_TYPE } from "../../../../utils/types/equipmentType.js";
6
6
  import { ModificationType } from "../../../../utils/types/modificationType.js";
@@ -42,8 +42,8 @@ const loadCreationFormSchema = object().shape({
42
42
  [FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED),
43
43
  [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
44
44
  [FieldConstants.LOAD_TYPE]: string().nullable(),
45
- [FieldConstants.ACTIVE_POWER_SET_POINT]: number().nullable().required(YUP_REQUIRED),
46
- [FieldConstants.REACTIVE_POWER_SET_POINT]: number().nullable().required(YUP_REQUIRED),
45
+ [FieldConstants.ACTIVE_POWER_SET_POINT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().required(YUP_REQUIRED),
46
+ [FieldConstants.REACTIVE_POWER_SET_POINT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().required(YUP_REQUIRED),
47
47
  [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(false)
48
48
  }).concat(creationPropertiesSchema).required(YUP_REQUIRED);
49
49
  const loadCreationEmptyFormData = {
@@ -1,14 +1,41 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
2
+ import { useState, useCallback, useEffect } from "react";
3
3
  import { useFormContext } from "react-hook-form";
4
4
  import { CouplingOmnibusCreation } from "./CouplingOmnibusCreation.js";
5
- import { ExpandableInput } from "../../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
5
+ import "react-intl";
6
+ import "@mui/material";
7
+ import "../../../../overflowableText/OverflowableText.js";
6
8
  import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
7
9
  import "../../../../../utils/conversionUtils.js";
8
10
  import "../../../../../utils/types/equipmentType.js";
9
11
  import "@mui/icons-material";
10
12
  import "../../../../../utils/yupConfig.js";
11
13
  import { fetchBusBarSectionsForNewCoupler } from "../../../../../services/networkModification.js";
14
+ import "localized-countries";
15
+ import "localized-countries/data/fr";
16
+ import "localized-countries/data/en";
17
+ import "notistack";
18
+ import "../../../../inputs/reactHookForm/provider/CustomFormProvider.js";
19
+ import "yup";
20
+ import "../../../../treeViewFinder/TreeViewFinder.js";
21
+ import "../../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
22
+ import "../../../../customAGGrid/customAggrid.js";
23
+ import "ag-grid-community";
24
+ import "react-papaparse";
25
+ import "react-csv-downloader";
26
+ import "../../../../inputs/reactHookForm/numbers/RangeInput.js";
27
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
28
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
29
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
30
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
31
+ import "../../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
32
+ import { ExpandableInput } from "../../../../inputs/reactHookForm/expandableInput/ExpandableInput.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";
12
39
  function CouplingOmnibusForm() {
13
40
  const { setValue, subscribe, trigger, getValues, formState } = useFormContext();
14
41
  const couplingOmnibusCreation = {
@@ -16,19 +43,29 @@ function CouplingOmnibusForm() {
16
43
  [FieldConstants.BUS_BAR_SECTION_ID2]: null
17
44
  };
18
45
  const [sectionOptions, setSectionOptions] = useState([]);
46
+ const setBbsOptions = useCallback(
47
+ (onFetchSuccess) => {
48
+ const equipmentId = getValues(FieldConstants.EQUIPMENT_ID);
49
+ const busBarCount = getValues(FieldConstants.BUS_BAR_COUNT);
50
+ const sectionCount = getValues(FieldConstants.SECTION_COUNT);
51
+ if (!equipmentId || !busBarCount || !sectionCount) {
52
+ return;
53
+ }
54
+ const switchKinds = getValues(FieldConstants.SWITCH_KINDS).map(
55
+ (value) => value.switchKind
56
+ );
57
+ fetchBusBarSectionsForNewCoupler(equipmentId, busBarCount, sectionCount, switchKinds).then((bbsIds) => {
58
+ setSectionOptions(bbsIds);
59
+ if (onFetchSuccess) {
60
+ onFetchSuccess({ sectionOptions: bbsIds });
61
+ }
62
+ });
63
+ },
64
+ [getValues]
65
+ );
19
66
  useEffect(() => {
20
- const switchKinds = getValues(FieldConstants.SWITCH_KINDS).map(
21
- (value) => value.switchKind
22
- );
23
- fetchBusBarSectionsForNewCoupler(
24
- getValues(FieldConstants.EQUIPMENT_ID),
25
- getValues(FieldConstants.BUS_BAR_COUNT),
26
- getValues(FieldConstants.SECTION_COUNT),
27
- switchKinds
28
- ).then((bbsIds) => {
29
- setSectionOptions(bbsIds);
30
- });
31
- }, [getValues]);
67
+ setBbsOptions();
68
+ }, [setBbsOptions]);
32
69
  useEffect(() => {
33
70
  const unsubscribe = subscribe({
34
71
  name: [
@@ -41,22 +78,11 @@ function CouplingOmnibusForm() {
41
78
  values: true
42
79
  },
43
80
  callback: () => {
44
- const switchKinds = getValues(FieldConstants.SWITCH_KINDS).map(
45
- (value) => value.switchKind
46
- );
47
- fetchBusBarSectionsForNewCoupler(
48
- getValues(FieldConstants.EQUIPMENT_ID),
49
- getValues(FieldConstants.BUS_BAR_COUNT),
50
- getValues(FieldConstants.SECTION_COUNT),
51
- switchKinds
52
- ).then((bbsIds) => {
53
- setValue(FieldConstants.COUPLING_OMNIBUS, []);
54
- setSectionOptions(bbsIds);
55
- });
81
+ setBbsOptions(() => setValue(FieldConstants.COUPLING_OMNIBUS, []));
56
82
  }
57
83
  });
58
84
  return () => unsubscribe();
59
- }, [subscribe, trigger, getValues, setValue, formState]);
85
+ }, [subscribe, trigger, setValue, formState, setBbsOptions]);
60
86
  return /* @__PURE__ */ jsx(
61
87
  ExpandableInput,
62
88
  {
@@ -1,7 +1,7 @@
1
1
  import { object, array, string, number, boolean, ref } from "yup";
2
2
  import { creationPropertiesSchema, toModificationProperties, getPropertiesFromModification, emptyProperties } from "../../common/properties/propertyUtils.js";
3
3
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
4
- import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
+ import { YUP_REQUIRED, YUP_NOT_TYPE_NUMBER } from "../../../../utils/constants/translationKeys.js";
5
5
  import { convertOutputValue, convertInputValue } from "../../../../utils/conversionUtils.js";
6
6
  import "../../../../utils/types/equipmentType.js";
7
7
  import { MODIFICATION_TYPES } from "../../../../utils/types/modificationType.js";
@@ -102,23 +102,23 @@ const voltageLevelCreationFormSchema = object().shape({
102
102
  [FieldConstants.COUNTRY]: string().nullable(),
103
103
  [FieldConstants.SUBSTATION_CREATION]: creationPropertiesSchema,
104
104
  [FieldConstants.HIDE_NOMINAL_VOLTAGE]: boolean().required(YUP_REQUIRED),
105
- [FieldConstants.NOMINAL_V]: number().nullable().when([FieldConstants.HIDE_NOMINAL_VOLTAGE], {
105
+ [FieldConstants.NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().when([FieldConstants.HIDE_NOMINAL_VOLTAGE], {
106
106
  is: (hideNominalVoltage) => !hideNominalVoltage,
107
107
  then: (schema) => schema.min(0, "mustBeGreaterOrEqualToZero").required(YUP_REQUIRED)
108
108
  }),
109
- [FieldConstants.LOW_VOLTAGE_LIMIT]: number().nullable().min(0, "mustBeGreaterOrEqualToZero").max(ref(FieldConstants.HIGH_VOLTAGE_LIMIT), "voltageLevelNominalVoltageMaxValueError"),
110
- [FieldConstants.HIGH_VOLTAGE_LIMIT]: number().nullable().min(0, "mustBeGreaterOrEqualToZero"),
111
- [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").max(ref(FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT), "ShortCircuitCurrentLimitMinMaxError"),
112
- [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").when([FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT], {
109
+ [FieldConstants.LOW_VOLTAGE_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "mustBeGreaterOrEqualToZero").max(ref(FieldConstants.HIGH_VOLTAGE_LIMIT), "voltageLevelNominalVoltageMaxValueError"),
110
+ [FieldConstants.HIGH_VOLTAGE_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "mustBeGreaterOrEqualToZero"),
111
+ [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").max(ref(FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT), "ShortCircuitCurrentLimitMinMaxError"),
112
+ [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").when([FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT], {
113
113
  is: (lowShortCircuitCurrentLimit) => lowShortCircuitCurrentLimit != null,
114
114
  then: (schema) => schema.required(YUP_REQUIRED)
115
115
  }),
116
116
  [FieldConstants.HIDE_BUS_BAR_SECTION]: boolean().required(YUP_REQUIRED),
117
- [FieldConstants.BUS_BAR_COUNT]: number().nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
117
+ [FieldConstants.BUS_BAR_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
118
118
  is: (hideBusBarSection) => !hideBusBarSection,
119
119
  then: (schema) => schema.min(1, "BusBarCountMustBeGreaterThanOrEqualToOne").required(YUP_REQUIRED)
120
120
  }),
121
- [FieldConstants.SECTION_COUNT]: number().nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
121
+ [FieldConstants.SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
122
122
  is: (hideBusBarSection) => !hideBusBarSection,
123
123
  then: (schema) => schema.min(1, "SectionCountMustBeGreaterThanOrEqualToOne").required(YUP_REQUIRED)
124
124
  }),
@@ -2,7 +2,7 @@ import { object, number, string, boolean, ref } from "yup";
2
2
  import { modificationPropertiesSchema, toModificationProperties, getPropertiesFromModification } from "../../common/properties/propertyUtils.js";
3
3
  import { toModificationOperation, convertInputValue, convertOutputValue } from "../../../../utils/conversionUtils.js";
4
4
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
5
- import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
5
+ import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
6
6
  import "../../../../utils/types/equipmentType.js";
7
7
  import { ModificationType } from "../../../../utils/types/modificationType.js";
8
8
  import { FieldType } from "../../../../utils/types/fieldType.js";
@@ -15,20 +15,20 @@ const voltageLevelModificationFormSchema = object().shape({
15
15
  [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
16
16
  [FieldConstants.HIDE_SUBSTATION_FIELD]: boolean().required(YUP_REQUIRED),
17
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], {
18
+ [FieldConstants.NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "mustBeGreaterOrEqualToZero"),
19
+ [FieldConstants.LOW_VOLTAGE_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "mustBeGreaterOrEqualToZero").when([FieldConstants.HIGH_VOLTAGE_LIMIT], {
20
20
  is: (highVoltageLimit) => highVoltageLimit != null,
21
21
  then: (schema) => schema.max(ref(FieldConstants.HIGH_VOLTAGE_LIMIT), "voltageLevelNominalVoltageMaxValueError")
22
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], {
23
+ [FieldConstants.HIGH_VOLTAGE_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "mustBeGreaterOrEqualToZero"),
24
+ [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").when([FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT], {
25
25
  is: (highShortCircuitCurrentLimit) => highShortCircuitCurrentLimit != null,
26
26
  then: (schema) => schema.max(
27
27
  ref(FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT),
28
28
  "ShortCircuitCurrentLimitMinMaxError"
29
29
  )
30
30
  }),
31
- [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero")
31
+ [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero")
32
32
  }).concat(modificationPropertiesSchema);
33
33
  const voltageLevelModificationEmptyFormData = {
34
34
  equipmentID: "",
@@ -39,7 +39,10 @@ function ContingencyTable({
39
39
  );
40
40
  useEffect(() => {
41
41
  if (showContingencyCount) {
42
- if (!contingencyListsInfos || contingencyListsInfos.length === 0) {
42
+ const hasNoContingencies = !contingencyListsInfos || (contingencyListsInfos.length ?? 0) === 0 || contingencyListsInfos.every(
43
+ (contingencyList) => (contingencyList[CONTINGENCY_LISTS]?.length ?? 0) === 0
44
+ );
45
+ if (hasNoContingencies) {
43
46
  setSimulatedContingencyCount(null);
44
47
  return;
45
48
  }
@@ -63,7 +63,7 @@ const getSAParametersFormSchema = (name, limitReductions) => {
63
63
  };
64
64
  const toFormValueSaParameters = (params) => ({
65
65
  [PARAM_SA_PROVIDER]: params[PARAM_SA_PROVIDER],
66
- ...toFormValuesContingencyListsInfos(params?.[CONTINGENCY_LISTS_INFOS]),
66
+ ...toFormValuesContingencyListsInfos(params?.[CONTINGENCY_LISTS_INFOS] ?? []),
67
67
  ...toFormValuesLimitReductions(params?.limitReductions),
68
68
  // SA specific form values
69
69
  [PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: params[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD] * 100,
@@ -70,6 +70,8 @@ const useModificationLabelComputer = () => {
70
70
  return `: ${modificationMetadata.rootNetworkName} / ${modificationMetadata.nodeName} / ${computedDateFormatted}`;
71
71
  }
72
72
  return "";
73
+ case MODIFICATION_TYPES.COMPOSITE_MODIFICATION.type:
74
+ return modificationMetadata.name;
73
75
  default:
74
76
  return modificationMetadata.equipmentId || "";
75
77
  }
package/dist/index.js CHANGED
@@ -271,7 +271,7 @@ import { MAX_CHAR_DESCRIPTION } from "./utils/constants/uiConstants.js";
271
271
  import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./utils/constants/unitsConstants.js";
272
272
  import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./utils/constants/configConstants.js";
273
273
  import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./utils/constants/filterConstant.js";
274
- import { DUPLICATED_PROPS_ERROR, YUP_REQUIRED } from "./utils/constants/translationKeys.js";
274
+ import { DUPLICATED_PROPS_ERROR, YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "./utils/constants/translationKeys.js";
275
275
  import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, toModificationOperation, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
276
276
  import { catchErrorHandler, extractErrorMessageDescriptor, snackWithFallback } from "./utils/error.js";
277
277
  import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./utils/functions.js";
@@ -838,6 +838,7 @@ export {
838
838
  VoltageLevelCreationForm,
839
839
  VoltageLevelModificationForm,
840
840
  WRITE_SLACK_BUS,
841
+ YUP_NOT_TYPE_NUMBER,
841
842
  YUP_REQUIRED,
842
843
  alertThresholdMarks,
843
844
  areArrayElementsUnique,
@@ -20,6 +20,7 @@ export declare const networkModificationsEn: {
20
20
  'network_modifications.GENERATOR_MODIFICATION': string;
21
21
  'network_modifications.LINE_CREATION': string;
22
22
  'network_modifications.LINE_MODIFICATION': string;
23
+ 'network_modifications.COMPOSITE_MODIFICATION': string;
23
24
  'network_modifications.TWO_WINDINGS_TRANSFORMER_CREATION': string;
24
25
  'network_modifications.TWO_WINDINGS_TRANSFORMER_MODIFICATION': string;
25
26
  'network_modifications.OPERATING_STATUS_MODIFICATION': string;
@@ -115,6 +116,7 @@ export declare const networkModificationsEn: {
115
116
  ShortCircuitCurrentLimitMinMaxError: string;
116
117
  DuplicatedPropsError: string;
117
118
  YupRequired: string;
119
+ YupNotTypeNumber: string;
118
120
  CreateLoad: string;
119
121
  loadType: string;
120
122
  ConnectivityTab: string;
@@ -26,6 +26,7 @@ const networkModificationsEn = {
26
26
  "network_modifications.GENERATOR_MODIFICATION": "Modifying generator {computedLabel}",
27
27
  "network_modifications.LINE_CREATION": "Creating line {computedLabel}",
28
28
  "network_modifications.LINE_MODIFICATION": "Modifying line {computedLabel}",
29
+ "network_modifications.COMPOSITE_MODIFICATION": "{computedLabel}",
29
30
  "network_modifications.TWO_WINDINGS_TRANSFORMER_CREATION": "Creating 2 windings transformer {computedLabel}",
30
31
  "network_modifications.TWO_WINDINGS_TRANSFORMER_MODIFICATION": "Modifying 2 windings transformer {computedLabel}",
31
32
  "network_modifications.OPERATING_STATUS_MODIFICATION": "{action, select, TRIP {Trip {computedLabel}} LOCKOUT {Lock out {computedLabel}} ENERGISE_END_ONE {Energise {computedLabel} on {energizedEnd}} ENERGISE_END_TWO {Energise {computedLabel} on {energizedEnd}} SWITCH_ON {Switch on {computedLabel}} other {Equipment operating status modification {computedLabel}}}",
@@ -121,6 +122,7 @@ const networkModificationsEn = {
121
122
  ShortCircuitCurrentLimitMinMaxError: "Low short-circuit current limit must be less than or equal to high limit",
122
123
  [DUPLICATED_PROPS_ERROR]: "Duplicated properties: each property must be unique",
123
124
  [YUP_REQUIRED]: "This field is required",
125
+ YupNotTypeNumber: "This field only accepts numeric values",
124
126
  CreateLoad: "Create load",
125
127
  loadType: "Type",
126
128
  ConnectivityTab: "Connectivity",
@@ -20,6 +20,7 @@ export declare const networkModificationsFr: {
20
20
  'network_modifications.GENERATOR_MODIFICATION': string;
21
21
  'network_modifications.LINE_CREATION': string;
22
22
  'network_modifications.LINE_MODIFICATION': string;
23
+ 'network_modifications.COMPOSITE_MODIFICATION': string;
23
24
  'network_modifications.TWO_WINDINGS_TRANSFORMER_CREATION': string;
24
25
  'network_modifications.TWO_WINDINGS_TRANSFORMER_MODIFICATION': string;
25
26
  'network_modifications.OPERATING_STATUS_MODIFICATION': string;
@@ -115,6 +116,7 @@ export declare const networkModificationsFr: {
115
116
  ShortCircuitCurrentLimitMinMaxError: string;
116
117
  DuplicatedPropsError: string;
117
118
  YupRequired: string;
119
+ YupNotTypeNumber: string;
118
120
  CreateLoad: string;
119
121
  loadType: string;
120
122
  ConnectivityTab: string;
@@ -26,6 +26,7 @@ const networkModificationsFr = {
26
26
  "network_modifications.GENERATOR_MODIFICATION": "Modification du générateur {computedLabel}",
27
27
  "network_modifications.LINE_CREATION": "Création de la ligne {computedLabel}",
28
28
  "network_modifications.LINE_MODIFICATION": "Modification de la ligne {computedLabel}",
29
+ "network_modifications.COMPOSITE_MODIFICATION": "{computedLabel}",
29
30
  "network_modifications.TWO_WINDINGS_TRANSFORMER_CREATION": "Création du transformateur à 2 enroulements {computedLabel}",
30
31
  "network_modifications.TWO_WINDINGS_TRANSFORMER_MODIFICATION": "Modification du transformateur à 2 enroulements {computedLabel}",
31
32
  "network_modifications.OPERATING_STATUS_MODIFICATION": "{action, select, TRIP {Déclenchement de {computedLabel}} LOCKOUT {Consignation de {computedLabel}} ENERGISE_END_ONE {Mise sous tension à vide de {computedLabel} depuis {energizedEnd}} ENERGISE_END_TWO {Mise sous tension à vide de {computedLabel} depuis {energizedEnd}} SWITCH_ON {Mise en service de {computedLabel}} other {Modification du statut opérationnel de l'équipement {computedLabel}}}",
@@ -121,6 +122,7 @@ const networkModificationsFr = {
121
122
  ShortCircuitCurrentLimitMinMaxError: "La limite ICC min doit être inférieure ou égale à la limite ICC max",
122
123
  [DUPLICATED_PROPS_ERROR]: "Propriétés dupliquées : chaque propriété doit être unique",
123
124
  [YUP_REQUIRED]: "Ce champ doit être renseigné",
125
+ YupNotTypeNumber: "Ce champ n'accepte que des valeurs numériques",
124
126
  CreateLoad: "Créer une consommation",
125
127
  loadType: "Type",
126
128
  ConnectivityTab: "Connectivité",
@@ -5,7 +5,7 @@ import { MAX_CHAR_DESCRIPTION } from "./uiConstants.js";
5
5
  import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./unitsConstants.js";
6
6
  import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./configConstants.js";
7
7
  import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./filterConstant.js";
8
- import { DUPLICATED_PROPS_ERROR, YUP_REQUIRED } from "./translationKeys.js";
8
+ import { DUPLICATED_PROPS_ERROR, YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "./translationKeys.js";
9
9
  export {
10
10
  AMPERE,
11
11
  ActivePowerAdornment,
@@ -44,5 +44,6 @@ export {
44
44
  SIEMENS,
45
45
  SusceptanceAdornment,
46
46
  VoltageAdornment,
47
+ YUP_NOT_TYPE_NUMBER,
47
48
  YUP_REQUIRED
48
49
  };
@@ -1,2 +1,3 @@
1
1
  export declare const YUP_REQUIRED = "YupRequired";
2
+ export declare const YUP_NOT_TYPE_NUMBER = "YupNotTypeNumber";
2
3
  export declare const DUPLICATED_PROPS_ERROR = "DuplicatedPropsError";
@@ -1,6 +1,8 @@
1
1
  const YUP_REQUIRED = "YupRequired";
2
+ const YUP_NOT_TYPE_NUMBER = "YupNotTypeNumber";
2
3
  const DUPLICATED_PROPS_ERROR = "DuplicatedPropsError";
3
4
  export {
4
5
  DUPLICATED_PROPS_ERROR,
6
+ YUP_NOT_TYPE_NUMBER,
5
7
  YUP_REQUIRED
6
8
  };
@@ -6,7 +6,7 @@ import { MAX_CHAR_DESCRIPTION } from "./constants/uiConstants.js";
6
6
  import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./constants/unitsConstants.js";
7
7
  import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./constants/configConstants.js";
8
8
  import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./constants/filterConstant.js";
9
- import { DUPLICATED_PROPS_ERROR, YUP_REQUIRED } from "./constants/translationKeys.js";
9
+ import { DUPLICATED_PROPS_ERROR, YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "./constants/translationKeys.js";
10
10
  import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, toModificationOperation, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
11
11
  import { catchErrorHandler, extractErrorMessageDescriptor, snackWithFallback } from "./error.js";
12
12
  import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./functions.js";
@@ -127,6 +127,7 @@ export {
127
127
  VSC,
128
128
  VoltageAdornment,
129
129
  VoltageLevel,
130
+ YUP_NOT_TYPE_NUMBER,
130
131
  YUP_REQUIRED,
131
132
  areArrayElementsUnique,
132
133
  areIdsEqual,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.182.0",
3
+ "version": "0.184.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",