@gridsuite/commons-ui 0.280.0 → 0.282.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 (207) hide show
  1. package/dist/components/composite/customAGGrid/custom-aggrid-filters/hooks/use-custom-aggrid-comparator-filter.js +1 -0
  2. package/dist/components/composite/customAGGrid/hooks/use-custom-aggrid-sort.js +1 -0
  3. package/dist/components/composite/reactQueryBuilder/OperatorSelector.js +1 -0
  4. package/dist/components/composite/report/QuickSearch.js +1 -0
  5. package/dist/components/composite/report/report-viewer/log-table/log-table.js +1 -1
  6. package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.d.ts +6 -1
  7. package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +29 -5
  8. package/dist/components/ui/directoryItemSelector/DirectoryItemSelector.js +1 -0
  9. package/dist/components/ui/reactHookForm/booleans/RadioInput.d.ts +1 -0
  10. package/dist/components/ui/reactHookForm/booleans/RadioInput.js +2 -1
  11. package/dist/features/index.js +92 -12
  12. package/dist/features/network-modification-table/network-modifications-table.js +1 -0
  13. package/dist/features/network-modification-table/renderers/reference-link-cell.js +1 -1
  14. package/dist/features/network-modification-table/renderers/root-network-chip-cell.js +1 -0
  15. package/dist/features/network-modification-table/renderers/switch-cell.js +1 -0
  16. package/dist/features/network-modification-table/row/drag-row-clone.js +1 -0
  17. package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +1 -0
  18. package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.d.ts +3 -3
  19. package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.js +2 -2
  20. package/dist/features/network-modifications/battery/modification/BatteryModificationForm.d.ts +4 -1
  21. package/dist/features/network-modifications/battery/modification/BatteryModificationForm.js +7 -11
  22. package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.d.ts +3 -3
  23. package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.js +2 -2
  24. package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.d.ts +4 -1
  25. package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.js +4 -8
  26. package/dist/features/network-modifications/index.d.ts +1 -1
  27. package/dist/features/network-modifications/index.js +81 -6
  28. package/dist/features/network-modifications/line/common/LineDialogTabs.d.ts +3 -3
  29. package/dist/features/network-modifications/line/common/LineDialogTabs.js +2 -2
  30. package/dist/features/network-modifications/line/common/LineForm.d.ts +4 -1
  31. package/dist/features/network-modifications/line/common/LineForm.js +7 -11
  32. package/dist/features/network-modifications/line/common/line.utils.d.ts +1 -1
  33. package/dist/features/network-modifications/load/common/LoadDialogTabs.d.ts +3 -3
  34. package/dist/features/network-modifications/load/common/LoadDialogTabs.js +2 -2
  35. package/dist/features/network-modifications/load/common/LoadForm.d.ts +4 -1
  36. package/dist/features/network-modifications/load/common/LoadForm.js +7 -11
  37. package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.d.ts +3 -2
  38. package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.js +2 -2
  39. package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.d.ts +4 -1
  40. package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.js +8 -11
  41. package/dist/features/network-modifications/tabular/TabularForm.d.ts +22 -0
  42. package/dist/features/network-modifications/tabular/TabularForm.js +536 -0
  43. package/dist/features/network-modifications/tabular/index.d.ts +7 -0
  44. package/dist/features/network-modifications/tabular/index.js +65 -0
  45. package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.d.ts +12 -0
  46. package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.js +123 -0
  47. package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.d.ts +1 -0
  48. package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.js +87 -0
  49. package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.d.ts +5 -0
  50. package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.js +91 -0
  51. package/dist/features/network-modifications/tabular/properties/index.d.ts +4 -0
  52. package/dist/features/network-modifications/tabular/properties/index.js +13 -0
  53. package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.d.ts +26 -0
  54. package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.js +50 -0
  55. package/dist/features/network-modifications/tabular/tabular.constants.d.ts +59 -0
  56. package/dist/features/network-modifications/tabular/tabular.constants.js +75 -0
  57. package/dist/features/network-modifications/tabular/tabular.types.d.ts +41 -0
  58. package/dist/features/network-modifications/tabular/tabular.types.js +8 -0
  59. package/dist/features/network-modifications/tabular/tabular.utils.d.ts +68 -0
  60. package/dist/features/network-modifications/tabular/tabular.utils.js +301 -0
  61. package/dist/features/network-modifications/tabular/tabularCreation.utils.d.ts +25 -0
  62. package/dist/features/network-modifications/tabular/tabularCreation.utils.js +276 -0
  63. package/dist/features/network-modifications/tabular/tabularModification.utils.d.ts +43 -0
  64. package/dist/features/network-modifications/tabular/tabularModification.utils.js +406 -0
  65. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.d.ts +3 -3
  66. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.js +2 -2
  67. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.d.ts +4 -1
  68. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.js +7 -11
  69. package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.d.ts +4 -7
  70. package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +16 -19
  71. package/dist/features/network-modifications/voltageLevel/creation/index.d.ts +1 -1
  72. package/dist/features/network-modifications/voltageLevel/creation/index.js +3 -1
  73. package/dist/features/network-modifications/voltageLevel/index.d.ts +2 -1
  74. package/dist/features/network-modifications/voltageLevel/index.js +18 -4
  75. package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.d.ts → creation/CreateVoltageLevelTopologyForm.d.ts} +1 -1
  76. package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.js → creation/CreateVoltageLevelTopologyForm.js} +38 -38
  77. package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.d.ts → creation/voltageLevelTopologyCreation.types.d.ts} +1 -1
  78. package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.d.ts → creation/voltageLevelTopologyCreation.utils.d.ts} +1 -1
  79. package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.js → creation/voltageLevelTopologyCreation.utils.js} +5 -5
  80. package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.d.ts +6 -0
  81. package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.js +80 -0
  82. package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.d.ts +10 -0
  83. package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.js +284 -0
  84. package/dist/features/network-modifications/voltageLevel/topology/modification/constants.d.ts +10 -0
  85. package/dist/features/network-modifications/voltageLevel/topology/modification/constants.js +10 -0
  86. package/dist/features/network-modifications/{hooks → voltageLevel/topology/modification}/index.d.ts +4 -1
  87. package/dist/features/network-modifications/voltageLevel/topology/modification/index.js +14 -0
  88. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.d.ts +28 -0
  89. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.js +1 -0
  90. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.d.ts +29 -0
  91. package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.js +124 -0
  92. package/dist/features/parameters/common/hook/index.d.ts +0 -1
  93. package/dist/features/parameters/common/hook/index.js +1 -3
  94. package/dist/features/parameters/common/index.d.ts +1 -0
  95. package/dist/features/parameters/common/index.js +3 -3
  96. package/dist/features/parameters/common/parameter-field.d.ts +2 -2
  97. package/dist/features/parameters/common/parameter-field.js +1 -1
  98. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.d.ts +1 -1
  99. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -1
  100. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +10 -10
  101. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.d.ts +1 -0
  102. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js +2 -0
  103. package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -1
  104. package/dist/features/parameters/dynamic-margin-calculation/time-delay-parameters.js +1 -1
  105. package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +1 -1
  106. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +9 -9
  107. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +1 -1
  108. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -1
  109. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.d.ts +1 -0
  110. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.js +2 -0
  111. package/dist/features/parameters/dynamic-security-analysis/scenario-parameters.js +1 -1
  112. package/dist/features/parameters/dynamic-simulation/curve/dialog/curve-preview.js +1 -0
  113. package/dist/features/parameters/dynamic-simulation/curve/dialog/equipment-filter.js +1 -0
  114. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +9 -9
  115. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.d.ts +1 -1
  116. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +1 -1
  117. package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.d.ts +1 -0
  118. package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.js +2 -0
  119. package/dist/features/parameters/dynamic-simulation/network/network-parameters.js +1 -1
  120. package/dist/features/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters.js +1 -1
  121. package/dist/features/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters.js +1 -1
  122. package/dist/features/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters.js +1 -1
  123. package/dist/features/parameters/dynamic-simulation/solver/solver-parameters.js +1 -1
  124. package/dist/features/parameters/dynamic-simulation/time-delay/time-delay-parameters.js +1 -1
  125. package/dist/features/parameters/index.js +12 -7
  126. package/dist/features/parameters/loadflow/load-flow-advanced-parameters.js +1 -1
  127. package/dist/features/parameters/loadflow/load-flow-general-parameters.js +1 -1
  128. package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +6 -6
  129. package/dist/features/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -0
  130. package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +2 -0
  131. package/dist/features/parameters/loadflow/load-flow-provider-specific-parameters.js +1 -1
  132. package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +3 -3
  133. package/dist/features/parameters/network-visualizations/constants.d.ts +1 -0
  134. package/dist/features/parameters/network-visualizations/constants.js +2 -0
  135. package/dist/features/parameters/network-visualizations/index.js +2 -1
  136. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +6 -6
  137. package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +3 -7
  138. package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +6 -6
  139. package/dist/features/parameters/security-analysis/constants.d.ts +1 -0
  140. package/dist/features/parameters/security-analysis/constants.js +2 -0
  141. package/dist/features/parameters/security-analysis/index.js +2 -1
  142. package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +1 -1
  143. package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -1
  144. package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +6 -6
  145. package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -3
  146. package/dist/features/parameters/sensi/columns-definitions.d.ts +2 -0
  147. package/dist/features/parameters/sensi/columns-definitions.js +36 -1
  148. package/dist/features/parameters/sensi/index.js +3 -1
  149. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -1
  150. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +2 -1
  151. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +10 -7
  152. package/dist/features/parameters/sensi/sensitivity-parameters-selector.d.ts +3 -1
  153. package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +19 -35
  154. package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +9 -1
  155. package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +29 -1
  156. package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +6 -6
  157. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.d.ts +1 -0
  158. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +2 -0
  159. package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +3 -3
  160. package/dist/features/parameters/voltage-init/constants.d.ts +1 -0
  161. package/dist/features/parameters/voltage-init/constants.js +2 -0
  162. package/dist/features/parameters/voltage-init/index.js +2 -1
  163. package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -8
  164. package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +6 -6
  165. package/dist/features/process-configs/loadflow/lf-process-config-edition.js +7 -1
  166. package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +7 -1
  167. package/dist/features/process-configs/shortcircuit/sc-process-config-edition.js +7 -1
  168. package/dist/features/results/loadflow/limit-violation-result.js +1 -1
  169. package/dist/features/results/shortcircuit/shortcircuit-analysis-result.js +1 -1
  170. package/dist/features/side-bar/AppSideBarHeader.js +20 -5
  171. package/dist/features/side-bar/EnvironmentChip.d.ts +13 -0
  172. package/dist/features/side-bar/EnvironmentChip.js +49 -0
  173. package/dist/hooks/index.d.ts +1 -0
  174. package/dist/hooks/index.js +3 -1
  175. package/dist/hooks/use-tabs.d.ts +33 -0
  176. package/dist/hooks/use-tabs.js +55 -0
  177. package/dist/index.js +97 -13
  178. package/dist/services/appsMetadata.d.ts +2 -0
  179. package/dist/services/directory.d.ts +1 -1
  180. package/dist/services/directory.js +6 -2
  181. package/dist/services/index.js +2 -1
  182. package/dist/services/userAdmin.d.ts +2 -1
  183. package/dist/services/userAdmin.js +9 -1
  184. package/dist/translations/en/businessErrorsEn.d.ts +1 -0
  185. package/dist/translations/en/businessErrorsEn.js +1 -0
  186. package/dist/translations/en/networkModificationsEn.d.ts +85 -0
  187. package/dist/translations/en/networkModificationsEn.js +91 -1
  188. package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
  189. package/dist/translations/fr/businessErrorsFr.js +1 -0
  190. package/dist/translations/fr/networkModificationsFr.d.ts +85 -0
  191. package/dist/translations/fr/networkModificationsFr.js +91 -1
  192. package/dist/utils/constants/index.js +2 -1
  193. package/dist/utils/constants/notificationsProvider.d.ts +1 -0
  194. package/dist/utils/constants/notificationsProvider.js +1 -0
  195. package/dist/utils/constants/translationKeys.d.ts +1 -0
  196. package/dist/utils/constants/translationKeys.js +2 -0
  197. package/dist/utils/index.js +2 -1
  198. package/dist/utils/types/types.d.ts +4 -0
  199. package/package.json +1 -1
  200. package/dist/features/network-modifications/hooks/index.js +0 -4
  201. package/dist/features/network-modifications/hooks/useTabsWithError.d.ts +0 -15
  202. package/dist/features/network-modifications/hooks/useTabsWithError.js +0 -28
  203. package/dist/features/parameters/common/hook/use-tabs.d.ts +0 -16
  204. package/dist/features/parameters/common/hook/use-tabs.js +0 -65
  205. /package/dist/features/network-modifications/voltageLevel/topology/{index.d.ts → creation/index.d.ts} +0 -0
  206. /package/dist/features/network-modifications/voltageLevel/topology/{index.js → creation/index.js} +0 -0
  207. /package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.js → creation/voltageLevelTopologyCreation.types.js} +0 -0
