@gridsuite/commons-ui 0.177.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 (55) 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/index.js +26 -1
  46. package/dist/services/index.js +2 -1
  47. package/dist/services/networkModification.d.ts +1 -0
  48. package/dist/services/networkModification.js +15 -1
  49. package/dist/translations/en/networkModificationsEn.d.ts +35 -0
  50. package/dist/translations/en/networkModificationsEn.js +35 -0
  51. package/dist/translations/fr/networkModificationsFr.d.ts +35 -0
  52. package/dist/translations/fr/networkModificationsFr.js +35 -0
  53. package/dist/utils/constants/fieldConstants.d.ts +22 -1
  54. package/dist/utils/constants/fieldConstants.js +21 -0
  55. package/package.json +1 -1
@@ -85,6 +85,7 @@ import { CountriesInput } from "./inputs/reactHookForm/selectInputs/CountriesInp
85
85
  import { InputWithPopupConfirmation } from "./inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
86
86
  import { MuiSelectInput } from "./inputs/reactHookForm/selectInputs/MuiSelectInput.js";
87
87
  import { SelectInput } from "./inputs/reactHookForm/selectInputs/SelectInput.js";
88
+ import { EnumInput } from "./inputs/reactHookForm/selectInputs/EnumInput.js";
88
89
  import { TableNumericalInput } from "./inputs/reactHookForm/tableInputs/table-numerical-input.js";
89
90
  import { TableTextInput } from "./inputs/reactHookForm/tableInputs/table-text-input.js";
90
91
  import { DescriptionField } from "./inputs/reactHookForm/text/DescriptionField.js";
@@ -190,6 +191,13 @@ import { SubstationCreationForm } from "./network-modifications/substation/creat
190
191
  import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./network-modifications/substation/creation/substationCreation.utils.js";
191
192
  import { SubstationModificationForm } from "./network-modifications/substation/modification/SubstationModificationForm.js";
192
193
  import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./network-modifications/substation/modification/substationModification.utils.js";
