@gridsuite/commons-ui 0.208.0 → 0.210.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/components/filter/utils/filterFormUtils.js +2 -1
  2. package/dist/components/index.js +33 -3
  3. package/dist/components/inputs/reactHookForm/booleans/RadioInput.js +2 -2
  4. package/dist/components/network-modification-table/renderers/name-cell.d.ts +2 -1
  5. package/dist/components/network-modification-table/renderers/name-cell.js +136 -19
  6. package/dist/components/network-modifications/battery/creation/BatteryCreationForm.d.ts +4 -0
  7. package/dist/components/network-modifications/battery/creation/BatteryCreationForm.js +105 -0
  8. package/dist/components/network-modifications/battery/creation/batteryCreation.types.d.ts +26 -0
  9. package/dist/components/network-modifications/battery/creation/batteryCreation.types.js +1 -0
  10. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.d.ts +79 -0
  11. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.js +145 -0
  12. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.d.ts → battery/creation/index.d.ts} +3 -5
  13. package/dist/components/network-modifications/battery/creation/index.js +9 -0
  14. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation → battery}/index.d.ts +1 -1
  15. package/dist/components/network-modifications/battery/index.js +9 -0
  16. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -2
  17. package/dist/components/network-modifications/common/index.js +5 -2
  18. package/dist/components/network-modifications/common/reactiveLimits/index.js +5 -2
  19. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/index.js +2 -1
  20. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.d.ts +10 -1
  21. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +30 -27
  22. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.type.d.ts +3 -3
  23. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.d.ts +33 -0
  24. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +69 -35
  25. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +1 -1
  26. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.js +3 -3
  27. package/dist/components/network-modifications/index.d.ts +2 -0
  28. package/dist/components/network-modifications/index.js +33 -3
  29. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.d.ts +6 -0
  30. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.js +199 -0
  31. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.d.ts +64 -0
  32. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +90 -0
  33. package/dist/components/network-modifications/shunt-compensator/common/index.d.ts +10 -0
  34. package/dist/components/network-modifications/shunt-compensator/common/index.js +13 -0
  35. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.d.ts +20 -0
  36. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.js +1 -0
  37. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.d.ts +27 -0
  38. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.js +16 -0
  39. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.d.ts +3 -0
  40. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +82 -0
  41. package/dist/components/network-modifications/shunt-compensator/creation/index.d.ts +9 -0
  42. package/dist/components/network-modifications/shunt-compensator/creation/index.js +9 -0
  43. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.d.ts +20 -0
  44. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.js +1 -0
  45. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.d.ts +110 -0
  46. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +103 -0
  47. package/dist/components/network-modifications/shunt-compensator/index.d.ts +8 -0
  48. package/dist/components/network-modifications/shunt-compensator/index.js +20 -0
  49. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
  50. package/dist/components/network-modifications/voltageLevel/creation/index.d.ts +1 -0
  51. package/dist/components/network-modifications/voltageLevel/creation/index.js +3 -1
  52. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +6 -2
  53. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +22 -43
  54. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +1 -0
  55. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +2 -0
  56. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -1
  57. package/dist/components/network-modifications/voltageLevel/index.js +3 -1
  58. package/dist/index.js +33 -3
  59. package/dist/translations/en/networkModificationsEn.d.ts +24 -0
  60. package/dist/translations/en/networkModificationsEn.js +24 -0
  61. package/dist/translations/fr/networkModificationsFr.d.ts +24 -0
  62. package/dist/translations/fr/networkModificationsFr.js +24 -0
  63. package/dist/utils/constants/fieldConstants.d.ts +7 -0
  64. package/dist/utils/constants/fieldConstants.js +7 -0
  65. package/dist/utils/types/network-modification-metadata.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.d.ts +0 -11
  68. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js +0 -84
  69. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.d.ts +0 -6
  70. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.js +0 -11
  71. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +0 -61
  72. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.d.ts +0 -14
  73. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.js +0 -27
  74. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/index.js +0 -4