@@ -0,0 +1,406 @@
1
+ import { v4 } from "uuid";
2
+ import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
3
+ import { convertInputValue, toModificationOperation, convertOutputValue } from "../../../utils/conversionUtils.js";
4
+ import { CONNECTION_DIRECTIONS, ENERGY_SOURCES, REGULATION_SIDES } from "../../../utils/types/equipmentType.js";
5
+ import { MODIFICATION_TYPES, ModificationType } from "../../../utils/types/modificationType.js";
6
+ import { FieldType } from "../../../utils/types/fieldType.js";
7
+ import "react/jsx-runtime";
8
+ import "@mui/icons-material";
9
+ import { SHUNT_COMPENSATOR_TYPES } from "../shunt-compensator/common/shuntCompensator.utils.js";
10
+ import "@mui/material";
11
+ import "react-hook-form";
12
+ import "react";
13
+ import "react-intl";
14
+ import "../../../components/ui/overflowableText/OverflowableText.js";
15
+ import "localized-countries";
16
+ import "localized-countries/data/fr";
17
+ import "localized-countries/data/en";
18
+ import "notistack";
19
+ import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
20
+ import "yup";
21
+ import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
22
+ import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
23
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
24
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
25
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
26
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
27
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
28
+ import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
29
+ import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
30
+ import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
31
+ import "@hello-pangea/dnd";
32
+ import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
33
+ import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
34
+ import "mui-nested-menu";
35
+ import "react-resizable-panels";
36
+ import "react-papaparse";
37
+ import "../common/properties/propertyUtils.js";
38
+ import "react-dom";
39
+ import "autosuggest-highlight/match";
40
+ import "autosuggest-highlight/parse";
41
+ import "clsx";
42
+ import "../../../components/composite/filter/FilterCreationDialog.js";
43
+ import "../../../components/composite/filter/HeaderFilterForm.js";
44
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
45
+ import "../../../components/composite/filter/expert/ExpertFilterForm.js";
46
+ import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
47
+ import "../../../components/composite/filter/expert/expertFilterConstants.js";
48
+ import "react-querybuilder";
49
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
50
+ import "../../../components/composite/filter/utils/filterFormUtils.js";
51
+ import "@react-querybuilder/material";
52
+ import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
53
+ import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
54
+ import "../../../components/composite/agGridTable/BottomTableButtons.js";
55
+ import "../../../components/composite/agGridTable/CustomAgGridTable.js";
56
+ import "ag-grid-community";
57
+ import "../../../components/composite/customAGGrid/customAggrid.js";
58
+ import "../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
59
+ import "mathjs";
60
+ import "../../../components/composite/report/report-viewer/log-table/log-table.js";
61
+ import "react-window";
62
+ import "../../../components/composite/report/report-treeview/treeview-item.js";
63
+ import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
64
+ import "../common/regulatingTerminal/RegulatingTerminalForm.js";
65
+ import "@mui/material/colors";
66
+ import "@mui/x-charts";
67
+ import "../common/currentLimits/limitsPane.utils.js";
68
+ import "../shunt-compensator/creation/shuntCompensatorCreation.utils.js";
69
+ import "../shunt-compensator/modification/shuntCompensatorModification.utils.js";
70
+ import { TABULAR_BOOLEAN, TabularFieldConstants, TABULAR_NUMBER, REGULATING_TERMINAL_TYPES, TABULAR_ENUM, LOAD_TYPES_FOR_LOAD_TABULAR_CREATION_MODIFICATION } from "./tabular.constants.js";
71
+ import { convertReactiveCapabilityCurvePointsFromBackToFront, convertReactiveCapabilityCurvePointsFromFrontToBack, formatModification, addPropertiesFromBack, transformProperties } from "./tabular.utils.js";
72
+ const REACTIVE_CAPABILITY_CURVE_FIELDS = [
73
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE, type: TABULAR_BOOLEAN },
74
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MIN, type: TABULAR_NUMBER },
75
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MIN, type: TABULAR_NUMBER },
76
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MIN, type: TABULAR_NUMBER },
77
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_0, type: TABULAR_NUMBER },
78
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_0, type: TABULAR_NUMBER },
79
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_0, type: TABULAR_NUMBER },
80
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MAX, type: TABULAR_NUMBER },
81
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MAX, type: TABULAR_NUMBER },
82
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MAX, type: TABULAR_NUMBER }
83
+ ];
84
+ const VOLTAGE_REGULATION_FIELDS = [
85
+ { id: TabularFieldConstants.VOLTAGE_REGULATION_ON, type: TABULAR_BOOLEAN },
86
+ { id: FieldConstants.TARGET_V, type: TABULAR_NUMBER },
87
+ { id: TabularFieldConstants.REGULATING_TERMINAL_ID },
88
+ { id: TabularFieldConstants.REGULATING_TERMINAL_TYPE, type: TABULAR_ENUM, options: REGULATING_TERMINAL_TYPES },
89
+ { id: FieldConstants.REGULATING_TERMINAL_VOLTAGE_LEVEL_ID }
90
+ ];
91
+ const CONNECTION_FIELDS = [
92
+ { id: FieldConstants.CONNECTED, type: TABULAR_BOOLEAN },
93
+ { id: FieldConstants.CONNECTION_NAME },
94
+ {
95
+ id: FieldConstants.CONNECTION_DIRECTION,
96
+ type: TABULAR_ENUM,
97
+ options: CONNECTION_DIRECTIONS.map((direction) => direction.id)
98
+ },
99
+ { id: FieldConstants.CONNECTION_POSITION, type: TABULAR_NUMBER }
100
+ ];
101
+ const TWO_SIDES_CONNECTION_FIELDS = [
102
+ { id: TabularFieldConstants.CONNECTED1, type: TABULAR_BOOLEAN },
103
+ { id: TabularFieldConstants.CONNECTION_NAME1 },
104
+ {
105
+ id: TabularFieldConstants.CONNECTION_DIRECTION1,
106
+ type: TABULAR_ENUM,
107
+ options: CONNECTION_DIRECTIONS.map((direction) => direction.id)
108
+ },
109
+ { id: TabularFieldConstants.CONNECTION_POSITION1, type: TABULAR_NUMBER },
110
+ { id: TabularFieldConstants.CONNECTED2, type: TABULAR_BOOLEAN },
111
+ { id: TabularFieldConstants.CONNECTION_NAME2 },
112
+ {
113
+ id: TabularFieldConstants.CONNECTION_DIRECTION2,
114
+ type: TABULAR_ENUM,
115
+ options: CONNECTION_DIRECTIONS.map((direction) => direction.id)
116
+ },
117
+ { id: TabularFieldConstants.CONNECTION_POSITION2, type: TABULAR_NUMBER }
118
+ ];
119
+ const TABULAR_MODIFICATION_FIELDS = {
120
+ SUBSTATION: [
121
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
122
+ { id: FieldConstants.EQUIPMENT_NAME },
123
+ { id: FieldConstants.COUNTRY }
124
+ ],
125
+ VOLTAGE_LEVEL: [
126
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
127
+ { id: FieldConstants.EQUIPMENT_NAME },
128
+ { id: FieldConstants.NOMINAL_V, type: TABULAR_NUMBER },
129
+ { id: FieldConstants.LOW_VOLTAGE_LIMIT, type: TABULAR_NUMBER },
130
+ { id: FieldConstants.HIGH_VOLTAGE_LIMIT, type: TABULAR_NUMBER },
131
+ { id: TabularFieldConstants.IP_MIN, type: TABULAR_NUMBER },
132
+ { id: TabularFieldConstants.IP_MAX, type: TABULAR_NUMBER }
133
+ ],
134
+ LINE: [
135
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
136
+ { id: FieldConstants.EQUIPMENT_NAME },
137
+ { id: FieldConstants.R, type: TABULAR_NUMBER },
138
+ { id: FieldConstants.X, type: TABULAR_NUMBER },
139
+ { id: FieldConstants.G1, type: TABULAR_NUMBER },
140
+ { id: FieldConstants.G2, type: TABULAR_NUMBER },
141
+ { id: FieldConstants.B1, type: TABULAR_NUMBER },
142
+ { id: FieldConstants.B2, type: TABULAR_NUMBER },
143
+ ...TWO_SIDES_CONNECTION_FIELDS
144
+ ],
145
+ TWO_WINDINGS_TRANSFORMER: [
146
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
147
+ { id: FieldConstants.EQUIPMENT_NAME },
148
+ { id: FieldConstants.R, type: TABULAR_NUMBER },
149
+ { id: FieldConstants.X, type: TABULAR_NUMBER },
150
+ { id: FieldConstants.G, type: TABULAR_NUMBER },
151
+ { id: FieldConstants.B, type: TABULAR_NUMBER },
152
+ { id: FieldConstants.RATED_U1, type: TABULAR_NUMBER },
153
+ { id: FieldConstants.RATED_U2, type: TABULAR_NUMBER },
154
+ { id: FieldConstants.RATED_S, type: TABULAR_NUMBER },
155
+ ...TWO_SIDES_CONNECTION_FIELDS,
156
+ { id: TabularFieldConstants.RATIO_TAP_CHANGER_LOAD_TAP_CHANGING_CAPABILITIES, type: TABULAR_BOOLEAN },
157
+ {
158
+ id: TabularFieldConstants.RATIO_TAP_CHANGER_REGULATION_SIDE,
159
+ type: TABULAR_ENUM,
160
+ options: Object.values(REGULATION_SIDES).map((side) => side.id)
161
+ }
162
+ ],
163
+ GENERATOR: [
164
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
165
+ { id: FieldConstants.EQUIPMENT_NAME },
166
+ { id: FieldConstants.ENERGY_SOURCE, type: TABULAR_ENUM, options: ENERGY_SOURCES.map((energy) => energy.id) },
167
+ ...CONNECTION_FIELDS,
168
+ { id: TabularFieldConstants.MIN_P, type: TABULAR_NUMBER },
169
+ { id: TabularFieldConstants.MAX_P, type: TABULAR_NUMBER },
170
+ { id: FieldConstants.RATED_S, type: TABULAR_NUMBER },
171
+ { id: FieldConstants.MIN_Q, type: TABULAR_NUMBER },
172
+ { id: FieldConstants.MAX_Q, type: TABULAR_NUMBER },
173
+ ...REACTIVE_CAPABILITY_CURVE_FIELDS,
174
+ { id: TabularFieldConstants.TARGET_P, type: TABULAR_NUMBER },
175
+ { id: TabularFieldConstants.TARGET_Q, type: TABULAR_NUMBER },
176
+ ...VOLTAGE_REGULATION_FIELDS,
177
+ { id: FieldConstants.Q_PERCENT, type: TABULAR_NUMBER },
178
+ { id: TabularFieldConstants.PARTICIPATE, type: TABULAR_BOOLEAN },
179
+ { id: FieldConstants.DROOP, type: TABULAR_NUMBER },
180
+ { id: FieldConstants.TRANSIENT_REACTANCE, type: TABULAR_NUMBER },
181
+ { id: TabularFieldConstants.STEP_UP_TRANSFORMER_REACTANCE, type: TABULAR_NUMBER },
182
+ { id: FieldConstants.PLANNED_ACTIVE_POWER_SET_POINT, type: TABULAR_NUMBER },
183
+ { id: FieldConstants.MARGINAL_COST, type: TABULAR_NUMBER },
184
+ { id: FieldConstants.PLANNED_OUTAGE_RATE, type: TABULAR_NUMBER },
185
+ { id: FieldConstants.FORCED_OUTAGE_RATE, type: TABULAR_NUMBER }
186
+ ],
187
+ LOAD: [
188
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
189
+ { id: FieldConstants.EQUIPMENT_NAME },
190
+ {
191
+ id: FieldConstants.LOAD_TYPE,
192
+ type: TABULAR_ENUM,
193
+ options: LOAD_TYPES_FOR_LOAD_TABULAR_CREATION_MODIFICATION.map((load) => load.id)
194
+ },
195
+ ...CONNECTION_FIELDS,
196
+ { id: TabularFieldConstants.P0, type: TABULAR_NUMBER },
197
+ { id: FieldConstants.Q0, type: TABULAR_NUMBER }
198
+ ],
199
+ BATTERY: [
200
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
201
+ { id: FieldConstants.EQUIPMENT_NAME },
202
+ ...CONNECTION_FIELDS,
203
+ { id: TabularFieldConstants.MIN_P, type: TABULAR_NUMBER },
204
+ { id: TabularFieldConstants.MAX_P, type: TABULAR_NUMBER },
205
+ { id: FieldConstants.MIN_Q, type: TABULAR_NUMBER },
206
+ { id: FieldConstants.MAX_Q, type: TABULAR_NUMBER },
207
+ ...REACTIVE_CAPABILITY_CURVE_FIELDS,
208
+ { id: TabularFieldConstants.TARGET_P, type: TABULAR_NUMBER },
209
+ { id: TabularFieldConstants.TARGET_Q, type: TABULAR_NUMBER },
210
+ { id: TabularFieldConstants.PARTICIPATE, type: TABULAR_BOOLEAN },
211
+ { id: FieldConstants.DROOP, type: TABULAR_NUMBER },
212
+ ...VOLTAGE_REGULATION_FIELDS
213
+ ],
214
+ SHUNT_COMPENSATOR: [
215
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
216
+ { id: FieldConstants.EQUIPMENT_NAME },
217
+ ...CONNECTION_FIELDS,
218
+ { id: FieldConstants.MAXIMUM_SECTION_COUNT, type: TABULAR_NUMBER },
219
+ { id: FieldConstants.SECTION_COUNT, type: TABULAR_NUMBER },
220
+ {
221
+ id: FieldConstants.SHUNT_COMPENSATOR_TYPE,
222
+ type: TABULAR_ENUM,
223
+ options: Object.keys(SHUNT_COMPENSATOR_TYPES)
224
+ },
225
+ { id: FieldConstants.MAX_Q_AT_NOMINAL_V, type: TABULAR_NUMBER },
226
+ { id: FieldConstants.MAX_SUSCEPTANCE, type: TABULAR_NUMBER }
227
+ ]
228
+ };
229
+ const TABULAR_MODIFICATION_TYPES = {
230
+ GENERATOR: MODIFICATION_TYPES.GENERATOR_MODIFICATION.type,
231
+ LOAD: MODIFICATION_TYPES.LOAD_MODIFICATION.type,
232
+ BATTERY: MODIFICATION_TYPES.BATTERY_MODIFICATION.type,
233
+ VOLTAGE_LEVEL: MODIFICATION_TYPES.VOLTAGE_LEVEL_MODIFICATION.type,
234
+ SHUNT_COMPENSATOR: MODIFICATION_TYPES.SHUNT_COMPENSATOR_MODIFICATION.type,
235
+ LINE: MODIFICATION_TYPES.LINE_MODIFICATION.type,
236
+ TWO_WINDINGS_TRANSFORMER: MODIFICATION_TYPES.TWO_WINDINGS_TRANSFORMER_MODIFICATION.type,
237
+ SUBSTATION: MODIFICATION_TYPES.SUBSTATION_MODIFICATION.type
238
+ };
239
+ const getEquipmentTypeFromModificationType = (type) => {
240
+ return Object.keys(TABULAR_MODIFICATION_TYPES).find((key) => TABULAR_MODIFICATION_TYPES[key] === type);
241
+ };
242
+ const convertCamelToSnake = (key) => FieldType[key.split(/\.?(?=[A-Z])/).join("_").toUpperCase()];
243
+ const convertInputValues = (key, value) => {
244
+ if (key === TabularFieldConstants.EQUIPMENT_ID) {
245
+ return value;
246
+ }
247
+ return convertInputValue(convertCamelToSnake(key), value?.value);
248
+ };
249
+ const convertOutputValues = (key, value) => {
250
+ if (key === TabularFieldConstants.EQUIPMENT_ID) {
251
+ return value;
252
+ }
253
+ return toModificationOperation(convertOutputValue(convertCamelToSnake(key), value));
254
+ };
255
+ const getTabularFieldType = (modificationType, key) => {
256
+ let fieldType = key;
257
+ if (modificationType === TABULAR_MODIFICATION_TYPES.VOLTAGE_LEVEL) {
258
+ if (key === TabularFieldConstants.IP_MIN) {
259
+ fieldType = FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT;
260
+ } else if (key === TabularFieldConstants.IP_MAX) {
261
+ fieldType = FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT;
262
+ }
263
+ }
264
+ return fieldType;
265
+ };
266
+ const convertGeneratorOrBatteryModificationFromBackToFront = (modification) => {
267
+ const formattedModification = {};
268
+ Object.keys(modification).forEach((key) => {
269
+ if (key === TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_POINTS) {
270
+ convertReactiveCapabilityCurvePointsFromBackToFront(
271
+ modification[key]
272
+ ).forEach((point) => {
273
+ formattedModification[point.key] = point.value;
274
+ });
275
+ } else {
276
+ formattedModification[key] = convertInputValues(key, modification[key]);
277
+ }
278
+ });
279
+ return formattedModification;
280
+ };
281
+ const convertGeneratorOrBatteryModificationFromFrontToBack = (modification) => {
282
+ const formattedModification = { ...modification };
283
+ convertReactiveCapabilityCurvePointsFromFrontToBack(formattedModification);
284
+ REACTIVE_CAPABILITY_CURVE_FIELDS.forEach((field) => {
285
+ if (field.id !== TabularFieldConstants.REACTIVE_CAPABILITY_CURVE) {
286
+ delete formattedModification[field.id];
287
+ }
288
+ });
289
+ Object.keys(formattedModification).forEach((key) => {
290
+ if (key !== TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_POINTS) {
291
+ formattedModification[key] = convertOutputValues(key, formattedModification[key]);
292
+ }
293
+ });
294
+ return formattedModification;
295
+ };
296
+ const TWT_TAP_CHANGER_FIELDS = [
297
+ TabularFieldConstants.RATIO_TAP_CHANGER_LOAD_TAP_CHANGING_CAPABILITIES,
298
+ TabularFieldConstants.RATIO_TAP_CHANGER_REGULATION_SIDE
299
+ ];
300
+ const convertTWTTapChangerModificationFromFrontToBack = (modification) => {
301
+ if (!modification) {
302
+ return {};
303
+ }
304
+ const formattedModification = { ...modification };
305
+ if (TWT_TAP_CHANGER_FIELDS.some((field) => field in formattedModification)) {
306
+ formattedModification[FieldConstants.RATIO_TAP_CHANGER] = {
307
+ [FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES]: formattedModification[TabularFieldConstants.RATIO_TAP_CHANGER_LOAD_TAP_CHANGING_CAPABILITIES],
308
+ [FieldConstants.REGULATION_SIDE]: formattedModification[TabularFieldConstants.RATIO_TAP_CHANGER_REGULATION_SIDE]
309
+ };
310
+ TWT_TAP_CHANGER_FIELDS.forEach((field) => {
311
+ delete formattedModification[field];
312
+ });
313
+ }
314
+ Object.keys(formattedModification).forEach((key) => {
315
+ if (key === FieldConstants.RATIO_TAP_CHANGER) {
316
+ Object.keys(formattedModification[FieldConstants.RATIO_TAP_CHANGER]).forEach((ratioKey) => {
317
+ formattedModification[FieldConstants.RATIO_TAP_CHANGER][ratioKey] = convertOutputValues(
318
+ ratioKey,
319
+ formattedModification[FieldConstants.RATIO_TAP_CHANGER][ratioKey]
320
+ );
321
+ });
322
+ } else {
323
+ formattedModification[key] = convertOutputValues(key, formattedModification[key]);
324
+ }
325
+ });
326
+ return formattedModification;
327
+ };
328
+ const MODIFICATION_TRANSFORMATION_STRATEGIES = {
329
+ [TABULAR_MODIFICATION_TYPES.GENERATOR]: (row) => convertGeneratorOrBatteryModificationFromFrontToBack(row),
330
+ [TABULAR_MODIFICATION_TYPES.BATTERY]: (row) => convertGeneratorOrBatteryModificationFromFrontToBack(row),
331
+ [TABULAR_MODIFICATION_TYPES.TWO_WINDINGS_TRANSFORMER]: (row) => convertTWTTapChangerModificationFromFrontToBack(row),
332
+ // Default strategy for other modification types
333
+ default: (row, modificationType) => {
334
+ const transformedRow = {};
335
+ Object.keys(row).forEach((key) => {
336
+ transformedRow[key] = convertOutputValues(getTabularFieldType(modificationType, key), row[key]);
337
+ });
338
+ return transformedRow;
339
+ }
340
+ };
341
+ const transformRowToBackEndModification = (row, modificationType) => {
342
+ const propertiesModifications = transformProperties(row);
343
+ const transformationStrategy = MODIFICATION_TRANSFORMATION_STRATEGIES[modificationType] ?? MODIFICATION_TRANSFORMATION_STRATEGIES.default;
344
+ const transformedData = transformationStrategy(row, modificationType);
345
+ if (propertiesModifications.length > 0) {
346
+ transformedData[TabularFieldConstants.TABULAR_PROPERTIES] = propertiesModifications;
347
+ }
348
+ return {
349
+ type: modificationType,
350
+ ...transformedData
351
+ };
352
+ };
353
+ const transformModificationsTable = (modificationType, modificationsTable = []) => {
354
+ if (!modificationsTable?.length) {
355
+ return [];
356
+ }
357
+ return modificationsTable.map((row) => transformRowToBackEndModification(row, modificationType));
358
+ };
359
+ const tabularModificationDtoToForm = (dto) => {
360
+ const { modificationType } = dto;
361
+ const modifications = (dto?.modifications ?? []).map((modif) => {
362
+ let modification = formatModification(modif);
363
+ if (modificationType === TABULAR_MODIFICATION_TYPES.GENERATOR || modificationType === TABULAR_MODIFICATION_TYPES.BATTERY) {
364
+ modification = convertGeneratorOrBatteryModificationFromBackToFront(modification);
365
+ } else {
366
+ Object.keys(modification).forEach((key) => {
367
+ modification[key] = convertInputValues(getTabularFieldType(modificationType, key), modif[key]);
368
+ });
369
+ }
370
+ modification = addPropertiesFromBack(modification, modif?.[TabularFieldConstants.TABULAR_PROPERTIES]);
371
+ return { [FieldConstants.AG_GRID_ROW_UUID]: v4(), ...modification };
372
+ });
373
+ return {
374
+ [FieldConstants.TYPE]: getEquipmentTypeFromModificationType(modificationType) ?? "",
375
+ [TabularFieldConstants.MODIFICATIONS_TABLE]: modifications,
376
+ [TabularFieldConstants.TABULAR_PROPERTIES]: dto?.properties,
377
+ [TabularFieldConstants.CSV_FILENAME]: dto?.csvFilename
378
+ };
379
+ };
380
+ const tabularModificationFormToDto = (form) => {
381
+ const modificationType = TABULAR_MODIFICATION_TYPES[form[FieldConstants.TYPE]];
382
+ return {
383
+ type: ModificationType.TABULAR_MODIFICATION,
384
+ modificationType,
385
+ modifications: transformModificationsTable(modificationType, form[TabularFieldConstants.MODIFICATIONS_TABLE]),
386
+ csvFilename: form[TabularFieldConstants.CSV_FILENAME],
387
+ properties: form[TabularFieldConstants.TABULAR_PROPERTIES]
388
+ };
389
+ };
390
+ export {
391
+ MODIFICATION_TRANSFORMATION_STRATEGIES,
392
+ TABULAR_MODIFICATION_FIELDS,
393
+ TABULAR_MODIFICATION_TYPES,
394
+ TWT_TAP_CHANGER_FIELDS,
395
+ convertGeneratorOrBatteryModificationFromBackToFront,
396
+ convertGeneratorOrBatteryModificationFromFrontToBack,
397
+ convertInputValues,
398
+ convertOutputValues,
399
+ convertTWTTapChangerModificationFromFrontToBack,
400
+ getEquipmentTypeFromModificationType,
401
+ getTabularFieldType,
402
+ tabularModificationDtoToForm,
403
+ tabularModificationFormToDto,
404
+ transformModificationsTable,
405
+ transformRowToBackEndModification
406
+ };
@@ -1,9 +1,9 @@
1
- import { default as React } from 'react';
1
+ import { SyntheticEvent } from 'react';
2
2
  interface TwoWindingsTransformerDialogProps {
3
3
  tabIndex: number;
4
4
  tabIndexesWithError: number[];
5
- setTabIndex: (newTabIndex: number) => void;
5
+ onTabChange: (event: SyntheticEvent<Element, Event>, newValue: number) => void;
6
6
  isModification?: boolean;
7
7
  }