194
+ import { CreateSwitchesDialog } from "./network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.js";
195
+ import { SwitchesBetweenSections } from "./network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.js";
196
+ import { CouplingOmnibusForm } from "./network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.js";
197
+ import { CouplingOmnibusCreation } from "./network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.js";
198
+ import { VoltageLevelCreationForm } from "./network-modifications/voltage-level/creation/VoltageLevelCreationForm.js";
199
+ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./network-modifications/voltage-level/creation/voltageLevelCreation.utils.js";
200
+ import { SwitchKind } from "./network-modifications/voltage-level/creation/voltageLevelCreation.types.js";
193
201
  export {
194
202
  ACCURACY,
195
203
  ACTIVE,
@@ -241,7 +249,10 @@ export {
241
249
  CountriesInput,
242
250
  CountrySelectionInput,
243
251
  CountryValueEditor,
252
+ CouplingOmnibusCreation,
253
+ CouplingOmnibusForm,
244
254
  CreateParameterDialog,
255
+ CreateSwitchesDialog,
245
256
  CsvExport,
246
257
  CsvUploader,
247
258
  CustomAGGrid,
@@ -292,6 +303,7 @@ export {
292
303
  ElementSearchDialog,
293
304
  ElementSearchInput,
294
305
  ElementValueEditor,
306
+ EnumInput,
295
307
  EquipmentItem,
296
308
  EquipmentsSelectionType,
297
309
  ErrorCellRenderer,
@@ -474,6 +486,7 @@ export {
474
486
  STOP_TIME,
475
487
  SUBSTATION_LAYOUT,
476
488
  SVAR_REGULATION_MODE_OPTIONS,
489
+ SWITCH_TYPE,
477
490
  SecurityAnalysisParametersDialog,
478
491
  SecurityAnalysisParametersInline,
479
492
  SelectClearable,
@@ -499,7 +512,9 @@ export {
499
512
  SubstationLayout,
500
513
  SubstationModificationForm,
501
514
  SwitchInput,
515
+ SwitchKind,
502
516
  SwitchWithLabel,
517
+ SwitchesBetweenSections,
503
518
  TAB_INFO,
504
519
  TRANSFORMERS_SELECTION_TYPE,
505
520
  TWT_SPLIT_SHUNT_ADMITTANCE,
@@ -534,8 +549,10 @@ export {
534
549
  VoltageInitParametersEditionDialog,
535
550
  VoltageInitParametersInLine,
536
551
  VoltageInitTabValues,
552
+ VoltageLevelCreationForm,
537
553
  WRITE_SLACK_BUS,
538
554
  alertThresholdMarks,
555
+ buildNewBusbarSections,
539
556
  copyEquipmentPropertiesForCreation,
540
557
  countRules,
541
558
  createPropertyModification,
@@ -555,6 +572,8 @@ export {
555
572
  generateTreeViewFinderClass,
556
573
  getConcatenatedProperties,
557
574
  getContingencyListsInfosFormSchema,
575
+ getCreateSwitchesEmptyFormData,
576
+ getCreateSwitchesValidationSchema,
558
577
  getExpertFilterEmptyFormData,
559
578
  getExplicitNamingFilterEmptyFormData,
560
579
  getFilledPropertiesFromModification,
@@ -606,6 +625,7 @@ export {
606
625
  toFormValuesContingencyListsInfos,
607
626
  toFormValuesLimitReductions,
608
627
  toModificationProperties,
628
+ translateSwitchKinds,
609
629
  unscrollableDialogStyles,
610
630
  useConvertValue,
611
631
  useCsvExport,
@@ -614,5 +634,9 @@ export {
614
634
  useGlobalAnnouncement,
615
635
  useListenerManager,
616
636
  useNotificationsListener,
617
- useValid
637
+ useValid,
638
+ voltageLevelCreationDtoToForm,
639
+ voltageLevelCreationEmptyFormData,
640
+ voltageLevelCreationFormSchema,
641
+ voltageLevelCreationFormToDto
618
642
  };
@@ -28,6 +28,7 @@ import { CountriesInput } from "./reactHookForm/selectInputs/CountriesInput.js";
28
28
  import { InputWithPopupConfirmation } from "./reactHookForm/selectInputs/InputWithPopupConfirmation.js";
29
29
  import { MuiSelectInput } from "./reactHookForm/selectInputs/MuiSelectInput.js";
30
30
  import { SelectInput } from "./reactHookForm/selectInputs/SelectInput.js";
31
+ import { EnumInput } from "./reactHookForm/selectInputs/EnumInput.js";
31
32
  import { TableNumericalInput } from "./reactHookForm/tableInputs/table-numerical-input.js";
32
33
  import { TableTextInput } from "./reactHookForm/tableInputs/table-text-input.js";
33
34
  import { DescriptionField } from "./reactHookForm/text/DescriptionField.js";
@@ -86,6 +87,7 @@ export {
86
87
  DescriptionInput,
87
88
  DirectoryItemsInput,
88
89
  ElementValueEditor,
90
+ EnumInput,
89
91
  ErrorInput,
90
92
  ExpandableInput,
91
93
  ExpandingTextField,
@@ -27,6 +27,7 @@ import { CountriesInput } from "./selectInputs/CountriesInput.js";
27
27
  import { InputWithPopupConfirmation } from "./selectInputs/InputWithPopupConfirmation.js";
28
28
  import { MuiSelectInput } from "./selectInputs/MuiSelectInput.js";
29
29
  import { SelectInput } from "./selectInputs/SelectInput.js";
30
+ import { EnumInput } from "./selectInputs/EnumInput.js";
30
31
  import { TableNumericalInput } from "./tableInputs/table-numerical-input.js";
31
32
  import { TableTextInput } from "./tableInputs/table-text-input.js";
32
33
  import { DescriptionField } from "./text/DescriptionField.js";
@@ -61,6 +62,7 @@ export {
61
62
  DescriptionField,
62
63
  DescriptionInput,
63
64
  DirectoryItemsInput,
65
+ EnumInput,
64
66
  ErrorInput,
65
67
  ExpandableInput,
66
68
  ExpandingTextField,
@@ -6,7 +6,7 @@ function IntegerInput(props) {
6
6
  if (value === "-") {
7
7
  return value;
8
8
  }
9
- return value === null || typeof value === "number" && Number.isNaN(value) ? "" : value.toString();
9
+ return value === null || value === void 0 || typeof value === "number" && Number.isNaN(value) ? "" : value.toString();
10
10
  };
11
11
  const outputTransform = (value) => {
12
12
  if (value === "-") {
@@ -0,0 +1,18 @@
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
+ interface EnumInputProps<T> {
8
+ options: T[];
9
+ name: string;
10
+ label: string;
11
+ size: 'small' | 'medium';
12
+ labelValues: Record<string, string>;
13
+ }
14
+ export declare function EnumInput<T extends {
15
+ id: string;
16
+ label: string;
17
+ }>({ options, name, label, size, labelValues, }: Readonly<EnumInputProps<T>>): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,28 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { FormControl, InputLabel, Select, MenuItem, FormHelperText } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { useController } from "react-hook-form";
5
+ import { FieldLabel } from "../utils/FieldLabel.js";
6
+ import "react";
7
+ import "@mui/icons-material";
8
+ import "yup";
9
+ function EnumInput({
10
+ options,
11
+ name,
12
+ label,
13
+ size,
14
+ labelValues
15
+ }) {
16
+ const {
17
+ field: { onChange, value },
18
+ fieldState: { error }
19
+ } = useController({ name });
20
+ return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, size, error: !!error, children: [
21
+ /* @__PURE__ */ jsx(InputLabel, { id: "enum-type-label", children: /* @__PURE__ */ jsx(FieldLabel, { label, values: labelValues }) }),
22
+ /* @__PURE__ */ jsx(Select, { label, id: label, value, fullWidth: true, onChange, children: options.map((e) => /* @__PURE__ */ jsx(MenuItem, { value: e.id, children: /* @__PURE__ */ jsx("em", { children: /* @__PURE__ */ jsx(FormattedMessage, { id: e.label }) }) }, e.label)) }),
23
+ error?.message && /* @__PURE__ */ jsx(FormHelperText, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: error.message }) })
24
+ ] });
25
+ }
26
+ export {
27
+ EnumInput
28
+ };
@@ -8,3 +8,4 @@ export * from './CountriesInput';
8
8
  export * from './InputWithPopupConfirmation';
9
9
  export * from './MuiSelectInput';
10
10
  export * from './SelectInput';
11
+ export * from './EnumInput';
@@ -2,8 +2,10 @@ import { CountriesInput } from "./CountriesInput.js";
2
2
  import { InputWithPopupConfirmation } from "./InputWithPopupConfirmation.js";
3
3
  import { MuiSelectInput } from "./MuiSelectInput.js";
4
4
  import { SelectInput } from "./SelectInput.js";
5
+ import { EnumInput } from "./EnumInput.js";
5
6
  export {
6
7
  CountriesInput,
8
+ EnumInput,
7
9
  InputWithPopupConfirmation,
8
10
  MuiSelectInput,
9
11
  SelectInput
@@ -6,3 +6,4 @@
6
6
  */
7
7
  export * from './common';
8
8
  export * from './substation';
9
+ export * from './voltage-level';
@@ -6,11 +6,26 @@ import { SubstationCreationForm } from "./substation/creation/SubstationCreation
6
6
  import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./substation/creation/substationCreation.utils.js";
7
7
  import { SubstationModificationForm } from "./substation/modification/SubstationModificationForm.js";
8
8
  import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./substation/modification/substationModification.utils.js";
9
+ import { CreateSwitchesDialog } from "./voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.js";
10
+ import { SwitchesBetweenSections } from "./voltage-level/creation/switches-between-sections/SwitchesBetweenSections.js";
11
+ import { CouplingOmnibusForm } from "./voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.js";
12
+ import { CouplingOmnibusCreation } from "./voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.js";
13
+ import { VoltageLevelCreationForm } from "./voltage-level/creation/VoltageLevelCreationForm.js";
14
+ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./voltage-level/creation/voltageLevelCreation.utils.js";
15
+ import { SwitchKind } from "./voltage-level/creation/voltageLevelCreation.types.js";
9
16
  export {
17
+ CouplingOmnibusCreation,
18
+ CouplingOmnibusForm,
19
+ CreateSwitchesDialog,
10
20
  PropertiesForm,
11
21
  PropertyForm,
22
+ SWITCH_TYPE,
12
23
  SubstationCreationForm,
13
24
  SubstationModificationForm,
25
+ SwitchKind,
26
+ SwitchesBetweenSections,
27
+ VoltageLevelCreationForm,
28
+ buildNewBusbarSections,
14
29
  copyEquipmentPropertiesForCreation,
15
30
  createPropertyModification,
16
31
  creationPropertiesSchema,
@@ -18,6 +33,8 @@ export {
18
33
  fetchPredefinedProperties,
19
34
  filledTextField,
20
35
  getConcatenatedProperties,
36
+ getCreateSwitchesEmptyFormData,
37
+ getCreateSwitchesValidationSchema,
21
38
  getFilledPropertiesFromModification,
22
39
  getPropertiesFromModification,
23
40
  getPropertyValue,
@@ -34,5 +51,10 @@ export {
34
51
  substationModificationEmptyFormData,
35
52
  substationModificationFormSchema,
36
53
  substationModificationFormToDto,
37
- toModificationProperties
54
+ toModificationProperties,
55
+ translateSwitchKinds,
56
+ voltageLevelCreationDtoToForm,
57
+ voltageLevelCreationEmptyFormData,
58
+ voltageLevelCreationFormSchema,
59
+ voltageLevelCreationFormToDto
38
60
  };
@@ -0,0 +1,11 @@
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 interface VoltageLevelCreationFormProps {
8
+ substationOptions?: string[];
9
+ showDeleteSubstationButton?: boolean;
10
+ }
11
+ export declare function VoltageLevelCreationForm({ substationOptions, showDeleteSubstationButton, }?: VoltageLevelCreationFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,174 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useCallback } from "react";
3
+ import { Grid, Box } from "@mui/material";
4
+ import { useFormContext, useWatch } from "react-hook-form";
5
+ import GridItem from "../../../grid/grid-item.js";
6
+ import GridSection from "../../../grid/grid-section.js";
7
+ import "react-intl";
8
+ import "../../../overflowableText/OverflowableText.js";
9
+ import { VoltageAdornment, KiloAmpereAdornment } from "../../../../utils/constants/adornments.js";
10
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
11
+ import "../../../../utils/conversionUtils.js";
12
+ import "../../../../utils/types/equipmentType.js";
13
+ import "@mui/icons-material";
14
+ import "../../../../utils/yupConfig.js";
15
+ import { fetchDefaultCountry } from "../../../../services/appsMetadata.js";
16
+ import "localized-countries";
17
+ import "localized-countries/data/fr";
18
+ import "localized-countries/data/en";
19
+ import "notistack";
20
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
21
+ import "yup";
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 { AutocompleteInput } from "../../../inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
29
+ import { FloatInput } from "../../../inputs/reactHookForm/numbers/FloatInput.js";
30
+ import { IntegerInput } from "../../../inputs/reactHookForm/numbers/IntegerInput.js";
31
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
32
+ import { TextInput } from "../../../inputs/reactHookForm/text/TextInput.js";
33
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
34
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
35
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
36
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
37
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
38
+ import "@react-querybuilder/material";
39
+ import "../../../filter/expert/expertFilterConstants.js";
40
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
41
+ import "uuid";
42
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
43
+ import "react-querybuilder";
44
+ import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
45
+ import "./switches-between-sections/creation/CreateSwitchesDialog.js";
46
+ import { SwitchesBetweenSections } from "./switches-between-sections/SwitchesBetweenSections.js";
47
+ import { CouplingOmnibusForm } from "./coupling-omnibus/CouplingOmnibusForm.js";
48
+ import { SubstationCreationSection } from "./substation-creation/SubstationCreationSection.js";
49
+ import { SubstationAutocompleteAddButton } from "./substation-creation/SubstationAutocompleteAddButton.js";
50
+ function VoltageLevelCreationForm({
51
+ substationOptions,
52
+ showDeleteSubstationButton = true
53
+ } = {}) {
54
+ const { setValue, getValues } = useFormContext();
55
+ const watchAddSubstationCreation = useWatch({ name: FieldConstants.ADD_SUBSTATION_CREATION });
56
+ const watchHideNominalVoltage = useWatch({ name: FieldConstants.HIDE_NOMINAL_VOLTAGE });
57
+ const watchHideBusBarSection = useWatch({ name: FieldConstants.HIDE_BUS_BAR_SECTION });
58
+ const watchBusBarCount = useWatch({ name: FieldConstants.BUS_BAR_COUNT });
59
+ const watchSectionCount = useWatch({ name: FieldConstants.SECTION_COUNT });
60
+ const displayOmnibus = watchBusBarCount > 1 || watchSectionCount > 1;
61
+ useEffect(() => {
62
+ if (watchAddSubstationCreation && !getValues(FieldConstants.COUNTRY)) {
63
+ fetchDefaultCountry().then((country) => {
64
+ if (country) {
65
+ setValue(FieldConstants.COUNTRY, country);
66
+ }
67
+ });
68
+ }
69
+ }, [setValue, getValues, watchAddSubstationCreation]);
70
+ const handleDeleteSubstationCreation = useCallback(() => {
71
+ setValue(FieldConstants.ADD_SUBSTATION_CREATION, false);
72
+ setValue(FieldConstants.SUBSTATION_CREATION_ID, null);
73
+ setValue(FieldConstants.SUBSTATION_NAME, null);
74
+ setValue(FieldConstants.COUNTRY, null);
75
+ }, [setValue]);
76
+ const substationField = substationOptions ? /* @__PURE__ */ jsx(
77
+ AutocompleteInput,
78
+ {
79
+ openOnFocus: true,
80
+ forcePopupIcon: true,
81
+ name: FieldConstants.SUBSTATION_ID,
82
+ label: "SUBSTATION",
83
+ options: substationOptions,
84
+ size: "small",
85
+ formProps: { margin: "normal" },
86
+ allowNewValue: true,
87
+ PaperComponent: SubstationAutocompleteAddButton,
88
+ noOptionsText: ""
89
+ }
90
+ ) : /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.SUBSTATION_ID, label: "SUBSTATION", formProps: { margin: "normal" } });
91
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
92
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
93
+ /* @__PURE__ */ jsx(GridItem, { children: /* @__PURE__ */ jsx(
94
+ TextInput,
95
+ {
96
+ name: FieldConstants.EQUIPMENT_ID,
97
+ label: "ID",
98
+ formProps: { autoFocus: true, margin: "normal" }
99
+ }
100
+ ) }),
101
+ /* @__PURE__ */ jsx(GridItem, { children: /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.EQUIPMENT_NAME, label: "Name", formProps: { margin: "normal" } }) })
102
+ ] }),
103
+ watchAddSubstationCreation ? /* @__PURE__ */ jsx(
104
+ SubstationCreationSection,
105
+ {
106
+ showDeleteButton: showDeleteSubstationButton,
107
+ onDelete: handleDeleteSubstationCreation
108
+ }
109
+ ) : /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sm: 6, children: substationField }) }),
110
+ /* @__PURE__ */ jsx(GridSection, { title: "VoltageText" }),
111
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
112
+ !watchHideNominalVoltage && /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
113
+ FloatInput,
114
+ {
115
+ name: FieldConstants.NOMINAL_V,
116
+ label: "NominalVoltage",
117
+ adornment: VoltageAdornment
118
+ }
119
+ ) }),
120
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
121
+ FloatInput,
122
+ {
123
+ name: FieldConstants.LOW_VOLTAGE_LIMIT,
124
+ label: "LowVoltageLimit",
125
+ adornment: VoltageAdornment
126
+ }
127
+ ) }),
128
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
129
+ FloatInput,
130
+ {
131
+ name: FieldConstants.HIGH_VOLTAGE_LIMIT,
132
+ label: "HighVoltageLimit",
133
+ adornment: VoltageAdornment
134
+ }
135
+ ) })
136
+ ] }),
137
+ /* @__PURE__ */ jsx(GridSection, { title: "ShortCircuit" }),
138
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
139
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
140
+ FloatInput,
141
+ {
142
+ name: FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
143
+ label: "LowShortCircuitCurrentLimit",
144
+ adornment: KiloAmpereAdornment
145
+ }
146
+ ) }),
147
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
148
+ FloatInput,
149
+ {
150
+ name: FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
151
+ label: "HighShortCircuitCurrentLimit",
152
+ adornment: KiloAmpereAdornment
153
+ }
154
+ ) }),
155
+ /* @__PURE__ */ jsx(Box, { sx: { width: "100%" } })
156
+ ] }),
157
+ !watchHideBusBarSection && /* @__PURE__ */ jsxs(Fragment, { children: [
158
+ /* @__PURE__ */ jsx(GridSection, { title: "BusBarSections" }),
159
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
160
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(IntegerInput, { name: FieldConstants.BUS_BAR_COUNT, label: "BusBarCount" }) }),
161
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(IntegerInput, { name: FieldConstants.SECTION_COUNT, label: "numberOfSections" }) }),
162
+ /* @__PURE__ */ jsx(SwitchesBetweenSections, {})
163
+ ] }),
164
+ displayOmnibus && /* @__PURE__ */ jsxs(Fragment, { children: [
165
+ /* @__PURE__ */ jsx(GridSection, { title: "Coupling_Omnibus" }),
166
+ /* @__PURE__ */ jsx(Grid, { container: true, children: /* @__PURE__ */ jsx(GridItem, { size: 12, children: /* @__PURE__ */ jsx(CouplingOmnibusForm, {}) }) })
167
+ ] })
168
+ ] }),
169
+ /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel" })
170
+ ] });
171
+ }
172
+ export {
173
+ VoltageLevelCreationForm
174
+ };
@@ -0,0 +1,7 @@
1
+ import { Option } from '../../../../../utils/types/types';
2
+ interface CouplingOmnibusCreationProps {
3
+ index: number;
4
+ sectionOptions: Option[];
5
+ }
6
+ export declare function CouplingOmnibusCreation({ index, sectionOptions }: Readonly<CouplingOmnibusCreationProps>): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,54 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { useFormContext } from "react-hook-form";
4
+ import { AutocompleteInput } from "../../../../inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
5
+ import GridItem from "../../../../grid/grid-item.js";
6
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
7
+ import "../../../../../utils/conversionUtils.js";
8
+ import "../../../../../utils/types/equipmentType.js";
9
+ import "@mui/icons-material";
10
+ import "../../../../../utils/yupConfig.js";
11
+ function CouplingOmnibusCreation({ index, sectionOptions }) {
12
+ const { getValues, trigger, subscribe } = useFormContext();
13
+ useEffect(() => {
14
+ const unsubscribe = subscribe({
15
+ name: [`${FieldConstants.COUPLING_OMNIBUS}.${index}.${FieldConstants.BUS_BAR_SECTION_ID1}`],
16
+ formState: {
17
+ values: true
18
+ },
19
+ callback: () => {
20
+ if (getValues(`${FieldConstants.COUPLING_OMNIBUS}.${index}.${FieldConstants.BUS_BAR_SECTION_ID2}`)) {
21
+ trigger(`${FieldConstants.COUPLING_OMNIBUS}.${index}.${FieldConstants.BUS_BAR_SECTION_ID2}`);
22
+ }
23
+ }
24
+ });
25
+ return () => unsubscribe();
26
+ }, [subscribe, trigger, getValues, index]);
27
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
29
+ AutocompleteInput,
30
+ {
31
+ allowNewValue: true,
32
+ forcePopupIcon: true,
33
+ name: `${FieldConstants.COUPLING_OMNIBUS}.${index}.${FieldConstants.BUS_BAR_SECTION_ID1}`,
34
+ label: "BusBarSectionID1",
35
+ options: sectionOptions ?? [],
36
+ size: "small"
37
+ }
38
+ ) }),
39
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
40
+ AutocompleteInput,
41
+ {
42
+ allowNewValue: true,
43
+ forcePopupIcon: true,
44
+ name: `${FieldConstants.COUPLING_OMNIBUS}.${index}.${FieldConstants.BUS_BAR_SECTION_ID2}`,
45
+ label: "BusBarSectionID2",
46
+ options: sectionOptions ?? [],
47
+ size: "small"
48
+ }
49
+ ) })
50
+ ] });
51
+ }
52
+ export {
53
+ CouplingOmnibusCreation
54
+ };
@@ -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 declare function CouplingOmnibusForm(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { useFormContext } from "react-hook-form";
4
+ import { CouplingOmnibusCreation } from "./CouplingOmnibusCreation.js";
5
+ import { ExpandableInput } from "../../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
6
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
7
+ import "../../../../../utils/conversionUtils.js";
8
+ import "../../../../../utils/types/equipmentType.js";
9
+ import "@mui/icons-material";
10
+ import "../../../../../utils/yupConfig.js";
11
+ import { fetchBusBarSectionsForNewCoupler } from "../../../../../services/networkModification.js";
12
+ function CouplingOmnibusForm() {
13
+ const { setValue, subscribe, trigger, getValues, formState } = useFormContext();
14
+ const couplingOmnibusCreation = {
15
+ [FieldConstants.BUS_BAR_SECTION_ID1]: null,
16
+ [FieldConstants.BUS_BAR_SECTION_ID2]: null
17
+ };
18
+ const [sectionOptions, setSectionOptions] = useState([]);
19
+ 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]);
32
+ useEffect(() => {
33
+ const unsubscribe = subscribe({
34
+ name: [
35
+ FieldConstants.EQUIPMENT_ID,
36
+ FieldConstants.BUS_BAR_COUNT,
37
+ FieldConstants.SECTION_COUNT,
38
+ FieldConstants.SWITCH_KINDS
39
+ ],
40
+ formState: {
41
+ values: true
42
+ },
43
+ 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
+ });
56
+ }
57
+ });
58
+ return () => unsubscribe();
59
+ }, [subscribe, trigger, getValues, setValue, formState]);
60
+ return /* @__PURE__ */ jsx(
61
+ ExpandableInput,
62
+ {
63
+ name: FieldConstants.COUPLING_OMNIBUS,
64
+ Field: CouplingOmnibusCreation,
65
+ fieldProps: { sectionOptions },
66
+ addButtonLabel: "AddCoupling_Omnibus",
67
+ initialValue: couplingOmnibusCreation
68
+ }
69
+ );
70
+ }
71
+ export {
72
+ CouplingOmnibusForm
73
+ };
@@ -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 { CouplingOmnibusForm } from './CouplingOmnibusForm';
8
+ export { CouplingOmnibusCreation } from './CouplingOmnibusCreation';
@@ -0,0 +1,6 @@
1
+ import { CouplingOmnibusForm } from "./CouplingOmnibusForm.js";
2
+ import { CouplingOmnibusCreation } from "./CouplingOmnibusCreation.js";
3
+ export {
4
+ CouplingOmnibusCreation,
5
+ CouplingOmnibusForm
6
+ };
@@ -0,0 +1,11 @@
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 './switches-between-sections';
8
+ export * from './coupling-omnibus';
9
+ export * from './VoltageLevelCreationForm';
10
+ export * from './voltageLevelCreation.utils';
11
+ export * from './voltageLevelCreation.types';
@@ -0,0 +1,24 @@
1
+ import { CreateSwitchesDialog } from "./switches-between-sections/creation/CreateSwitchesDialog.js";
2
+ import { SwitchesBetweenSections } from "./switches-between-sections/SwitchesBetweenSections.js";
3
+ import { CouplingOmnibusForm } from "./coupling-omnibus/CouplingOmnibusForm.js";
4
+ import { CouplingOmnibusCreation } from "./coupling-omnibus/CouplingOmnibusCreation.js";
5
+ import { VoltageLevelCreationForm } from "./VoltageLevelCreationForm.js";
6
+ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./voltageLevelCreation.utils.js";
7
+ import { SwitchKind } from "./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
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Custom Paper component for the substation Autocomplete dropdown.
3
+ * Appends a "Create Substation" action button below the options list.
4
+ */
5
+ export declare function SubstationAutocompleteAddButton({ children, ...rest }: Readonly<React.HTMLAttributes<HTMLElement>>): import("react/jsx-runtime").JSX.Element;