@gridsuite/commons-ui 0.269.0 → 0.271.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 (142) hide show
  1. package/dist/components/ui/dialogs/customMuiDialog/CustomMuiDialog.d.ts +10 -3
  2. package/dist/components/ui/dialogs/customMuiDialog/CustomMuiDialog.js +33 -28
  3. package/dist/features/index.js +96 -3
  4. package/dist/features/network-modifications/common/branch/branchCreation.types.d.ts +26 -0
  5. package/dist/features/network-modifications/common/branch/branchModification.types.d.ts +36 -0
  6. package/dist/features/network-modifications/common/branch/branchModification.types.js +1 -0
  7. package/dist/features/network-modifications/{line/characteristics/lineCharacteristicsPane.types.d.ts → common/branch/index.d.ts} +2 -8
  8. package/dist/features/network-modifications/common/branch/index.js +1 -0
  9. package/dist/features/network-modifications/common/connectivity/connectivityForm.utils.d.ts +2 -0
  10. package/dist/features/network-modifications/common/currentLimits/limits.types.d.ts +1 -0
  11. package/dist/features/network-modifications/common/currentLimits/limitsPane.utils.d.ts +2 -2
  12. package/dist/features/network-modifications/common/index.d.ts +1 -0
  13. package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +1 -1
  14. package/dist/features/network-modifications/common/regulatingTerminal/regulatingTerminal.utils.d.ts +2 -2
  15. package/dist/features/network-modifications/common/regulatingTerminal/regulatingTerminal.utils.js +2 -2
  16. package/dist/features/network-modifications/index.d.ts +1 -0
  17. package/dist/features/network-modifications/index.js +96 -3
  18. package/dist/features/network-modifications/line/characteristics/index.d.ts +0 -1
  19. package/dist/features/network-modifications/line/characteristics/index.js +1 -2
  20. package/dist/features/network-modifications/line/characteristics/lineCharacteristicsPane.utils.d.ts +4 -19
  21. package/dist/features/network-modifications/line/characteristics/lineCharacteristicsPane.utils.js +0 -14
  22. package/dist/features/network-modifications/line/creation/lineCreation.types.d.ts +6 -26
  23. package/dist/features/network-modifications/line/index.js +1 -2
  24. package/dist/features/network-modifications/line/modification/lineModification.types.d.ts +3 -35
  25. package/dist/features/network-modifications/twoWindingsTransformer/characteristics/TwoWindingsTransformerCharacteristicsPane.d.ts +7 -0
  26. package/dist/features/network-modifications/twoWindingsTransformer/characteristics/TwoWindingsTransformerCharacteristicsPane.js +168 -0
  27. package/dist/features/network-modifications/twoWindingsTransformer/characteristics/index.d.ts +8 -0
  28. package/dist/features/network-modifications/twoWindingsTransformer/characteristics/index.js +8 -0
  29. package/dist/features/network-modifications/twoWindingsTransformer/characteristics/twoWindingsTransformerCharacteristicsPane.utils.d.ts +41 -0
  30. package/dist/features/network-modifications/twoWindingsTransformer/characteristics/twoWindingsTransformerCharacteristicsPane.utils.js +51 -0
  31. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogHeader.d.ts +6 -0
  32. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogHeader.js +123 -0
  33. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.d.ts +9 -0
  34. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.js +89 -0
  35. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabsContent.d.ts +14 -0
  36. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabsContent.js +118 -0
  37. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.d.ts +6 -0
  38. package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.js +47 -0
  39. package/dist/features/network-modifications/twoWindingsTransformer/common/index.d.ts +12 -0
  40. package/dist/features/network-modifications/twoWindingsTransformer/common/index.js +13 -0
  41. package/dist/features/network-modifications/twoWindingsTransformer/common/twoWindingsTransformer.types.d.ts +87 -0
  42. package/dist/features/network-modifications/twoWindingsTransformer/common/twoWindingsTransformer.types.js +1 -0
  43. package/dist/features/network-modifications/twoWindingsTransformer/common/twoWindingsTransformer.utils.d.ts +10 -0
  44. package/dist/features/network-modifications/twoWindingsTransformer/common/twoWindingsTransformer.utils.js +50 -0
  45. package/dist/features/network-modifications/twoWindingsTransformer/creation/index.d.ts +8 -0
  46. package/dist/features/network-modifications/twoWindingsTransformer/creation/index.js +12 -0
  47. package/dist/features/network-modifications/twoWindingsTransformer/creation/twoWindingsTransformerCreation.types.d.ts +47 -0
  48. package/dist/features/network-modifications/twoWindingsTransformer/creation/twoWindingsTransformerCreation.types.js +8 -0
  49. package/dist/features/network-modifications/twoWindingsTransformer/creation/twoWindingsTransformerCreation.utils.d.ts +248 -0
  50. package/dist/features/network-modifications/twoWindingsTransformer/creation/twoWindingsTransformerCreation.utils.js +325 -0
  51. package/dist/features/network-modifications/twoWindingsTransformer/index.d.ts +11 -0
  52. package/dist/features/network-modifications/twoWindingsTransformer/index.js +88 -0
  53. package/dist/features/network-modifications/twoWindingsTransformer/modification/index.d.ts +9 -0
  54. package/dist/features/network-modifications/twoWindingsTransformer/modification/index.js +10 -0
  55. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/ToBeEstimatedForm.d.ts +6 -0
  56. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/ToBeEstimatedForm.js +104 -0
  57. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/index.d.ts +9 -0
  58. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/index.js +7 -0
  59. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/toBeEstimated.type.d.ts +10 -0
  60. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/toBeEstimated.type.js +1 -0
  61. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/toBeEstimated.utils.d.ts +12 -0
  62. package/dist/features/network-modifications/twoWindingsTransformer/modification/measurements/toBeEstimated.utils.js +18 -0
  63. package/dist/features/network-modifications/twoWindingsTransformer/modification/twoWindingsTransformerModification.types.d.ts +39 -0
  64. package/dist/features/network-modifications/twoWindingsTransformer/modification/twoWindingsTransformerModification.types.js +1 -0
  65. package/dist/features/network-modifications/twoWindingsTransformer/modification/twoWindingsTransformerModification.utils.d.ts +265 -0
  66. package/dist/features/network-modifications/twoWindingsTransformer/modification/twoWindingsTransformerModification.utils.js +100 -0
  67. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/RegulatedTerminalSection.d.ts +13 -0
  68. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/RegulatedTerminalSection.js +130 -0
  69. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/TapChangerSteps.d.ts +20 -0
  70. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/TapChangerSteps.js +311 -0
  71. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/index.d.ts +12 -0
  72. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/index.js +53 -0
  73. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/PhaseTapChangerPane.d.ts +2 -0
  74. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/PhaseTapChangerPane.js +198 -0
  75. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/PhaseTapChangerPaneSteps.d.ts +9 -0
  76. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/PhaseTapChangerPaneSteps.js +201 -0
  77. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/index.d.ts +9 -0
  78. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/index.js +15 -0
  79. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/phaseTapChanger.utils.d.ts +114 -0
  80. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/phaseTapChanger/phaseTapChanger.utils.js +242 -0
  81. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/RatioTapChangerPane.d.ts +2 -0
  82. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/RatioTapChangerPane.js +283 -0
  83. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/RatioTapChangerPaneSteps.d.ts +9 -0
  84. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/RatioTapChangerPaneSteps.js +181 -0
  85. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/index.d.ts +9 -0
  86. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/index.js +18 -0
  87. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/ratioTapChanger.utils.d.ts +132 -0
  88. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/ratioTapChanger/ratioTapChanger.utils.js +211 -0
  89. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/CreateRuleDialog.d.ts +2 -0
  90. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/CreateRuleDialog.js +102 -0
  91. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/CreateRuleDialogSubmitButton.d.ts +7 -0
  92. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/CreateRuleDialogSubmitButton.js +22 -0
  93. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/CreateRuleForm.d.ts +6 -0
  94. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/CreateRuleForm.js +86 -0
  95. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/ImportRuleDialog.d.ts +10 -0
  96. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/ImportRuleDialog.js +140 -0
  97. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/index.d.ts +12 -0
  98. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/index.js +13 -0
  99. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/regulationRule.types.d.ts +12 -0
  100. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/regulationRule.types.js +1 -0
  101. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/regulationRule.utils.d.ts +9 -0
  102. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/regulationRule/regulationRule.utils.js +19 -0
  103. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/tapChanger.utils.d.ts +14 -0
  104. package/dist/features/network-modifications/twoWindingsTransformer/tapChanger/tapChanger.utils.js +79 -0
  105. package/dist/features/network-modifications/voltageLevel/index.d.ts +1 -0
  106. package/dist/features/network-modifications/voltageLevel/index.js +9 -1
  107. package/dist/features/network-modifications/voltageLevel/section/VoltageLevelSectionCreationForm.d.ts +10 -0
  108. package/dist/features/network-modifications/voltageLevel/section/VoltageLevelSectionCreationForm.js +375 -0
  109. package/dist/features/network-modifications/voltageLevel/section/index.d.ts +9 -0
  110. package/dist/features/network-modifications/voltageLevel/section/index.js +10 -0
  111. package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.types.d.ts +15 -0
  112. package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.types.js +1 -0
  113. package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.utils.d.ts +48 -0
  114. package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.utils.js +100 -0
  115. package/dist/index.js +107 -7
  116. package/dist/translations/en/filterExpertEn.d.ts +0 -3
  117. package/dist/translations/en/filterExpertEn.js +0 -3
  118. package/dist/translations/en/network-modification-validationEn.d.ts +1 -0
  119. package/dist/translations/en/network-modification-validationEn.js +2 -1
  120. package/dist/translations/en/networkModificationsEn.d.ts +87 -9
  121. package/dist/translations/en/networkModificationsEn.js +91 -12
  122. package/dist/translations/fr/filterExpertFr.d.ts +0 -3
  123. package/dist/translations/fr/filterExpertFr.js +0 -3
  124. package/dist/translations/fr/network-modification-validationFr.d.ts +1 -0
  125. package/dist/translations/fr/network-modification-validationFr.js +2 -1
  126. package/dist/translations/fr/networkModificationsFr.d.ts +87 -9
  127. package/dist/translations/fr/networkModificationsFr.js +91 -12
  128. package/dist/utils/constants/fieldConstants.d.ts +37 -0
  129. package/dist/utils/constants/fieldConstants.js +37 -0
  130. package/dist/utils/constants/index.js +2 -1
  131. package/dist/utils/constants/translationKeys.d.ts +1 -0
  132. package/dist/utils/constants/translationKeys.js +2 -0
  133. package/dist/utils/functions.d.ts +9 -0
  134. package/dist/utils/functions.js +40 -0
  135. package/dist/utils/index.js +11 -4
  136. package/dist/utils/langs.d.ts +1 -0
  137. package/dist/utils/langs.js +9 -1
  138. package/dist/utils/types/equipmentType.d.ts +34 -0
  139. package/dist/utils/types/equipmentType.js +28 -0
  140. package/dist/utils/types/index.js +4 -1
  141. package/package.json +1 -1
  142. /package/dist/features/network-modifications/{line/characteristics/lineCharacteristicsPane.types.js → common/branch/branchCreation.types.js} +0 -0
