@gridsuite/commons-ui 0.107.1 → 0.109.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 (114) hide show
  1. package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +10 -10
  2. package/dist/components/dnd-table/dnd-table-add-rows-dialog.d.ts +13 -0
  3. package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +69 -0
  4. package/dist/components/dnd-table/dnd-table-bottom-left-buttons.d.ts +17 -0
  5. package/dist/components/dnd-table/dnd-table-bottom-left-buttons.js +48 -0
  6. package/dist/components/dnd-table/dnd-table-bottom-right-buttons.d.ts +17 -0
  7. package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +104 -0
  8. package/dist/components/dnd-table/dnd-table.d.ts +28 -0
  9. package/dist/components/dnd-table/dnd-table.js +394 -0
  10. package/dist/components/dnd-table/dnd-table.type.d.ts +51 -0
  11. package/dist/components/dnd-table/dnd-table.type.js +16 -0
  12. package/dist/components/dnd-table/index.d.ts +11 -0
  13. package/dist/components/dnd-table/index.js +14 -0
  14. package/dist/components/filter/HeaderFilterForm.js +4 -4
  15. package/dist/components/index.d.ts +1 -0
  16. package/dist/components/index.js +60 -4
  17. package/dist/components/inputs/index.js +6 -0
  18. package/dist/components/inputs/reactHookForm/chip-items-input.d.ts +13 -0
  19. package/dist/components/inputs/reactHookForm/chip-items-input.js +129 -0
  20. package/dist/components/inputs/reactHookForm/index.d.ts +2 -0
  21. package/dist/components/inputs/reactHookForm/index.js +6 -0
  22. package/dist/components/inputs/reactHookForm/tableInputs/index.d.ts +8 -0
  23. package/dist/components/inputs/reactHookForm/tableInputs/index.js +6 -0
  24. package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.d.ts +12 -0
  25. package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +110 -0
  26. package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.d.ts +8 -0
  27. package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +43 -0
  28. package/dist/components/parameters/common/ProviderParam.js +6 -6
  29. package/dist/components/parameters/common/constant.d.ts +8 -0
  30. package/dist/components/parameters/common/constant.js +12 -1
  31. package/dist/components/parameters/common/index.js +3 -1
  32. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +7 -7
  33. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +6 -6
  34. package/dist/components/parameters/common/name-element-editor/name-element-editor-form.js +8 -8
  35. package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +11 -10
  36. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +7 -7
  37. package/dist/components/parameters/common/widget/parameter-float.js +6 -6
  38. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +11 -10
  39. package/dist/components/parameters/common/widget/parameter-line-slider.js +6 -6
  40. package/dist/components/parameters/index.d.ts +1 -0
  41. package/dist/components/parameters/index.js +42 -4
  42. package/dist/components/parameters/loadflow/constants.d.ts +0 -1
  43. package/dist/components/parameters/loadflow/constants.js +0 -2
  44. package/dist/components/parameters/loadflow/index.js +1 -2
  45. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +7 -12
  46. package/dist/components/parameters/loadflow/load-flow-parameter-field.js +6 -6
  47. package/dist/components/parameters/loadflow/load-flow-parameters-form.js +6 -6
  48. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +6 -6
  49. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +48 -12
  50. package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +0 -4
  51. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +1 -2
  52. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +2 -1
  53. package/dist/components/parameters/network-visualizations/constants.js +5 -1
  54. package/dist/components/parameters/network-visualizations/index.js +2 -1
  55. package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +6 -6
  56. package/dist/components/parameters/network-visualizations/network-visualizations-form.js +7 -7
  57. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +3 -3
  58. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +2 -2
  59. package/dist/components/parameters/network-visualizations/network-visualizations.types.d.ts +2 -1
  60. package/dist/components/parameters/network-visualizations/network-visualizations.types.js +2 -0
  61. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +12 -11
  62. package/dist/components/parameters/short-circuit/short-circuit-fields.js +5 -5
  63. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +3 -3
  64. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +6 -6
  65. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +2 -2
  66. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +11 -10
  67. package/dist/components/parameters/voltage-init/constants.d.ts +39 -0
  68. package/dist/components/parameters/voltage-init/constants.js +65 -0
  69. package/dist/components/parameters/voltage-init/equipment-selection-parameters.d.ts +7 -0
  70. package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +119 -0
  71. package/dist/components/parameters/voltage-init/general-parameters.d.ts +4 -0
  72. package/dist/components/parameters/voltage-init/general-parameters.js +112 -0
  73. package/dist/components/parameters/voltage-init/index.d.ts +10 -0
  74. package/dist/components/parameters/voltage-init/index.js +38 -0
  75. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.d.ts +32 -0
  76. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +218 -0
  77. package/dist/components/parameters/voltage-init/voltage-init-form-utils.d.ts +4 -0
  78. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +220 -0
  79. package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.d.ts +2 -0
  80. package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.js +97 -0
  81. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.d.ts +30 -0
  82. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +150 -0
  83. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.d.ts +8 -0
  84. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +173 -0
  85. package/dist/components/parameters/voltage-init/voltage-init.type.d.ts +33 -0
  86. package/dist/components/parameters/voltage-init/voltage-init.type.js +8 -0
  87. package/dist/components/parameters/voltage-init/voltage-limits-parameters.d.ts +7 -0
  88. package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +188 -0
  89. package/dist/index.js +72 -5
  90. package/dist/services/index.d.ts +1 -0
  91. package/dist/services/index.js +6 -2
  92. package/dist/services/study.d.ts +2 -0
  93. package/dist/services/study.js +15 -1
  94. package/dist/services/voltage-init.d.ts +4 -0
  95. package/dist/services/voltage-init.js +14 -0
  96. package/dist/translations/en/dndTableEn.d.ts +16 -0
  97. package/dist/translations/en/dndTableEn.js +13 -0
  98. package/dist/translations/en/index.d.ts +1 -0
  99. package/dist/translations/en/index.js +2 -0
  100. package/dist/translations/en/networkModificationsEn.js +12 -12
  101. package/dist/translations/en/parameters.d.ts +32 -1
  102. package/dist/translations/en/parameters.js +33 -2
  103. package/dist/translations/fr/dndTableFr.d.ts +16 -0
  104. package/dist/translations/fr/dndTableFr.js +13 -0
  105. package/dist/translations/fr/index.d.ts +1 -0
  106. package/dist/translations/fr/index.js +2 -0
  107. package/dist/translations/fr/networkModificationsFr.js +12 -12
  108. package/dist/translations/fr/parameters.d.ts +33 -1
  109. package/dist/translations/fr/parameters.js +34 -2
  110. package/dist/utils/index.d.ts +1 -0
  111. package/dist/utils/index.js +3 -0
  112. package/dist/utils/validation-functions.d.ts +8 -0
  113. package/dist/utils/validation-functions.js +23 -0
  114. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ var VoltageInitTabValues = /* @__PURE__ */ ((VoltageInitTabValues2) => {
2
+ VoltageInitTabValues2["GENERAL"] = "GENERAL";
3
+ VoltageInitTabValues2["VOLTAGE_LIMITS"] = "voltageLimits";
4
+ VoltageInitTabValues2["EQUIPMENTS_SELECTION"] = "equipmentSelection";
5
+ return VoltageInitTabValues2;
6
+ })(VoltageInitTabValues || {});
7
+ const GENERAL = "GENERAL";
8
+ const GENERAL_APPLY_MODIFICATIONS = "GENERAL_APPLY_MODIFICATIONS";
9
+ const DEFAULT_GENERAL_APPLY_MODIFICATIONS = true;
10
+ const DEFAULT_UPDATE_BUS_VOLTAGE = true;
11
+ const DEFAULT_REACTIVE_SLACKS_THRESHOLD = 500;
12
+ const DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD = 0;
13
+ const REACTIVE_SLACKS_THRESHOLD = "reactiveSlacksThreshold";
14
+ const SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD = "shuntCompensatorActivationThreshold";
15
+ const ID = "id";
16
+ const PRIORITY = "priority";
17
+ const FILTER_ID = "filterId";
18
+ const FILTER_NAME = "filterName";
19
+ const SELECTION_TYPE = "selectionType";
20
+ const UPDATE_BUS_VOLTAGE = "updateBusVoltage";
21
+ const VOLTAGE_LIMITS_MODIFICATION = "voltageLimitsModification";
22
+ const VOLTAGE_LIMITS_DEFAULT = "voltageLimitsDefault";
23
+ const GENERATORS_SELECTION_TYPE = "generatorsSelectionType";
24
+ const VARIABLE_Q_GENERATORS = "variableQGenerators";
25
+ const TRANSFORMERS_SELECTION_TYPE = "twoWindingsTransformersSelectionType";
26
+ const VARIABLE_TRANSFORMERS = "variableTwoWindingsTransformers";
27
+ const VARIABLE_SHUNT_COMPENSATORS = "variableShuntCompensators";
28
+ const SHUNT_COMPENSATORS_SELECTION_TYPE = "shuntCompensatorsSelectionType";
29
+ const RATIO_TAP_CHANGER_POSITION = "ratioTapChangerPosition";
30
+ const RATIO_TAP_CHANGER_TARGET_V = "ratioTapChangerTargetV";
31
+ const LEG_SIDE = "legSide";
32
+ const HIGH_VOLTAGE_LIMIT = "highVoltageLimit";
33
+ const LOW_VOLTAGE_LIMIT = "lowVoltageLimit";
34
+ const FILTERS = "filters";
35
+ export {
36
+ DEFAULT_GENERAL_APPLY_MODIFICATIONS,
37
+ DEFAULT_REACTIVE_SLACKS_THRESHOLD,
38
+ DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
39
+ DEFAULT_UPDATE_BUS_VOLTAGE,
40
+ FILTERS,
41
+ FILTER_ID,
42
+ FILTER_NAME,
43
+ GENERAL,
44
+ GENERAL_APPLY_MODIFICATIONS,
45
+ GENERATORS_SELECTION_TYPE,
46
+ HIGH_VOLTAGE_LIMIT,
47
+ ID,
48
+ LEG_SIDE,
49
+ LOW_VOLTAGE_LIMIT,
50
+ PRIORITY,
51
+ RATIO_TAP_CHANGER_POSITION,
52
+ RATIO_TAP_CHANGER_TARGET_V,
53
+ REACTIVE_SLACKS_THRESHOLD,
54
+ SELECTION_TYPE,
55
+ SHUNT_COMPENSATORS_SELECTION_TYPE,
56
+ SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
57
+ TRANSFORMERS_SELECTION_TYPE,
58
+ UPDATE_BUS_VOLTAGE,
59
+ VARIABLE_Q_GENERATORS,
60
+ VARIABLE_SHUNT_COMPENSATORS,
61
+ VARIABLE_TRANSFORMERS,
62
+ VOLTAGE_LIMITS_DEFAULT,
63
+ VOLTAGE_LIMITS_MODIFICATION,
64
+ VoltageInitTabValues
65
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2023, 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 declare function EquipmentSelectionParameters(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,119 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Grid, Alert } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ import "react";
5
+ import "react-hook-form";
6
+ import { EquipmentType } from "../../../utils/types/equipmentType.js";
7
+ import "localized-countries";
8
+ import "localized-countries/data/fr";
9
+ import "localized-countries/data/en";
10
+ import "notistack";
11
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
12
+ import "@mui/icons-material";
13
+ import "yup";
14
+ import "../../overflowableText/OverflowableText.js";
15
+ import { ElementType } from "../../../utils/types/elementType.js";
16
+ import "../../treeViewFinder/TreeViewFinder.js";
17
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
18
+ import "../../customAGGrid/customAggrid.js";
19
+ import "ag-grid-community";
20
+ import "react-papaparse";
21
+ import "react-csv-downloader";
22
+ import { RadioInput } from "../../inputs/reactHookForm/booleans/RadioInput.js";
23
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
24
+ import "../../../utils/conversionUtils.js";
25
+ import "../../../utils/yupConfig.js";
26
+ import "@react-querybuilder/material";
27
+ import "../../filter/expert/expertFilterConstants.js";
28
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
29
+ import "uuid";
30
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
31
+ import "react-querybuilder";
32
+ import { GENERATORS_SELECTION_TYPE, VARIABLE_Q_GENERATORS, TRANSFORMERS_SELECTION_TYPE, VARIABLE_TRANSFORMERS, SHUNT_COMPENSATORS_SELECTION_TYPE, VARIABLE_SHUNT_COMPENSATORS } from "./constants.js";
33
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
34
+ import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
35
+ import { ParameterLineDirectoryItemsInput } from "../common/widget/parameter-line-directory-items-input.js";
36
+ import "../common/widget/parameter-line-slider.js";
37
+ import "../common/limitreductions/columns-definitions.js";
38
+ const equipmentsSelectionStyles = {
39
+ alert: (theme) => ({
40
+ display: "flex",
41
+ alignItems: "center",
42
+ marginBottom: theme.spacing(2)
43
+ }),
44
+ choice: (theme) => ({
45
+ marginTop: theme.spacing(4)
46
+ }),
47
+ choiceContainer: {
48
+ paddingLeft: 1
49
+ }
50
+ };
51
+ const initialEquipmentsSelectionType = {
52
+ ALL_EXCEPT: {
53
+ id: "ALL_EXCEPT",
54
+ label: "allExcept"
55
+ },
56
+ NONE_EXCEPT: {
57
+ id: "NONE_EXCEPT",
58
+ label: "noneExcept"
59
+ }
60
+ };
61
+ function EquipmentSelectionParameters() {
62
+ return /* @__PURE__ */ jsxs(Grid, { item: true, container: true, direction: "column", children: [
63
+ /* @__PURE__ */ jsx(Alert, { sx: equipmentsSelectionStyles.alert, severity: "info", variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersEquipmentsSelectionAlert" }) }),
64
+ /* @__PURE__ */ jsx(Grid, { item: true, container: true, justifyContent: "flex-end", sx: equipmentsSelectionStyles.choiceContainer, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 5, sx: equipmentsSelectionStyles.choice, children: /* @__PURE__ */ jsx(
65
+ RadioInput,
66
+ {
67
+ name: GENERATORS_SELECTION_TYPE,
68
+ options: Object.values(initialEquipmentsSelectionType)
69
+ }
70
+ ) }) }),
71
+ /* @__PURE__ */ jsx(
72
+ ParameterLineDirectoryItemsInput,
73
+ {
74
+ name: VARIABLE_Q_GENERATORS,
75
+ equipmentTypes: [EquipmentType.GENERATOR],
76
+ elementType: ElementType.FILTER,
77
+ label: "VariableGenerators",
78
+ hideErrorMessage: true
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(Grid, { item: true, container: true, justifyContent: "flex-end", sx: equipmentsSelectionStyles.choiceContainer, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 5, sx: equipmentsSelectionStyles.choice, children: /* @__PURE__ */ jsx(
82
+ RadioInput,
83
+ {
84
+ name: TRANSFORMERS_SELECTION_TYPE,
85
+ options: Object.values(initialEquipmentsSelectionType)
86
+ }
87
+ ) }) }),
88
+ /* @__PURE__ */ jsx(
89
+ ParameterLineDirectoryItemsInput,
90
+ {
91
+ name: VARIABLE_TRANSFORMERS,
92
+ equipmentTypes: [EquipmentType.TWO_WINDINGS_TRANSFORMER],
93
+ elementType: ElementType.FILTER,
94
+ label: "VariableTransformers",
95
+ hideErrorMessage: true
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsx(Grid, { item: true, container: true, justifyContent: "flex-end", sx: equipmentsSelectionStyles.choiceContainer, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 5, sx: equipmentsSelectionStyles.choice, children: /* @__PURE__ */ jsx(
99
+ RadioInput,
100
+ {
101
+ name: SHUNT_COMPENSATORS_SELECTION_TYPE,
102
+ options: Object.values(initialEquipmentsSelectionType)
103
+ }
104
+ ) }) }),
105
+ /* @__PURE__ */ jsx(
106
+ ParameterLineDirectoryItemsInput,
107
+ {
108
+ name: VARIABLE_SHUNT_COMPENSATORS,
109
+ equipmentTypes: [EquipmentType.SHUNT_COMPENSATOR],
110
+ elementType: ElementType.FILTER,
111
+ label: "VariableShuntCompensators",
112
+ hideErrorMessage: true
113
+ }
114
+ )
115
+ ] });
116
+ }
117
+ export {
118
+ EquipmentSelectionParameters
119
+ };
@@ -0,0 +1,4 @@
1
+ export interface GeneralParametersProps {
2
+ withApplyModifications: boolean;
3
+ }
4
+ export declare function GeneralParameters({ withApplyModifications }: Readonly<GeneralParametersProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,112 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useFormContext, useWatch } from "react-hook-form";
3
+ import { useCallback } from "react";
4
+ import { FormattedMessage } from "react-intl";
5
+ import { Grid, Alert, Box } from "@mui/material";
6
+ import { GENERAL, GENERAL_APPLY_MODIFICATIONS, UPDATE_BUS_VOLTAGE, REACTIVE_SLACKS_THRESHOLD, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD } from "./constants.js";
7
+ import { ReactivePowerAdornment } from "../common/constant.js";
8
+ import { LineSeparator } from "../common/line-separator.js";
9
+ import { parametersStyles } from "../parameters-style.js";
10
+ import "../../../utils/types/equipmentType.js";
11
+ import "localized-countries";
12
+ import "localized-countries/data/fr";
13
+ import "localized-countries/data/en";
14
+ import "notistack";
15
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
16
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
17
+ import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
18
+ import "@mui/icons-material";
19
+ import "../../treeViewFinder/TreeViewFinder.js";
20
+ import "yup";
21
+ import "../../overflowableText/OverflowableText.js";
22
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
23
+ import "../../customAGGrid/customAggrid.js";
24
+ import "ag-grid-community";
25
+ import "react-papaparse";
26
+ import "react-csv-downloader";
27
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
28
+ import "../../../utils/conversionUtils.js";
29
+ import "../../../utils/yupConfig.js";
30
+ import "@react-querybuilder/material";
31
+ import "../../filter/expert/expertFilterConstants.js";
32
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
33
+ import "uuid";
34
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
35
+ import "react-querybuilder";
36
+ import { ParameterFloat } from "../common/widget/parameter-float.js";
37
+ import "../common/widget/parameter-line-slider.js";
38
+ import { ParameterSwitch } from "../common/widget/parameter-switch.js";
39
+ import "../common/limitreductions/columns-definitions.js";
40
+ function GeneralParameters({ withApplyModifications }) {
41
+ const { setValue } = useFormContext();
42
+ const applyModificationsWatched = useWatch({
43
+ name: `${GENERAL}.${GENERAL_APPLY_MODIFICATIONS}`
44
+ });
45
+ const updateBusVoltageWatched = useWatch({
46
+ name: `${GENERAL}.${UPDATE_BUS_VOLTAGE}`
47
+ });
48
+ const setApplyModificationsValue = useCallback(
49
+ (_, checked) => {
50
+ setValue(`${GENERAL}.${GENERAL_APPLY_MODIFICATIONS}`, checked, {
51
+ shouldDirty: true
52
+ });
53
+ },
54
+ [setValue]
55
+ );
56
+ const setUpdateBusVoltageValue = useCallback(
57
+ (_, checked) => {
58
+ setValue(`${GENERAL}.${UPDATE_BUS_VOLTAGE}`, checked, {
59
+ shouldDirty: true
60
+ });
61
+ },
62
+ [setValue]
63
+ );
64
+ return /* @__PURE__ */ jsxs(Grid, { children: [
65
+ withApplyModifications && /* @__PURE__ */ jsxs(Fragment, { children: [
66
+ /* @__PURE__ */ jsx(Alert, { sx: parametersStyles.adjustExistingLimitsInfo, severity: "info", variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersGeneralSaveInfo" }) }),
67
+ /* @__PURE__ */ jsx(
68
+ ParameterSwitch,
69
+ {
70
+ value: applyModificationsWatched,
71
+ label: "VoltageInitParametersGeneralApplyModificationsLabel",
72
+ onChange: setApplyModificationsValue
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(Box, { my: 2, children: /* @__PURE__ */ jsx(LineSeparator, {}) })
76
+ ] }),
77
+ /* @__PURE__ */ jsx(
78
+ ParameterSwitch,
79
+ {
80
+ value: updateBusVoltageWatched,
81
+ label: "VoltageInitParametersGeneralUpdateBusVoltageLabel",
82
+ onChange: setUpdateBusVoltageValue
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(
86
+ ParameterFloat,
87
+ {
88
+ name: `${GENERAL}.${REACTIVE_SLACKS_THRESHOLD}`,
89
+ style: parametersStyles.parameterName,
90
+ label: "ReactiveSlacksThreshold",
91
+ adornment: ReactivePowerAdornment,
92
+ labelSize: 8,
93
+ inputSize: 4
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsx(
97
+ ParameterFloat,
98
+ {
99
+ name: `${GENERAL}.${SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD}`,
100
+ style: parametersStyles.parameterName,
101
+ label: "ShuntCompensatorActivationThreshold",
102
+ adornment: ReactivePowerAdornment,
103
+ tooltip: "ShuntCompensatorActivationThresholdDescription",
104
+ labelSize: 8,
105
+ inputSize: 4
106
+ }
107
+ )
108
+ ] });
109
+ }
110
+ export {
111
+ GeneralParameters
112
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2025, 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 https://mozilla.org/MPL/2.0/.
6
+ */
7
+ export * from './constants';
8
+ export * from './voltage-init.type';
9
+ export * from './voltage-init-parameters-dialog';
10
+ export * from './voltage-init-parameters-inline';
@@ -0,0 +1,38 @@
1
+ import { DEFAULT_GENERAL_APPLY_MODIFICATIONS, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, FILTERS, FILTER_ID, FILTER_NAME, GENERAL, GENERAL_APPLY_MODIFICATIONS, GENERATORS_SELECTION_TYPE, HIGH_VOLTAGE_LIMIT, ID, LEG_SIDE, LOW_VOLTAGE_LIMIT, PRIORITY, RATIO_TAP_CHANGER_POSITION, RATIO_TAP_CHANGER_TARGET_V, REACTIVE_SLACKS_THRESHOLD, SELECTION_TYPE, SHUNT_COMPENSATORS_SELECTION_TYPE, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, TRANSFORMERS_SELECTION_TYPE, UPDATE_BUS_VOLTAGE, VARIABLE_Q_GENERATORS, VARIABLE_SHUNT_COMPENSATORS, VARIABLE_TRANSFORMERS, VOLTAGE_LIMITS_DEFAULT, VOLTAGE_LIMITS_MODIFICATION, VoltageInitTabValues } from "./constants.js";
2
+ import { EquipmentsSelectionType } from "./voltage-init.type.js";
3
+ import { VoltageInitParametersEditionDialog } from "./voltage-init-parameters-dialog.js";
4
+ import { VoltageInitParametersInLine } from "./voltage-init-parameters-inline.js";
5
+ export {
6
+ DEFAULT_GENERAL_APPLY_MODIFICATIONS,
7
+ DEFAULT_REACTIVE_SLACKS_THRESHOLD,
8
+ DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
9
+ DEFAULT_UPDATE_BUS_VOLTAGE,
10
+ EquipmentsSelectionType,
11
+ FILTERS,
12
+ FILTER_ID,
13
+ FILTER_NAME,
14
+ GENERAL,
15
+ GENERAL_APPLY_MODIFICATIONS,
16
+ GENERATORS_SELECTION_TYPE,
17
+ HIGH_VOLTAGE_LIMIT,
18
+ ID,
19
+ LEG_SIDE,
20
+ LOW_VOLTAGE_LIMIT,
21
+ PRIORITY,
22
+ RATIO_TAP_CHANGER_POSITION,
23
+ RATIO_TAP_CHANGER_TARGET_V,
24
+ REACTIVE_SLACKS_THRESHOLD,
25
+ SELECTION_TYPE,
26
+ SHUNT_COMPENSATORS_SELECTION_TYPE,
27
+ SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
28
+ TRANSFORMERS_SELECTION_TYPE,
29
+ UPDATE_BUS_VOLTAGE,
30
+ VARIABLE_Q_GENERATORS,
31
+ VARIABLE_SHUNT_COMPENSATORS,
32
+ VARIABLE_TRANSFORMERS,
33
+ VOLTAGE_LIMITS_DEFAULT,
34
+ VOLTAGE_LIMITS_MODIFICATION,
35
+ VoltageInitParametersEditionDialog,
36
+ VoltageInitParametersInLine,
37
+ VoltageInitTabValues
38
+ };
@@ -0,0 +1,32 @@
1
+ import { FieldErrors, UseFormReturn } from 'react-hook-form';
2
+ import { SyntheticEvent } from 'react';
3
+ import { ObjectSchema } from 'yup';
4
+ import { UUID } from 'crypto';
5
+ import { VoltageInitTabValues as TabValues } from './constants';
6
+ import { VoltageInitStudyParameters } from './voltage-init.type';
7
+ export interface UseVoltageInitParametersFormReturn {
8
+ formMethods: UseFormReturn;
9
+ formSchema: ObjectSchema<any>;
10
+ selectedTab: TabValues;
11
+ handleTabChange: (event: SyntheticEvent, newValue: TabValues) => void;
12
+ paramsLoading: boolean;
13
+ onSaveInline: (formData: Record<string, any>) => void;
14
+ onSaveDialog: (formData: Record<string, any>) => void;
15
+ tabIndexesWithError: TabValues[];
16
+ onValidationError: (errors: FieldErrors) => void;
17
+ }
18
+ type UseVoltageInitParametersFormProps = {
19
+ parametersUuid: UUID;
20
+ name: string;
21
+ description: string | null;
22
+ studyUuid: null;
23
+ parameters: null;
24
+ } | {
25
+ parametersUuid: null;
26
+ name: null;
27
+ description: null;
28
+ studyUuid: UUID | null;
29
+ parameters: VoltageInitStudyParameters | null;
30
+ };
31
+ export declare const useVoltageInitParametersForm: ({ parametersUuid, name, description, studyUuid, parameters, }: UseVoltageInitParametersFormProps) => UseVoltageInitParametersFormReturn;
32
+ export {};
@@ -0,0 +1,218 @@
1
+ import { useForm } from "react-hook-form";
2
+ import { yupResolver } from "@hookform/resolvers/yup";
3
+ import { useState, useCallback, useMemo, useEffect } from "react";
4
+ import "../../../utils/yupConfig.js";
5
+ import "react/jsx-runtime";
6
+ import "react-intl";
7
+ import "@mui/material";
8
+ import "../../../utils/types/equipmentType.js";
9
+ import { updateParameter } from "../../../services/explore.js";
10
+ import { updateVoltageInitParameters } from "../../../services/study.js";
11
+ import { getVoltageInitParameters } from "../../../services/voltage-init.js";
12
+ import "localized-countries";
13
+ import "localized-countries/data/fr";
14
+ import "localized-countries/data/en";
15
+ import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
16
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
17
+ import "@mui/icons-material";
18
+ import * as yup from "yup";
19
+ import "../../overflowableText/OverflowableText.js";
20
+ import { NAME, DESCRIPTION_INPUT } from "../../inputs/reactHookForm/DirectoryItemsInput.js";
21
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
22
+ import "../../customAGGrid/customAggrid.js";
23
+ import "ag-grid-community";
24
+ import "react-papaparse";
25
+ import "react-csv-downloader";
26
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
27
+ import { isBlankOrEmpty } from "../../../utils/conversionUtils.js";
28
+ import { ElementType } from "../../../utils/types/elementType.js";
29
+ import "@react-querybuilder/material";
30
+ import "../../filter/expert/expertFilterConstants.js";
31
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
32
+ import "uuid";
33
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
34
+ import "react-querybuilder";
35
+ import { VoltageInitTabValues, VARIABLE_SHUNT_COMPENSATORS, ID, SHUNT_COMPENSATORS_SELECTION_TYPE, VARIABLE_TRANSFORMERS, TRANSFORMERS_SELECTION_TYPE, VARIABLE_Q_GENERATORS, GENERATORS_SELECTION_TYPE, VOLTAGE_LIMITS_DEFAULT, HIGH_VOLTAGE_LIMIT, LOW_VOLTAGE_LIMIT, FILTERS, VOLTAGE_LIMITS_MODIFICATION, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, REACTIVE_SLACKS_THRESHOLD, UPDATE_BUS_VOLTAGE, GENERAL_APPLY_MODIFICATIONS, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, DEFAULT_GENERAL_APPLY_MODIFICATIONS, GENERAL } from "./constants.js";
36
+ import "../../filter/HeaderFilterForm.js";
37
+ import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
38
+ import { fromVoltageInitParametersFormToParamValues, fromVoltageInitParamsDataToFormValues, fromStudyVoltageInitParamsDataToFormValues } from "./voltage-init-form-utils.js";
39
+ import "@hello-pangea/dnd";
40
+ import { SELECTED } from "../../dnd-table/dnd-table.type.js";
41
+ const useVoltageInitParametersForm = ({
42
+ parametersUuid,
43
+ name,
44
+ description,
45
+ studyUuid,
46
+ parameters
47
+ }) => {
48
+ const [selectedTab, setSelectedTab] = useState(VoltageInitTabValues.GENERAL);
49
+ const [paramsLoading, setParamsLoading] = useState(false);
50
+ const [tabIndexesWithError, setTabIndexesWithError] = useState([]);
51
+ const { snackError } = useSnackMessage();
52
+ const handleTabChange = useCallback((_event, newValue) => {
53
+ setSelectedTab(newValue);
54
+ }, []);
55
+ const formSchema = useMemo(() => {
56
+ return yup.object({
57
+ [VoltageInitTabValues.GENERAL]: yup.object().shape({
58
+ [GENERAL_APPLY_MODIFICATIONS]: yup.boolean(),
59
+ [UPDATE_BUS_VOLTAGE]: yup.boolean().required(),
60
+ [REACTIVE_SLACKS_THRESHOLD]: yup.number().min(0, "ReactiveSlacksThresholdMustBeGreaterOrEqualToZero").required(),
61
+ [SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: yup.number().min(0, "ShuntCompensatorActivationThresholdMustBeGreaterOrEqualToZero").required()
62
+ }),
63
+ [VOLTAGE_LIMITS_MODIFICATION]: yup.array().of(
64
+ yup.object().shape({
65
+ [SELECTED]: yup.boolean().required(),
66
+ [FILTERS]: yup.array().of(
67
+ yup.object().shape({
68
+ [ID]: yup.string().required(),
69
+ [NAME]: yup.string().required()
70
+ })
71
+ ).min(1, "FilterInputMinError"),
72
+ [LOW_VOLTAGE_LIMIT]: yup.number().nullable(),
73
+ [HIGH_VOLTAGE_LIMIT]: yup.number().nullable()
74
+ })
75
+ ),
76
+ [VOLTAGE_LIMITS_DEFAULT]: yup.array().of(
77
+ yup.object().shape({
78
+ [SELECTED]: yup.boolean().required(),
79
+ [FILTERS]: yup.array().of(
80
+ yup.object().shape({
81
+ [ID]: yup.string().required(),
82
+ [NAME]: yup.string().required()
83
+ })
84
+ ).min(1, "FilterInputMinError"),
85
+ [LOW_VOLTAGE_LIMIT]: yup.number().min(0).nullable().test((value, context) => {
86
+ return !isBlankOrEmpty(value) || !isBlankOrEmpty(context.parent[HIGH_VOLTAGE_LIMIT]);
87
+ }),
88
+ [HIGH_VOLTAGE_LIMIT]: yup.number().min(0).nullable().test((value, context) => {
89
+ return !isBlankOrEmpty(value) || !isBlankOrEmpty(context.parent[LOW_VOLTAGE_LIMIT]);
90
+ })
91
+ })
92
+ ),
93
+ [GENERATORS_SELECTION_TYPE]: yup.mixed().required(),
94
+ [VARIABLE_Q_GENERATORS]: yup.array().of(
95
+ yup.object().shape({
96
+ [ID]: yup.string().required(),
97
+ [NAME]: yup.string().required()
98
+ })
99
+ ),
100
+ [TRANSFORMERS_SELECTION_TYPE]: yup.mixed().required(),
101
+ [VARIABLE_TRANSFORMERS]: yup.array().of(
102
+ yup.object().shape({
103
+ [ID]: yup.string().required(),
104
+ [NAME]: yup.string().required()
105
+ })
106
+ ),
107
+ [SHUNT_COMPENSATORS_SELECTION_TYPE]: yup.mixed().required(),
108
+ [VARIABLE_SHUNT_COMPENSATORS]: yup.array().of(
109
+ yup.object().shape({
110
+ [ID]: yup.string().required(),
111
+ [NAME]: yup.string().required()
112
+ })
113
+ )
114
+ }).concat(getNameElementEditorSchema(name));
115
+ }, [name]);
116
+ const formMethods = useForm({
117
+ defaultValues: {
118
+ ...getNameElementEditorEmptyFormData(name, description),
119
+ [VoltageInitTabValues.GENERAL]: {
120
+ [GENERAL_APPLY_MODIFICATIONS]: DEFAULT_GENERAL_APPLY_MODIFICATIONS,
121
+ [UPDATE_BUS_VOLTAGE]: DEFAULT_UPDATE_BUS_VOLTAGE,
122
+ [REACTIVE_SLACKS_THRESHOLD]: DEFAULT_REACTIVE_SLACKS_THRESHOLD,
123
+ [SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD
124
+ },
125
+ [VOLTAGE_LIMITS_MODIFICATION]: [],
126
+ [VOLTAGE_LIMITS_DEFAULT]: [],
127
+ [GENERATORS_SELECTION_TYPE]: "ALL_EXCEPT",
128
+ [VARIABLE_Q_GENERATORS]: [],
129
+ [TRANSFORMERS_SELECTION_TYPE]: "NONE_EXCEPT",
130
+ [VARIABLE_TRANSFORMERS]: [],
131
+ [SHUNT_COMPENSATORS_SELECTION_TYPE]: "NONE_EXCEPT",
132
+ [VARIABLE_SHUNT_COMPENSATORS]: []
133
+ },
134
+ resolver: yupResolver(formSchema)
135
+ });
136
+ const { reset } = formMethods;
137
+ const onValidationError = useCallback(
138
+ (errors) => {
139
+ const tabsInError = [];
140
+ if ((errors == null ? void 0 : errors[GENERAL]) && VoltageInitTabValues.GENERAL !== selectedTab) {
141
+ tabsInError.push(VoltageInitTabValues.GENERAL);
142
+ }
143
+ setTabIndexesWithError(tabsInError);
144
+ },
145
+ [selectedTab]
146
+ );
147
+ const onSaveInline = useCallback(
148
+ (formData) => {
149
+ if (studyUuid) {
150
+ updateVoltageInitParameters(studyUuid, fromVoltageInitParametersFormToParamValues(formData)).catch(
151
+ (error) => {
152
+ snackError({
153
+ messageTxt: error.message,
154
+ headerId: "updateVoltageInitParametersError"
155
+ });
156
+ }
157
+ );
158
+ }
159
+ },
160
+ [snackError, studyUuid]
161
+ );
162
+ const onSaveDialog = useCallback(
163
+ (formData) => {
164
+ if (parametersUuid) {
165
+ updateParameter(
166
+ parametersUuid,
167
+ fromVoltageInitParametersFormToParamValues(formData).computationParameters,
168
+ formData[NAME],
169
+ ElementType.VOLTAGE_INIT_PARAMETERS,
170
+ formData[DESCRIPTION_INPUT] ?? ""
171
+ ).catch((error) => {
172
+ snackError({
173
+ messageTxt: error.message,
174
+ headerId: "updateVoltageInitParametersError"
175
+ });
176
+ });
177
+ }
178
+ },
179
+ [parametersUuid, snackError]
180
+ );
181
+ useEffect(() => {
182
+ if (parametersUuid) {
183
+ const timer = setTimeout(() => {
184
+ setParamsLoading(true);
185
+ }, 700);
186
+ getVoltageInitParameters(parametersUuid).then((params) => {
187
+ reset(fromVoltageInitParamsDataToFormValues(params));
188
+ }).catch((error) => {
189
+ snackError({
190
+ messageTxt: error.message,
191
+ headerId: "paramsRetrievingError"
192
+ });
193
+ }).finally(() => {
194
+ clearTimeout(timer);
195
+ setParamsLoading(false);
196
+ });
197
+ }
198
+ }, [parametersUuid, reset, snackError]);
199
+ useEffect(() => {
200
+ if (parameters) {
201
+ reset(fromStudyVoltageInitParamsDataToFormValues(parameters));
202
+ }
203
+ }, [parameters, reset]);
204
+ return {
205
+ formMethods,
206
+ formSchema,
207
+ selectedTab,
208
+ handleTabChange,
209
+ paramsLoading,
210
+ onSaveInline,
211
+ onSaveDialog,
212
+ tabIndexesWithError,
213
+ onValidationError
214
+ };
215
+ };
216
+ export {
217
+ useVoltageInitParametersForm
218
+ };
@@ -0,0 +1,4 @@
1
+ import { VoltageInitParameters, VoltageInitStudyParameters } from './voltage-init.type';
2
+ export declare const fromVoltageInitParametersFormToParamValues: (newParams: Record<string, any>) => VoltageInitStudyParameters;
3
+ export declare const fromVoltageInitParamsDataToFormValues: (parameters: VoltageInitParameters) => Record<string, any>;
4
+ export declare const fromStudyVoltageInitParamsDataToFormValues: (parameters: VoltageInitStudyParameters) => Record<string, any>;