@gridsuite/commons-ui 0.176.0 → 0.178.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 (63) hide show
  1. package/dist/components/index.js +25 -1
  2. package/dist/components/inputs/index.js +2 -0
  3. package/dist/components/inputs/reactHookForm/index.js +2 -0
  4. package/dist/components/inputs/reactHookForm/numbers/IntegerInput.js +1 -1
  5. package/dist/components/inputs/reactHookForm/selectInputs/EnumInput.d.ts +18 -0
  6. package/dist/components/inputs/reactHookForm/selectInputs/EnumInput.js +28 -0
  7. package/dist/components/inputs/reactHookForm/selectInputs/index.d.ts +1 -0
  8. package/dist/components/inputs/reactHookForm/selectInputs/index.js +2 -0
  9. package/dist/components/network-modifications/index.d.ts +1 -0
  10. package/dist/components/network-modifications/index.js +23 -1
  11. package/dist/components/network-modifications/voltage-level/creation/VoltageLevelCreationForm.d.ts +11 -0
  12. package/dist/components/network-modifications/voltage-level/creation/VoltageLevelCreationForm.js +174 -0
  13. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.d.ts +7 -0
  14. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.js +54 -0
  15. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.d.ts +7 -0
  16. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.js +73 -0
  17. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/index.d.ts +8 -0
  18. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/index.js +6 -0
  19. package/dist/components/network-modifications/voltage-level/creation/index.d.ts +11 -0
  20. package/dist/components/network-modifications/voltage-level/creation/index.js +24 -0
  21. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.d.ts +5 -0
  22. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.js +76 -0
  23. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationCreationSection.d.ts +6 -0
  24. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationCreationSection.js +61 -0
  25. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.d.ts +7 -0
  26. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.js +119 -0
  27. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.d.ts +11 -0
  28. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.js +82 -0
  29. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialogSubmitButton.d.ts +6 -0
  30. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialogSubmitButton.js +11 -0
  31. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesForm.d.ts +11 -0
  32. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesForm.js +70 -0
  33. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/createSwitchesDialog.utils.d.ts +14 -0
  34. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/createSwitchesDialog.utils.js +27 -0
  35. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/index.d.ts +7 -0
  36. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/index.js +4 -0
  37. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/index.d.ts +8 -0
  38. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/index.js +6 -0
  39. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.d.ts +34 -0
  40. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.js +9 -0
  41. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.d.ts +155 -0
  42. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.js +248 -0
  43. package/dist/components/network-modifications/voltage-level/index.d.ts +7 -0
  44. package/dist/components/network-modifications/voltage-level/index.js +24 -0
  45. package/dist/components/parameters/short-circuit/short-circuit-parameters-content.d.ts +1 -2
  46. package/dist/components/parameters/short-circuit/short-circuit-parameters-content.js +4 -7
  47. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.d.ts +1 -3
  48. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -3
  49. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.d.ts +1 -2
  50. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +2 -9
  51. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.d.ts +1 -2
  52. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -3
  53. package/dist/index.js +26 -1
  54. package/dist/services/index.js +2 -1
  55. package/dist/services/networkModification.d.ts +1 -0
  56. package/dist/services/networkModification.js +15 -1
  57. package/dist/translations/en/networkModificationsEn.d.ts +35 -0
  58. package/dist/translations/en/networkModificationsEn.js +35 -0
  59. package/dist/translations/fr/networkModificationsFr.d.ts +35 -0
  60. package/dist/translations/fr/networkModificationsFr.js +35 -0
  61. package/dist/utils/constants/fieldConstants.d.ts +22 -1
  62. package/dist/utils/constants/fieldConstants.js +21 -0
  63. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ import { IntlShape } from 'react-intl';