@@ -0,0 +1,311 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useMemo, useCallback, useEffect } from "react";
3
+ import { useFormContext, useFieldArray, useWatch } from "react-hook-form";
4
+ import { Tooltip, IconButton, Grid } from "@mui/material";
5
+ import { Addchart } from "@mui/icons-material";
6
+ import { useIntl } from "react-intl";
7
+ import { CreateRuleDialog } from "./regulationRule/CreateRuleDialog.js";
8
+ import { ImportRuleDialog } from "./regulationRule/ImportRuleDialog.js";
9
+ import "../../../../components/ui/overflowableText/OverflowableText.js";
10
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
11
+ import "../../../../utils/conversionUtils.js";
12
+ import "../../../../utils/types/equipmentType.js";
13
+ import "localized-countries";
14
+ import "localized-countries/data/fr";
15
+ import "localized-countries/data/en";
16
+ import "notistack";
17
+ import "../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
18
+ import { useCustomFormContext } from "../../../../components/ui/reactHookForm/provider/useCustomFormContext.js";
19
+ import "yup";
20
+ import "../../../../components/ui/treeViewFinder/TreeViewFinder.js";
21
+ import { IntegerInput } from "../../../../components/ui/reactHookForm/numbers/IntegerInput.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 { DndTable } from "../../../../components/composite/dnd-table/dnd-table.js";
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 "uuid";
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 { roundToDefaultPrecision } from "../../../../utils/rounding.js";
61
+ import "../../../../components/composite/report/report-viewer/log-table/log-table.js";
62
+ import "react-window";
63
+ import "../../../../components/composite/report/report-treeview/treeview-item.js";
64
+ import "../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
65
+ import { compareStepsWithPreviousValues, toTapChangerStepList, computeHighTapPosition } from "./tapChanger.utils.js";
66
+ function TapChangerSteps({
67
+ tapChanger,
68
+ createTapRuleColumn,
69
+ columnsDefinition,
70
+ csvColumns,
71
+ createRuleMessageId,
72
+ createRuleAllowNegativeValues,
73
+ importRuleMessageId,
74
+ resetButtonMessageId,
75
+ handleImportRow,
76
+ disabled,
77
+ previousValues,
78
+ editData,
79
+ isModification = false
80
+ }) {
81
+ const intl = useIntl();
82
+ const { trigger, getValues, setValue, clearErrors } = useFormContext();
83
+ const { isNodeBuilt } = useCustomFormContext();
84
+ const useFieldArrayOutput = useFieldArray({
85
+ name: `${tapChanger}.${FieldConstants.STEPS}`
86
+ });
87
+ const {
88
+ fields: tapSteps,
89
+ // don't use it to access form data ! check doc
90
+ replace
91
+ } = useFieldArrayOutput;
92
+ const lowTapPosition = useWatch({
93
+ name: `${tapChanger}.${FieldConstants.LOW_TAP_POSITION}`
94
+ });
95
+ const [openCreateRuleDialog, setOpenCreateRuleDialog] = useState(false);
96
+ const [openImportRuleDialog, setOpenImportRuleDialog] = useState(false);
97
+ const disableAddingRows = useMemo(() => {
98
+ return isModification && lowTapPosition === null && previousValues?.[FieldConstants.LOW_TAP_POSITION] === void 0;
99
+ }, [isModification, lowTapPosition, previousValues]);
100
+ const allowedToAddTapRows = useCallback(() => {
101
+ return trigger(`${tapChanger}.${FieldConstants.LOW_TAP_POSITION}`);
102
+ }, [trigger, tapChanger]);
103
+ const createTapRows = useCallback(
104
+ (numberOfRows) => {
105
+ const currentLowTapPosition = getValues(`${tapChanger}.${FieldConstants.LOW_TAP_POSITION}`);
106
+ const currentTapRows = getValues(`${tapChanger}.${FieldConstants.STEPS}`);
107
+ let nextHighestTap;
108
+ if (currentTapRows.length === 0) {
109
+ nextHighestTap = currentLowTapPosition;
110
+ } else {
111
+ nextHighestTap = currentTapRows[currentTapRows.length - 1][FieldConstants.STEPS_TAP] + 1;
112
+ }
113
+ const tapRowsToAdd = [];
114
+ for (let i = 0; i < numberOfRows; i++) {
115
+ const newRow = columnsDefinition.slice(1).reduce(
116
+ (accumulator, currentValue) => ({
117
+ ...accumulator,
118
+ [currentValue.dataKey]: currentValue.initialValue
119
+ }),
120
+ { [FieldConstants.STEPS_TAP]: nextHighestTap }
121
+ );
122
+ tapRowsToAdd.push(newRow);
123
+ if (i !== numberOfRows - 1) {
124
+ nextHighestTap += 1;
125
+ }
126
+ }
127
+ setValue(`${tapChanger}.${FieldConstants.HIGH_TAP_POSITION}`, nextHighestTap);
128
+ return tapRowsToAdd;
129
+ },
130
+ [columnsDefinition, getValues, setValue, tapChanger]
131
+ );
132
+ const tapStepsWatcher = useWatch({
133
+ name: `${tapChanger}.${FieldConstants.STEPS}`
134
+ });
135
+ const areStepsModified = useMemo(() => {
136
+ if (editData && isNodeBuilt) {
137
+ return true;
138
+ }
139
+ return !compareStepsWithPreviousValues(
140
+ tapStepsWatcher,
141
+ toTapChangerStepList(previousValues?.[FieldConstants.STEPS])
142
+ );
143
+ }, [editData, isNodeBuilt, previousValues, tapStepsWatcher]);
144
+ const resetTapNumbers = useCallback(
145
+ (stepsOverride) => {
146
+ const currentTapRows = stepsOverride ?? getValues(`${tapChanger}.${FieldConstants.STEPS}`);
147
+ const currentLowTapPosition = isModification && lowTapPosition === null ? previousValues?.[FieldConstants.LOW_TAP_POSITION] : lowTapPosition;
148
+ if (currentLowTapPosition == null) {
149
+ return;
150
+ }
151
+ for (let tapPosition = currentLowTapPosition, index = 0; index < currentTapRows.length; tapPosition++, index++) {
152
+ setValue(`${tapChanger}.${FieldConstants.STEPS}[${index}].${FieldConstants.STEPS_TAP}`, tapPosition);
153
+ }
154
+ const newHighTapPosition = currentTapRows.length !== 0 ? (currentLowTapPosition ?? 0) + currentTapRows.length - 1 : null;
155
+ setValue(`${tapChanger}.${FieldConstants.HIGH_TAP_POSITION}`, newHighTapPosition);
156
+ },
157
+ [getValues, tapChanger, lowTapPosition, previousValues, setValue, isModification]
158
+ );
159
+ useEffect(() => {
160
+ trigger(`${tapChanger}.${FieldConstants.LOW_TAP_POSITION}`).then((result) => {
161
+ if (result) {
162
+ resetTapNumbers(null);
163
+ }
164
+ });
165
+ }, [trigger, tapChanger, lowTapPosition, resetTapNumbers]);
166
+ useEffect(() => {
167
+ resetTapNumbers(tapSteps);
168
+ }, [tapSteps, resetTapNumbers]);
169
+ const handleResetButton = useCallback(() => {
170
+ replace(previousValues?.[FieldConstants.STEPS] ?? []);
171
+ setValue(`${tapChanger}.${FieldConstants.LOW_TAP_POSITION}`, null);
172
+ clearErrors(`${tapChanger}.${FieldConstants.STEPS}`);
173
+ }, [clearErrors, previousValues, replace, setValue, tapChanger]);
174
+ const handleCreateTapRule = (lowTap, highTap) => {
175
+ const currentTapRows = getValues(`${tapChanger}.${FieldConstants.STEPS}`);
176
+ if (currentTapRows.length > 1) {
177
+ const interval = (highTap - lowTap) / (currentTapRows.length - 1);
178
+ let current = lowTap;
179
+ currentTapRows.forEach((_row, index) => {
180
+ currentTapRows[index][createTapRuleColumn] = roundToDefaultPrecision(current);
181
+ current += interval;
182
+ });
183
+ replace(currentTapRows);
184
+ }
185
+ };
186
+ const handleImportTapRuleButton = useCallback(() => {
187
+ trigger(`${tapChanger}.${FieldConstants.LOW_TAP_POSITION}`).then((result) => {
188
+ if (result) {
189
+ setOpenImportRuleDialog(true);
190
+ }
191
+ });
192
+ }, [trigger, tapChanger]);
193
+ const handleImportTapRule = (results) => {
194
+ const rows = results.data.map((val) => ({
195
+ ...handleImportRow(val),
196
+ [FieldConstants.SELECTED]: false
197
+ }));
198
+ if (rows.length > 0) {
199
+ replace(rows);
200
+ }
201
+ };
202
+ const lowTapPositionField = /* @__PURE__ */ jsx(
203
+ IntegerInput,
204
+ {
205
+ name: `${tapChanger}.${FieldConstants.LOW_TAP_POSITION}`,
206
+ label: "LowTapPosition",
207
+ formProps: {
208
+ disabled
209
+ },
210
+ previousValue: previousValues?.[FieldConstants.LOW_TAP_POSITION]
211
+ }
212
+ );
213
+ const highTapPositionField = /* @__PURE__ */ jsx(
214
+ IntegerInput,
215
+ {
216
+ name: `${tapChanger}.${FieldConstants.HIGH_TAP_POSITION}`,
217
+ label: "HighTapPosition",
218
+ formProps: {
219
+ disabled: true
220
+ },
221
+ previousValue: computeHighTapPosition(previousValues?.[FieldConstants.STEPS] ?? []) ?? void 0
222
+ }
223
+ );
224
+ const tapPositionField = /* @__PURE__ */ jsx(
225
+ IntegerInput,
226
+ {
227
+ name: `${tapChanger}.${FieldConstants.TAP_POSITION}`,
228
+ label: "TapPosition",
229
+ formProps: {
230
+ disabled
231
+ },
232
+ previousValue: previousValues?.[FieldConstants.TAP_POSITION]
233
+ }
234
+ );
235
+ const createRuleButton = /* @__PURE__ */ jsx(
236
+ Tooltip,
237
+ {
238
+ title: intl.formatMessage({
239
+ id: createRuleMessageId
240
+ }),
241
+ placement: "left",
242
+ children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { onClick: () => setOpenCreateRuleDialog(true), disabled: disabled || tapSteps.length === 0, children: /* @__PURE__ */ jsx(Addchart, {}) }) })
243
+ }
244
+ );
245
+ const completedColumnsDefinition = columnsDefinition.map(
246
+ (column, index) => index === columnsDefinition.length - 1 ? { ...column, extra: createRuleButton } : column
247
+ );
248
+ const getTapPreviousValue = useCallback(
249
+ (rowIndex, column, arrayFormName, previousTapSteps) => {
250
+ const step = previousTapSteps?.find(
251
+ (e) => e.index === getValues(arrayFormName)[rowIndex]?.index
252
+ );
253
+ if (step === void 0) {
254
+ return void 0;
255
+ }
256
+ return step?.[column.dataKey];
257
+ },
258
+ [getValues]
259
+ );
260
+ const isTapModified = useCallback(() => areStepsModified, [areStepsModified]);
261
+ return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, children: [
262
+ /* @__PURE__ */ jsx(Grid, { size: 4, children: lowTapPositionField }),
263
+ /* @__PURE__ */ jsx(Grid, { size: 4, children: highTapPositionField }),
264
+ /* @__PURE__ */ jsx(Grid, { size: 4, children: tapPositionField }),
265
+ /* @__PURE__ */ jsx(
266
+ DndTable,
267
+ {
268
+ name: `${tapChanger}.${FieldConstants.STEPS}`,
269
+ useFieldArrayOutput,
270
+ columnsDefinition: completedColumnsDefinition,
271
+ tableHeight: 400,
272
+ allowedToAddRows: allowedToAddTapRows,
273
+ createRows: createTapRows,
274
+ handleUploadButton: handleImportTapRuleButton,
275
+ uploadButtonMessageId: importRuleMessageId,
276
+ handleResetButton,
277
+ resetButtonMessageId,
278
+ previousValues: toTapChangerStepList(previousValues?.[FieldConstants.STEPS]),
279
+ getPreviousValue: getTapPreviousValue,
280
+ isValueModified: isTapModified,
281
+ withResetButton: isModification && areStepsModified,
282
+ disableAddingRows,
283
+ disabled,
284
+ disableDragAndDrop: true
285
+ }
286
+ ),
287
+ /* @__PURE__ */ jsx(
288
+ CreateRuleDialog,
289
+ {
290
+ tapChanger,
291
+ openCreateRuleDialog,
292
+ setOpenCreateRuleDialog,
293
+ handleCreateTapRule,
294
+ allowNegativeValues: createRuleAllowNegativeValues
295
+ }
296
+ ),
297
+ /* @__PURE__ */ jsx(
298
+ ImportRuleDialog,
299
+ {
300
+ tapChanger,
301
+ openImportRuleDialog,
302
+ setOpenImportRuleDialog,
303
+ csvColumns,
304
+ handleImportTapRule
305
+ }
306
+ )
307
+ ] });
308
+ }
309
+ export {
310
+ TapChangerSteps
311
+ };
@@ -0,0 +1,12 @@
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 './tapChanger.utils';
8
+ export * from './regulationRule';
9
+ export * from './phaseTapChanger';
10
+ export * from './ratioTapChanger';
11
+ export * from './RegulatedTerminalSection';
12
+ export * from './TapChangerSteps';
@@ -0,0 +1,53 @@
1
+ import { compareStepsWithPreviousValues, computeHighTapPosition, getRegulationTypeLabel, getTapChangerEquipmentSectionTypeValue, getTapSideLabel, toTapChangerStepList } from "./tapChanger.utils.js";
2
+ import { getCreateRuleEmptyFormData, getCreateRuleValidationSchema } from "./regulationRule/regulationRule.utils.js";
3
+ import { CreateRuleDialogSubmitButton } from "./regulationRule/CreateRuleDialogSubmitButton.js";
4
+ import { CreateRuleForm } from "./regulationRule/CreateRuleForm.js";
5
+ import { CreateRuleDialog } from "./regulationRule/CreateRuleDialog.js";
6
+ import { ImportRuleDialog } from "./regulationRule/ImportRuleDialog.js";
7
+ import { getComputedPhaseRegulationType, getComputedPhaseRegulationTypeId, getComputedPhaseTapChangerRegulationMode, getComputedPreviousPhaseRegulationType, getPhaseTapChangerEmptyFormData, getPhaseTapChangerFormData, getPhaseTapChangerValidationSchemaProps, getPhaseTapRegulationSideId } from "./phaseTapChanger/phaseTapChanger.utils.js";
8
+ import { PhaseTapChangerPaneSteps } from "./phaseTapChanger/PhaseTapChangerPaneSteps.js";
9
+ import { PhaseTapChangerPane } from "./phaseTapChanger/PhaseTapChangerPane.js";
10
+ import { getComputedPreviousRatioRegulationType, getComputedRegulationMode, getComputedRegulationModeId, getComputedRegulationType, getComputedRegulationTypeId, getComputedTapSide, getComputedTapSideId, getInitialTwtRatioRegulationModeId, getRatioTapChangerEmptyFormData, getRatioTapChangerFormData, getRatioTapChangerValidationSchemaProps } from "./ratioTapChanger/ratioTapChanger.utils.js";
11
+ import { RatioTapChangerPaneSteps } from "./ratioTapChanger/RatioTapChangerPaneSteps.js";
12
+ import { RatioTapChangerPane } from "./ratioTapChanger/RatioTapChangerPane.js";
13
+ import { RegulatedTerminalSection } from "./RegulatedTerminalSection.js";
14
+ import { TapChangerSteps } from "./TapChangerSteps.js";
15
+ export {
16
+ CreateRuleDialog,
17
+ CreateRuleDialogSubmitButton,
18
+ CreateRuleForm,
19
+ ImportRuleDialog,
20
+ PhaseTapChangerPane,
21
+ PhaseTapChangerPaneSteps,
22
+ RatioTapChangerPane,
23
+ RatioTapChangerPaneSteps,
24
+ RegulatedTerminalSection,
25
+ TapChangerSteps,
26
+ compareStepsWithPreviousValues,
27
+ computeHighTapPosition,
28
+ getComputedPhaseRegulationType,
29
+ getComputedPhaseRegulationTypeId,
30
+ getComputedPhaseTapChangerRegulationMode,
31
+ getComputedPreviousPhaseRegulationType,
32
+ getComputedPreviousRatioRegulationType,
33
+ getComputedRegulationMode,
34
+ getComputedRegulationModeId,
35
+ getComputedRegulationType,
36
+ getComputedRegulationTypeId,
37
+ getComputedTapSide,
38
+ getComputedTapSideId,
39
+ getCreateRuleEmptyFormData,
40
+ getCreateRuleValidationSchema,
41
+ getInitialTwtRatioRegulationModeId,
42
+ getPhaseTapChangerEmptyFormData,
43
+ getPhaseTapChangerFormData,
44
+ getPhaseTapChangerValidationSchemaProps,
45
+ getPhaseTapRegulationSideId,
46
+ getRatioTapChangerEmptyFormData,
47
+ getRatioTapChangerFormData,
48
+ getRatioTapChangerValidationSchemaProps,
49
+ getRegulationTypeLabel,
50
+ getTapChangerEquipmentSectionTypeValue,
51
+ getTapSideLabel,
52
+ toTapChangerStepList
53
+ };
@@ -0,0 +1,2 @@
1
+ import { TapChangerPaneProps } from '../../common/twoWindingsTransformer.types';
2
+ export declare function PhaseTapChangerPane({ id, voltageLevelOptions, previousValues, editData, fetchVoltageLevelEquipments, isModification, }: Readonly<TapChangerPaneProps>): import("react").JSX.Element;
@@ -0,0 +1,198 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import { useWatch } from "react-hook-form";
4
+ import { useIntl } from "react-intl";
5
+ import { useMemo } from "react";
6
+ import { PhaseTapChangerPaneSteps } from "./PhaseTapChangerPaneSteps.js";
7
+ import { getComputedPreviousPhaseRegulationType, getComputedPhaseTapChangerRegulationMode } from "./phaseTapChanger.utils.js";
8
+ import { AmpereAdornment, ActivePowerAdornment } from "../../../../../utils/constants/adornments.js";
9
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
10
+ import "../../../../../utils/conversionUtils.js";
11
+ import { PHASE_REGULATION_MODES } from "../../../../../utils/types/equipmentType.js";
12
+ import "@mui/icons-material";
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 { FloatInput } from "../../../../../components/ui/reactHookForm/numbers/FloatInput.js";
22
+ import "../../../../../components/ui/reactHookForm/numbers/RangeInput.js";
23
+ import { SelectInput } from "../../../../../components/ui/reactHookForm/selectInputs/SelectInput.js";
24
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
25
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
26
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
27
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
28
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
29
+ import "../../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
30
+ import "../../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
31
+ import "../../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
32
+ import "@hello-pangea/dnd";
33
+ import "../../../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
34
+ import "../../../../../components/ui/snackbarProvider/SnackbarProvider.js";
35
+ import "mui-nested-menu";
36
+ import "react-resizable-panels";
37
+ import "react-papaparse";
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 "uuid";
50
+ import "../../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
51
+ import "../../../../../components/composite/filter/utils/filterFormUtils.js";
52
+ import { GridItem } from "../../../../../components/composite/grid/grid-item.js";
53
+ import { GridSection } from "../../../../../components/composite/grid/grid-section.js";
54
+ import "@react-querybuilder/material";
55
+ import "../../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
56
+ import "../../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
57
+ import "../../../../../components/composite/agGridTable/BottomTableButtons.js";
58
+ import "../../../../../components/composite/agGridTable/CustomAgGridTable.js";
59
+ import "ag-grid-community";
60
+ import "../../../../../components/composite/customAGGrid/customAggrid.js";
61
+ import "../../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
62
+ import "mathjs";
63
+ import "../../../../../components/composite/report/report-viewer/log-table/log-table.js";
64
+ import "react-window";
65
+ import "../../../../../components/composite/report/report-treeview/treeview-item.js";
66
+ import "../../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
67
+ import { RegulatedTerminalSection } from "../RegulatedTerminalSection.js";
68
+ function PhaseTapChangerPane({
69
+ id = FieldConstants.PHASE_TAP_CHANGER,
70
+ voltageLevelOptions = [],
71
+ previousValues,
72
+ editData,
73
+ fetchVoltageLevelEquipments,
74
+ isModification = false
75
+ }) {
76
+ const intl = useIntl();
77
+ const phaseTapChangerEnabledWatch = useWatch({
78
+ name: `${id}.${FieldConstants.ENABLED}`
79
+ });
80
+ const regulationModeWatch = useWatch({
81
+ name: `${id}.${FieldConstants.REGULATION_MODE}`
82
+ });
83
+ const regulationTypeWatch = useWatch({
84
+ name: `${id}.${FieldConstants.REGULATION_TYPE}`
85
+ });
86
+ const getPhaseTapChangerRegulationModeLabel = (phaseTapChangerFormValues) => {
87
+ const computedRegulationMode = getComputedPhaseTapChangerRegulationMode(phaseTapChangerFormValues ?? void 0);
88
+ if (computedRegulationMode) {
89
+ return intl.formatMessage({
90
+ id: computedRegulationMode?.label
91
+ });
92
+ }
93
+ return void 0;
94
+ };
95
+ const getRegulatingPreviousValue = (field, tap) => {
96
+ if (tap?.[FieldConstants.REGULATION_MODE] === PHASE_REGULATION_MODES.ACTIVE_POWER_CONTROL.id && field === FieldConstants.FLOW_SET_POINT_REGULATING_VALUE || tap?.[FieldConstants.REGULATION_MODE] === PHASE_REGULATION_MODES.CURRENT_LIMITER.id && field === FieldConstants.CURRENT_LIMITER_REGULATING_VALUE) {
97
+ return tap?.regulationValue;
98
+ }
99
+ return void 0;
100
+ };
101
+ const regulationType = useMemo(() => {
102
+ return regulationTypeWatch || getComputedPreviousPhaseRegulationType(previousValues);
103
+ }, [regulationTypeWatch, previousValues]);
104
+ const regulationMode = useMemo(() => {
105
+ return regulationModeWatch || getComputedPhaseTapChangerRegulationMode(previousValues?.phaseTapChanger)?.id;
106
+ }, [regulationModeWatch, previousValues]);
107
+ const regulationModeField = /* @__PURE__ */ jsx(
108
+ SelectInput,
109
+ {
110
+ name: `${id}.${FieldConstants.REGULATION_MODE}`,
111
+ label: "RegulationMode",
112
+ options: Object.values(PHASE_REGULATION_MODES),
113
+ disabled: !phaseTapChangerEnabledWatch,
114
+ size: "small",
115
+ previousValue: getPhaseTapChangerRegulationModeLabel(previousValues?.phaseTapChanger)
116
+ }
117
+ );
118
+ const currentLimiterRegulatingValueField = /* @__PURE__ */ jsx(
119
+ FloatInput,
120
+ {
121
+ name: `${id}.${FieldConstants.CURRENT_LIMITER_REGULATING_VALUE}`,
122
+ label: "RegulatingValueCurrentLimiter",
123
+ formProps: {
124
+ disabled: !phaseTapChangerEnabledWatch
125
+ },
126
+ adornment: AmpereAdornment,
127
+ previousValue: getRegulatingPreviousValue(
128
+ FieldConstants.CURRENT_LIMITER_REGULATING_VALUE,
129
+ previousValues?.phaseTapChanger
130
+ )
131
+ }
132
+ );
133
+ const flowSetPointRegulatingValueField = /* @__PURE__ */ jsx(
134
+ FloatInput,
135
+ {
136
+ name: `${id}.${FieldConstants.FLOW_SET_POINT_REGULATING_VALUE}`,
137
+ label: "RegulatingValueActivePowerControl",
138
+ adornment: ActivePowerAdornment,
139
+ formProps: {
140
+ disabled: !phaseTapChangerEnabledWatch
141
+ },
142
+ previousValue: getRegulatingPreviousValue(
143
+ FieldConstants.FLOW_SET_POINT_REGULATING_VALUE,
144
+ previousValues?.phaseTapChanger
145
+ )
146
+ }
147
+ );
148
+ const targetDeadbandField = /* @__PURE__ */ jsx(
149
+ FloatInput,
150
+ {
151
+ name: `${id}.${FieldConstants.TARGET_DEADBAND}`,
152
+ label: "Deadband",
153
+ adornment: regulationMode === PHASE_REGULATION_MODES.ACTIVE_POWER_CONTROL.id ? ActivePowerAdornment : AmpereAdornment,
154
+ formProps: {
155
+ disabled: !phaseTapChangerEnabledWatch
156
+ },
157
+ previousValue: previousValues?.phaseTapChanger?.targetDeadband
158
+ }
159
+ );
160
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
161
+ /* @__PURE__ */ jsx(GridSection, { title: "RegulationSection", heading: 4 }),
162
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, children: [
163
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: regulationModeField }),
164
+ regulationMode === PHASE_REGULATION_MODES.CURRENT_LIMITER.id && /* @__PURE__ */ jsxs(Fragment, { children: [
165
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: currentLimiterRegulatingValueField }),
166
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: targetDeadbandField })
167
+ ] }),
168
+ regulationMode === PHASE_REGULATION_MODES.ACTIVE_POWER_CONTROL.id && /* @__PURE__ */ jsxs(Fragment, { children: [
169
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: flowSetPointRegulatingValueField }),
170
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: targetDeadbandField })
171
+ ] })
172
+ ] }),
173
+ phaseTapChangerEnabledWatch && regulationMode && /* @__PURE__ */ jsx(
174
+ RegulatedTerminalSection,
175
+ {
176
+ id,
177
+ voltageLevelOptions,
178
+ previousValues,
179
+ tapChangerDisabled: !phaseTapChangerEnabledWatch,
180
+ regulationType,
181
+ fetchVoltageLevelEquipments
182
+ }
183
+ ),
184
+ /* @__PURE__ */ jsx(GridSection, { title: "TapsSection", heading: 4 }),
185
+ /* @__PURE__ */ jsx(
186
+ PhaseTapChangerPaneSteps,
187
+ {
188
+ disabled: !phaseTapChangerEnabledWatch,
189
+ previousValues: previousValues?.phaseTapChanger,
190
+ editData,
191
+ isModification
192
+ }
193
+ )
194
+ ] });
195
+ }
196
+ export {
197
+ PhaseTapChangerPane
198
+ };
@@ -0,0 +1,9 @@
1
+ import { TapChangerMapInfos } from '../../common/twoWindingsTransformer.types';
2
+ import { TwoWindingsTransformerModificationDto } from '../../modification/twoWindingsTransformerModification.types';
3
+ export interface PhaseTapChangerPaneStepsProps {
4
+ disabled?: boolean;
5
+ previousValues?: TapChangerMapInfos;
6
+ editData?: TwoWindingsTransformerModificationDto;
7
+ isModification?: boolean;
8
+ }
9
+ export declare function PhaseTapChangerPaneSteps({ disabled, previousValues, editData, isModification, }: Readonly<PhaseTapChangerPaneStepsProps>): import("react").JSX.Element;