8
- export declare function TwoWindingsTransformerDialogTabs({ tabIndex, tabIndexesWithError, setTabIndex, isModification, }: Readonly<TwoWindingsTransformerDialogProps>): React.JSX.Element;
8
+ export declare function TwoWindingsTransformerDialogTabs({ tabIndex, tabIndexesWithError, onTabChange, isModification, }: Readonly<TwoWindingsTransformerDialogProps>): import("react").JSX.Element;
9
9
  export {};
@@ -11,7 +11,7 @@ import "@mui/icons-material";
11
11
  function TwoWindingsTransformerDialogTabs({
12
12
  tabIndex,
13
13
  tabIndexesWithError,
14
- setTabIndex,
14
+ onTabChange,
15
15
  isModification = false
16
16
  }) {
17
17
  const phaseTapChangerEnabledWatch = useWatch({
@@ -25,7 +25,7 @@ function TwoWindingsTransformerDialogTabs({
25
25
  {
26
26
  value: tabIndex,
27
27
  variant: "scrollable",
28
- onChange: (event, newValue) => setTabIndex(newValue),
28
+ onChange: onTabChange,
29
29
  slotProps: {
30
30
  indicator: { sx: getTabIndicatorStyle(tabIndexesWithError, tabIndex) }
31
31
  },
@@ -1,6 +1,9 @@
1
1
  import { TwoWindingsTransformerDialogHeaderProps } from './TwoWindingsTransformerDialogHeader';
2
+ import { TwoWindingsTransformerDialogTab } from './twoWindingsTransformer.utils';
2
3
  import { TwoWindingsTransformerDialogTabsContentProps } from './TwoWindingsTransformerDialogTabsContent';
4
+ import { UseTabsReturn } from '../../../../hooks';
3
5
  interface TwoWindingsTransformerFormProps extends TwoWindingsTransformerDialogHeaderProps, Omit<TwoWindingsTransformerDialogTabsContentProps, 'tabIndex' | 'isModification' | 'twtToModify'> {
6
+ useTabsReturn: UseTabsReturn<TwoWindingsTransformerDialogTab>;
4
7
  }
5
- export declare function TwoWindingsTransformerForm({ twtToModify, voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, fetchVoltageLevelEquipments, editData, isModification, }: Readonly<TwoWindingsTransformerFormProps>): import("react").JSX.Element;
8
+ export declare function TwoWindingsTransformerForm({ twtToModify, voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, fetchVoltageLevelEquipments, editData, isModification, useTabsReturn, }: Readonly<TwoWindingsTransformerFormProps>): import("react").JSX.Element;
6
9
  export {};
@@ -1,8 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Stack, Box } from "@mui/material";
3
3
  import { TwoWindingsTransformerDialogHeader } from "./TwoWindingsTransformerDialogHeader.js";
4
- import { useTabsWithError } from "../../hooks/useTabsWithError.js";
5
- import { TwoWindingsTransformerDialogTab, TWT_TAB_FIELDS } from "./twoWindingsTransformer.utils.js";
6
4
  import { TwoWindingsTransformerDialogTabs } from "./TwoWindingsTransformerDialogTabs.js";
7
5
  import { TwoWindingsTransformerDialogTabsContent } from "./TwoWindingsTransformerDialogTabsContent.js";
8
6
  function TwoWindingsTransformerForm({
@@ -12,27 +10,25 @@ function TwoWindingsTransformerForm({
12
10
  PositionDiagramPane,
13
11
  fetchVoltageLevelEquipments,
14
12
  editData,
15
- isModification = false
13
+ isModification = false,
14
+ useTabsReturn
16
15
  }) {
17
- const { tabIndex, setTabIndex, tabIndexesWithError } = useTabsWithError(
18
- TWT_TAB_FIELDS,
19
- TwoWindingsTransformerDialogTab.CONNECTIVITY_TAB
20
- );
16
+ const { selectedTab, tabsWithError, onTabChange } = useTabsReturn;
21
17
  return /* @__PURE__ */ jsxs(Stack, { spacing: 2, height: "100%", children: [
22
18
  /* @__PURE__ */ jsx(TwoWindingsTransformerDialogHeader, { twtToModify, isModification }),
23
19
  /* @__PURE__ */ jsx(
24
20
  TwoWindingsTransformerDialogTabs,
25
21
  {
26
- tabIndex,
27
- tabIndexesWithError,
28
- setTabIndex,
22
+ tabIndex: selectedTab,
23
+ tabIndexesWithError: tabsWithError,
24
+ onTabChange,
29
25
  isModification
30
26
  }
31
27
  ),
32
28
  /* @__PURE__ */ jsx(Box, { sx: { flexGrow: 1, overflowY: "auto", overflowX: "hidden", paddingRight: 3 }, children: /* @__PURE__ */ jsx(
33
29
  TwoWindingsTransformerDialogTabsContent,
34
30
  {
35
- tabIndex,
31
+ tabIndex: selectedTab,
36
32
  twtToModify,
37
33
  voltageLevelOptions,
38
34
  fetchBusesOrBusbarSections,
@@ -1,11 +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
- */
1
+ import { VoltageLevelTab } from './voltageLevel.constants';
2
+ import { UseTabsReturn } from '../../../../hooks';
7
3
  export interface VoltageLevelCreationFormProps {
8
4
  substationOptions?: string[];
9
5
  showDeleteSubstationButton?: boolean;
6
+ useTabsReturn: UseTabsReturn<VoltageLevelTab>;
10
7
  }
11
- export declare function VoltageLevelCreationForm({ substationOptions, showDeleteSubstationButton, }?: VoltageLevelCreationFormProps): import("react").JSX.Element;
8
+ export declare function VoltageLevelCreationForm({ substationOptions, showDeleteSubstationButton, useTabsReturn, }: VoltageLevelCreationFormProps): import("react").JSX.Element;
@@ -31,7 +31,7 @@ import "../../../../components/ui/snackbarProvider/SnackbarProvider.js";
31
31
  import "mui-nested-menu";
32
32
  import "react-resizable-panels";
33
33
  import "react-papaparse";
34
- import { VoltageLevelTab, VOLTAGE_LEVEL_TAB_FIELDS } from "./voltageLevel.constants.js";
34
+ import { VoltageLevelTab } from "./voltageLevel.constants.js";
35
35
  import "./voltageLevelCreation.utils.js";
36
36
  import { StructureTab } from "./tabs/structureTab/StructureTab.js";
37
37
  import { SubstationTab } from "./tabs/substationTab/SubstationTab.js";
@@ -71,15 +71,12 @@ import "@mui/material/colors";
71
71
  import "@mui/x-charts";
72
72
  import "../../common/currentLimits/limitsPane.utils.js";
73
73
  import { getTabStyle, getTabIndicatorStyle } from "../../../parameters/parameters-style.js";
74
- import { useTabsWithError } from "../../hooks/useTabsWithError.js";
75
74
  function VoltageLevelCreationForm({
76
75
  substationOptions,
77
- showDeleteSubstationButton = true
78
- } = {}) {
79
- const { tabIndex, setTabIndex, tabIndexesWithError } = useTabsWithError(
80
- VOLTAGE_LEVEL_TAB_FIELDS,
81
- VoltageLevelTab.SUBSTATION_TAB
82
- );
76
+ showDeleteSubstationButton = true,
77
+ useTabsReturn
78
+ }) {
79
+ const { selectedTab, tabsWithError, onTabChange } = useTabsReturn;
83
80
  const watchHideBusBarSection = useWatch({ name: FieldConstants.HIDE_BUS_BAR_SECTION });
84
81
  return /* @__PURE__ */ jsxs(Stack, { spacing: 2, children: [
85
82
  /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
@@ -96,12 +93,12 @@ function VoltageLevelCreationForm({
96
93
  /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsxs(
97
94
  Tabs,
98
95
  {
99
- value: tabIndex,
96
+ value: selectedTab,
100
97
  variant: "scrollable",
101
- onChange: (_, newValue) => setTabIndex(newValue),
98
+ onChange: onTabChange,
102
99
  slotProps: {
103
100
  indicator: {
104
- sx: getTabIndicatorStyle(tabIndexesWithError, tabIndex)
101
+ sx: getTabIndicatorStyle(tabsWithError, selectedTab)
105
102
  }
106
103
  },
107
104
  children: [
@@ -109,21 +106,21 @@ function VoltageLevelCreationForm({
109
106
  Tab,
110
107
  {
111
108
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "SubstationTab" }),
112
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.SUBSTATION_TAB)
109
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.SUBSTATION_TAB)
113
110
  }
114
111
  ),
115
112
  /* @__PURE__ */ jsx(
116
113
  Tab,
117
114
  {
118
115
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "CharacteristicsTab" }),
119
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.CHARACTERISTICS_TAB)
116
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.CHARACTERISTICS_TAB)
120
117
  }
121
118
  ),
122
119
  /* @__PURE__ */ jsx(
123
120
  Tab,
124
121
  {
125
122
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "StructureTab" }),
126
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.STRUCTURE_TAB),
123
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.STRUCTURE_TAB),
127
124
  disabled: watchHideBusBarSection
128
125
  }
129
126
  ),
@@ -131,23 +128,23 @@ function VoltageLevelCreationForm({
131
128
  Tab,
132
129
  {
133
130
  label: /* @__PURE__ */ jsx(FormattedMessage, { id: "AdditionalInformationTab" }),
134
- sx: getTabStyle(tabIndexesWithError, VoltageLevelTab.ADDITIONAL_INFORMATION_TAB)
131
+ sx: getTabStyle(tabsWithError, VoltageLevelTab.ADDITIONAL_INFORMATION_TAB)
135
132
  }
136
133
  )
137
134
  ]
138
135
  }
139
136
  ) }),
140
137
  /* @__PURE__ */ jsxs(Grid, { children: [
141
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.SUBSTATION_TAB, children: /* @__PURE__ */ jsx(
138
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.SUBSTATION_TAB, children: /* @__PURE__ */ jsx(
142
139
  SubstationTab,
143
140
  {
144
141
  substationOptions,
145
142
  showDeleteButton: showDeleteSubstationButton
146
143
  }
147
144
  ) }),
148
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.CHARACTERISTICS_TAB, children: /* @__PURE__ */ jsx(CharacteristicsTab, {}) }),
149
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.STRUCTURE_TAB, children: /* @__PURE__ */ jsx(StructureTab, {}) }),
150
- /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== VoltageLevelTab.ADDITIONAL_INFORMATION_TAB, children: /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel" }) })
145
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.CHARACTERISTICS_TAB, children: /* @__PURE__ */ jsx(CharacteristicsTab, {}) }),
146
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.STRUCTURE_TAB, children: /* @__PURE__ */ jsx(StructureTab, {}) }),
147
+ /* @__PURE__ */ jsx(Box, { hidden: selectedTab !== VoltageLevelTab.ADDITIONAL_INFORMATION_TAB, children: /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel" }) })
151
148
  ] })
152
149
  ] });
