@gridsuite/commons-ui 0.202.0 → 0.203.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 (83) hide show
  1. package/dist/components/addButton/AddButton.d.ts +10 -0
  2. package/dist/components/addButton/AddButton.js +16 -0
  3. package/dist/components/addButton/index.d.ts +1 -0
  4. package/dist/components/addButton/index.js +5 -0
  5. package/dist/components/cardErrorBoundary/CardErrorBoundary.d.ts +1 -1
  6. package/dist/components/index.d.ts +1 -0
  7. package/dist/components/index.js +36 -1
  8. package/dist/components/inputs/index.js +0 -2
  9. package/dist/components/inputs/reactHookForm/expandableInput/ExpandableInput.js +3 -28
  10. package/dist/components/inputs/reactHookForm/text/DescriptionField.js +4 -4
  11. package/dist/components/inputs/reactQueryBuilder/index.d.ts +0 -1
  12. package/dist/components/inputs/reactQueryBuilder/index.js +0 -2
  13. package/dist/components/network-modifications/common/activePowerControl/ActivePowerControlForm.d.ts +6 -0
  14. package/dist/components/network-modifications/common/activePowerControl/ActivePowerControlForm.js +97 -0
  15. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.type.d.ts +10 -0
  16. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.type.js +1 -0
  17. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.d.ts +8 -0
  18. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +26 -0
  19. package/dist/components/network-modifications/common/activePowerControl/index.d.ts +9 -0
  20. package/dist/components/network-modifications/common/activePowerControl/index.js +7 -0
  21. package/dist/components/network-modifications/common/connectivity/BranchConnectivityForm.js +0 -2
  22. package/dist/components/network-modifications/common/connectivity/ConnectivityForm.d.ts +9 -17
  23. package/dist/components/network-modifications/common/connectivity/ConnectivityForm.js +56 -219
  24. package/dist/components/network-modifications/common/connectivity/PositionForm.d.ts +11 -0
  25. package/dist/components/network-modifications/common/connectivity/PositionForm.js +111 -0
  26. package/dist/components/network-modifications/common/connectivity/VoltageLevelConnectivityForm.d.ts +13 -0
  27. package/dist/components/network-modifications/common/connectivity/VoltageLevelConnectivityForm.js +164 -0
  28. package/dist/components/network-modifications/common/connectivity/connectivityForm.utils.js +3 -3
  29. package/dist/components/network-modifications/common/connectivity/index.d.ts +1 -0
  30. package/dist/components/network-modifications/common/connectivity/index.js +2 -0
  31. package/dist/components/network-modifications/common/index.d.ts +3 -0
  32. package/dist/components/network-modifications/common/index.js +35 -1
  33. package/dist/components/network-modifications/common/reactiveLimits/ReactiveLimitsForm.d.ts +8 -0
  34. package/dist/components/network-modifications/common/reactiveLimits/ReactiveLimitsForm.js +102 -0
  35. package/dist/components/network-modifications/common/reactiveLimits/index.d.ts +10 -0
  36. package/dist/components/network-modifications/common/reactiveLimits/index.js +23 -0
  37. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.d.ts +12 -0
  38. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js +101 -0
  39. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.d.ts +10 -0
  40. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js +118 -0
  41. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/index.d.ts +9 -0
  42. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/index.js +15 -0
  43. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.d.ts +20 -0
  44. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +152 -0
  45. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.type.d.ts +21 -0
  46. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.type.js +1 -0
  47. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.d.ts +55 -0
  48. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +66 -0
  49. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +3 -3
  50. package/dist/components/network-modifications/common/shortCircuit/ShortCircuitForm.d.ts +5 -0
  51. package/dist/components/network-modifications/common/shortCircuit/ShortCircuitForm.js +68 -0
  52. package/dist/components/network-modifications/common/shortCircuit/index.d.ts +9 -0
  53. package/dist/components/network-modifications/common/shortCircuit/index.js +8 -0
  54. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.type.d.ts +10 -0
  55. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.type.js +1 -0
  56. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.d.ts +15 -0
  57. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.js +37 -0
  58. package/dist/components/network-modifications/generator/creation/generatorCreation.types.d.ts +40 -0
  59. package/dist/components/network-modifications/generator/creation/generatorCreation.types.js +1 -0
  60. package/dist/components/network-modifications/generator/creation/index.d.ts +7 -0
  61. package/dist/components/network-modifications/generator/creation/index.js +1 -0
  62. package/dist/components/network-modifications/generator/generatorDialog.type.d.ts +102 -0
  63. package/dist/components/network-modifications/generator/generatorDialog.type.js +1 -0
  64. package/dist/components/network-modifications/generator/index.d.ts +9 -0
  65. package/dist/components/network-modifications/generator/index.js +1 -0
  66. package/dist/components/network-modifications/generator/modification/generatorModification.types.d.ts +41 -0
  67. package/dist/components/network-modifications/generator/modification/generatorModification.types.js +1 -0
  68. package/dist/components/network-modifications/generator/modification/index.d.ts +7 -0
  69. package/dist/components/network-modifications/generator/modification/index.js +1 -0
  70. package/dist/components/network-modifications/index.d.ts +1 -0
  71. package/dist/components/network-modifications/index.js +34 -0
  72. package/dist/components/network-modifications/load/common/LoadDialogTabsContent.js +0 -1
  73. package/dist/components/network-modifications/load/creation/loadCreation.utils.js +1 -1
  74. package/dist/components/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationTab.js +4 -3
  75. package/dist/components/parameters/common/hook/use-parameters-form.js +1 -1
  76. package/dist/index.js +36 -1
  77. package/dist/translations/en/networkModificationsEn.d.ts +26 -0
  78. package/dist/translations/en/networkModificationsEn.js +26 -0
  79. package/dist/translations/fr/networkModificationsFr.d.ts +26 -0
  80. package/dist/translations/fr/networkModificationsFr.js +26 -0
  81. package/dist/utils/constants/fieldConstants.d.ts +22 -1
  82. package/dist/utils/constants/fieldConstants.js +22 -1
  83. package/package.json +1 -1
