@gridsuite/commons-ui 0.270.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 (132) 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 +87 -2
  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 +87 -2
  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/index.js +98 -6
  106. package/dist/translations/en/filterExpertEn.d.ts +0 -3
  107. package/dist/translations/en/filterExpertEn.js +0 -3
  108. package/dist/translations/en/network-modification-validationEn.d.ts +1 -0
  109. package/dist/translations/en/network-modification-validationEn.js +2 -1
  110. package/dist/translations/en/networkModificationsEn.d.ts +70 -9
  111. package/dist/translations/en/networkModificationsEn.js +71 -10
  112. package/dist/translations/fr/filterExpertFr.d.ts +0 -3
  113. package/dist/translations/fr/filterExpertFr.js +0 -3
  114. package/dist/translations/fr/network-modification-validationFr.d.ts +1 -0
  115. package/dist/translations/fr/network-modification-validationFr.js +2 -1
  116. package/dist/translations/fr/networkModificationsFr.d.ts +70 -9
  117. package/dist/translations/fr/networkModificationsFr.js +71 -10
  118. package/dist/utils/constants/fieldConstants.d.ts +37 -0
  119. package/dist/utils/constants/fieldConstants.js +37 -0
  120. package/dist/utils/constants/index.js +2 -1
  121. package/dist/utils/constants/translationKeys.d.ts +1 -0
  122. package/dist/utils/constants/translationKeys.js +2 -0
  123. package/dist/utils/functions.d.ts +9 -0
  124. package/dist/utils/functions.js +40 -0
  125. package/dist/utils/index.js +11 -4
  126. package/dist/utils/langs.d.ts +1 -0
  127. package/dist/utils/langs.js +9 -1
  128. package/dist/utils/types/equipmentType.d.ts +34 -0
  129. package/dist/utils/types/equipmentType.js +28 -0
  130. package/dist/utils/types/index.js +4 -1
  131. package/package.json +1 -1
  132. /package/dist/features/network-modifications/{line/characteristics/lineCharacteristicsPane.types.js → common/branch/branchCreation.types.js} +0 -0