153
150
  }
@@ -5,7 +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
+ export { MAX_SECTIONS_COUNT, VOLTAGE_LEVEL_TAB_FIELDS, VoltageLevelTab } from './voltageLevel.constants';
9
9
  export * from './VoltageLevelCreationForm';
10
10
  export * from './voltageLevelCreation.utils';
11
11
  export * from './voltageLevelCreation.types';
@@ -62,7 +62,7 @@ import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
62
62
  import "@mui/material/colors";
63
63
  import "@mui/x-charts";
64
64
  import "../../common/currentLimits/limitsPane.utils.js";
65
- import { MAX_SECTIONS_COUNT } from "./voltageLevel.constants.js";
65
+ import { MAX_SECTIONS_COUNT, VOLTAGE_LEVEL_TAB_FIELDS, VoltageLevelTab } from "./voltageLevel.constants.js";
66
66
  import { VoltageLevelCreationForm } from "./VoltageLevelCreationForm.js";
67
67
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./voltageLevelCreation.utils.js";
68
68
  import { SwitchKind } from "./voltageLevelCreation.types.js";
@@ -71,7 +71,9 @@ export {
71
71
  SWITCH_TYPE,
72
72
  SwitchKind,
73
73
  SwitchesBetweenSections,
74
+ VOLTAGE_LEVEL_TAB_FIELDS,
74
75
  VoltageLevelCreationForm,
76
+ VoltageLevelTab,
75
77
  buildNewBusbarSections,
76
78
  getCreateSwitchesEmptyFormData,
77
79
  getCreateSwitchesValidationSchema,
@@ -8,7 +8,8 @@ export * from './coupling-device';
8
8
  export * from './creation';
9
9
  export * from './voltage-level.type';
10
10
  export * from './modification';
11
- export * from './topology';
11
+ export * from './topology/creation';
12
+ export * from './topology/modification';
12
13
  export * from './section';
13
14
  export * from './moveFeederBays';
14
15
  export * from './common';