@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,276 @@
1
+ import { v4 } from "uuid";
2
+ import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
3
+ import "../../../utils/conversionUtils.js";
4
+ import { CONNECTION_DIRECTIONS, ENERGY_SOURCES } from "../../../utils/types/equipmentType.js";
5
+ import { MODIFICATION_TYPES, ModificationType } from "../../../utils/types/modificationType.js";
6
+ import "react/jsx-runtime";
7
+ import "@mui/icons-material";
8
+ import { SHUNT_COMPENSATOR_TYPES } from "../shunt-compensator/common/shuntCompensator.utils.js";
9
+ import "@mui/material";
10
+ import "react-hook-form";
11
+ import "react";
12
+ import "react-intl";
13
+ import "../../../components/ui/overflowableText/OverflowableText.js";
14
+ import "localized-countries";
15
+ import "localized-countries/data/fr";
16
+ import "localized-countries/data/en";
17
+ import "notistack";
18
+ import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
19
+ import "yup";
20
+ import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
21
+ import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
22
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
23
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
24
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
25
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
26
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
27
+ import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
28
+ import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
29
+ import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
30
+ import "@hello-pangea/dnd";
31
+ import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
32
+ import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
33
+ import "mui-nested-menu";
34
+ import "react-resizable-panels";
35
+ import "react-papaparse";
36
+ import "../common/properties/propertyUtils.js";
37
+ import "react-dom";
38
+ import "autosuggest-highlight/match";
39
+ import "autosuggest-highlight/parse";
40
+ import "clsx";
41
+ import "../../../components/composite/filter/FilterCreationDialog.js";
42
+ import "../../../components/composite/filter/HeaderFilterForm.js";
43
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
44
+ import "../../../components/composite/filter/expert/ExpertFilterForm.js";
45
+ import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
46
+ import "../../../components/composite/filter/expert/expertFilterConstants.js";
47
+ import "react-querybuilder";
48
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
49
+ import "../../../components/composite/filter/utils/filterFormUtils.js";
50
+ import "@react-querybuilder/material";
51
+ import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
52
+ import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
53
+ import "../../../components/composite/agGridTable/BottomTableButtons.js";
54
+ import "../../../components/composite/agGridTable/CustomAgGridTable.js";
55
+ import "ag-grid-community";
56
+ import "../../../components/composite/customAGGrid/customAggrid.js";
57
+ import "../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
58
+ import "mathjs";
59
+ import "../../../components/composite/report/report-viewer/log-table/log-table.js";
60
+ import "react-window";
61
+ import "../../../components/composite/report/report-treeview/treeview-item.js";
62
+ import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
63
+ import "../common/regulatingTerminal/RegulatingTerminalForm.js";
64
+ import "@mui/material/colors";
65
+ import "@mui/x-charts";
66
+ import "../common/currentLimits/limitsPane.utils.js";
67
+ import "../shunt-compensator/creation/shuntCompensatorCreation.utils.js";
68
+ import "../shunt-compensator/modification/shuntCompensatorModification.utils.js";
69
+ import { TABULAR_BOOLEAN, TabularFieldConstants, TABULAR_NUMBER, TABULAR_ENUM, REGULATING_TERMINAL_TYPES, LOAD_TYPES_FOR_LOAD_TABULAR_CREATION_MODIFICATION } from "./tabular.constants.js";
70
+ import { convertReactiveCapabilityCurvePointsFromBackToFront, formatModification, addPropertiesFromBack, transformProperties, convertReactiveCapabilityCurvePointsFromFrontToBack } from "./tabular.utils.js";
71
+ const REACTIVE_CAPABILITY_CURVE_FIELDS = [
72
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE, required: true, type: TABULAR_BOOLEAN },
73
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MIN, required: false, type: TABULAR_NUMBER },
74
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MIN, required: false, type: TABULAR_NUMBER },
75
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MIN, required: false, type: TABULAR_NUMBER },
76
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_0, required: false, type: TABULAR_NUMBER },
77
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_0, required: false, type: TABULAR_NUMBER },
78
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_0, required: false, type: TABULAR_NUMBER },
79
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_P_MAX, required: false, type: TABULAR_NUMBER },
80
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MAX, required: false, type: TABULAR_NUMBER },
81
+ { id: TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MAX, required: false, type: TABULAR_NUMBER }
82
+ ];
83
+ const CONNECTION_FIELDS = [
84
+ { id: FieldConstants.CONNECTED, required: true, type: TABULAR_BOOLEAN },
85
+ { id: FieldConstants.CONNECTION_NAME, required: false },
86
+ {
87
+ id: FieldConstants.CONNECTION_DIRECTION,
88
+ required: false,
89
+ type: TABULAR_ENUM,
90
+ options: CONNECTION_DIRECTIONS.map((direction) => direction.id)
91
+ },
92
+ { id: FieldConstants.CONNECTION_POSITION, required: false, type: TABULAR_NUMBER }
93
+ ];
94
+ const VOLTAGE_REGULATION_FIELDS = [
95
+ { id: TabularFieldConstants.VOLTAGE_REGULATION_ON, required: true, type: TABULAR_BOOLEAN },
96
+ { id: FieldConstants.TARGET_V, required: false, type: TABULAR_NUMBER },
97
+ { id: TabularFieldConstants.REGULATING_TERMINAL_ID, required: false },
98
+ {
99
+ id: TabularFieldConstants.REGULATING_TERMINAL_TYPE,
100
+ required: false,
101
+ type: TABULAR_ENUM,
102
+ options: REGULATING_TERMINAL_TYPES
103
+ },
104
+ { id: FieldConstants.REGULATING_TERMINAL_VOLTAGE_LEVEL_ID, required: false }
105
+ ];
106
+ const TABULAR_CREATION_FIELDS = {
107
+ GENERATOR: [
108
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
109
+ { id: FieldConstants.EQUIPMENT_NAME, required: false },
110
+ {
111
+ id: FieldConstants.ENERGY_SOURCE,
112
+ required: true,
113
+ type: TABULAR_ENUM,
114
+ options: ENERGY_SOURCES.map((energy) => energy.id)
115
+ },
116
+ { id: FieldConstants.VOLTAGE_LEVEL_ID, required: true },
117
+ { id: TabularFieldConstants.BUS_OR_BUSBAR_SECTION_ID, required: true },
118
+ ...CONNECTION_FIELDS,
119
+ { id: TabularFieldConstants.MIN_P, required: true, type: TABULAR_NUMBER },
120
+ { id: TabularFieldConstants.MAX_P, required: true, type: TABULAR_NUMBER },
121
+ { id: FieldConstants.RATED_S, required: false, type: TABULAR_NUMBER },
122
+ { id: FieldConstants.MIN_Q, required: false, type: TABULAR_NUMBER },
123
+ { id: FieldConstants.MAX_Q, required: false, type: TABULAR_NUMBER },
124
+ ...REACTIVE_CAPABILITY_CURVE_FIELDS,
125
+ { id: TabularFieldConstants.TARGET_P, required: true, type: TABULAR_NUMBER },
126
+ { id: TabularFieldConstants.TARGET_Q, required: true, type: TABULAR_NUMBER },
127
+ ...VOLTAGE_REGULATION_FIELDS,
128
+ { id: FieldConstants.Q_PERCENT, required: false, type: TABULAR_NUMBER },
129
+ { id: TabularFieldConstants.PARTICIPATE, required: true, type: TABULAR_BOOLEAN },
130
+ { id: FieldConstants.DROOP, required: false, type: TABULAR_NUMBER },
131
+ { id: FieldConstants.TRANSIENT_REACTANCE, required: false, type: TABULAR_NUMBER },
132
+ { id: TabularFieldConstants.STEP_UP_TRANSFORMER_REACTANCE, required: false, type: TABULAR_NUMBER },
133
+ { id: FieldConstants.PLANNED_ACTIVE_POWER_SET_POINT, required: false, type: TABULAR_NUMBER },
134
+ { id: FieldConstants.MARGINAL_COST, required: false, type: TABULAR_NUMBER },
135
+ { id: FieldConstants.PLANNED_OUTAGE_RATE, required: false, type: TABULAR_NUMBER },
136
+ { id: FieldConstants.FORCED_OUTAGE_RATE, required: false, type: TABULAR_NUMBER }
137
+ ],
138
+ LOAD: [
139
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
140
+ { id: FieldConstants.EQUIPMENT_NAME, required: false },
141
+ {
142
+ id: FieldConstants.LOAD_TYPE,
143
+ required: true,
144
+ type: TABULAR_ENUM,
145
+ options: LOAD_TYPES_FOR_LOAD_TABULAR_CREATION_MODIFICATION.map((load) => load.id)
146
+ },
147
+ { id: FieldConstants.VOLTAGE_LEVEL_ID, required: true },
148
+ { id: TabularFieldConstants.BUS_OR_BUSBAR_SECTION_ID, required: true },
149
+ ...CONNECTION_FIELDS,
150
+ { id: TabularFieldConstants.P0, required: true, type: TABULAR_NUMBER },
151
+ { id: FieldConstants.Q0, required: true, type: TABULAR_NUMBER }
152
+ ],
153
+ BATTERY: [
154
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
155
+ { id: FieldConstants.EQUIPMENT_NAME, required: false },
156
+ { id: FieldConstants.VOLTAGE_LEVEL_ID, required: true },
157
+ { id: TabularFieldConstants.BUS_OR_BUSBAR_SECTION_ID, required: true },
158
+ ...CONNECTION_FIELDS,
159
+ { id: TabularFieldConstants.MIN_P, required: true, type: TABULAR_NUMBER },
160
+ { id: TabularFieldConstants.MAX_P, required: true, type: TABULAR_NUMBER },
161
+ { id: FieldConstants.MIN_Q, required: false, type: TABULAR_NUMBER },
162
+ { id: FieldConstants.MAX_Q, required: false, type: TABULAR_NUMBER },
163
+ ...REACTIVE_CAPABILITY_CURVE_FIELDS,
164
+ { id: TabularFieldConstants.TARGET_P, required: true, type: TABULAR_NUMBER },
165
+ { id: TabularFieldConstants.TARGET_Q, required: true, type: TABULAR_NUMBER },
166
+ { id: TabularFieldConstants.PARTICIPATE, required: true, type: TABULAR_BOOLEAN },
167
+ { id: FieldConstants.DROOP, required: false, type: TABULAR_NUMBER },
168
+ ...VOLTAGE_REGULATION_FIELDS
169
+ ],
170
+ SHUNT_COMPENSATOR: [
171
+ { id: TabularFieldConstants.EQUIPMENT_ID, required: true },
172
+ { id: FieldConstants.EQUIPMENT_NAME, required: false },
173
+ { id: FieldConstants.VOLTAGE_LEVEL_ID, required: true },
174
+ { id: TabularFieldConstants.BUS_OR_BUSBAR_SECTION_ID, required: true },
175
+ ...CONNECTION_FIELDS,
176
+ { id: FieldConstants.MAXIMUM_SECTION_COUNT, required: true, type: TABULAR_NUMBER },
177
+ { id: FieldConstants.SECTION_COUNT, required: true, type: TABULAR_NUMBER },
178
+ {
179
+ id: FieldConstants.SHUNT_COMPENSATOR_TYPE,
180
+ requiredIf: { id: FieldConstants.MAX_Q_AT_NOMINAL_V },
181
+ type: TABULAR_ENUM,
182
+ options: Object.keys(SHUNT_COMPENSATOR_TYPES)
183
+ },
184
+ {
185
+ id: FieldConstants.MAX_Q_AT_NOMINAL_V,
186
+ requiredIf: { id: FieldConstants.SHUNT_COMPENSATOR_TYPE },
187
+ type: TABULAR_NUMBER
188
+ },
189
+ { id: FieldConstants.MAX_SUSCEPTANCE, required: false, type: TABULAR_NUMBER }
190
+ ]
191
+ };
192
+ const TABULAR_CREATION_TYPES = {
193
+ GENERATOR: MODIFICATION_TYPES.GENERATOR_CREATION.type,
194
+ BATTERY: MODIFICATION_TYPES.BATTERY_CREATION.type,
195
+ LOAD: MODIFICATION_TYPES.LOAD_CREATION.type,
196
+ SHUNT_COMPENSATOR: MODIFICATION_TYPES.SHUNT_COMPENSATOR_CREATION.type
197
+ };
198
+ const convertCreationFieldFromBackToFront = (key, value) => {
199
+ if (key === TabularFieldConstants.REACTIVE_CAPABILITY_CURVE_POINTS) {
200
+ return convertReactiveCapabilityCurvePointsFromBackToFront(value);
201
+ }
202
+ return { key, value };
203
+ };
204
+ const convertCreationFieldFromFrontToBack = (key, value) => {
205
+ if (key === FieldConstants.CONNECTION_DIRECTION) {
206
+ return { key, value: value ?? "UNDEFINED" };
207
+ }
208
+ return { key, value };
209
+ };
210
+ const getEquipmentTypeFromCreationType = (type) => {
211
+ return Object.keys(TABULAR_CREATION_TYPES).find((key) => TABULAR_CREATION_TYPES[key] === type);
212
+ };
213
+ const convertCreations = (creations) => {
214
+ return creations.map((creat) => {
215
+ const creation = {};
216
+ Object.keys(formatModification(creat)).forEach((key) => {
217
+ const entry = convertCreationFieldFromBackToFront(key, creat[key]);
218
+ (Array.isArray(entry) ? entry : [entry]).forEach((item) => {
219
+ creation[item.key] = item.value;
220
+ });
221
+ });
222
+ return addPropertiesFromBack(creation, creat?.[TabularFieldConstants.TABULAR_PROPERTIES]);
223
+ });
224
+ };
225
+ const transformRowToBackEndCreation = (row, modificationType) => {
226
+ const creation = {
227
+ type: modificationType
228
+ };
229
+ const propertiesModifications = transformProperties(row);
230
+ Object.keys(row).forEach((key) => {
231
+ const entry = convertCreationFieldFromFrontToBack(key, row[key]);
232
+ creation[entry.key] = entry.value;
233
+ });
234
+ if (modificationType === ModificationType.GENERATOR_CREATION || modificationType === ModificationType.BATTERY_CREATION) {
235
+ convertReactiveCapabilityCurvePointsFromFrontToBack(creation);
236
+ }
237
+ if (propertiesModifications.length > 0) {
238
+ creation[TabularFieldConstants.TABULAR_PROPERTIES] = propertiesModifications;
239
+ }
240
+ return creation;
241
+ };
242
+ const transformCreationsTable = (modificationType, creationsTable = []) => creationsTable.map((row) => transformRowToBackEndCreation(row, modificationType));
243
+ const tabularCreationDtoToForm = (dto) => {
244
+ const creations = convertCreations(dto?.modifications ?? []).map((creation) => ({
245
+ [FieldConstants.AG_GRID_ROW_UUID]: v4(),
246
+ ...creation
247
+ }));
248
+ return {
249
+ [FieldConstants.TYPE]: getEquipmentTypeFromCreationType(dto?.modificationType) ?? "",
250
+ [TabularFieldConstants.MODIFICATIONS_TABLE]: creations,
251
+ [TabularFieldConstants.TABULAR_PROPERTIES]: dto?.properties,
252
+ [TabularFieldConstants.CSV_FILENAME]: dto?.csvFilename
253
+ };
254
+ };
255
+ const tabularCreationFormToDto = (form) => {
256
+ const modificationType = TABULAR_CREATION_TYPES[form[FieldConstants.TYPE]];
257
+ return {
258
+ type: ModificationType.TABULAR_CREATION,
259
+ modificationType,
260
+ modifications: transformCreationsTable(modificationType, form[TabularFieldConstants.MODIFICATIONS_TABLE]),
261
+ csvFilename: form[TabularFieldConstants.CSV_FILENAME],
262
+ properties: form[TabularFieldConstants.TABULAR_PROPERTIES]
263
+ };
264
+ };
265
+ export {
266
+ TABULAR_CREATION_FIELDS,
267
+ TABULAR_CREATION_TYPES,
268
+ convertCreationFieldFromBackToFront,
269
+ convertCreationFieldFromFrontToBack,
270
+ convertCreations,
271
+ getEquipmentTypeFromCreationType,
272
+ tabularCreationDtoToForm,
273
+ tabularCreationFormToDto,
274
+ transformCreationsTable,
275
+ transformRowToBackEndCreation
276
+ };
@@ -0,0 +1,43 @@
1
+ import { TabularFieldConstants } from './tabular.constants';
2
+ import { TabularFields, TabularFormDto, TabularModificationDto, TabularModificationRow } from './tabular.types';
3
+ import { TabularFormType } from './tabular.utils';
4
+ export declare const TABULAR_MODIFICATION_FIELDS: TabularFields;
5
+ export declare const TABULAR_MODIFICATION_TYPES: {
6
+ [key: string]: string;
7
+ };
8
+ export declare const getEquipmentTypeFromModificationType: (type: string) => string | undefined;
9
+ export declare const convertInputValues: (key: string, value: {
10
+ value: string | number;
11
+ }) => any;
12
+ export declare const convertOutputValues: (key: string, value: string | number) => string | number | import('../../..').AttributeModification<any> | null;
13
+ export declare const getTabularFieldType: (modificationType: string, key: string) => string;
14
+ export declare const convertGeneratorOrBatteryModificationFromBackToFront: (modification: TabularModificationRow) => TabularModificationRow;
15
+ export declare const convertGeneratorOrBatteryModificationFromFrontToBack: (modification: TabularModificationRow) => TabularModificationRow;
16
+ export declare const TWT_TAP_CHANGER_FIELDS: TabularFieldConstants[];
17
+ export declare const convertTWTTapChangerModificationFromFrontToBack: (modification: TabularModificationRow) => TabularModificationRow;
18
+ /**
19
+ * Type definition for modification transformation strategies
20
+ */
21
+ export type ModificationTransformationStrategy = {
22
+ [key: string]: (row: TabularModificationRow, modificationType: string) => TabularModificationRow;
23
+ };
24
+ /**
25
+ * Transformation strategies from front-end to back-end for different modification types
26
+ */
27
+ export declare const MODIFICATION_TRANSFORMATION_STRATEGIES: ModificationTransformationStrategy;
28
+ /**
29
+ * Transforms a single row of form data into a modification object for the back-end
30
+ * @param row - The form data row to transform
31
+ * @param modificationType - The type of modification being performed
32
+ * @returns The transformed modification object
33
+ */
34
+ export declare const transformRowToBackEndModification: (row: TabularModificationRow, modificationType: string) => TabularModificationRow;
35
+ /**
36
+ * Transforms form data modifications table into an array of back-end modification objects
37
+ * @param modificationsTable - Array of form data rows
38
+ * @param modificationType - The type of modification being performed
39
+ * @returns Array of transformed modification objects
40
+ */
41
+ export declare const transformModificationsTable: (modificationType: string, modificationsTable?: TabularModificationRow[]) => TabularModificationRow[];
42
+ export declare const tabularModificationDtoToForm: (dto: TabularModificationDto) => TabularFormType;
43
+ export declare const tabularModificationFormToDto: (form: TabularFormType) => TabularFormDto;