@@ -0,0 +1,22 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Button } from "@mui/material";
3
+ import { useFormContext, useWatch } from "react-hook-form";
4
+ import { FormattedMessage } from "react-intl";
5
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
6
+ import "../../../../../utils/conversionUtils.js";
7
+ import "../../../../../utils/types/equipmentType.js";
8
+ import "@mui/icons-material";
9
+ function CreateRuleDialogSubmitButton({
10
+ handleSave,
11
+ allowNegativeValues
12
+ }) {
13
+ const { handleSubmit } = useFormContext();
14
+ const [lowTapPosition, highTapPosition] = useWatch({
15
+ name: [FieldConstants.LOW_TAP_POSITION, FieldConstants.HIGH_TAP_POSITION]
16
+ });
17
+ const isTapValuesInvalid = highTapPosition == null || lowTapPosition == null || !allowNegativeValues && highTapPosition <= 0 || !allowNegativeValues && lowTapPosition <= 0 || highTapPosition === lowTapPosition;
18
+ return /* @__PURE__ */ jsx(Button, { onClick: handleSubmit(handleSave), variant: "outlined", disabled: isTapValuesInvalid, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) });
19
+ }
20
+ export {
21
+ CreateRuleDialogSubmitButton
22
+ };
@@ -0,0 +1,6 @@
1
+ import { FieldConstants } from '../../../../../utils';
2
+ interface CreateRuleFormProps {
3
+ tapChanger: FieldConstants.PHASE_TAP_CHANGER | FieldConstants.RATIO_TAP_CHANGER;
4
+ }
5
+ export declare function CreateRuleForm({ tapChanger }: Readonly<CreateRuleFormProps>): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,86 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { DialogTitle, DialogContent, Stack, Box } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ import "@mui/icons-material";
5
+ import "../../../../../components/ui/overflowableText/OverflowableText.js";
6
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
7
+ import "../../../../../utils/conversionUtils.js";
8
+ import "../../../../../utils/types/equipmentType.js";
9
+ import "react";
10
+ import "react-hook-form";
11
+ import "localized-countries";
12
+ import "localized-countries/data/fr";
13
+ import "localized-countries/data/en";
14
+ import "notistack";
15
+ import "../../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
16
+ import "yup";
17
+ import "../../../../../components/ui/treeViewFinder/TreeViewFinder.js";
18
+ import { FloatInput } from "../../../../../components/ui/reactHookForm/numbers/FloatInput.js";
19
+ import "../../../../../components/ui/reactHookForm/numbers/RangeInput.js";
20
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
21
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
22
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
23
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
24
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
25
+ import "../../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
26
+ import "../../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
27
+ import "../../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
28
+ import "@hello-pangea/dnd";
29
+ import "../../../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
30
+ import "../../../../../components/ui/snackbarProvider/SnackbarProvider.js";
31
+ import "mui-nested-menu";
32
+ import "react-resizable-panels";
33
+ import "react-papaparse";
34
+ import "react-dom";
35
+ import "autosuggest-highlight/match";
36
+ import "autosuggest-highlight/parse";
37
+ import "clsx";
38
+ import "../../../../../components/composite/filter/FilterCreationDialog.js";
39
+ import "../../../../../components/composite/filter/HeaderFilterForm.js";
40
+ import "../../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
41
+ import "../../../../../components/composite/filter/expert/ExpertFilterForm.js";
42
+ import "../../../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
43
+ import "../../../../../components/composite/filter/expert/expertFilterConstants.js";
44
+ import "react-querybuilder";
45
+ import "uuid";
46
+ import "../../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
47
+ import "../../../../../components/composite/filter/utils/filterFormUtils.js";
48
+ import "@react-querybuilder/material";
49
+ import "../../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
50
+ import "../../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
51
+ import "../../../../../components/composite/agGridTable/BottomTableButtons.js";
52
+ import "../../../../../components/composite/agGridTable/CustomAgGridTable.js";
53
+ import "ag-grid-community";
54
+ import "../../../../../components/composite/customAGGrid/customAggrid.js";
55
+ import "../../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
56
+ import "mathjs";
57
+ import "../../../../../components/composite/report/report-viewer/log-table/log-table.js";
58
+ import "react-window";
59
+ import "../../../../../components/composite/report/report-treeview/treeview-item.js";
60
+ import "../../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
61
+ const TAP_LABELS = {
62
+ [FieldConstants.PHASE_TAP_CHANGER]: {
63
+ low: "LowTapAlpha",
64
+ high: "HighTapAlpha",
65
+ title: "CreateDephasingRule"
66
+ },
67
+ [FieldConstants.RATIO_TAP_CHANGER]: {
68
+ low: "LowTapRatio",
69
+ high: "HighTapRatio",
70
+ title: "CreateRegulationRule"
71
+ }
72
+ };
73
+ const DIALOG_CONTENT_STYLE = { paddingTop: "5px" };
74
+ function CreateRuleForm({ tapChanger }) {
75
+ const labels = TAP_LABELS[tapChanger] ?? { low: "", high: "", title: "" };
76
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ /* @__PURE__ */ jsx(DialogTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: labels.title }) }),
78
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(Stack, { spacing: 2, sx: DIALOG_CONTENT_STYLE, children: [
79
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(FloatInput, { label: labels.low, name: FieldConstants.LOW_TAP_POSITION }) }),
80
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(FloatInput, { label: labels.high, name: FieldConstants.HIGH_TAP_POSITION }) })
81
+ ] }) })
82
+ ] });
83
+ }
84
+ export {
85
+ CreateRuleForm
86
+ };
@@ -0,0 +1,10 @@
1
+ import { default as Papa } from 'papaparse';
2
+ import { FieldConstants } from '../../../../../utils';
3
+ export interface ImportRuleDialogProps {
4
+ tapChanger: FieldConstants.PHASE_TAP_CHANGER | FieldConstants.RATIO_TAP_CHANGER;
5
+ openImportRuleDialog: boolean;
6
+ setOpenImportRuleDialog: (open: boolean) => void;
7
+ csvColumns: string[];
8
+ handleImportTapRule: (results: Papa.ParseResult<Record<string, string>>) => void;
9
+ }
10
+ export declare function ImportRuleDialog({ tapChanger, openImportRuleDialog, setOpenImportRuleDialog, csvColumns, handleImportTapRule, }: ImportRuleDialogProps): import("react").JSX.Element;
@@ -0,0 +1,140 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Dialog, DialogTitle, DialogContent, Stack, Grid, Button, Alert, DialogActions } from "@mui/material";
3
+ import { useState, useEffect, useMemo } from "react";
4
+ import { useIntl, FormattedMessage } from "react-intl";
5
+ import { useCSVDownloader } from "react-papaparse";
6
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
7
+ import "../../../../../utils/conversionUtils.js";
8
+ import "../../../../../utils/types/equipmentType.js";
9
+ import { transformIfFrenchNumber, getCsvDelimiter } from "../../../../../utils/langs.js";
10
+ import "@mui/icons-material";
11
+ import "../../../../../components/ui/overflowableText/OverflowableText.js";
12
+ import "react-hook-form";
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 { CancelButton } from "../../../../../components/ui/reactHookForm/utils/CancelButton.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 { CsvPicker } from "../../../../../components/ui/csvPicker/csv-picker.js";
36
+ import "react-dom";
37
+ import { MAX_ROWS_NUMBER } from "../../../../../components/composite/dnd-table/dnd-table.type.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 "../../../../../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
+ const NO_REQUIRED_COLUMNS = [];
65
+ function ImportRuleDialog({
66
+ tapChanger,
67
+ openImportRuleDialog,
68
+ setOpenImportRuleDialog,
69
+ csvColumns,
70
+ handleImportTapRule
71
+ }) {
72
+ const { locale } = useIntl();
73
+ const { CSVDownloader } = useCSVDownloader();
74
+ const [selectedFile, setSelectedFile] = useState();
75
+ const [fileErrorMessage, setFileErrorMessage] = useState();
76
+ const [parsedResults, setParsedResults] = useState();
77
+ const language = locale;
78
+ useEffect(() => {
79
+ setSelectedFile(void 0);
80
+ setFileErrorMessage(void 0);
81
+ setParsedResults(void 0);
82
+ }, [openImportRuleDialog]);
83
+ const parseConfig = useMemo(
84
+ () => ({ transform: (value) => transformIfFrenchNumber(value, language) }),
85
+ [language]
86
+ );
87
+ const handleCloseDialog = () => {
88
+ setOpenImportRuleDialog(false);
89
+ };
90
+ const handleSave = () => {
91
+ if (!fileErrorMessage && parsedResults) {
92
+ handleImportTapRule(parsedResults);
93
+ handleCloseDialog();
94
+ }
95
+ };
96
+ const isInvalid = useMemo(() => {
97
+ return typeof parsedResults === "undefined" || typeof fileErrorMessage !== "undefined";
98
+ }, [parsedResults, fileErrorMessage]);
99
+ return /* @__PURE__ */ jsxs(Dialog, { open: openImportRuleDialog, fullWidth: true, children: [
100
+ /* @__PURE__ */ jsx(DialogTitle, { children: /* @__PURE__ */ jsx(
101
+ FormattedMessage,
102
+ {
103
+ id: tapChanger === FieldConstants.PHASE_TAP_CHANGER ? "ImportDephasingRule" : "ImportRegulationRule"
104
+ }
105
+ ) }),
106
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(Stack, { spacing: 2, children: [
107
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(
108
+ CSVDownloader,
109
+ {
110
+ data: [csvColumns],
111
+ filename: tapChanger === FieldConstants.PHASE_TAP_CHANGER ? "tap-dephasing-rule" : "tap-regulating-rule",
112
+ config: { delimiter: getCsvDelimiter(language) },
113
+ children: /* @__PURE__ */ jsx(Button, { variant: "contained", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "GenerateSkeleton" }) })
114
+ }
115
+ ) }),
116
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(
117
+ CsvPicker,
118
+ {
119
+ label: tapChanger === FieldConstants.PHASE_TAP_CHANGER ? "ImportDephasingRule" : "ImportRegulationRule",
120
+ requiredColumns: NO_REQUIRED_COLUMNS,
121
+ maxLineNumber: MAX_ROWS_NUMBER,
122
+ language,
123
+ parseConfig,
124
+ selectedFile,
125
+ onFileChange: setSelectedFile,
126
+ onFileError: setFileErrorMessage,
127
+ onComplete: setParsedResults
128
+ }
129
+ ) }),
130
+ fileErrorMessage && /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(Alert, { severity: "error", children: fileErrorMessage }) })
131
+ ] }) }),
132
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
133
+ /* @__PURE__ */ jsx(CancelButton, { onClick: handleCloseDialog }),
134
+ /* @__PURE__ */ jsx(Button, { onClick: handleSave, variant: "outlined", disabled: isInvalid, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) })
135
+ ] })
136
+ ] });
137
+ }
138
+ export {
139
+ ImportRuleDialog
140
+ };
@@ -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 './regulationRule.types';
8
+ export * from './regulationRule.utils';
9
+ export * from './CreateRuleDialogSubmitButton';
10
+ export * from './CreateRuleForm';
11
+ export * from './CreateRuleDialog';
12
+ export * from './ImportRuleDialog';
@@ -0,0 +1,13 @@
1
+ import { getCreateRuleEmptyFormData, getCreateRuleValidationSchema } from "./regulationRule.utils.js";
2
+ import { CreateRuleDialogSubmitButton } from "./CreateRuleDialogSubmitButton.js";
3
+ import { CreateRuleForm } from "./CreateRuleForm.js";
4
+ import { CreateRuleDialog } from "./CreateRuleDialog.js";
5
+ import { ImportRuleDialog } from "./ImportRuleDialog.js";
6
+ export {
7
+ CreateRuleDialog,
8
+ CreateRuleDialogSubmitButton,
9
+ CreateRuleForm,
10
+ ImportRuleDialog,
11
+ getCreateRuleEmptyFormData,
12
+ getCreateRuleValidationSchema
13
+ };
@@ -0,0 +1,12 @@
1
+ import { FieldConstants } from '../../../../../utils';
2
+ export interface CreateRuleFormInput {
3
+ lowTapPosition: number | null;
4
+ highTapPosition: number | null;
5
+ }
6
+ export interface CreateRuleDialogProps {
7
+ tapChanger: FieldConstants.PHASE_TAP_CHANGER | FieldConstants.RATIO_TAP_CHANGER;
8
+ openCreateRuleDialog: boolean;
9
+ setOpenCreateRuleDialog: (open: boolean) => void;
10
+ handleCreateTapRule: (lowTap: number, highTap: number) => void;
11
+ allowNegativeValues: boolean;
12
+ }
@@ -0,0 +1,9 @@
1
+ import { CreateRuleFormInput } from './regulationRule.types';
2
+ export declare const getCreateRuleValidationSchema: () => import('yup').ObjectSchema<{
3
+ lowTapPosition: number;
4
+ highTapPosition: number;
5
+ }, import('yup').AnyObject, {
6
+ lowTapPosition: undefined;
7
+ highTapPosition: undefined;
8
+ }, "">;
9
+ export declare const getCreateRuleEmptyFormData: () => CreateRuleFormInput;
@@ -0,0 +1,19 @@
1
+ import { object, number } from "yup";
2
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
3
+ import "../../../../../utils/conversionUtils.js";
4
+ import "../../../../../utils/types/equipmentType.js";
5
+ import "react/jsx-runtime";
6
+ import "@mui/icons-material";
7
+ const createRuleValidationSchema = () => object().shape({
8
+ [FieldConstants.LOW_TAP_POSITION]: number().nullable().required(),
9
+ [FieldConstants.HIGH_TAP_POSITION]: number().nullable().required()
10
+ });
11
+ const getCreateRuleValidationSchema = () => createRuleValidationSchema();
12
+ const getCreateRuleEmptyFormData = () => ({
13
+ [FieldConstants.LOW_TAP_POSITION]: null,
14
+ [FieldConstants.HIGH_TAP_POSITION]: null
15
+ });
16
+ export {
17
+ getCreateRuleEmptyFormData,
18
+ getCreateRuleValidationSchema
19
+ };
@@ -0,0 +1,14 @@
1
+ import { IntlShape } from 'react-intl';
2
+ import { TapChangerStep, TapChangerStepMapInfos } from '../common/twoWindingsTransformer.types';
3
+ export declare const getRegulationTypeLabel: (twt: any, tap: any, intl: IntlShape) => string | null;
4
+ export declare const getTapSideLabel: (twt: any, tap: any, intl: IntlShape) => string | null;
5
+ export declare const compareStepsWithPreviousValues: (tapSteps: TapChangerStep[], previousValues?: TapChangerStep[]) => boolean;
6
+ export declare const computeHighTapPosition: (steps: Record<number, TapChangerStepMapInfos>) => number | null;
7
+ interface TapChangerInfos {
8
+ regulatingTerminalConnectableType: string;
9
+ regulatingTerminalConnectableId: string;
10
+ regulatingTerminalVlId: string;
11
+ }
12
+ export declare const getTapChangerEquipmentSectionTypeValue: (tapChanger: TapChangerInfos) => string | null;
13
+ export declare function toTapChangerStepList(stepsRecord: Record<number, TapChangerStepMapInfos> | undefined): TapChangerStep[] | undefined;
14
+ export {};
@@ -0,0 +1,79 @@
1
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
2
+ import "../../../../utils/conversionUtils.js";
3
+ import { REGULATION_SIDES } from "../../../../utils/types/equipmentType.js";
4
+ import "react/jsx-runtime";
5
+ import "@mui/icons-material";
6
+ import { REGULATION_TYPES } from "../../common/voltageRegulation/voltageRegulation.utils.js";
7
+ const getRegulationTypeLabel = (twt, tap, intl) => {
8
+ if (tap?.regulatingTerminalConnectableId != null) {
9
+ return tap?.regulatingTerminalConnectableId === twt?.id ? intl.formatMessage({ id: REGULATION_TYPES.LOCAL.label }) : intl.formatMessage({ id: REGULATION_TYPES.DISTANT.label });
10
+ }
11
+ return null;
12
+ };
13
+ const getTapSideLabel = (twt, tap, intl) => {
14
+ if (!tap || !twt) {
15
+ return null;
16
+ }
17
+ if (tap?.regulatingTerminalConnectableId === twt?.id) {
18
+ return tap?.regulatingTerminalVlId === twt?.voltageLevelId1 ? intl.formatMessage({ id: REGULATION_SIDES.SIDE1.label }) : intl.formatMessage({ id: REGULATION_SIDES.SIDE2.label });
19
+ }
20
+ return null;
21
+ };
22
+ const STEP_DATA_FIELDS = [
23
+ FieldConstants.STEPS_TAP,
24
+ FieldConstants.STEPS_RESISTANCE,
25
+ FieldConstants.STEPS_REACTANCE,
26
+ FieldConstants.STEPS_CONDUCTANCE,
27
+ FieldConstants.STEPS_SUSCEPTANCE,
28
+ FieldConstants.STEPS_RATIO,
29
+ FieldConstants.STEPS_ALPHA
30
+ ];
31
+ const isStepEqual = (step, previousStep) => STEP_DATA_FIELDS.every((field) => {
32
+ const value = step[field];
33
+ const previousValue = previousStep[field];
34
+ if (value == null || previousValue == null) {
35
+ return value == null && previousValue == null;
36
+ }
37
+ return Number(value) === Number(previousValue);
38
+ });
39
+ const compareStepsWithPreviousValues = (tapSteps, previousValues) => {
40
+ if (previousValues === void 0) {
41
+ return false;
42
+ }
43
+ if (tapSteps.length !== previousValues?.length) {
44
+ return false;
45
+ }
46
+ return tapSteps.every((step, index) => isStepEqual(step, previousValues[index]));
47
+ };
48
+ const computeHighTapPosition = (steps) => {
49
+ const values = steps ? Object.keys(steps).map(Number) : [];
50
+ return values.length > 0 ? Math.max(...values) : null;
51
+ };
52
+ const getTapChangerEquipmentSectionTypeValue = (tapChanger) => {
53
+ if (!tapChanger?.regulatingTerminalConnectableType) {
54
+ return null;
55
+ }
56
+ return `${tapChanger?.regulatingTerminalConnectableType} : ${tapChanger?.regulatingTerminalConnectableId}`;
57
+ };
58
+ function toTapChangerStepList(stepsRecord) {
59
+ if (stepsRecord) {
60
+ return Object.keys(stepsRecord).map((key) => {
61
+ const index = Number(key);
62
+ return {
63
+ ...stepsRecord[index],
64
+ [FieldConstants.STEPS_TAP]: index
65
+ };
66
+ }).sort((a, b) => {
67
+ return a[FieldConstants.STEPS_TAP] - b[FieldConstants.STEPS_TAP];
68
+ });
69
+ }
70
+ return void 0;
71
+ }
72
+ export {
73
+ compareStepsWithPreviousValues,
74
+ computeHighTapPosition,
75
+ getRegulationTypeLabel,
76
+ getTapChangerEquipmentSectionTypeValue,
77
+ getTapSideLabel,
78
+ toTapChangerStepList
79
+ };