@@ -0,0 +1,82 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import "react-intl";
4
+ import "../../../overflowableText/OverflowableText.js";
5
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
6
+ import "../../../../utils/conversionUtils.js";
7
+ import "../../../../utils/types/equipmentType.js";
8
+ import "@mui/icons-material";
9
+ import "../../../../utils/yupConfig.js";
10
+ import "react";
11
+ import "react-hook-form";
12
+ import "localized-countries";
13
+ import "localized-countries/data/fr";
14
+ import "localized-countries/data/en";
15
+ import "notistack";
16
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
17
+ import "yup";
18
+ import "../../../treeViewFinder/TreeViewFinder.js";
19
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
20
+ import "../../../customAGGrid/customAggrid.js";
21
+ import "ag-grid-community";
22
+ import "react-papaparse";
23
+ import "react-csv-downloader";
24
+ import { TextInput } from "../../../inputs/reactHookForm/text/TextInput.js";
25
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
26
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
27
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
28
+ import "@material-symbols/svg-400/outlined/arrows_input.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 "../../../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";
39
+ import GridSection from "../../../grid/grid-section.js";
40
+ import { ConnectivityForm } from "../../common/connectivity/ConnectivityForm.js";
41
+ import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
42
+ import { filledTextField } from "../../common/form.utils.js";
43
+ import "../../common/properties/propertyUtils.js";
44
+ import { CharacteristicsForm } from "../common/CharacteristicsForm.js";
45
+ function ShuntCompensatorCreationForm({
46
+ voltageLevelOptions = [],
47
+ fetchBusesOrBusbarSections,
48
+ PositionDiagramPane
49
+ }) {
50
+ return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 2, children: [
51
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
52
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
53
+ TextInput,
54
+ {
55
+ name: FieldConstants.EQUIPMENT_ID,
56
+ label: "ID",
57
+ formProps: { autoFocus: true, ...filledTextField }
58
+ }
59
+ ) }),
60
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.EQUIPMENT_NAME, label: "Name", formProps: filledTextField }) })
61
+ ] }) }),
62
+ /* @__PURE__ */ jsxs(Grid, { item: true, children: [
63
+ /* @__PURE__ */ jsx(GridSection, { title: "Connectivity" }),
64
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
65
+ ConnectivityForm,
66
+ {
67
+ voltageLevelOptions,
68
+ PositionDiagramPane,
69
+ fetchBusesOrBusbarSections
70
+ }
71
+ ) }) })
72
+ ] }),
73
+ /* @__PURE__ */ jsxs(Grid, { item: true, children: [
74
+ /* @__PURE__ */ jsx(GridSection, { title: "Characteristics" }),
75
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(CharacteristicsForm, { isModification: false }) }) })
76
+ ] }),
77
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "shuntCompensator" }) })
78
+ ] });
79
+ }
80
+ export {
81
+ ShuntCompensatorCreationForm
82
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2026, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export * from './ShuntCompensatorCreationForm';
8
+ export * from './shuntCompensatorCreation.types';
9
+ export * from './shuntCompensatorCreation.utils';
@@ -0,0 +1,9 @@
1
+ import { ShuntCompensatorCreationForm } from "./ShuntCompensatorCreationForm.js";
2
+ import { shuntCompensatorCreationDtoToForm, shuntCompensatorCreationEmptyFormData, shuntCompensatorCreationFormSchema, shuntCompensatorCreationFormToDto } from "./shuntCompensatorCreation.utils.js";
3
+ export {
4
+ ShuntCompensatorCreationForm,
5
+ shuntCompensatorCreationDtoToForm,
6
+ shuntCompensatorCreationEmptyFormData,
7
+ shuntCompensatorCreationFormSchema,
8
+ shuntCompensatorCreationFormToDto
9
+ };
@@ -0,0 +1,20 @@
1
+ import { ModificationType } from '../../../../utils';
2
+ import { Property } from '../../common';
3
+ export interface ShuntCompensatorCreationDto {
4
+ type: ModificationType;
5
+ uuid?: string;
6
+ equipmentId: string;
7
+ equipmentName: string | null;
8
+ maxSusceptance: number | null;
9
+ maxQAtNominalV: number | null;
10
+ shuntCompensatorType: string | null;
11
+ sectionCount: number | null;
12
+ maximumSectionCount: number | null;
13
+ voltageLevelId: string;
14
+ busOrBusbarSectionId: string;
15
+ connectionDirection: string | null;
16
+ connectionName?: string | null;
17
+ connectionPosition?: number | null;
18
+ terminalConnected?: boolean | null;
19
+ properties: Property[] | null;
20
+ }
@@ -0,0 +1,110 @@
1
+ import { InferType } from 'yup';
2
+ import { DeepNullable } from '../../../../utils';
3
+ import { ShuntCompensatorCreationDto } from './shuntCompensatorCreation.types';
4
+ export declare const shuntCompensatorCreationFormSchema: import('yup').ObjectSchema<NonNullable<({
5
+ maxQAtNominalV: number | null;
6
+ maxSusceptance: number | null;
7
+ maximumSectionCount: number | null;
8
+ sectionCount: number | null;
9
+ switchedOnQAtNominalV: number | null | undefined;
10
+ switchedOnSusceptance: number | null | undefined;
11
+ characteristicsChoice: string;
12
+ shuntCompensatorType: string | null;
13
+ equipmentID: string;
14
+ equipmentName: string | null | undefined;
15
+ connectivity: {
16
+ terminalConnected?: boolean | null | undefined;
17
+ connectionDirection?: string | null | undefined;
18
+ connectionName?: string | undefined;
19
+ connectionPosition?: number | null | undefined;
20
+ busOrBusbarSection: {
21
+ id?: string | undefined;
22
+ } | null;
23
+ voltageLevel: {
24
+ id?: string | undefined;
25
+ } | null;
26
+ };
27
+ } | {
28
+ maxQAtNominalV: number | null;
29
+ maxSusceptance: number | null;
30
+ maximumSectionCount: number;
31
+ sectionCount: number;
32
+ switchedOnQAtNominalV: import('yup').Maybe<number | undefined>;
33
+ switchedOnSusceptance: import('yup').Maybe<number | undefined>;
34
+ characteristicsChoice: string;
35
+ shuntCompensatorType: string | null;
36
+ equipmentID: string;
37
+ equipmentName: string | null | undefined;
38
+ connectivity: {
39
+ terminalConnected?: boolean | null | undefined;
40
+ connectionDirection?: string | null | undefined;
41
+ connectionName?: string | undefined;
42
+ connectionPosition?: number | null | undefined;
43
+ busOrBusbarSection: {
44
+ id?: string | undefined;
45
+ } | null;
46
+ voltageLevel: {
47
+ id?: string | undefined;
48
+ } | null;
49
+ };
50
+ }) & {
51
+ AdditionalProperties: {
52
+ previousValue?: string | null | undefined;
53
+ added: NonNullable<boolean | undefined>;
54
+ deletionMark: NonNullable<boolean | undefined>;
55
+ name: string;
56
+ value: string;
57
+ }[] | undefined;
58
+ }>, import('yup').AnyObject, {
59
+ maxQAtNominalV: null;
60
+ maxSusceptance: null;
61
+ maximumSectionCount: null;
62
+ sectionCount: null;
63
+ switchedOnQAtNominalV: undefined;
64
+ switchedOnSusceptance: undefined;
65
+ characteristicsChoice: undefined;
66
+ shuntCompensatorType: null;
67
+ equipmentID: undefined;
68
+ equipmentName: undefined;
69
+ connectivity: {
70
+ voltageLevel: {
71
+ id: undefined;
72
+ };
73
+ busOrBusbarSection: {
74
+ id: undefined;
75
+ };
76
+ connectionDirection: undefined;
77
+ connectionName: undefined;
78
+ connectionPosition: undefined;
79
+ terminalConnected: undefined;
80
+ };
81
+ AdditionalProperties: "";
82
+ } | {
83
+ maxQAtNominalV: null;
84
+ maxSusceptance: null;
85
+ maximumSectionCount: undefined;
86
+ sectionCount: undefined;
87
+ switchedOnQAtNominalV: undefined;
88
+ switchedOnSusceptance: undefined;
89
+ characteristicsChoice: undefined;
90
+ shuntCompensatorType: null;
91
+ equipmentID: undefined;
92
+ equipmentName: undefined;
93
+ connectivity: {
94
+ voltageLevel: {
95
+ id: undefined;
96
+ };
97
+ busOrBusbarSection: {
98
+ id: undefined;
99
+ };
100
+ connectionDirection: undefined;
101
+ connectionName: undefined;
102
+ connectionPosition: undefined;
103
+ terminalConnected: undefined;
104
+ };
105
+ AdditionalProperties: "";
106
+ }, "">;
107
+ export type ShuntCompensatorCreationFormData = InferType<typeof shuntCompensatorCreationFormSchema>;
108
+ export declare const shuntCompensatorCreationEmptyFormData: DeepNullable<ShuntCompensatorCreationFormData>;
109
+ export declare const shuntCompensatorCreationDtoToForm: (shuntDto: ShuntCompensatorCreationDto) => ShuntCompensatorCreationFormData;
110
+ export declare const shuntCompensatorCreationFormToDto: (shuntForm: ShuntCompensatorCreationFormData) => ShuntCompensatorCreationDto;
@@ -0,0 +1,103 @@
1
+ import { object, string } from "yup";
2
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
+ import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
+ import "../../../../utils/conversionUtils.js";
5
+ import { UNDEFINED_CONNECTION_DIRECTION } from "../../../../utils/types/equipmentType.js";
6
+ import { ModificationType } from "../../../../utils/types/modificationType.js";
7
+ import "react/jsx-runtime";
8
+ import "@mui/icons-material";
9
+ import { sanitizeString } from "../../../../utils/ts-utils.js";
10
+ import "../../../../utils/yupConfig.js";
11
+ import "react";
12
+ import "react-hook-form";
13
+ import { creationPropertiesSchema, getFilledPropertiesFromModification, toModificationProperties } from "../../common/properties/propertyUtils.js";
14
+ import "@mui/material";
15
+ import "react-intl";
16
+ import "../../../overflowableText/OverflowableText.js";
17
+ import "localized-countries";
18
+ import "localized-countries/data/fr";
19
+ import "localized-countries/data/en";
20
+ import "notistack";
21
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
22
+ import "../../../treeViewFinder/TreeViewFinder.js";
23
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
24
+ import "../../../customAGGrid/customAggrid.js";
25
+ import "ag-grid-community";
26
+ import "react-papaparse";
27
+ import "react-csv-downloader";
28
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
29
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
30
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
31
+ import "@material-symbols/svg-400/outlined/arrows_input.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 "../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
36
+ import "@react-querybuilder/material";
37
+ import "../../../filter/expert/expertFilterConstants.js";
38
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
39
+ import "uuid";
40
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
41
+ import "react-querybuilder";
42
+ import { getConnectivityWithPositionSchema, getConnectivityWithPositionEmptyFormDataProps, getConnectivityFormDataProps } from "../../common/connectivity/connectivityForm.utils.js";
43
+ import { CHARACTERISTICS_CHOICES } from "../common/shuntCompensator.utils.js";
44
+ import { getCharacteristicsFormValidationSchema, getCharacteristicsEmptyFormData, getCharacteristicsFormData } from "../common/characteristicsForm.utils.js";
45
+ const shuntCompensatorCreationFormSchema = object().shape({
46
+ [FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED),
47
+ [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
48
+ [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(false),
49
+ ...getCharacteristicsFormValidationSchema(false)
50
+ }).concat(creationPropertiesSchema).required(YUP_REQUIRED);
51
+ const shuntCompensatorCreationEmptyFormData = {
52
+ [FieldConstants.EQUIPMENT_ID]: "",
53
+ [FieldConstants.EQUIPMENT_NAME]: "",
54
+ [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionEmptyFormDataProps(),
55
+ ...getCharacteristicsEmptyFormData(),
56
+ [FieldConstants.ADDITIONAL_PROPERTIES]: []
57
+ };
58
+ const shuntCompensatorCreationDtoToForm = (shuntDto) => ({
59
+ [FieldConstants.EQUIPMENT_ID]: shuntDto.equipmentId,
60
+ [FieldConstants.EQUIPMENT_NAME]: shuntDto.equipmentName ?? "",
61
+ [FieldConstants.CONNECTIVITY]: getConnectivityFormDataProps({
62
+ voltageLevelId: shuntDto.voltageLevelId,
63
+ busbarSectionId: shuntDto.busOrBusbarSectionId,
64
+ connectionDirection: shuntDto.connectionDirection,
65
+ connectionName: shuntDto.connectionName,
66
+ connectionPosition: shuntDto.connectionPosition,
67
+ terminalConnected: shuntDto.terminalConnected
68
+ }),
69
+ ...getCharacteristicsFormData({
70
+ maxSusceptance: shuntDto.maxSusceptance ?? null,
71
+ maxQAtNominalV: shuntDto.maxQAtNominalV ?? null,
72
+ shuntCompensatorType: shuntDto.shuntCompensatorType,
73
+ sectionCount: shuntDto.sectionCount,
74
+ maximumSectionCount: shuntDto.maximumSectionCount
75
+ }),
76
+ [FieldConstants.ADDITIONAL_PROPERTIES]: getFilledPropertiesFromModification(shuntDto?.properties)
77
+ });
78
+ const shuntCompensatorCreationFormToDto = (shuntForm) => {
79
+ const choice = shuntForm[FieldConstants.CHARACTERISTICS_CHOICE];
80
+ return {
81
+ type: ModificationType.SHUNT_COMPENSATOR_CREATION,
82
+ equipmentId: shuntForm[FieldConstants.EQUIPMENT_ID],
83
+ equipmentName: sanitizeString(shuntForm[FieldConstants.EQUIPMENT_NAME]),
84
+ maxSusceptance: choice === CHARACTERISTICS_CHOICES.SUSCEPTANCE.id ? shuntForm[FieldConstants.MAX_SUSCEPTANCE] ?? null : null,
85
+ maxQAtNominalV: choice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id ? shuntForm[FieldConstants.MAX_Q_AT_NOMINAL_V] ?? null : null,
86
+ shuntCompensatorType: choice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id ? shuntForm[FieldConstants.SHUNT_COMPENSATOR_TYPE] ?? null : null,
87
+ sectionCount: shuntForm[FieldConstants.SECTION_COUNT] ?? null,
88
+ maximumSectionCount: shuntForm[FieldConstants.MAXIMUM_SECTION_COUNT] ?? null,
89
+ voltageLevelId: shuntForm[FieldConstants.CONNECTIVITY]?.voltageLevel?.id ?? "",
90
+ busOrBusbarSectionId: shuntForm[FieldConstants.CONNECTIVITY]?.busOrBusbarSection?.id ?? "",
91
+ connectionDirection: shuntForm[FieldConstants.CONNECTIVITY]?.connectionDirection ?? UNDEFINED_CONNECTION_DIRECTION,
92
+ connectionName: sanitizeString(shuntForm[FieldConstants.CONNECTIVITY]?.connectionName),
93
+ connectionPosition: shuntForm[FieldConstants.CONNECTIVITY]?.connectionPosition ?? null,
94
+ terminalConnected: shuntForm[FieldConstants.CONNECTIVITY]?.terminalConnected ?? null,
95
+ properties: toModificationProperties(shuntForm)
96
+ };
97
+ };
98
+ export {
99
+ shuntCompensatorCreationDtoToForm,
100
+ shuntCompensatorCreationEmptyFormData,
101
+ shuntCompensatorCreationFormSchema,
102
+ shuntCompensatorCreationFormToDto
103
+ };
@@ -0,0 +1,8 @@
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 './common';
8
+ export * from './creation';
@@ -0,0 +1,20 @@
1
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./common/shuntCompensator.utils.js";
2
+ import { CharacteristicsForm } from "./common/CharacteristicsForm.js";
3
+ import { getCharacteristicsCreateFormDataFromSearchCopy, getCharacteristicsEmptyFormData, getCharacteristicsFormData, getCharacteristicsFormValidationSchema } from "./common/characteristicsForm.utils.js";
4
+ import { ShuntCompensatorCreationForm } from "./creation/ShuntCompensatorCreationForm.js";
5
+ import { shuntCompensatorCreationDtoToForm, shuntCompensatorCreationEmptyFormData, shuntCompensatorCreationFormSchema, shuntCompensatorCreationFormToDto } from "./creation/shuntCompensatorCreation.utils.js";
6
+ export {
7
+ CHARACTERISTICS_CHOICES,
8
+ CharacteristicsForm,
9
+ SHUNT_COMPENSATOR_TYPES,
10
+ ShuntCompensatorCreationForm,
11
+ computeSwitchedOnValue,
12
+ getCharacteristicsCreateFormDataFromSearchCopy,
13
+ getCharacteristicsEmptyFormData,
14
+ getCharacteristicsFormData,
15
+ getCharacteristicsFormValidationSchema,
16
+ shuntCompensatorCreationDtoToForm,
17
+ shuntCompensatorCreationEmptyFormData,
18
+ shuntCompensatorCreationFormSchema,
19
+ shuntCompensatorCreationFormToDto
20
+ };
@@ -37,7 +37,7 @@ import "uuid";
37
37
  import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
38
38
  import "react-querybuilder";
39
39
  import { VoltageLevelTab, VOLTAGE_LEVEL_TAB_FIELDS } from "./voltageLevel.constants.js";
40
- import "./tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js";
40
+ import "./voltageLevelCreation.utils.js";
41
41
  import { StructureTab } from "./tabs/structureTab/StructureTab.js";
42
42
  import { SubstationTab } from "./tabs/substationTab/SubstationTab.js";
43
43
  import { CharacteristicsTab } from "./tabs/characteristicsTab/CharacteristicsTab.js";
@@ -5,6 +5,7 @@
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
7
  export { SwitchesBetweenSections } from './tabs';
8
+ export { MAX_SECTIONS_COUNT } from './voltageLevel.constants';
8
9
  export * from './VoltageLevelCreationForm';
9
10
  export * from './voltageLevelCreation.utils';
10
11
  export * from './voltageLevelCreation.types';
@@ -1,6 +1,7 @@
1
1
  import { SwitchesBetweenSections } from "./tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js";
2
2
  import "react/jsx-runtime";
3
3
  import "@mui/material";
4
+ import "react";
4
5
  import "react-hook-form";
5
6
  import "react-intl";
6
7
  import "../../../overflowableText/OverflowableText.js";
@@ -8,7 +9,6 @@ import "../../../../utils/conversionUtils.js";
8
9
  import "../../../../utils/types/equipmentType.js";
9
10
  import "@mui/icons-material";
10
11
  import "../../../../utils/yupConfig.js";
11
- import "react";
12
12
  import "localized-countries";
13
13
  import "localized-countries/data/fr";
14
14
  import "localized-countries/data/en";
@@ -36,10 +36,12 @@ import "uuid";
36
36
  import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
37
37
  import "react-querybuilder";
38
38
  import "../../common/properties/propertyUtils.js";
39
+ import { MAX_SECTIONS_COUNT } from "./voltageLevel.constants.js";
39
40
  import { VoltageLevelCreationForm } from "./VoltageLevelCreationForm.js";
40
41
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./voltageLevelCreation.utils.js";
41
42
  import { SwitchKind } from "./voltageLevelCreation.types.js";
42
43
  export {
44
+ MAX_SECTIONS_COUNT,
43
45
  SWITCH_TYPE,
44
46
  SwitchKind,
45
47
  SwitchesBetweenSections,
@@ -1,6 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Grid } from "@mui/material";
3
- import { useWatch } from "react-hook-form";
3
+ import { useEffect } from "react";
4
+ import { useFormContext, useWatch } from "react-hook-form";
4
5
  import GridSection from "../../../../../grid/grid-section.js";
5
6
  import "react-intl";
6
7
  import "../../../../../overflowableText/OverflowableText.js";
@@ -9,7 +10,6 @@ import "../../../../../../utils/conversionUtils.js";
9
10
  import "../../../../../../utils/types/equipmentType.js";
10
11
  import "@mui/icons-material";
11
12
  import "../../../../../../utils/yupConfig.js";
12
- import "react";
13
13
  import "localized-countries";
14
14
  import "localized-countries/data/fr";
15
15
  import "localized-countries/data/en";
@@ -40,8 +40,12 @@ import "react-querybuilder";
40
40
  import { SwitchesBetweenSections } from "./switchesBetweenSections/SwitchesBetweenSections.js";
41
41
  import { CouplingOmnibusForm } from "./couplingOmnibus/CouplingOmnibusForm.js";
42
42
  function StructureTab() {
43
+ const { trigger } = useFormContext();
43
44
  const watchBusBarCount = useWatch({ name: FieldConstants.BUS_BAR_COUNT });
44
45
  const watchSectionCount = useWatch({ name: FieldConstants.SECTION_COUNT });
46
+ useEffect(() => {
47
+ trigger(FieldConstants.SECTION_COUNT);
48
+ }, [watchSectionCount, trigger]);
45
49
  const displayOmnibus = watchBusBarCount > 1 || watchSectionCount > 1;
46
50
  return /* @__PURE__ */ jsxs(Fragment, { children: [
47
51
  /* @__PURE__ */ jsx(GridSection, { title: "BusBarSections" }),
@@ -1,12 +1,12 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { IconButton } from "@mui/material";
3
- import { useState, useCallback, useRef, useEffect } from "react";
4
- import { useFormContext, useWatch } from "react-hook-form";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { Grid2 } from "@mui/material";
3
+ import { useCallback, useRef, useEffect } from "react";
4
+ import { useFormContext, useFieldArray, useWatch } from "react-hook-form";
5
5
  import { useIntl } from "react-intl";
6
- import { ArrowDropDown } from "@mui/icons-material";
7
6
  import { FieldConstants } from "../../../../../../../utils/constants/fieldConstants.js";
8
7
  import "../../../../../../../utils/conversionUtils.js";
9
8
  import "../../../../../../../utils/types/equipmentType.js";
9
+ import "@mui/icons-material";
10
10
  import "../../../../../../../utils/yupConfig.js";
11
11
  import { SwitchKind } from "../../../voltageLevelCreation.types.js";
12
12
  import "../../../../../../overflowableText/OverflowableText.js";
@@ -22,8 +22,8 @@ import "../../../../../../customAGGrid/customAggrid.js";
22
22
  import "ag-grid-community";
23
23
  import "react-papaparse";
24
24
  import "react-csv-downloader";
25
- import { TextInput } from "../../../../../../inputs/reactHookForm/text/TextInput.js";
26
25
  import "../../../../../../inputs/reactHookForm/numbers/RangeInput.js";
26
+ import { EnumInput } from "../../../../../../inputs/reactHookForm/selectInputs/EnumInput.js";
27
27
  import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
28
28
  import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
29
29
  import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
@@ -37,23 +37,16 @@ import "../../../../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
37
37
  import "uuid";
38
38
  import "../../../../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
39
39
  import "react-querybuilder";
40
- import { CreateSwitchesDialog } from "./creation/CreateSwitchesDialog.js";
41
40
  import GridSection from "../../../../../../grid/grid-section.js";
41
+ import { SWITCH_TYPE } from "../../../voltageLevelCreation.utils.js";
42
+ import { MAX_SECTIONS_COUNT } from "../../../voltageLevel.constants.js";
42
43
  function SwitchesBetweenSections() {
43
- const { getValues, setValue } = useFormContext();
44
- const [openCreateSwitchesDialog, setOpenCreateSwitchesDialog] = useState(false);
44
+ const { setValue } = useFormContext();
45
+ const { fields: rows } = useFieldArray({ name: `${FieldConstants.SWITCH_KINDS}` });
45
46
  const watchSectionCount = useWatch({ name: FieldConstants.SECTION_COUNT });
46
47
  const watchSwitchesBetweenSections = useWatch({
47
48
  name: FieldConstants.SWITCHES_BETWEEN_SECTIONS
48
49
  });
49
- const addIconAdornment = useCallback((clickCallback) => {
50
- return /* @__PURE__ */ jsx(IconButton, { onClick: clickCallback, children: /* @__PURE__ */ jsx(ArrowDropDown, {}) });
51
- }, []);
52
- const handleClickOpenSwitchesPane = useCallback(() => {
53
- if (watchSectionCount > 1) {
54
- setOpenCreateSwitchesDialog(true);
55
- }
56
- }, [watchSectionCount]);
57
50
  const intl = useIntl();
58
51
  const setSwitchesKinds = useCallback(
59
52
  (data) => {
@@ -68,19 +61,13 @@ function SwitchesBetweenSections() {
68
61
  },
69
62
  [intl, setValue]
70
63
  );
71
- const handleCreateSwitchesDialog = useCallback(
72
- (data) => {
73
- setSwitchesKinds(data);
74
- },
75
- [setSwitchesKinds]
76
- );
77
64
  const sectionCountRef = useRef(watchSectionCount);
78
65
  const switchesBetweenSectionsRef = useRef(watchSwitchesBetweenSections);
79
66
  useEffect(() => {
80
67
  if (sectionCountRef.current !== watchSectionCount && switchesBetweenSectionsRef.current === watchSwitchesBetweenSections) {
81
68
  const initialKindDisconnector = { switchKind: SwitchKind.DISCONNECTOR };
82
69
  let list = [];
83
- if (watchSectionCount >= 1) {
70
+ if (watchSectionCount >= 1 && watchSectionCount <= MAX_SECTIONS_COUNT) {
84
71
  list = new Array(watchSectionCount - 1).fill(initialKindDisconnector);
85
72
  }
86
73
  const data = { switchKinds: list };
@@ -89,32 +76,24 @@ function SwitchesBetweenSections() {
89
76
  sectionCountRef.current = watchSectionCount;
90
77
  switchesBetweenSectionsRef.current = watchSwitchesBetweenSections;
91
78
  }, [watchSectionCount, watchSwitchesBetweenSections, setSwitchesKinds]);
92
- if (Number.isNaN(watchSectionCount) || watchSectionCount <= 1) {
79
+ if (Number.isNaN(watchSectionCount) || watchSectionCount <= 1 || watchSectionCount > MAX_SECTIONS_COUNT) {
93
80
  return null;
94
81
  }
95
82
  return /* @__PURE__ */ jsxs(Fragment, { children: [
96
83
  /* @__PURE__ */ jsx(GridSection, { title: "SwitchesBetweenSections" }),
97
- /* @__PURE__ */ jsx(
98
- TextInput,
84
+ /* @__PURE__ */ jsx(Grid2, { container: true, spacing: 2, pt: 1, children: rows.map((value, index) => /* @__PURE__ */ jsx(Grid2, { size: 4, children: /* @__PURE__ */ jsx(
85
+ EnumInput,
99
86
  {
100
- name: FieldConstants.SWITCHES_BETWEEN_SECTIONS,
101
- label: "SwitchesBetweenSections",
102
- formProps: {
103
- multiline: true
87
+ options: Object.values(SWITCH_TYPE),
88
+ name: `${FieldConstants.SWITCH_KINDS}.${index}.${FieldConstants.SWITCH_KIND}`,
89
+ label: "SwitchBetweenSectionsLabel",
90
+ labelValues: {
91
+ index1: String(index + 1),
92
+ index2: String(index + 2)
104
93
  },
105
- customAdornment: addIconAdornment(handleClickOpenSwitchesPane)
106
- }
107
- ),
108
- openCreateSwitchesDialog && /* @__PURE__ */ jsx(
109
- CreateSwitchesDialog,
110
- {
111
- openCreateSwitchesDialog,
112
- setOpenCreateSwitchesDialog,
113
- handleCreateSwitchesDialog,
114
- sectionCount: getValues(FieldConstants.SECTION_COUNT),
115
- switchKinds: getValues(FieldConstants.SWITCH_KINDS)
94
+ size: "small"
116
95
  }
117
- )
96
+ ) }, value.id)) })
118
97
  ] });
119
98
  }
120
99
  export {
@@ -1,4 +1,5 @@
1
1
  import { FieldConstants } from '../../../../utils';
2
+ export declare const MAX_SECTIONS_COUNT = 20;
2
3
  export declare enum VoltageLevelTab {
3
4
  SUBSTATION_TAB = 0,
4
5
  CHARACTERISTICS_TAB = 1,
@@ -4,6 +4,7 @@ import "../../../../utils/types/equipmentType.js";
4
4
  import "react/jsx-runtime";
5
5
  import "@mui/icons-material";
6
6
  import "../../../../utils/yupConfig.js";
7
+ const MAX_SECTIONS_COUNT = 20;
7
8
  var VoltageLevelTab = /* @__PURE__ */ ((VoltageLevelTab2) => {
8
9
  VoltageLevelTab2[VoltageLevelTab2["SUBSTATION_TAB"] = 0] = "SUBSTATION_TAB";
9
10
  VoltageLevelTab2[VoltageLevelTab2["CHARACTERISTICS_TAB"] = 1] = "CHARACTERISTICS_TAB";
@@ -52,6 +53,7 @@ const VOLTAGE_LEVEL_TAB_FIELDS = {
52
53
  ]: [FieldConstants.ADDITIONAL_PROPERTIES]
53
54
  };
54
55
  export {
56
+ MAX_SECTIONS_COUNT,
55
57
  VOLTAGE_LEVEL_TAB_FIELDS,
56
58
  VoltageLevelTab
57
59
  };
@@ -10,6 +10,7 @@ import "react/jsx-runtime";
10
10
  import "@mui/icons-material";
11
11
  import { sanitizeString } from "../../../../utils/ts-utils.js";
12
12
  import "../../../../utils/yupConfig.js";
13
+ import { MAX_SECTIONS_COUNT } from "./voltageLevel.constants.js";
13
14
  import "@mui/material";
14
15
  import "react-intl";
15
16
  import "../../../overflowableText/OverflowableText.js";
@@ -122,7 +123,7 @@ const voltageLevelCreationFormSchema = object().shape({
122
123
  }),
123
124
  [FieldConstants.SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
124
125
  is: (hideBusBarSection) => !hideBusBarSection,
125
- then: (schema) => schema.min(1, "SectionCountMustBeGreaterThanOrEqualToOne").required(YUP_REQUIRED)
126
+ then: (schema) => schema.min(1, "SectionCountMustBeGreaterThanOrEqualToOne").max(MAX_SECTIONS_COUNT, "SectionCountMustBeLessThanOrEqualToTwenty").required(YUP_REQUIRED)
126
127
  }),
127
128
  [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: string().nullable().when([FieldConstants.SECTION_COUNT], {
128
129
  is: (sectionCount) => sectionCount > 1,
@@ -1,6 +1,7 @@
1
1
  import { SwitchesBetweenSections } from "./creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js";
2
2
  import "react/jsx-runtime";
3
3
  import "@mui/material";
4
+ import "react";
4
5
  import "react-hook-form";
5
6
  import "react-intl";
6
7
  import "../../overflowableText/OverflowableText.js";
@@ -8,7 +9,6 @@ import "../../../utils/conversionUtils.js";
8
9
  import "../../../utils/types/equipmentType.js";
9
10
  import "@mui/icons-material";
10
11
  import "../../../utils/yupConfig.js";
11
- import "react";
12
12
  import "localized-countries";
13
13
  import "localized-countries/data/fr";
14
14
  import "localized-countries/data/en";
@@ -36,12 +36,14 @@ import "uuid";
36
36
  import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
37
37
  import "react-querybuilder";
38
38
  import "../common/properties/propertyUtils.js";
39
+ import { MAX_SECTIONS_COUNT } from "./creation/voltageLevel.constants.js";
39
40
  import { VoltageLevelCreationForm } from "./creation/VoltageLevelCreationForm.js";
40
41
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./creation/voltageLevelCreation.utils.js";
41
42
  import { SwitchKind } from "./creation/voltageLevelCreation.types.js";
42
43
  import { VoltageLevelModificationForm } from "./modification/VoltageLevelModificationForm.js";
43
44
  import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto } from "./modification/voltageLevelModification.utils.js";
44
45
  export {
46
+ MAX_SECTIONS_COUNT,
45
47
  SWITCH_TYPE,
46
48
  SwitchKind,
47
49
  SwitchesBetweenSections,