2
+ import { InferType } from 'yup';
3
+ import { FieldConstants } from '../../../../utils';
4
+ import { SwitchKind, VoltageLevelCreationDto } from './voltageLevelCreation.types';
5
+ import { Option } from '../../../../utils/types/types';
6
+ export declare const SWITCH_TYPE: {
7
+ readonly BREAKER: {
8
+ readonly id: "BREAKER";
9
+ readonly label: "Breaker";
10
+ };
11
+ readonly DISCONNECTOR: {
12
+ readonly id: "DISCONNECTOR";
13
+ readonly label: "Disconnector";
14
+ };
15
+ };
16
+ export declare const buildNewBusbarSections: (equipmentId: string, sectionCount: number, busbarCount: number) => Option[];
17
+ export declare const getCreateSwitchesValidationSchema: (id?: FieldConstants) => {
18
+ [x: string]: import('yup').ArraySchema<{
19
+ switchKind: string;
20
+ }[] | null | undefined, import('yup').AnyObject, "", "">;
21
+ };
22
+ export declare const getCreateSwitchesEmptyFormData: (sectionCount: number, id?: FieldConstants) => {
23
+ [x: string]: any[];
24
+ };
25
+ export declare const voltageLevelCreationFormSchema: import('yup').ObjectSchema<{
26
+ equipmentID: string;
27
+ equipmentName: string | null | undefined;
28
+ addSubstationCreationId: NonNullable<boolean | undefined>;
29
+ substationId: string | null | undefined;
30
+ substationCreationId: string | null | undefined;
31
+ substationName: string | null | undefined;
32
+ country: string | null | undefined;
33
+ substationCreation: {
34
+ AdditionalProperties?: {
35
+ previousValue?: string | null | undefined;
36
+ added: NonNullable<boolean | undefined>;
37
+ deletionMark: NonNullable<boolean | undefined>;
38
+ name: string;
39
+ value: string;
40
+ }[] | undefined;
41
+ };
42
+ hideNominalVoltage: NonNullable<boolean | undefined>;
43
+ nominalV: number | null | undefined;
44
+ lowVoltageLimit: number | null | undefined;
45
+ highVoltageLimit: number | null | undefined;
46
+ lowShortCircuitCurrentLimit: number | null | undefined;
47
+ highShortCircuitCurrentLimit: number | null | undefined;
48
+ hideBusBarSection: NonNullable<boolean | undefined>;
49
+ busbarCount: number | null | undefined;
50
+ sectionCount: number | null | undefined;
51
+ switchesBetweenSections: string | null | undefined;
52
+ switchKinds: {
53
+ switchKind: string;
54
+ }[] | undefined;
55
+ topologyKind: string | null | undefined;
56
+ couplingOmnibus: {
57
+ busbarSectionId1: string;
58
+ busbarSectionId2: string;
59
+ }[] | undefined;
60
+ } & {
61
+ AdditionalProperties: {
62
+ previousValue?: string | null | undefined;
63
+ added: NonNullable<boolean | undefined>;
64
+ deletionMark: NonNullable<boolean | undefined>;
65
+ name: string;
66
+ value: string;
67
+ }[] | undefined;
68
+ }, import('yup').AnyObject, {
69
+ equipmentID: undefined;
70
+ equipmentName: undefined;
71
+ addSubstationCreationId: undefined;
72
+ substationId: undefined;
73
+ substationCreationId: undefined;
74
+ substationName: undefined;
75
+ country: undefined;
76
+ substationCreation: {
77
+ AdditionalProperties: "";
78
+ };
79
+ hideNominalVoltage: undefined;
80
+ nominalV: undefined;
81
+ lowVoltageLimit: undefined;
82
+ highVoltageLimit: undefined;
83
+ lowShortCircuitCurrentLimit: undefined;
84
+ highShortCircuitCurrentLimit: undefined;
85
+ hideBusBarSection: undefined;
86
+ busbarCount: undefined;
87
+ sectionCount: undefined;
88
+ switchesBetweenSections: undefined;
89
+ switchKinds: "";
90
+ topologyKind: undefined;
91
+ couplingOmnibus: "";
92
+ AdditionalProperties: "";
93
+ }, "">;
94
+ export type VoltageLevelCreationFormData = InferType<typeof voltageLevelCreationFormSchema>;
95
+ export declare const voltageLevelCreationEmptyFormData: {
96
+ equipmentID: string;
97
+ equipmentName: string;
98
+ addSubstationCreationId: false;
99
+ substationId: null;
100
+ substationCreationId: null;
101
+ substationName: null;
102
+ country: null;
103
+ substationCreation: {
104
+ AdditionalProperties?: {
105
+ previousValue?: string | null | undefined;
106
+ added: NonNullable<boolean | undefined>;
107
+ deletionMark: NonNullable<boolean | undefined>;
108
+ name: string;
109
+ value: string;
110
+ }[] | undefined;
111
+ country?: string | null | undefined;
112
+ equipmentName?: string | null | undefined;
113
+ equipmentID: string;
114
+ };
115
+ hideNominalVoltage: false;
116
+ nominalV: null;
117
+ lowVoltageLimit: null;
118
+ highVoltageLimit: null;
119
+ lowShortCircuitCurrentLimit: null;
120
+ highShortCircuitCurrentLimit: null;
121
+ hideBusBarSection: false;
122
+ busbarCount: number;
123
+ sectionCount: number;
124
+ switchesBetweenSections: string;
125
+ switchKinds: never[];
126
+ couplingOmnibus: never[];
127
+ AdditionalProperties: never[];
128
+ };
129
+ export declare const voltageLevelCreationFormToDto: (voltageLevelForm: VoltageLevelCreationFormData) => VoltageLevelCreationDto;
130
+ export declare const translateSwitchKinds: (switchKinds: SwitchKind[] | null, intl?: IntlShape) => string;
131
+ export declare const voltageLevelCreationDtoToForm: (voltageLevelDto: VoltageLevelCreationDto, intl?: IntlShape, includePreviousValue?: boolean) => {
132
+ AdditionalProperties?: import('../..').Property[];
133
+ equipmentID: string;
134
+ equipmentName: string;
135
+ substationId: string | null;
136
+ nominalV: number | null;
137
+ lowVoltageLimit: number | null;
138
+ highVoltageLimit: number | null;
139
+ lowShortCircuitCurrentLimit: any;
140
+ highShortCircuitCurrentLimit: any;
141
+ busbarCount: number;
142
+ sectionCount: number;
143
+ switchesBetweenSections: string;
144
+ couplingOmnibus: import('./voltageLevelCreation.types').CouplingDevice[];
145
+ switchKinds: {
146
+ switchKind: SwitchKind;
147
+ }[];
148
+ addSubstationCreationId: boolean;
149
+ substationCreationId: string | null;
150
+ substationName: string | null;
151
+ country: string | null;
152
+ substationCreation: import('../..').Properties;
153
+ hideNominalVoltage: boolean;
154
+ hideBusBarSection: boolean;
155
+ };
@@ -0,0 +1,248 @@
1
+ import { object, array, string, number, boolean, ref } from "yup";
2
+ import { creationPropertiesSchema, toModificationProperties, getPropertiesFromModification, emptyProperties } from "../../common/properties/propertyUtils.js";
3
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
4
+ import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
5
+ import { convertOutputValue, convertInputValue } from "../../../../utils/conversionUtils.js";
6
+ import "../../../../utils/types/equipmentType.js";
7
+ import { MODIFICATION_TYPES } from "../../../../utils/types/modificationType.js";
8
+ import { FieldType } from "../../../../utils/types/fieldType.js";
9
+ import "react/jsx-runtime";
10
+ import "@mui/icons-material";
11
+ import { sanitizeString } from "../../../../utils/ts-utils.js";
12
+ import "../../../../utils/yupConfig.js";
13
+ import "@mui/material";
14
+ import "react-intl";
15
+ import "../../../overflowableText/OverflowableText.js";
16
+ import "react";
17
+ import "react-hook-form";
18
+ import "localized-countries";
19
+ import "localized-countries/data/fr";
20
+ import "localized-countries/data/en";
21
+ import "notistack";
22
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
23
+ import "../../../treeViewFinder/TreeViewFinder.js";
24
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
25
+ import "../../../customAGGrid/customAggrid.js";
26
+ import "ag-grid-community";
27
+ import "react-papaparse";
28
+ import "react-csv-downloader";
29
+ import "../../../inputs/reactHookForm/numbers/RangeInput.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/left_panel_close.svg?react";
33
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
34
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
35
+ import "@react-querybuilder/material";
36
+ import "../../../filter/expert/expertFilterConstants.js";
37
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
38
+ import "uuid";
39
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
40
+ import "react-querybuilder";
41
+ import { substationCreationEmptyFormData } from "../../substation/creation/substationCreation.utils.js";
42
+ import "../../substation/modification/substationModification.utils.js";
43
+ const SWITCH_TYPE = {
44
+ BREAKER: { id: "BREAKER", label: "Breaker" },
45
+ DISCONNECTOR: { id: "DISCONNECTOR", label: "Disconnector" }
46
+ };
47
+ const buildNewBusbarSections = (equipmentId, sectionCount, busbarCount) => {
48
+ const newBusbarSections = [];
49
+ for (let i = 0; i < busbarCount; i++) {
50
+ for (let j = 0; j < sectionCount; j++) {
51
+ newBusbarSections.push({
52
+ id: `${equipmentId}_${i + 1}_${j + 1}`,
53
+ label: ""
54
+ });
55
+ }
56
+ }
57
+ return newBusbarSections;
58
+ };
59
+ const getCreateSwitchesValidationSchema = (id = FieldConstants.SWITCH_KINDS) => {
60
+ return {
61
+ [id]: array().nullable().of(
62
+ object().shape({
63
+ [FieldConstants.SWITCH_KIND]: string().nullable().required(YUP_REQUIRED)
64
+ })
65
+ )
66
+ };
67
+ };
68
+ const getCreateSwitchesEmptyFormData = (sectionCount, id = FieldConstants.SWITCH_KINDS) => ({
69
+ [id]: new Array(sectionCount - 1).fill({ [FieldConstants.SWITCH_KIND]: "" })
70
+ });
71
+ const voltageLevelCreationFormSchema = object().shape({
72
+ [FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED).when([FieldConstants.ADD_SUBSTATION_CREATION], {
73
+ is: (addSubstationCreation) => !addSubstationCreation,
74
+ then: (schema) => schema.notOneOf(
75
+ [ref(FieldConstants.SUBSTATION_ID), null],
76
+ "CreateSubstationInVoltageLevelIdenticalId"
77
+ )
78
+ }).when([FieldConstants.ADD_SUBSTATION_CREATION], {
79
+ is: (addSubstationCreation) => addSubstationCreation,
80
+ then: (schema) => schema.notOneOf(
81
+ [ref(FieldConstants.SUBSTATION_CREATION_ID), null],
82
+ "CreateSubstationInVoltageLevelIdenticalId"
83
+ )
84
+ }),
85
+ [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
86
+ [FieldConstants.ADD_SUBSTATION_CREATION]: boolean().required(YUP_REQUIRED),
87
+ [FieldConstants.SUBSTATION_ID]: string().nullable().when([FieldConstants.ADD_SUBSTATION_CREATION], {
88
+ is: (addSubstationCreation) => !addSubstationCreation,
89
+ then: (schema) => schema.required(YUP_REQUIRED).notOneOf(
90
+ [ref(FieldConstants.EQUIPMENT_ID), null],
91
+ "CreateSubstationInVoltageLevelIdenticalId"
92
+ )
93
+ }),
94
+ [FieldConstants.SUBSTATION_CREATION_ID]: string().nullable().when([FieldConstants.ADD_SUBSTATION_CREATION], {
95
+ is: (addSubstationCreation) => addSubstationCreation,
96
+ then: (schema) => schema.required(YUP_REQUIRED).notOneOf(
97
+ [ref(FieldConstants.EQUIPMENT_ID), null],
98
+ "CreateSubstationInVoltageLevelIdenticalId"
99
+ )
100
+ }),
101
+ [FieldConstants.SUBSTATION_NAME]: string().nullable(),
102
+ [FieldConstants.COUNTRY]: string().nullable(),
103
+ [FieldConstants.SUBSTATION_CREATION]: creationPropertiesSchema,
104
+ [FieldConstants.HIDE_NOMINAL_VOLTAGE]: boolean().required(YUP_REQUIRED),
105
+ [FieldConstants.NOMINAL_V]: number().nullable().when([FieldConstants.HIDE_NOMINAL_VOLTAGE], {
106
+ is: (hideNominalVoltage) => !hideNominalVoltage,
107
+ then: (schema) => schema.min(0, "mustBeGreaterOrEqualToZero").required(YUP_REQUIRED)
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], {
113
+ is: (lowShortCircuitCurrentLimit) => lowShortCircuitCurrentLimit != null,
114
+ then: (schema) => schema.required(YUP_REQUIRED)
115
+ }),
116
+ [FieldConstants.HIDE_BUS_BAR_SECTION]: boolean().required(YUP_REQUIRED),
117
+ [FieldConstants.BUS_BAR_COUNT]: number().nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
118
+ is: (hideBusBarSection) => !hideBusBarSection,
119
+ then: (schema) => schema.min(1, "BusBarCountMustBeGreaterThanOrEqualToOne").required(YUP_REQUIRED)
120
+ }),
121
+ [FieldConstants.SECTION_COUNT]: number().nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
122
+ is: (hideBusBarSection) => !hideBusBarSection,
123
+ then: (schema) => schema.min(1, "SectionCountMustBeGreaterThanOrEqualToOne").required(YUP_REQUIRED)
124
+ }),
125
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: string().nullable().when([FieldConstants.SECTION_COUNT], {
126
+ is: (sectionCount) => sectionCount > 1,
127
+ then: (schema) => schema.required(YUP_REQUIRED)
128
+ }),
129
+ [FieldConstants.SWITCH_KINDS]: array().of(
130
+ object().shape({
131
+ [FieldConstants.SWITCH_KIND]: string().required(YUP_REQUIRED)
132
+ })
133
+ ),
134
+ [FieldConstants.TOPOLOGY_KIND]: string().nullable(),
135
+ [FieldConstants.COUPLING_OMNIBUS]: array().of(
136
+ object().shape({
137
+ [FieldConstants.BUS_BAR_SECTION_ID1]: string().nullable().required(YUP_REQUIRED),
138
+ [FieldConstants.BUS_BAR_SECTION_ID2]: string().nullable().required(YUP_REQUIRED).notOneOf([ref(FieldConstants.BUS_BAR_SECTION_ID1), null], "CreateCouplingDeviceIdenticalBusBar")
139
+ })
140
+ )
141
+ }).concat(creationPropertiesSchema);
142
+ const voltageLevelCreationEmptyFormData = {
143
+ [FieldConstants.EQUIPMENT_ID]: "",
144
+ [FieldConstants.EQUIPMENT_NAME]: "",
145
+ [FieldConstants.ADD_SUBSTATION_CREATION]: false,
146
+ [FieldConstants.SUBSTATION_ID]: null,
147
+ [FieldConstants.SUBSTATION_CREATION_ID]: null,
148
+ [FieldConstants.SUBSTATION_NAME]: null,
149
+ [FieldConstants.COUNTRY]: null,
150
+ [FieldConstants.SUBSTATION_CREATION]: substationCreationEmptyFormData,
151
+ [FieldConstants.HIDE_NOMINAL_VOLTAGE]: false,
152
+ [FieldConstants.NOMINAL_V]: null,
153
+ [FieldConstants.LOW_VOLTAGE_LIMIT]: null,
154
+ [FieldConstants.HIGH_VOLTAGE_LIMIT]: null,
155
+ [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: null,
156
+ [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: null,
157
+ [FieldConstants.HIDE_BUS_BAR_SECTION]: false,
158
+ [FieldConstants.BUS_BAR_COUNT]: 1,
159
+ [FieldConstants.SECTION_COUNT]: 1,
160
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: "",
161
+ [FieldConstants.SWITCH_KINDS]: [],
162
+ [FieldConstants.COUPLING_OMNIBUS]: [],
163
+ [FieldConstants.ADDITIONAL_PROPERTIES]: []
164
+ };
165
+ const voltageLevelCreationFormToDto = (voltageLevelForm) => {
166
+ const substationCreation = voltageLevelForm[FieldConstants.ADD_SUBSTATION_CREATION] ? {
167
+ type: MODIFICATION_TYPES.SUBSTATION_CREATION.type,
168
+ equipmentId: voltageLevelForm[FieldConstants.SUBSTATION_CREATION_ID] ?? "",
169
+ equipmentName: voltageLevelForm[FieldConstants.SUBSTATION_NAME] ?? null,
170
+ country: voltageLevelForm[FieldConstants.COUNTRY] ?? null,
171
+ properties: toModificationProperties(voltageLevelForm[FieldConstants.SUBSTATION_CREATION])
172
+ } : null;
173
+ return {
174
+ type: MODIFICATION_TYPES.VOLTAGE_LEVEL_CREATION.type,
175
+ equipmentId: voltageLevelForm[FieldConstants.EQUIPMENT_ID],
176
+ equipmentName: sanitizeString(voltageLevelForm[FieldConstants.EQUIPMENT_NAME]),
177
+ substationId: substationCreation ? null : voltageLevelForm[FieldConstants.SUBSTATION_ID] ?? null,
178
+ substationCreation,
179
+ nominalV: voltageLevelForm[FieldConstants.NOMINAL_V] ?? null,
180
+ lowVoltageLimit: voltageLevelForm[FieldConstants.LOW_VOLTAGE_LIMIT] ?? null,
181
+ highVoltageLimit: voltageLevelForm[FieldConstants.HIGH_VOLTAGE_LIMIT] ?? null,
182
+ ipMin: convertOutputValue(
183
+ FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
184
+ voltageLevelForm[FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]
185
+ ),
186
+ ipMax: convertOutputValue(
187
+ FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
188
+ voltageLevelForm[FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]
189
+ ),
190
+ busbarCount: voltageLevelForm[FieldConstants.BUS_BAR_COUNT] ?? 1,
191
+ sectionCount: voltageLevelForm[FieldConstants.SECTION_COUNT] ?? 1,
192
+ switchKinds: (voltageLevelForm[FieldConstants.SWITCH_KINDS] ?? []).map(
193
+ (e) => e[FieldConstants.SWITCH_KIND]
194
+ ),
195
+ couplingDevices: (voltageLevelForm[FieldConstants.COUPLING_OMNIBUS] ?? []).map((device) => ({
196
+ busbarSectionId1: device[FieldConstants.BUS_BAR_SECTION_ID1] ?? "",
197
+ busbarSectionId2: device[FieldConstants.BUS_BAR_SECTION_ID2] ?? ""
198
+ })),
199
+ properties: toModificationProperties(voltageLevelForm)
200
+ };
201
+ };
202
+ const translateSwitchKinds = (switchKinds, intl) => switchKinds?.map((kind) => intl ? intl.formatMessage({ id: kind }) : kind).join(" / ") ?? "";
203
+ const voltageLevelCreationDtoToForm = (voltageLevelDto, intl, includePreviousValue = true) => {
204
+ const isSubstationCreation = voltageLevelDto.substationCreation?.equipmentId != null;
205
+ const substationProperties = isSubstationCreation ? getPropertiesFromModification(voltageLevelDto.substationCreation?.properties, includePreviousValue) : emptyProperties;
206
+ return {
207
+ [FieldConstants.EQUIPMENT_ID]: voltageLevelDto.equipmentId,
208
+ [FieldConstants.EQUIPMENT_NAME]: voltageLevelDto.equipmentName ?? "",
209
+ [FieldConstants.SUBSTATION_ID]: isSubstationCreation ? null : voltageLevelDto.substationId,
210
+ [FieldConstants.NOMINAL_V]: voltageLevelDto.nominalV,
211
+ [FieldConstants.LOW_VOLTAGE_LIMIT]: voltageLevelDto.lowVoltageLimit,
212
+ [FieldConstants.HIGH_VOLTAGE_LIMIT]: voltageLevelDto.highVoltageLimit,
213
+ [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: convertInputValue(
214
+ FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
215
+ voltageLevelDto.ipMin
216
+ ),
217
+ [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: convertInputValue(
218
+ FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
219
+ voltageLevelDto.ipMax
220
+ ),
221
+ [FieldConstants.BUS_BAR_COUNT]: voltageLevelDto.busbarCount ?? 1,
222
+ [FieldConstants.SECTION_COUNT]: voltageLevelDto.sectionCount ?? 1,
223
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: translateSwitchKinds(voltageLevelDto.switchKinds, intl),
224
+ [FieldConstants.COUPLING_OMNIBUS]: voltageLevelDto.couplingDevices ?? [],
225
+ [FieldConstants.SWITCH_KINDS]: voltageLevelDto.switchKinds?.map((switchKind) => ({
226
+ switchKind
227
+ })) ?? [],
228
+ [FieldConstants.ADD_SUBSTATION_CREATION]: isSubstationCreation,
229
+ [FieldConstants.SUBSTATION_CREATION_ID]: isSubstationCreation ? voltageLevelDto.substationCreation.equipmentId : null,
230
+ [FieldConstants.SUBSTATION_NAME]: isSubstationCreation ? voltageLevelDto.substationCreation.equipmentName : null,
231
+ [FieldConstants.COUNTRY]: isSubstationCreation ? voltageLevelDto.substationCreation.country : null,
232
+ [FieldConstants.SUBSTATION_CREATION]: substationProperties,
233
+ [FieldConstants.HIDE_NOMINAL_VOLTAGE]: false,
234
+ [FieldConstants.HIDE_BUS_BAR_SECTION]: false,
235
+ ...getPropertiesFromModification(voltageLevelDto.properties, includePreviousValue)
236
+ };
237
+ };
238
+ export {
239
+ SWITCH_TYPE,
240
+ buildNewBusbarSections,
241
+ getCreateSwitchesEmptyFormData,
242
+ getCreateSwitchesValidationSchema,
243
+ translateSwitchKinds,
244
+ voltageLevelCreationDtoToForm,
245
+ voltageLevelCreationEmptyFormData,
246
+ voltageLevelCreationFormSchema,
247
+ voltageLevelCreationFormToDto
248
+ };
@@ -0,0 +1,7 @@
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 './creation';
@@ -0,0 +1,24 @@
1
+ import { CreateSwitchesDialog } from "./creation/switches-between-sections/creation/CreateSwitchesDialog.js";
2
+ import { SwitchesBetweenSections } from "./creation/switches-between-sections/SwitchesBetweenSections.js";
3
+ import { CouplingOmnibusForm } from "./creation/coupling-omnibus/CouplingOmnibusForm.js";
4
+ import { CouplingOmnibusCreation } from "./creation/coupling-omnibus/CouplingOmnibusCreation.js";
5
+ import { VoltageLevelCreationForm } from "./creation/VoltageLevelCreationForm.js";
6
+ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./creation/voltageLevelCreation.utils.js";
7
+ import { SwitchKind } from "./creation/voltageLevelCreation.types.js";
8
+ export {
9
+ CouplingOmnibusCreation,
10
+ CouplingOmnibusForm,
11
+ CreateSwitchesDialog,
12
+ SWITCH_TYPE,
13
+ SwitchKind,
14
+ SwitchesBetweenSections,
15
+ VoltageLevelCreationForm,
16
+ buildNewBusbarSections,
17
+ getCreateSwitchesEmptyFormData,
18
+ getCreateSwitchesValidationSchema,
19
+ translateSwitchKinds,
20
+ voltageLevelCreationDtoToForm,
21
+ voltageLevelCreationEmptyFormData,
22
+ voltageLevelCreationFormSchema,
23
+ voltageLevelCreationFormToDto
24
+ };
@@ -1,7 +1,6 @@
1
1
  import { UseShortCircuitParametersFormReturn } from './use-short-circuit-parameters-form';
2
2
  type ShortCircuitParametersContentProps = {
3
3
  shortCircuitMethods: UseShortCircuitParametersFormReturn;
4
- isDeveloperMode: boolean;
5
4
  };
6
- declare function ShortCircuitParametersContent({ shortCircuitMethods, isDeveloperMode, }: Readonly<ShortCircuitParametersContentProps>): import("react/jsx-runtime").JSX.Element;
5
+ declare function ShortCircuitParametersContent({ shortCircuitMethods }: Readonly<ShortCircuitParametersContentProps>): import("react/jsx-runtime").JSX.Element;
7
6
  export default ShortCircuitParametersContent;
@@ -56,10 +56,7 @@ const styles = {
56
56
  paddingLeft: 1
57
57
  }
58
58
  };
59
- function ShortCircuitParametersContent({
60
- shortCircuitMethods,
61
- isDeveloperMode
62
- }) {
59
+ function ShortCircuitParametersContent({ shortCircuitMethods }) {
63
60
  const { resetAll, selectedTab, handleTabChange, tabIndexesWithError } = shortCircuitMethods;
64
61
  const watchSpecificParameters = useWatch({
65
62
  name: `${SPECIFIC_PARAMETERS}`
@@ -78,7 +75,7 @@ function ShortCircuitParametersContent({
78
75
  sx: getTabStyle(tabIndexesWithError, ShortCircuitParametersTabValues.GENERAL)
79
76
  }
80
77
  ),
81
- isThereSpecificParameters && isDeveloperMode && /* @__PURE__ */ jsx(
78
+ isThereSpecificParameters && /* @__PURE__ */ jsx(
82
79
  Tab,
83
80
  {
84
81
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: ShortCircuitParametersTabValues.STUDY_AREA }),
@@ -86,7 +83,7 @@ function ShortCircuitParametersContent({
86
83
  sx: getTabStyle(tabIndexesWithError, ShortCircuitParametersTabValues.STUDY_AREA)
87
84
  }
88
85
  ),
89
- isThereSpecificParameters && isDeveloperMode && /* @__PURE__ */ jsx(
86
+ isThereSpecificParameters && /* @__PURE__ */ jsx(
90
87
  Tab,
91
88
  {
92
89
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: ShortCircuitParametersTabValues.POWER_ELECTRONICS }),
@@ -97,7 +94,7 @@ function ShortCircuitParametersContent({
97
94
  ] }) }),
98
95
  /* @__PURE__ */ jsx(Box, { sx: styles.wrapper, children: /* @__PURE__ */ jsx(Grid, { container: true, sx: styles.container, children: /* @__PURE__ */ jsxs(Grid, { item: true, sx: styles.maxWidth, children: [
99
96
  /* @__PURE__ */ jsx(ShortCircuitGeneralTabPanel, { resetAll, value: selectedTab }),
100
- isThereSpecificParameters && isDeveloperMode && /* @__PURE__ */ jsxs(Fragment, { children: [
97
+ isThereSpecificParameters && /* @__PURE__ */ jsxs(Fragment, { children: [
101
98
  /* @__PURE__ */ jsx(ShortCircuitStudyAreaTabPanel, { value: selectedTab }),
102
99
  /* @__PURE__ */ jsx(ShortCircuitPowerElectronicsTabPanel, { value: selectedTab })
103
100
  ] })
@@ -1,4 +1,2 @@
1
1
  import { ParametersEditionDialogProps } from '../common';
2
- export declare function ShortCircuitParametersEditionDialog({ id, open, onClose, titleId, name, description, activeDirectory, user, language, isDeveloperMode, }: Readonly<ParametersEditionDialogProps & {
3
- isDeveloperMode: boolean;
4
- }>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ShortCircuitParametersEditionDialog({ id, open, onClose, titleId, name, description, activeDirectory, user, language, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
@@ -53,8 +53,7 @@ function ShortCircuitParametersEditionDialog({
53
53
  description,
54
54
  activeDirectory,
55
55
  user,
56
- language,
57
- isDeveloperMode
56
+ language
58
57
  }) {
59
58
  const parametersBackend = useParametersBackend(user, id, ComputingType.SHORT_CIRCUIT, OptionalServicesStatus.Up, {
60
59
  backendFetchParameters: fetchShortCircuitParameters,
@@ -91,7 +90,6 @@ function ShortCircuitParametersEditionDialog({
91
90
  ShortCircuitParametersForm,
92
91
  {
93
92
  shortCircuitMethods,
94
- isDeveloperMode,
95
93
  renderTitleFields: () => {
96
94
  return /* @__PURE__ */ jsx(
97
95
  NameElementEditorForm,
@@ -4,7 +4,6 @@ interface ShortCircuitParametersFormProps {
4
4
  shortCircuitMethods: UseShortCircuitParametersFormReturn;
5
5
  renderTitleFields?: () => ReactNode;
6
6
  renderActions?: () => ReactNode;
7
- isDeveloperMode: boolean;
8
7
  }
9
- export declare function ShortCircuitParametersForm({ shortCircuitMethods, renderTitleFields, renderActions, isDeveloperMode, }: Readonly<ShortCircuitParametersFormProps>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function ShortCircuitParametersForm({ shortCircuitMethods, renderTitleFields, renderActions, }: Readonly<ShortCircuitParametersFormProps>): import("react/jsx-runtime").JSX.Element;
10
9
  export {};
@@ -45,19 +45,12 @@ const styles = {
45
45
  function ShortCircuitParametersForm({
46
46
  shortCircuitMethods,
47
47
  renderTitleFields,
48
- renderActions,
49
- isDeveloperMode
48
+ renderActions
50
49
  }) {
51
50
  const { formMethods, formSchema, paramsLoaded } = shortCircuitMethods;
52
51
  return /* @__PURE__ */ jsx(CustomFormProvider, { validationSchema: formSchema, ...formMethods, removeOptional: true, children: /* @__PURE__ */ jsxs(Box, { sx: styles.shortCircuitParameters, children: [
53
52
  /* @__PURE__ */ jsx(Grid, { item: true, container: true, direction: "column", children: renderTitleFields?.() }),
54
- paramsLoaded ? /* @__PURE__ */ jsx(Grid, { sx: parametersStyles.scrollableGrid, children: /* @__PURE__ */ jsx(
55
- ShortCircuitParametersContent,
56
- {
57
- isDeveloperMode,
58
- shortCircuitMethods
59
- }
60
- ) }) : /* @__PURE__ */ jsx(LinearProgress, {}),
53
+ paramsLoaded ? /* @__PURE__ */ jsx(Grid, { sx: parametersStyles.scrollableGrid, children: /* @__PURE__ */ jsx(ShortCircuitParametersContent, { shortCircuitMethods }) }) : /* @__PURE__ */ jsx(LinearProgress, {}),
61
54
  /* @__PURE__ */ jsx(
62
55
  Grid,
63
56
  {
@@ -1,9 +1,8 @@
1
1
  import { UUID } from 'node:crypto';
2
2
  import { UseParametersBackendReturnProps } from '../../../utils';
3
3
  import { ComputingType } from '../common';
4
- export declare function ShortCircuitParametersInLine({ studyUuid, setHaveDirtyFields, parametersBackend, isDeveloperMode, }: Readonly<{
4
+ export declare function ShortCircuitParametersInLine({ studyUuid, setHaveDirtyFields, parametersBackend, }: Readonly<{
5
5
  studyUuid: UUID | null;
6
6
  setHaveDirtyFields: (isDirty: boolean) => void;
7
7
  parametersBackend: UseParametersBackendReturnProps<ComputingType.SHORT_CIRCUIT>;
8
- isDeveloperMode: boolean;
9
8
  }>): import("react/jsx-runtime").JSX.Element;
@@ -48,8 +48,7 @@ import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
48
48
  function ShortCircuitParametersInLine({
49
49
  studyUuid,
50
50
  setHaveDirtyFields,
51
- parametersBackend,
52
- isDeveloperMode
51
+ parametersBackend
53
52
  }) {
54
53
  const shortCircuitMethods = useShortCircuitParametersForm({
55
54
  parametersBackend,
@@ -105,7 +104,6 @@ function ShortCircuitParametersInLine({
105
104
  ShortCircuitParametersForm,
106
105
  {
107
106
  shortCircuitMethods,
108
- isDeveloperMode,
109
107
  renderActions: () => {
110
108
  return /* @__PURE__ */ jsxs(Box, { children: [
111
109
  /* @__PURE__ */ jsxs(Grid, { container: true, item: true, children: [