@@ -0,0 +1,152 @@
1
+ import { array, object, number, ref, ValidationError } 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
+ import { toNumber, validateValueIsANumber } from "../../../../../utils/validation-functions.js";
8
+ import "../../../../../utils/yupConfig.js";
9
+ const INSERT = "INSERT";
10
+ const REMOVE = "REMOVE";
11
+ const getCreationRowSchema = () => object().shape({
12
+ [FieldConstants.MAX_Q]: number().nullable().default(null),
13
+ [FieldConstants.MIN_Q]: number().nullable().default(null).max(ref(FieldConstants.MAX_Q), "ReactiveCapabilityCurveCreationErrorQminPQmaxPIncoherence"),
14
+ [FieldConstants.P]: number().nullable().default(null)
15
+ });
16
+ const getRowEmptyFormData = () => ({
17
+ [FieldConstants.P]: null,
18
+ [FieldConstants.MAX_Q]: null,
19
+ [FieldConstants.MIN_Q]: null
20
+ });
21
+ function getNotNullPFromArray(values) {
22
+ return values?.map((element) => {
23
+ const pValue = element[FieldConstants.P];
24
+ return validateValueIsANumber(pValue) ? toNumber(pValue) : null;
25
+ }).filter((p) => p !== null);
26
+ }
27
+ function checkAllPValuesAreUnique(values) {
28
+ const validActivePowerValues = getNotNullPFromArray(values);
29
+ const setOfPs = [...new Set(validActivePowerValues)];
30
+ return setOfPs.length === validActivePowerValues?.length;
31
+ }
32
+ function checkAllPValuesBetweenMinMax(values) {
33
+ const validActivePowerValues = getNotNullPFromArray(values);
34
+ if (validActivePowerValues) {
35
+ const minP = validActivePowerValues[0];
36
+ const maxP = validActivePowerValues[validActivePowerValues.length - 1];
37
+ return validActivePowerValues.every((p) => p >= minP && p <= maxP);
38
+ }
39
+ return void 0;
40
+ }
41
+ function hasAtLeastOneNegativeP(values) {
42
+ return values?.some((value) => value.p && value.p < 0);
43
+ }
44
+ function hasAtLeastOnePositiveP(values) {
45
+ return values?.some((value) => value.p && value.p >= 0);
46
+ }
47
+ function ifOneFieldThenAllFields(values, context) {
48
+ if (!values) {
49
+ return true;
50
+ }
51
+ const hasAnyValue = values.some((v) => v.p != null || v.maxQ != null || v.minQ != null);
52
+ if (!hasAnyValue) {
53
+ return true;
54
+ }
55
+ const errors = [];
56
+ values.forEach((value, index) => {
57
+ ["p", "maxQ", "minQ"].forEach((field) => {
58
+ if (value?.[field] == null) {
59
+ errors.push(
60
+ context.createError({
61
+ path: `${FieldConstants.REACTIVE_LIMITS}.${FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE}[${index}].${field}`,
62
+ message: "YupRequired"
63
+ })
64
+ );
65
+ }
66
+ });
67
+ });
68
+ return errors.length === 0 ? true : new ValidationError(errors);
69
+ }
70
+ const getReactiveCapabilityCurveValidationSchema = (id = FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE, positiveAndNegativePExist = false) => ({
71
+ [id]: array().nullable().when([FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE], {
72
+ is: "CURVE",
73
+ then: (schema) => {
74
+ let resultSchema = schema.of(getCreationRowSchema());
75
+ if (positiveAndNegativePExist) {
76
+ resultSchema = resultSchema.test(
77
+ "checkATLeastThereIsOneNegativeP",
78
+ "ReactiveCapabilityCurveCreationErrorMissingNegativeP",
79
+ hasAtLeastOneNegativeP
80
+ ).test(
81
+ "checkATLeastThereIsOnePositiveP",
82
+ "ReactiveCapabilityCurveCreationErrorMissingPositiveP",
83
+ hasAtLeastOnePositiveP
84
+ );
85
+ }
86
+ return resultSchema.min(2, "ReactiveCapabilityCurveCreationErrorMissingPoints").test("ifOneFieldThenAllFields", "", ifOneFieldThenAllFields).test(
87
+ "checkAllValuesAreUnique",
88
+ "ReactiveCapabilityCurveCreationErrorPInvalid",
89
+ checkAllPValuesAreUnique
90
+ ).test(
91
+ "checkAllValuesBetweenMinMax",
92
+ "ReactiveCapabilityCurveCreationErrorPOutOfRange",
93
+ checkAllPValuesBetweenMinMax
94
+ );
95
+ }
96
+ })
97
+ });
98
+ function setSelectedReactiveLimits(id, minMaxReactiveLimits, setValue) {
99
+ setValue(id, minMaxReactiveLimits ? "MINMAX" : "CURVE");
100
+ }
101
+ function setCurrentReactiveCapabilityCurveTable(previousReactiveCapabilityCurveTable, fieldKey, setValue) {
102
+ setValue(fieldKey, previousReactiveCapabilityCurveTable);
103
+ }
104
+ function handleReactiveCapabilityCurveChoice(currentChoice, previousChoice, currentReactiveLimits) {
105
+ if (currentChoice === "MINMAX") {
106
+ const hasAnyValue = currentReactiveLimits?.[FieldConstants.MAXIMUM_REACTIVE_POWER] || currentReactiveLimits?.[FieldConstants.MINIMUM_REACTIVE_POWER];
107
+ if (previousChoice === "CURVE" && !hasAnyValue) {
108
+ return "CURVE";
109
+ }
110
+ return "MINMAX";
111
+ }
112
+ if (currentChoice === "CURVE") {
113
+ const currentPoints = currentReactiveLimits?.[FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE];
114
+ const hasAnyValue = currentPoints?.some((v) => v.p != null || v.maxQ != null || v.minQ != null);
115
+ if (previousChoice === "MINMAX" && !hasAnyValue) {
116
+ return "MINMAX";
117
+ }
118
+ return "CURVE";
119
+ }
120
+ console.error(
121
+ "Reactive capability curve choice is not valid, it should be either MINMAX or CURVE. We return MINMAX by default."
122
+ );
123
+ return "MINMAX";
124
+ }
125
+ function toReactiveCapabilityCurveChoiceForGeneratorCreation(currentReactiveLimits, editData) {
126
+ const currentChoice = currentReactiveLimits?.[FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE];
127
+ let previousChoice;
128
+ if (editData) {
129
+ previousChoice = editData.reactiveCapabilityCurve ? "CURVE" : "MINMAX";
130
+ }
131
+ return handleReactiveCapabilityCurveChoice(currentChoice, previousChoice, currentReactiveLimits);
132
+ }
133
+ function toReactiveCapabilityCurveChoiceForGeneratorModification(currentReactiveLimits, editData, networkPoints) {
134
+ const currentChoice = currentReactiveLimits?.[FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE];
135
+ let editDataChoice;
136
+ if (editData) {
137
+ editDataChoice = editData.reactiveCapabilityCurve?.value === true ? "CURVE" : "MINMAX";
138
+ }
139
+ const networkChoice = networkPoints ? "CURVE" : "MINMAX";
140
+ const previousChoice = editDataChoice ?? networkChoice;
141
+ return handleReactiveCapabilityCurveChoice(currentChoice, previousChoice, currentReactiveLimits);
142
+ }
143
+ export {
144
+ INSERT,
145
+ REMOVE,
146
+ getReactiveCapabilityCurveValidationSchema,
147
+ getRowEmptyFormData,
148
+ setCurrentReactiveCapabilityCurveTable,
149
+ setSelectedReactiveLimits,
150
+ toReactiveCapabilityCurveChoiceForGeneratorCreation,
151
+ toReactiveCapabilityCurveChoiceForGeneratorModification
152
+ };
@@ -0,0 +1,21 @@
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 interface ReactiveCapabilityCurvePoints {
8
+ p?: number | null;
9
+ maxQ?: number | null;
10
+ minQ?: number | null;
11
+ }
12
+ export interface MinMaxReactiveLimitsFormInfos {
13
+ minQ?: number | null;
14
+ maxQ?: number | null;
15
+ }
16
+ export type ReactiveCapabilityCurve = ReactiveCapabilityCurveRow[] | null | undefined;
17
+ export type ReactiveCapabilityCurveRow = {
18
+ maxQ: number | null;
19
+ minQ: number | null;
20
+ p: number | null;
21
+ };
@@ -0,0 +1,55 @@
1
+ import { ReactiveCapabilityCurvePoints } from './reactiveLimits.type';
2
+ import { FieldConstants } from '../../../../utils';
3
+ export declare const REACTIVE_LIMIT_TYPES: readonly [{
4
+ readonly id: "MINMAX";
5
+ readonly label: "ReactiveLimitsKindMinMax";
6
+ }, {
7
+ readonly id: "CURVE";
8
+ readonly label: "ReactiveLimitsKindCurve";
9
+ }];
10
+ export declare const getReactiveLimitsFormData: ({ id, reactiveCapabilityCurveChoice, minimumReactivePower, maximumReactivePower, reactiveCapabilityCurvePoints, }: {
11
+ id?: string;
12
+ reactiveCapabilityCurveChoice: string;
13
+ minimumReactivePower?: number | null;
14
+ maximumReactivePower?: number | null;
15
+ reactiveCapabilityCurvePoints?: ReactiveCapabilityCurvePoints[] | null;
16
+ }) => {
17
+ [x: string]: {
18
+ reactiveCapabilityCurveChoice: string;
19
+ minimumReactivePower: number | null;
20
+ maximumReactivePower: number | null;
21
+ reactiveCapabilityCurveTable: ReactiveCapabilityCurvePoints[];
22
+ };
23
+ };
24
+ export declare const getReactiveLimitsEmptyFormData: (id?: FieldConstants) => {
25
+ [x: string]: {
26
+ reactiveCapabilityCurveChoice: string;
27
+ minimumReactivePower: null;
28
+ maximumReactivePower: null;
29
+ reactiveCapabilityCurveTable: {
30
+ p: null;
31
+ maxQ: null;
32
+ minQ: null;
33
+ }[];
34
+ };
35
+ };
36
+ export declare const getReactiveLimitsValidationSchema: (isEquipmentModification?: boolean, positiveAndNegativePExist?: boolean) => import('yup').ObjectSchema<{
37
+ reactiveCapabilityCurveChoice: string;
38
+ minimumReactivePower: number | null | undefined;
39
+ maximumReactivePower: number | null | undefined;
40
+ }, import('yup').AnyObject, {
41
+ reactiveCapabilityCurveChoice: undefined;
42
+ minimumReactivePower: undefined;
43
+ maximumReactivePower: undefined;
44
+ }, "">;
45
+ export declare const getReactiveLimitsSchema: (isEquipmentModification?: boolean, positiveAndNegativePExist?: boolean, id?: FieldConstants) => {
46
+ [x: string]: import('yup').ObjectSchema<{
47
+ reactiveCapabilityCurveChoice: string;
48
+ minimumReactivePower: number | null | undefined;
49
+ maximumReactivePower: number | null | undefined;
50
+ }, import('yup').AnyObject, {
51
+ reactiveCapabilityCurveChoice: undefined;
52
+ minimumReactivePower: undefined;
53
+ maximumReactivePower: undefined;
54
+ }, "">;
55
+ };
@@ -0,0 +1,66 @@
1
+ import { object, number, string } from "yup";
2
+ import { getRowEmptyFormData, getReactiveCapabilityCurveValidationSchema } from "./reactiveCapabilityCurve/reactiveCapability.utils.js";
3
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
4
+ import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
5
+ import "../../../../utils/conversionUtils.js";
6
+ import "../../../../utils/types/equipmentType.js";
7
+ import "react/jsx-runtime";
8
+ import "@mui/icons-material";
9
+ import "../../../../utils/yupConfig.js";
10
+ const REACTIVE_LIMIT_TYPES = [
11
+ { id: "MINMAX", label: "ReactiveLimitsKindMinMax" },
12
+ { id: "CURVE", label: "ReactiveLimitsKindCurve" }
13
+ ];
14
+ const getReactiveLimitsFormData = ({
15
+ id = FieldConstants.REACTIVE_LIMITS,
16
+ reactiveCapabilityCurveChoice,
17
+ minimumReactivePower,
18
+ maximumReactivePower,
19
+ reactiveCapabilityCurvePoints
20
+ }) => ({
21
+ [id]: {
22
+ [FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: reactiveCapabilityCurveChoice,
23
+ [FieldConstants.MINIMUM_REACTIVE_POWER]: minimumReactivePower ?? null,
24
+ [FieldConstants.MAXIMUM_REACTIVE_POWER]: maximumReactivePower ?? null,
25
+ [FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE]: reactiveCapabilityCurvePoints ?? [
26
+ getRowEmptyFormData(),
27
+ getRowEmptyFormData()
28
+ ]
29
+ }
30
+ });
31
+ const getReactiveLimitsEmptyFormData = (id = FieldConstants.REACTIVE_LIMITS) => ({
32
+ [id]: {
33
+ [FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: "MINMAX",
34
+ [FieldConstants.MINIMUM_REACTIVE_POWER]: null,
35
+ [FieldConstants.MAXIMUM_REACTIVE_POWER]: null,
36
+ [FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE]: [getRowEmptyFormData(), getRowEmptyFormData()]
37
+ }
38
+ });
39
+ const getReactiveLimitsValidationSchema = (isEquipmentModification = false, positiveAndNegativePExist = false) => object().shape(
40
+ {
41
+ [FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: string().nullable().required(YUP_REQUIRED),
42
+ [FieldConstants.MINIMUM_REACTIVE_POWER]: number().nullable().when([FieldConstants.MAXIMUM_REACTIVE_POWER], {
43
+ is: (maximumReactivePower) => !isEquipmentModification && maximumReactivePower != null,
44
+ then: (schema) => schema.required(YUP_REQUIRED)
45
+ }),
46
+ [FieldConstants.MAXIMUM_REACTIVE_POWER]: number().nullable().when([FieldConstants.MINIMUM_REACTIVE_POWER], {
47
+ is: (minimumReactivePower) => !isEquipmentModification && minimumReactivePower != null,
48
+ then: (schema) => schema.required(YUP_REQUIRED)
49
+ }),
50
+ ...getReactiveCapabilityCurveValidationSchema(
51
+ FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE,
52
+ positiveAndNegativePExist
53
+ )
54
+ },
55
+ [FieldConstants.MAXIMUM_REACTIVE_POWER, FieldConstants.MINIMUM_REACTIVE_POWER]
56
+ );
57
+ const getReactiveLimitsSchema = (isEquipmentModification = false, positiveAndNegativePExist = false, id = FieldConstants.REACTIVE_LIMITS) => ({
58
+ [id]: getReactiveLimitsValidationSchema(isEquipmentModification, positiveAndNegativePExist)
59
+ });
60
+ export {
61
+ REACTIVE_LIMIT_TYPES,
62
+ getReactiveLimitsEmptyFormData,
63
+ getReactiveLimitsFormData,
64
+ getReactiveLimitsSchema,
65
+ getReactiveLimitsValidationSchema
66
+ };
@@ -1,6 +1,6 @@
1
1
  import { number } from "yup";
2
2
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
- import { YUP_NOT_TYPE_NUMBER } from "../../../../utils/constants/translationKeys.js";
3
+ import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
4
  import "../../../../utils/conversionUtils.js";
5
5
  import "../../../../utils/types/equipmentType.js";
6
6
  import "react/jsx-runtime";
@@ -36,7 +36,7 @@ const getActivePowerSetPointSchema = (isEquipmentModification = false) => ({
36
36
  }).when([], {
37
37
  is: () => !isEquipmentModification,
38
38
  then: (schema) => {
39
- return schema.required().nonNullable("FieldIsRequired").test(
39
+ return schema.required(YUP_REQUIRED).nonNullable("FieldIsRequired").test(
40
40
  "activePowerSetPoint",
41
41
  "ActivePowerMustBeZeroOrBetweenMinAndMaxActivePower",
42
42
  testValueWithinPowerIntervalOrEqualToZero
@@ -47,7 +47,7 @@ const getActivePowerSetPointSchema = (isEquipmentModification = false) => ({
47
47
  const getReactivePowerSetPointSchema = (isEquipmentModification = false) => ({
48
48
  [FieldConstants.REACTIVE_POWER_SET_POINT]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().when([FieldConstants.VOLTAGE_REGULATION], {
49
49
  is: (value) => !isEquipmentModification && !value,
50
- then: (schema) => schema.required()
50
+ then: (schema) => schema.required(YUP_REQUIRED)
51
51
  })
52
52
  });
53
53
  const getSetPointsSchema = (isEquipmentModification = false) => ({
@@ -0,0 +1,5 @@
1
+ import { ShortCircuitInfos } from './shortCircuitForm.type';
2
+ export interface ShortCircuitFormProps {
3
+ previousValues?: ShortCircuitInfos;
4
+ }
5
+ export declare function ShortCircuitForm({ previousValues }: Readonly<ShortCircuitFormProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,68 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import "react-intl";
4
+ import "../../../overflowableText/OverflowableText.js";
5
+ import { OhmAdornment } from "../../../../utils/constants/adornments.js";
6
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
7
+ import "../../../../utils/conversionUtils.js";
8
+ import "../../../../utils/types/equipmentType.js";
9
+ import "@mui/icons-material";
10
+ import "../../../../utils/yupConfig.js";
11
+ import "react";
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 "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
18
+ import "yup";
19
+ import "../../../treeViewFinder/TreeViewFinder.js";
20
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
21
+ import "../../../customAGGrid/customAggrid.js";
22
+ import "ag-grid-community";
23
+ import "react-papaparse";
24
+ import "react-csv-downloader";
25
+ import { FloatInput } from "../../../inputs/reactHookForm/numbers/FloatInput.js";
26
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
27
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
28
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
29
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
30
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
31
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
32
+ import "../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
33
+ import "@react-querybuilder/material";
34
+ import "../../../filter/expert/expertFilterConstants.js";
35
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
36
+ import "uuid";
37
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
38
+ import "react-querybuilder";
39
+ import GridItem from "../../../grid/grid-item.js";
40
+ function ShortCircuitForm({ previousValues }) {
41
+ const transientReactanceField = /* @__PURE__ */ jsx(
42
+ FloatInput,
43
+ {
44
+ name: FieldConstants.TRANSIENT_REACTANCE,
45
+ label: "TransientReactanceForm",
46
+ adornment: OhmAdornment,
47
+ previousValue: previousValues?.directTransX ?? void 0,
48
+ clearable: true
49
+ }
50
+ );
51
+ const transformerReactanceField = /* @__PURE__ */ jsx(
52
+ FloatInput,
53
+ {
54
+ name: FieldConstants.TRANSFORMER_REACTANCE,
55
+ label: "TransformerReactanceForm",
56
+ adornment: OhmAdornment,
57
+ previousValue: Number.isNaN(Number(previousValues?.stepUpTransformerX)) ? void 0 : previousValues?.stepUpTransformerX ?? void 0,
58
+ clearable: true
59
+ }
60
+ );
61
+ return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
62
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: transientReactanceField }),
63
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: transformerReactanceField })
64
+ ] });
65
+ }
66
+ export {
67
+ ShortCircuitForm
68
+ };
@@ -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 './shortCircuitForm.type';
8
+ export * from './shortCircuitForm.utils';
9
+ export * from './ShortCircuitForm';
@@ -0,0 +1,8 @@
1
+ import { getShortCircuitEmptyFormData, getShortCircuitFormData, getShortCircuitFormSchema } from "./shortCircuitForm.utils.js";
2
+ import { ShortCircuitForm } from "./ShortCircuitForm.js";
3
+ export {
4
+ ShortCircuitForm,
5
+ getShortCircuitEmptyFormData,
6
+ getShortCircuitFormData,
7
+ getShortCircuitFormSchema
8
+ };
@@ -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 http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export interface ShortCircuitInfos {
8
+ directTransX?: number | null;
9
+ stepUpTransformerX?: number | null;
10
+ }
@@ -0,0 +1,15 @@
1
+ export declare const getShortCircuitEmptyFormData: () => {
2
+ directTransX: null;
3
+ transformerReactance: null;
4
+ };
5
+ export declare const getShortCircuitFormSchema: (isEquipmentModification?: boolean) => {
6
+ transformerReactance: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, undefined, "">;
7
+ directTransX: import('yup').NumberSchema<number | null | undefined, import('yup').AnyObject, undefined, "">;
8
+ };
9
+ export declare const getShortCircuitFormData: ({ directTransX, stepUpTransformerX, }: {
10
+ directTransX?: number | null;
11
+ stepUpTransformerX?: number | null;
12
+ }) => {
13
+ directTransX: number | null | undefined;
14
+ transformerReactance: number | null | undefined;
15
+ };
@@ -0,0 +1,37 @@
1
+ import { number } from "yup";
2
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
+ import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
+ import "../../../../utils/conversionUtils.js";
5
+ import "../../../../utils/types/equipmentType.js";
6
+ import "react/jsx-runtime";
7
+ import "@mui/icons-material";
8
+ import "../../../../utils/yupConfig.js";
9
+ const getShortCircuitEmptyFormData = () => {
10
+ return {
11
+ [FieldConstants.TRANSIENT_REACTANCE]: null,
12
+ [FieldConstants.TRANSFORMER_REACTANCE]: null
13
+ };
14
+ };
15
+ const getShortCircuitFormSchema = (isEquipmentModification = false) => {
16
+ return {
17
+ [FieldConstants.TRANSFORMER_REACTANCE]: number().nullable(),
18
+ [FieldConstants.TRANSIENT_REACTANCE]: number().nullable().when([FieldConstants.TRANSFORMER_REACTANCE], {
19
+ is: (transformerReactance) => isEquipmentModification && transformerReactance != null,
20
+ then: (schema) => schema.required(YUP_REQUIRED)
21
+ })
22
+ };
23
+ };
24
+ const getShortCircuitFormData = ({
25
+ directTransX,
26
+ stepUpTransformerX
27
+ }) => {
28
+ return {
29
+ [FieldConstants.TRANSIENT_REACTANCE]: directTransX,
30
+ [FieldConstants.TRANSFORMER_REACTANCE]: stepUpTransformerX
31
+ };
32
+ };
33
+ export {
34
+ getShortCircuitEmptyFormData,
35
+ getShortCircuitFormData,
36
+ getShortCircuitFormSchema
37
+ };
@@ -0,0 +1,40 @@
1
+ import { Property } from '../../common/properties';
2
+ import { ReactiveCapabilityCurvePoints } from '../../common/reactiveLimits/reactiveLimits.type';
3
+ import { ModificationType } from '../../../../utils';
4
+ export interface GeneratorCreationDto {
5
+ type: ModificationType;
6
+ uuid?: string;
7
+ equipmentId: string;
8
+ equipmentName: string | null;
9
+ energySource: string | null;
10
+ minP: number | null;
11
+ maxP: number | null;
12
+ ratedS: number | null;
13
+ targetP: number | null;
14
+ targetQ: number | null;
15
+ voltageRegulationOn: boolean | null;
16
+ targetV: number | null;
17
+ qPercent: number | null;
18
+ voltageLevelId: string | null;
19
+ busOrBusbarSectionId: string | null;
20
+ plannedActivePowerSetPoint: number | null;
21
+ marginalCost: number | null;
22
+ plannedOutageRate: number | null;
23
+ forcedOutageRate: number | null;
24
+ directTransX: number | null;
25
+ stepUpTransformerX: number | null;
26
+ regulatingTerminalId: string | null;
27
+ regulatingTerminalType: string | null;
28
+ regulatingTerminalVlId: string | null;
29
+ reactiveCapabilityCurve: boolean;
30
+ participate: boolean | null;
31
+ droop: number | null;
32
+ maxQ: number | null;
33
+ minQ: number | null;
34
+ reactiveCapabilityCurvePoints: ReactiveCapabilityCurvePoints[] | null;
35
+ connectionDirection: string | null;
36
+ connectionName: string | null;
37
+ connectionPosition: number | null;
38
+ terminalConnected: boolean | null;
39
+ properties: Property[] | null;
40
+ }
@@ -0,0 +1,7 @@
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 './generatorCreation.types';
@@ -0,0 +1,102 @@
1
+ import { FieldConstants } from '../../../utils';
2
+ import { ActivePowerControlInfos } from '../common/activePowerControl';
3
+ import { MinMaxReactiveLimitsFormInfos, ReactiveCapabilityCurvePoints } from '../common/reactiveLimits/reactiveLimits.type';
4
+ import { ShortCircuitInfos } from '../common/shortCircuit/shortCircuitForm.type';
5
+ import { Property } from '../common/properties/properties.type';
6
+ import { ConnectablePositionFormInfos } from '../common/connectivity/connectivity.type';
7
+ export type GeneratorDialogSchemaBaseForm = {
8
+ [FieldConstants.EQUIPMENT_NAME]?: string;
9
+ [FieldConstants.ENERGY_SOURCE]: string | null;
10
+ [FieldConstants.MAXIMUM_ACTIVE_POWER]: number | null;
11
+ [FieldConstants.MINIMUM_ACTIVE_POWER]: number | null;
12
+ [FieldConstants.RATED_NOMINAL_POWER]?: number | null;
13
+ [FieldConstants.TRANSFORMER_REACTANCE]?: number | null;
14
+ [FieldConstants.TRANSIENT_REACTANCE]?: number | null;
15
+ [FieldConstants.PLANNED_ACTIVE_POWER_SET_POINT]?: number | null;
16
+ [FieldConstants.MARGINAL_COST]?: number | null;
17
+ [FieldConstants.PLANNED_OUTAGE_RATE]?: number | null;
18
+ [FieldConstants.FORCED_OUTAGE_RATE]?: number | null;
19
+ [FieldConstants.CONNECTIVITY]: {
20
+ [FieldConstants.VOLTAGE_LEVEL]: {
21
+ [FieldConstants.ID]?: string;
22
+ };
23
+ [FieldConstants.BUS_OR_BUSBAR_SECTION]: {
24
+ [FieldConstants.ID]?: string;
25
+ };
26
+ [FieldConstants.CONNECTION_DIRECTION]?: string;
27
+ [FieldConstants.CONNECTION_NAME]?: string;
28
+ [FieldConstants.CONNECTION_POSITION]?: number;
29
+ [FieldConstants.CONNECTED]?: boolean;
30
+ };
31
+ [FieldConstants.VOLTAGE_REGULATION]?: boolean | null;
32
+ [FieldConstants.ACTIVE_POWER_SET_POINT]?: number;
33
+ [FieldConstants.REACTIVE_POWER_SET_POINT]?: number | null;
34
+ [FieldConstants.VOLTAGE_REGULATION_TYPE]?: string | null;
35
+ [FieldConstants.VOLTAGE_SET_POINT]?: number | null;
36
+ [FieldConstants.Q_PERCENT]?: number | null;
37
+ [FieldConstants.VOLTAGE_LEVEL]?: {
38
+ [FieldConstants.ID]?: string;
39
+ [FieldConstants.NAME]?: string;
40
+ [FieldConstants.SUBSTATION_ID]?: string;
41
+ [FieldConstants.NOMINAL_VOLTAGE]?: string;
42
+ [FieldConstants.TOPOLOGY_KIND]?: string | null;
43
+ };
44
+ [FieldConstants.EQUIPMENT]?: {
45
+ [FieldConstants.ID]?: string;
46
+ [FieldConstants.NAME]?: string | null;
47
+ [FieldConstants.TYPE]?: string;
48
+ };
49
+ [FieldConstants.FREQUENCY_REGULATION]?: boolean | null;
50
+ [FieldConstants.DROOP]?: number | null;
51
+ [FieldConstants.REACTIVE_LIMITS]: {
52
+ [FieldConstants.MINIMUM_REACTIVE_POWER]?: number | null;
53
+ [FieldConstants.MAXIMUM_REACTIVE_POWER]?: number | null;
54
+ [FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: string | null;
55
+ [FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE]?: ReactiveCapabilityCurvePoints[];
56
+ };
57
+ [FieldConstants.ADDITIONAL_PROPERTIES]?: Property[];
58
+ };
59
+ export type GeneratorCreationDialogSchemaForm = {
60
+ equipmentId: string;
61
+ } & GeneratorDialogSchemaBaseForm;
62
+ export type GeneratorModificationDialogSchemaForm = Partial<GeneratorDialogSchemaBaseForm>;
63
+ export interface GeneratorFormInfos {
64
+ id: string;
65
+ name: string;
66
+ energySource?: string;
67
+ maxP: number;
68
+ minP: number;
69
+ ratedS: number;
70
+ targetP: number;
71
+ voltageRegulatorOn: boolean;
72
+ targetV: number;
73
+ targetQ: number;
74
+ generatorStartup: GeneratorStartUpFormInfos;
75
+ connectablePosition: ConnectablePositionFormInfos;
76
+ activePowerControl: ActivePowerControlInfos;
77
+ generatorShortCircuit: ShortCircuitInfos;
78
+ regulatingTerminalId: string;
79
+ regulatingTerminalVlId: string;
80
+ regulatingTerminalConnectableId: string;
81
+ regulatingTerminalConnectableType: string;
82
+ coordinatedReactiveControl: CoordinatedReactiveControlInfos;
83
+ minMaxReactiveLimits: MinMaxReactiveLimitsFormInfos;
84
+ reactiveCapabilityCurvePoints: ReactiveCapabilityCurvePoints[];
85
+ voltageLevelId: string;
86
+ busOrBusbarSectionId: string;
87
+ connectionDirection: string | null;
88
+ connectionName?: string | null;
89
+ connectionPosition?: number | null;
90
+ terminalConnected?: boolean | null;
91
+ properties: Record<string, string> | undefined;
92
+ }
93
+ interface CoordinatedReactiveControlInfos {
94
+ qPercent?: number | null;
95
+ }
96
+ interface GeneratorStartUpFormInfos {
97
+ plannedActivePowerSetPoint: number | null;
98
+ marginalCost?: number | null;
99
+ plannedOutageRate?: number | null;
100
+ forcedOutageRate?: number | null;
101
+ }
102
+ export {};
@@ -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 './generatorDialog.type';
8
+ export * from './creation';
9
+ export * from './modification';