@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,181 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import { TapChangerSteps } from "../TapChangerSteps.js";
5
+ import "@mui/material";
6
+ import "@mui/icons-material";
7
+ import "../../../../../components/ui/overflowableText/OverflowableText.js";
8
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
9
+ import "../../../../../utils/conversionUtils.js";
10
+ import "../../../../../utils/types/equipmentType.js";
11
+ import { parseIntData } from "../../../../../utils/ts-utils.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 "yup";
19
+ import "../../../../../components/ui/treeViewFinder/TreeViewFinder.js";
20
+ import "../../../../../components/ui/reactHookForm/numbers/RangeInput.js";
21
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
22
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
23
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
24
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
25
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
26
+ import "../../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
27
+ import "../../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
28
+ import "../../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
29
+ import "@hello-pangea/dnd";
30
+ import "../../../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
31
+ import "../../../../../components/ui/snackbarProvider/SnackbarProvider.js";
32
+ import "mui-nested-menu";
33
+ import "react-resizable-panels";
34
+ import "react-papaparse";
35
+ import "react-dom";
36
+ import { DndColumnType } from "../../../../../components/composite/dnd-table/dnd-table.type.js";
37
+ import "autosuggest-highlight/match";
38
+ import "autosuggest-highlight/parse";
39
+ import "clsx";
40
+ import "../../../../../components/composite/filter/FilterCreationDialog.js";
41
+ import "../../../../../components/composite/filter/HeaderFilterForm.js";
42
+ import "../../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
43
+ import "../../../../../components/composite/filter/expert/ExpertFilterForm.js";
44
+ import "../../../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
45
+ import "../../../../../components/composite/filter/expert/expertFilterConstants.js";
46
+ import "react-querybuilder";
47
+ import "uuid";
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
+ function RatioTapChangerPaneSteps({
64
+ disabled,
65
+ previousValues,
66
+ editData,
67
+ isModification = false
68
+ }) {
69
+ const intl = useIntl();
70
+ const COLUMNS_DEFINITIONS = useMemo(() => {
71
+ return [
72
+ {
73
+ label: "Tap",
74
+ dataKey: FieldConstants.STEPS_TAP,
75
+ type: DndColumnType.TEXT
76
+ },
77
+ {
78
+ label: "DeltaResistance",
79
+ dataKey: FieldConstants.STEPS_RESISTANCE,
80
+ initialValue: 0,
81
+ editable: true,
82
+ type: DndColumnType.NUMERIC,
83
+ clearable: false
84
+ },
85
+ {
86
+ label: "DeltaReactance",
87
+ dataKey: FieldConstants.STEPS_REACTANCE,
88
+ initialValue: 0,
89
+ editable: true,
90
+ type: DndColumnType.NUMERIC,
91
+ clearable: false
92
+ },
93
+ {
94
+ label: "DeltaConductance",
95
+ dataKey: FieldConstants.STEPS_CONDUCTANCE,
96
+ initialValue: 0,
97
+ editable: true,
98
+ type: DndColumnType.NUMERIC,
99
+ clearable: false
100
+ },
101
+ {
102
+ label: "DeltaSusceptance",
103
+ dataKey: FieldConstants.STEPS_SUSCEPTANCE,
104
+ initialValue: 0,
105
+ editable: true,
106
+ type: DndColumnType.NUMERIC,
107
+ clearable: false
108
+ },
109
+ {
110
+ label: "Ratio",
111
+ dataKey: FieldConstants.STEPS_RATIO,
112
+ initialValue: 1,
113
+ editable: true,
114
+ type: DndColumnType.NUMERIC,
115
+ clearable: false
116
+ }
117
+ ].map((column) => ({
118
+ ...column,
119
+ label: intl.formatMessage({ id: column.label }).toLowerCase().replace(/^\w/, (c) => c.toUpperCase())
120
+ }));
121
+ }, [intl]);
122
+ const csvColumns = useMemo(() => {
123
+ return [
124
+ intl.formatMessage({ id: "ImportFileResistance" }),
125
+ intl.formatMessage({ id: "ImportFileReactance" }),
126
+ intl.formatMessage({ id: "ImportFileConductance" }),
127
+ intl.formatMessage({ id: "ImportFileSusceptance" }),
128
+ intl.formatMessage({ id: "Ratio" })
129
+ ];
130
+ }, [intl]);
131
+ const handleImportRow = (val) => {
132
+ return {
133
+ [FieldConstants.STEPS_RESISTANCE]: parseIntData(
134
+ val[intl.formatMessage({
135
+ id: "ImportFileResistance"
136
+ })],
137
+ 0
138
+ ),
139
+ [FieldConstants.STEPS_REACTANCE]: parseIntData(
140
+ val[intl.formatMessage({
141
+ id: "ImportFileReactance"
142
+ })],
143
+ 0
144
+ ),
145
+ [FieldConstants.STEPS_CONDUCTANCE]: parseIntData(
146
+ val[intl.formatMessage({
147
+ id: "ImportFileConductance"
148
+ })],
149
+ 0
150
+ ),
151
+ [FieldConstants.STEPS_SUSCEPTANCE]: parseIntData(
152
+ val[intl.formatMessage({
153
+ id: "ImportFileSusceptance"
154
+ })],
155
+ 0
156
+ ),
157
+ [FieldConstants.STEPS_RATIO]: Number.isNaN(Number.parseFloat(val[intl.formatMessage({ id: "Ratio" })])) ? 1 : Number.parseFloat(val[intl.formatMessage({ id: "Ratio" })])
158
+ };
159
+ };
160
+ return /* @__PURE__ */ jsx(
161
+ TapChangerSteps,
162
+ {
163
+ tapChanger: FieldConstants.RATIO_TAP_CHANGER,
164
+ createTapRuleColumn: FieldConstants.STEPS_RATIO,
165
+ columnsDefinition: COLUMNS_DEFINITIONS,
166
+ csvColumns,
167
+ createRuleMessageId: "CreateRegulationRule",
168
+ createRuleAllowNegativeValues: false,
169
+ importRuleMessageId: "ImportRegulationRule",
170
+ resetButtonMessageId: "ResetRegulationRule",
171
+ handleImportRow,
172
+ disabled,
173
+ previousValues,
174
+ editData: editData?.ratioTapChanger?.steps,
175
+ isModification
176
+ }
177
+ );
178
+ }
179
+ export {
180
+ RatioTapChangerPaneSteps
181
+ };
@@ -0,0 +1,9 @@
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 './ratioTapChanger.utils';
8
+ export * from './RatioTapChangerPaneSteps';
9
+ export * from './RatioTapChangerPane';
@@ -0,0 +1,18 @@
1
+ import { getComputedPreviousRatioRegulationType, getComputedRegulationMode, getComputedRegulationModeId, getComputedRegulationType, getComputedRegulationTypeId, getComputedTapSide, getComputedTapSideId, getInitialTwtRatioRegulationModeId, getRatioTapChangerEmptyFormData, getRatioTapChangerFormData, getRatioTapChangerValidationSchemaProps } from "./ratioTapChanger.utils.js";
2
+ import { RatioTapChangerPaneSteps } from "./RatioTapChangerPaneSteps.js";
3
+ import { RatioTapChangerPane } from "./RatioTapChangerPane.js";
4
+ export {
5
+ RatioTapChangerPane,
6
+ RatioTapChangerPaneSteps,
7
+ getComputedPreviousRatioRegulationType,
8
+ getComputedRegulationMode,
9
+ getComputedRegulationModeId,
10
+ getComputedRegulationType,
11
+ getComputedRegulationTypeId,
12
+ getComputedTapSide,
13
+ getComputedTapSideId,
14
+ getInitialTwtRatioRegulationModeId,
15
+ getRatioTapChangerEmptyFormData,
16
+ getRatioTapChangerFormData,
17
+ getRatioTapChangerValidationSchemaProps
18
+ };
@@ -0,0 +1,132 @@
1
+ import { InferType } from 'yup';
2
+ import { TapChangerStep, TwoWindingsTransformerMapInfos } from '../../common/twoWindingsTransformer.types';
3
+ import { FieldConstants } from '../../../../../utils/constants/fieldConstants';
4
+ import { DeepNullable } from '../../../../../utils';
5
+ export declare const getRatioTapChangerValidationSchemaProps: (isModification?: boolean) => import('yup').ObjectSchema<{
6
+ voltageLevel: {
7
+ id?: string | undefined;
8
+ name?: string | undefined;
9
+ nominalVoltage?: string | undefined;
10
+ substationId?: string | undefined;
11
+ topologyKind?: string | null | undefined;
12
+ } | null;
13
+ equipment: {
14
+ id?: string | undefined;
15
+ name?: string | null | undefined;
16
+ type?: string | undefined;
17
+ } | null;
18
+ enabled: NonNullable<boolean | undefined>;
19
+ hasLoadTapChangingCapabilities: boolean | null | undefined;
20
+ regulationMode: string | null | undefined;
21
+ regulationType: string | null | undefined;
22
+ regulationSide: string | null | undefined;
23
+ targetV: {} | null | undefined;
24
+ targetDeadband: {} | null | undefined;
25
+ lowTapPosition: number | null | undefined;
26
+ highTapPosition: number | null | undefined;
27
+ tapPosition: number | null | undefined;
28
+ steps: {
29
+ b?: number | undefined;
30
+ g?: number | undefined;
31
+ r?: number | undefined;
32
+ x?: number | undefined;
33
+ rho?: number | undefined;
34
+ index: number;
35
+ }[] | undefined;
36
+ }, import('yup').AnyObject, {
37
+ voltageLevel: {
38
+ id: undefined;
39
+ name: undefined;
40
+ substationId: undefined;
41
+ nominalVoltage: undefined;
42
+ topologyKind: undefined;
43
+ };
44
+ equipment: {
45
+ id: undefined;
46
+ name: undefined;
47
+ type: undefined;
48
+ };
49
+ enabled: undefined;
50
+ hasLoadTapChangingCapabilities: undefined;
51
+ regulationMode: undefined;
52
+ regulationType: undefined;
53
+ regulationSide: undefined;
54
+ targetV: undefined;
55
+ targetDeadband: undefined;
56
+ lowTapPosition: undefined;
57
+ highTapPosition: undefined;
58
+ tapPosition: undefined;
59
+ steps: "";
60
+ }, "">;
61
+ export type RatioTapChangerFormSchema = InferType<ReturnType<typeof getRatioTapChangerValidationSchemaProps>>;
62
+ export declare const getRatioTapChangerEmptyFormData: (isModification?: boolean) => DeepNullable<RatioTapChangerFormSchema>;
63
+ interface RatioTapChangerFormParams {
64
+ enabled?: boolean;
65
+ hasLoadTapChangingCapabilities?: boolean | null;
66
+ regulationMode?: string | null;
67
+ regulationType?: string | null;
68
+ regulationSide?: string | null;
69
+ targetV?: number | null;
70
+ targetDeadband?: number | null;
71
+ lowTapPosition?: number | null;
72
+ highTapPosition?: number | null;
73
+ tapPosition?: number | null;
74
+ steps?: TapChangerStep[];
75
+ voltageLevelId?: string;
76
+ equipmentId?: string;
77
+ equipmentType?: string;
78
+ }
79
+ export declare const getRatioTapChangerFormData: ({ enabled, hasLoadTapChangingCapabilities, regulationMode, regulationType, regulationSide, targetV, targetDeadband, lowTapPosition, highTapPosition, tapPosition, steps, voltageLevelId, equipmentId, equipmentType, }: RatioTapChangerFormParams, id?: typeof FieldConstants.RATIO_TAP_CHANGER) => {
80
+ ratioTapChanger: {
81
+ voltageLevel: {
82
+ id: string;
83
+ name: string;
84
+ substationId: string;
85
+ nominalVoltage: string;
86
+ topologyKind: string;
87
+ } | null;
88
+ equipment: {
89
+ id: string;
90
+ name: string | null;
91
+ type: string;
92
+ } | null;
93
+ enabled: boolean;
94
+ hasLoadTapChangingCapabilities: boolean | null;
95
+ regulationMode: string | null;
96
+ regulationType: string | null;
97
+ regulationSide: string | null;
98
+ targetV: number | null;
99
+ targetDeadband: number | null;
100
+ lowTapPosition: number | null;
101
+ highTapPosition: number | null;
102
+ tapPosition: number | null;
103
+ steps: TapChangerStep[];
104
+ };
105
+ };
106
+ export declare const getComputedRegulationType: (twt: TwoWindingsTransformerMapInfos) => {
107
+ readonly id: "DISTANT";
108
+ readonly label: "Distant";
109
+ } | {
110
+ readonly id: "LOCAL";
111
+ readonly label: "Local";
112
+ } | null;
113
+ export declare const getComputedRegulationTypeId: (twt: TwoWindingsTransformerMapInfos) => "LOCAL" | "DISTANT" | null;
114
+ export declare const getComputedRegulationMode: (twt: TwoWindingsTransformerMapInfos) => {
115
+ readonly id: "FIXED_RATIO";
116
+ readonly label: "FixedRatio";
117
+ } | {
118
+ readonly id: "VOLTAGE_REGULATION";
119
+ readonly label: "VoltageRegulation";
120
+ } | null;
121
+ export declare const getInitialTwtRatioRegulationModeId: (twt: TwoWindingsTransformerMapInfos) => "FIXED_RATIO" | "VOLTAGE_REGULATION" | null;
122
+ export declare const getComputedRegulationModeId: (twt: TwoWindingsTransformerMapInfos) => "FIXED_RATIO" | "VOLTAGE_REGULATION" | null;
123
+ export declare const getComputedPreviousRatioRegulationType: (previousValues: TwoWindingsTransformerMapInfos) => "LOCAL" | "DISTANT" | null;
124
+ export declare const getComputedTapSide: (twt: TwoWindingsTransformerMapInfos) => {
125
+ readonly id: "SIDE1";
126
+ readonly label: "RegulatedSide1";
127
+ } | {
128
+ readonly id: "SIDE2";
129
+ readonly label: "RegulatedSide2";
130
+ } | null;
131
+ export declare const getComputedTapSideId: (twt: TwoWindingsTransformerMapInfos) => "SIDE1" | "SIDE2" | null;
132
+ export {};
@@ -0,0 +1,211 @@
1
+ import { object, array, number, ref, mixed, string, bool } from "yup";
2
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
3
+ import { REGULATION_TYPES } from "../../../common/voltageRegulation/voltageRegulation.utils.js";
4
+ import { TARGET_DEADBAND_MUST_BE_GREATER_OR_EQUAL_TO_ZERO } from "../../../../../utils/constants/translationKeys.js";
5
+ import "../../../../../utils/conversionUtils.js";
6
+ import { RATIO_REGULATION_MODES, REGULATION_SIDES } from "../../../../../utils/types/equipmentType.js";
7
+ import { areNumbersOrdered, areArrayElementsUnique } from "../../../../../utils/functions.js";
8
+ import "react/jsx-runtime";
9
+ import "@mui/icons-material";
10
+ import { getRegulatingTerminalEmptyFormData, getRegulatingTerminalFormData } from "../../../common/regulatingTerminal/regulatingTerminal.utils.js";
11
+ const getRegulatingTerminalRatioTapChangerValidationSchema = () => ({
12
+ [FieldConstants.VOLTAGE_LEVEL]: object().nullable().shape({
13
+ [FieldConstants.ID]: string(),
14
+ [FieldConstants.NAME]: string(),
15
+ [FieldConstants.SUBSTATION_ID]: string(),
16
+ [FieldConstants.NOMINAL_VOLTAGE]: string(),
17
+ [FieldConstants.TOPOLOGY_KIND]: string().nullable()
18
+ }).when([FieldConstants.ENABLED, FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES, FieldConstants.REGULATION_TYPE], {
19
+ is: (enabled, hasLoadTapChangingCapabilities, regulationType) => enabled && hasLoadTapChangingCapabilities && regulationType === REGULATION_TYPES.DISTANT.id,
20
+ then: (schema) => schema.required()
21
+ }),
22
+ [FieldConstants.EQUIPMENT]: object().nullable().shape({
23
+ [FieldConstants.ID]: string(),
24
+ [FieldConstants.NAME]: string().nullable(),
25
+ [FieldConstants.TYPE]: string()
26
+ }).when([FieldConstants.ENABLED, FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES, FieldConstants.REGULATION_TYPE], {
27
+ is: (enabled, hasLoadTapChangingCapabilities, regulationType) => enabled && hasLoadTapChangingCapabilities && regulationType === REGULATION_TYPES.DISTANT.id,
28
+ then: (schema) => schema.required()
29
+ })
30
+ });
31
+ const getRatioTapChangerValidationSchemaProps = (isModification = false) => object().shape({
32
+ [FieldConstants.ENABLED]: bool().required(),
33
+ [FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES]: isModification ? bool().nullable() : bool().nullable().required(),
34
+ [FieldConstants.REGULATION_MODE]: string().nullable().when([FieldConstants.ENABLED, FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES], {
35
+ is: (enabled, hasLoadTapChangingCapabilities) => enabled && hasLoadTapChangingCapabilities,
36
+ then: (schema) => schema.required()
37
+ }),
38
+ [FieldConstants.REGULATION_TYPE]: string().nullable().when(
39
+ [FieldConstants.ENABLED, FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES, FieldConstants.REGULATION_MODE],
40
+ {
41
+ is: (enabled, hasLoadTapChangingCapabilities, regulationMode) => enabled && hasLoadTapChangingCapabilities && regulationMode === RATIO_REGULATION_MODES.VOLTAGE_REGULATION.id,
42
+ then: (schema) => schema.required()
43
+ }
44
+ ),
45
+ [FieldConstants.REGULATION_SIDE]: string().nullable().when(
46
+ [FieldConstants.ENABLED, FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES, FieldConstants.REGULATION_TYPE],
47
+ {
48
+ is: (enabled, hasLoadTapChangingCapabilities, regulationType) => enabled && hasLoadTapChangingCapabilities && regulationType === REGULATION_TYPES.LOCAL.id,
49
+ then: (schema) => schema.required()
50
+ }
51
+ ),
52
+ [FieldConstants.TARGET_V]: mixed().nullable().when([FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES], {
53
+ is: true,
54
+ then: () => number().nullable().positive("TargetVoltageMustBeGreaterThanZero")
55
+ }).when([FieldConstants.REGULATION_MODE, FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES], {
56
+ is: (regulationMode, hasLoadTapChangingCapabilities) => {
57
+ return hasLoadTapChangingCapabilities && regulationMode === RATIO_REGULATION_MODES.VOLTAGE_REGULATION.id;
58
+ },
59
+ then: (schema) => schema.required()
60
+ }),
61
+ [FieldConstants.TARGET_DEADBAND]: mixed().nullable().when(FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES, {
62
+ is: true,
63
+ then: () => number().nullable().min(0, TARGET_DEADBAND_MUST_BE_GREATER_OR_EQUAL_TO_ZERO)
64
+ }),
65
+ [FieldConstants.LOW_TAP_POSITION]: number().nullable().when(FieldConstants.ENABLED, {
66
+ is: (enabled) => enabled && !isModification,
67
+ then: (schema) => schema.required()
68
+ }),
69
+ [FieldConstants.HIGH_TAP_POSITION]: number().nullable().when(FieldConstants.ENABLED, {
70
+ is: (enabled) => enabled && !isModification,
71
+ then: (schema) => schema.required()
72
+ }),
73
+ [FieldConstants.TAP_POSITION]: number().nullable().when(FieldConstants.ENABLED, {
74
+ is: (enabled) => enabled && !isModification,
75
+ then: (schema) => schema.required().min(ref(FieldConstants.LOW_TAP_POSITION), "TapPositionMustBeBetweenLowAndHighTapPositionValue").max(
76
+ ref(FieldConstants.HIGH_TAP_POSITION),
77
+ "TapPositionMustBeBetweenLowAndHighTapPositionValue"
78
+ )
79
+ }),
80
+ [FieldConstants.STEPS]: array().of(
81
+ object().shape({
82
+ [FieldConstants.STEPS_TAP]: number().required(),
83
+ [FieldConstants.STEPS_RESISTANCE]: number(),
84
+ [FieldConstants.STEPS_REACTANCE]: number(),
85
+ [FieldConstants.STEPS_CONDUCTANCE]: number(),
86
+ [FieldConstants.STEPS_SUSCEPTANCE]: number(),
87
+ [FieldConstants.STEPS_RATIO]: number()
88
+ })
89
+ ).when(FieldConstants.ENABLED, {
90
+ is: true,
91
+ then: (schema) => schema.min(1, "GenerateRatioTapRowsError")
92
+ }).test("distinctOrderedRatio", "RatioValuesError", (stepsArray) => {
93
+ const ratioArray = (stepsArray ?? []).map((step) => step[FieldConstants.STEPS_RATIO]);
94
+ return areNumbersOrdered(ratioArray) && areArrayElementsUnique(ratioArray);
95
+ }),
96
+ ...getRegulatingTerminalRatioTapChangerValidationSchema()
97
+ });
98
+ const getRatioTapChangerEmptyFormData = (isModification = false) => {
99
+ return {
100
+ [FieldConstants.ENABLED]: false,
101
+ [FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES]: isModification ? null : false,
102
+ [FieldConstants.REGULATION_MODE]: null,
103
+ [FieldConstants.REGULATION_TYPE]: null,
104
+ [FieldConstants.REGULATION_SIDE]: isModification ? null : REGULATION_SIDES.SIDE1.id,
105
+ [FieldConstants.TARGET_V]: null,
106
+ [FieldConstants.TARGET_DEADBAND]: null,
107
+ [FieldConstants.LOW_TAP_POSITION]: null,
108
+ [FieldConstants.HIGH_TAP_POSITION]: null,
109
+ [FieldConstants.TAP_POSITION]: null,
110
+ [FieldConstants.STEPS]: [],
111
+ ...getRegulatingTerminalEmptyFormData()
112
+ };
113
+ };
114
+ const getRatioTapChangerFormData = ({
115
+ enabled = false,
116
+ hasLoadTapChangingCapabilities = false,
117
+ regulationMode = null,
118
+ regulationType = null,
119
+ regulationSide = REGULATION_SIDES.SIDE1.id,
120
+ targetV = null,
121
+ targetDeadband = null,
122
+ lowTapPosition = null,
123
+ highTapPosition = null,
124
+ tapPosition = null,
125
+ steps = [],
126
+ voltageLevelId,
127
+ equipmentId,
128
+ equipmentType
129
+ }, id = FieldConstants.RATIO_TAP_CHANGER) => ({
130
+ [id]: {
131
+ [FieldConstants.ENABLED]: enabled,
132
+ [FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES]: hasLoadTapChangingCapabilities,
133
+ [FieldConstants.REGULATION_MODE]: regulationMode,
134
+ [FieldConstants.REGULATION_TYPE]: regulationType,
135
+ [FieldConstants.REGULATION_SIDE]: regulationSide,
136
+ [FieldConstants.TARGET_V]: targetV,
137
+ [FieldConstants.TARGET_DEADBAND]: targetDeadband,
138
+ [FieldConstants.LOW_TAP_POSITION]: lowTapPosition,
139
+ [FieldConstants.HIGH_TAP_POSITION]: highTapPosition,
140
+ [FieldConstants.TAP_POSITION]: tapPosition,
141
+ [FieldConstants.STEPS]: steps,
142
+ ...getRegulatingTerminalFormData({
143
+ equipmentID: equipmentId,
144
+ voltageLevelId,
145
+ equipmentType
146
+ })
147
+ }
148
+ });
149
+ const getComputedRegulationType = (twt) => {
150
+ if (!twt?.[FieldConstants.RATIO_TAP_CHANGER]?.[FieldConstants.LOAD_TAP_CHANGING_CAPABILITIES] || !twt?.[FieldConstants.RATIO_TAP_CHANGER]?.regulatingTerminalConnectableId) {
151
+ return null;
152
+ }
153
+ if (twt?.[FieldConstants.RATIO_TAP_CHANGER]?.regulatingTerminalConnectableId !== twt?.[FieldConstants.ID]) {
154
+ return REGULATION_TYPES.DISTANT;
155
+ }
156
+ return REGULATION_TYPES.LOCAL;
157
+ };
158
+ const getComputedRegulationTypeId = (twt) => {
159
+ const regulationType = getComputedRegulationType(twt);
160
+ return regulationType?.id || null;
161
+ };
162
+ const getComputedRegulationMode = (twt) => {
163
+ const ratioTapChangerValues = twt?.ratioTapChanger;
164
+ if (!ratioTapChangerValues) {
165
+ return null;
166
+ }
167
+ if (ratioTapChangerValues[FieldConstants.REGULATING]) {
168
+ return RATIO_REGULATION_MODES.VOLTAGE_REGULATION;
169
+ }
170
+ return RATIO_REGULATION_MODES.FIXED_RATIO;
171
+ };
172
+ const getInitialTwtRatioRegulationModeId = (twt) => {
173
+ if (!twt?.ratioTapChanger?.hasLoadTapChangingCapabilities) {
174
+ return null;
175
+ }
176
+ const computedRegulationMode = getComputedRegulationMode(twt);
177
+ return computedRegulationMode?.id || null;
178
+ };
179
+ const getComputedRegulationModeId = (twt) => {
180
+ return getComputedRegulationMode(twt)?.id || null;
181
+ };
182
+ const getComputedPreviousRatioRegulationType = (previousValues) => {
183
+ const previousRegulationType = getComputedRegulationType(previousValues);
184
+ return previousRegulationType?.id || null;
185
+ };
186
+ const getComputedTapSide = (twt) => {
187
+ const ratioTapChangerValues = twt?.ratioTapChanger;
188
+ if (!ratioTapChangerValues || !twt) {
189
+ return null;
190
+ }
191
+ if (ratioTapChangerValues?.regulatingTerminalConnectableId === twt?.[FieldConstants.ID]) {
192
+ return ratioTapChangerValues?.regulatingTerminalVlId === twt?.voltageLevelId1 ? REGULATION_SIDES.SIDE1 : REGULATION_SIDES.SIDE2;
193
+ }
194
+ return null;
195
+ };
196
+ const getComputedTapSideId = (twt) => {
197
+ return getComputedTapSide(twt)?.id || null;
198
+ };
199
+ export {
200
+ getComputedPreviousRatioRegulationType,
201
+ getComputedRegulationMode,
202
+ getComputedRegulationModeId,
203
+ getComputedRegulationType,
204
+ getComputedRegulationTypeId,
205
+ getComputedTapSide,
206
+ getComputedTapSideId,
207
+ getInitialTwtRatioRegulationModeId,
208
+ getRatioTapChangerEmptyFormData,
209
+ getRatioTapChangerFormData,
210
+ getRatioTapChangerValidationSchemaProps
211
+ };
@@ -0,0 +1,2 @@
1
+ import { CreateRuleDialogProps } from './regulationRule.types';
2
+ export declare function CreateRuleDialog({ tapChanger, openCreateRuleDialog, setOpenCreateRuleDialog, handleCreateTapRule, allowNegativeValues, }: CreateRuleDialogProps): import("react").JSX.Element;
@@ -0,0 +1,102 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Dialog, DialogActions } from "@mui/material";
3
+ import { useForm } from "react-hook-form";
4
+ import { yupResolver } from "@hookform/resolvers/yup";
5
+ import { useCallback } from "react";
6
+ import { CreateRuleForm } from "./CreateRuleForm.js";
7
+ import { getCreateRuleEmptyFormData, getCreateRuleValidationSchema } from "./regulationRule.utils.js";
8
+ import { CreateRuleDialogSubmitButton } from "./CreateRuleDialogSubmitButton.js";
9
+ import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
10
+ import "../../../../../utils/conversionUtils.js";
11
+ import "../../../../../utils/types/equipmentType.js";
12
+ import "@mui/icons-material";
13
+ import "react-intl";
14
+ import "../../../../../components/ui/overflowableText/OverflowableText.js";
15
+ import "localized-countries";
16
+ import "localized-countries/data/fr";
17
+ import "localized-countries/data/en";
18
+ import "notistack";
19
+ import { CustomFormProvider } from "../../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
20
+ import { CancelButton } from "../../../../../components/ui/reactHookForm/utils/CancelButton.js";
21
+ import "yup";
22
+ import "../../../../../components/ui/treeViewFinder/TreeViewFinder.js";
23
+ import "../../../../../components/ui/reactHookForm/numbers/RangeInput.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 "@react-querybuilder/material";
53
+ import "../../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
54
+ import "../../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
55
+ import "../../../../../components/composite/agGridTable/BottomTableButtons.js";
56
+ import "../../../../../components/composite/agGridTable/CustomAgGridTable.js";
57
+ import "ag-grid-community";
58
+ import "../../../../../components/composite/customAGGrid/customAggrid.js";
59
+ import "../../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
60
+ import "mathjs";
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
+ const EMPTY_FORM_DATA = getCreateRuleEmptyFormData();
66
+ const FORM_SCHEMA = getCreateRuleValidationSchema();
67
+ function CreateRuleDialog({
68
+ tapChanger,
69
+ openCreateRuleDialog,
70
+ setOpenCreateRuleDialog,
71
+ handleCreateTapRule,
72
+ allowNegativeValues
73
+ }) {
74
+ const formMethods = useForm({
75
+ defaultValues: EMPTY_FORM_DATA,
76
+ resolver: yupResolver(FORM_SCHEMA)
77
+ });
78
+ const { reset } = formMethods;
79
+ const handleCloseDialog = useCallback(() => {
80
+ reset(EMPTY_FORM_DATA);
81
+ setOpenCreateRuleDialog(false);
82
+ }, [reset, setOpenCreateRuleDialog]);
83
+ const handleSave = useCallback(
84
+ (data) => {
85
+ if (data[FieldConstants.LOW_TAP_POSITION] != null && data[FieldConstants.HIGH_TAP_POSITION] != null) {
86
+ handleCreateTapRule(data[FieldConstants.LOW_TAP_POSITION], data[FieldConstants.HIGH_TAP_POSITION]);
87
+ handleCloseDialog();
88
+ }
89
+ },
90
+ [handleCreateTapRule, handleCloseDialog]
91
+ );
92
+ return /* @__PURE__ */ jsx(Dialog, { open: openCreateRuleDialog, fullWidth: true, children: /* @__PURE__ */ jsxs(CustomFormProvider, { validationSchema: FORM_SCHEMA, ...formMethods, children: [
93
+ /* @__PURE__ */ jsx(CreateRuleForm, { tapChanger }),
94
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
95
+ /* @__PURE__ */ jsx(CancelButton, { onClick: handleCloseDialog }),
96
+ /* @__PURE__ */ jsx(CreateRuleDialogSubmitButton, { handleSave, allowNegativeValues })
97
+ ] })
98
+ ] }) });
99
+ }
100
+ export {
101
+ CreateRuleDialog
102
+ };
@@ -0,0 +1,7 @@
1
+ import { CreateRuleFormInput } from './regulationRule.types';
2
+ interface CreateRuleDialogSubmitButtonProps {
3
+ handleSave: (data: CreateRuleFormInput) => void;
4
+ allowNegativeValues: boolean;
5
+ }
6
+ export declare function CreateRuleDialogSubmitButton({ handleSave, allowNegativeValues, }: Readonly<CreateRuleDialogSubmitButtonProps>): import("react").JSX.Element;
7
+ export {};