@gridsuite/commons-ui 0.256.0 → 0.257.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.
- package/dist/components/composite/filter/FilterCreationDialog.js +6 -2
- package/dist/components/composite/filter/HeaderFilterForm.js +3 -2
- package/dist/components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +2 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +2 -1
- package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +3 -2
- package/dist/features/network-modifications/battery/modification/batteryModification.utils.js +2 -1
- package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-form.js +2 -1
- package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-utils.js +2 -2
- package/dist/features/network-modifications/by-filter/formula/formula/formula-utils.js +5 -5
- package/dist/features/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -1
- package/dist/features/network-modifications/common/connectivity/connectivityForm.utils.js +2 -1
- package/dist/features/network-modifications/common/currentLimits/limitsPane.utils.js +2 -1
- package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +2 -1
- package/dist/features/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +3 -2
- package/dist/features/network-modifications/common/voltageRegulation/voltageRegulation.utils.js +3 -2
- package/dist/features/network-modifications/generator/creation/generatorCreation.utils.js +4 -3
- package/dist/features/network-modifications/generator/modification/generatorModification.utils.js +5 -4
- package/dist/features/network-modifications/line/characteristics/lineCharacteristicsPane.utils.js +7 -6
- package/dist/features/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +7 -6
- package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +10 -9
- package/dist/features/network-modifications/voltageLevel/modification/voltageLevelModification.utils.js +6 -5
- package/dist/features/parameters/common/limitreductions/columns-definitions.js +3 -2
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +2 -2
- package/dist/features/parameters/security-analysis/columns-definitions.js +4 -3
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +3 -3
- package/dist/hooks/use-unique-name-validation.js +3 -2
- package/dist/index.js +27 -1
- package/dist/translations/en/descriptionEn.d.ts +0 -6
- package/dist/translations/en/descriptionEn.js +6 -1
- package/dist/translations/en/filterEn.d.ts +0 -2
- package/dist/translations/en/filterEn.js +0 -2
- package/dist/translations/en/generic-validationEn.d.ts +23 -0
- package/dist/translations/en/generic-validationEn.js +25 -0
- package/dist/translations/en/index.d.ts +2 -0
- package/dist/translations/en/index.js +4 -0
- package/dist/translations/en/network-modification-validationEn.d.ts +23 -0
- package/dist/translations/en/network-modification-validationEn.js +31 -0
- package/dist/translations/en/networkModificationsEn.d.ts +6 -33
- package/dist/translations/en/networkModificationsEn.js +0 -38
- package/dist/translations/en/parameters.d.ts +0 -2
- package/dist/translations/en/parameters.js +0 -2
- package/dist/translations/en/use-unique-name-validation-en.d.ts +0 -2
- package/dist/translations/en/use-unique-name-validation-en.js +1 -3
- package/dist/translations/fr/descriptionFr.d.ts +0 -6
- package/dist/translations/fr/descriptionFr.js +6 -1
- package/dist/translations/fr/filterFr.d.ts +0 -2
- package/dist/translations/fr/filterFr.js +0 -2
- package/dist/translations/fr/generic-validationFr.d.ts +17 -0
- package/dist/translations/fr/generic-validationFr.js +25 -0
- package/dist/translations/fr/index.d.ts +2 -0
- package/dist/translations/fr/index.js +4 -0
- package/dist/translations/fr/network-modification-validationFr.d.ts +23 -0
- package/dist/translations/fr/network-modification-validationFr.js +31 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +6 -33
- package/dist/translations/fr/networkModificationsFr.js +0 -38
- package/dist/translations/fr/parameters.d.ts +0 -2
- package/dist/translations/fr/parameters.js +0 -2
- package/dist/translations/fr/use-unique-name-validation-fr.d.ts +0 -2
- package/dist/translations/fr/use-unique-name-validation-fr.js +1 -3
- package/dist/utils/constants/index.js +19 -1
- package/dist/utils/constants/translationKeys.d.ts +18 -0
- package/dist/utils/constants/translationKeys.js +36 -0
- package/dist/utils/index.js +19 -1
- package/package.json +1 -1
|
@@ -14,8 +14,12 @@ import { FilterType } from "./constants/FilterConstants.js";
|
|
|
14
14
|
import { MAX_CHAR_DESCRIPTION } from "../../../utils/constants/uiConstants.js";
|
|
15
15
|
import { EXPERT_FILTER_QUERY } from "./expert/expertFilterConstants.js";
|
|
16
16
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./explicitNaming/ExplicitNamingFilterConstants.js";
|
|
17
|
+
import { DESCRIPTION_LIMIT_ERROR, NAME_EMPTY } from "../../../utils/constants/translationKeys.js";
|
|
18
|
+
import "../../../utils/conversionUtils.js";
|
|
17
19
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
18
20
|
import { isDisabledValidationButton } from "../../../utils/form-utils.js";
|
|
21
|
+
import "../../../utils/types/equipmentType.js";
|
|
22
|
+
import "@mui/icons-material";
|
|
19
23
|
const emptyFormData = {
|
|
20
24
|
[FieldConstants.NAME]: "",
|
|
21
25
|
[FieldConstants.DESCRIPTION]: "",
|
|
@@ -24,8 +28,8 @@ const emptyFormData = {
|
|
|
24
28
|
...getExpertFilterEmptyFormData()
|
|
25
29
|
};
|
|
26
30
|
const formSchemaByFilterType = (filterType) => yup.object().shape({
|
|
27
|
-
[FieldConstants.NAME]: yup.string().trim().required(
|
|
28
|
-
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION,
|
|
31
|
+
[FieldConstants.NAME]: yup.string().trim().required(NAME_EMPTY),
|
|
32
|
+
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION, DESCRIPTION_LIMIT_ERROR),
|
|
29
33
|
[FieldConstants.EQUIPMENT_TYPE]: yup.string().required(),
|
|
30
34
|
...filterType?.id === FilterType.EXPLICIT_NAMING.id ? explicitNamingFilterSchema : {},
|
|
31
35
|
...filterType?.id === FilterType.EXPERT.id ? expertFilterSchema : {}
|
|
@@ -3,6 +3,7 @@ import { Grid2 } from "@mui/material";
|
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
5
5
|
import { MAX_CHAR_DESCRIPTION } from "../../../utils/constants/uiConstants.js";
|
|
6
|
+
import { DESCRIPTION_LIMIT_ERROR, NAME_EMPTY } from "../../../utils/constants/translationKeys.js";
|
|
6
7
|
import "../../../utils/conversionUtils.js";
|
|
7
8
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
8
9
|
import "../../../utils/types/equipmentType.js";
|
|
@@ -45,9 +46,9 @@ const filterStyles = {
|
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
const HeaderFilterSchema = {
|
|
48
|
-
[FieldConstants.NAME]: yup.string().trim().required(
|
|
49
|
+
[FieldConstants.NAME]: yup.string().trim().required(NAME_EMPTY),
|
|
49
50
|
[FieldConstants.EQUIPMENT_TYPE]: yup.string().required(),
|
|
50
|
-
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION,
|
|
51
|
+
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION, DESCRIPTION_LIMIT_ERROR)
|
|
51
52
|
};
|
|
52
53
|
function HeaderFilterForm({ creation, activeDirectory }) {
|
|
53
54
|
return /* @__PURE__ */ jsxs(Grid2, { container: true, spacing: 2, children: [
|
package/dist/components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js
CHANGED
|
@@ -10,8 +10,9 @@ import { CustomMuiDialog } from "../customMuiDialog/CustomMuiDialog.js";
|
|
|
10
10
|
import { ExpandingTextField } from "../../reactHookForm/text/ExpandingTextField.js";
|
|
11
11
|
import { MAX_CHAR_DESCRIPTION } from "../../../../utils/constants/uiConstants.js";
|
|
12
12
|
import { snackWithFallback } from "../../../../utils/error.js";
|
|
13
|
+
import { DESCRIPTION_LIMIT_ERROR } from "../../../../utils/constants/translationKeys.js";
|
|
13
14
|
const schema = yup.object().shape({
|
|
14
|
-
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION,
|
|
15
|
+
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION, DESCRIPTION_LIMIT_ERROR)
|
|
15
16
|
});
|
|
16
17
|
function DescriptionModificationDialog({
|
|
17
18
|
description,
|
|
@@ -8,6 +8,7 @@ import * as yup from "yup";
|
|
|
8
8
|
import "../../overflowableText/OverflowableText.js";
|
|
9
9
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
10
10
|
import { MAX_CHAR_DESCRIPTION } from "../../../../utils/constants/uiConstants.js";
|
|
11
|
+
import { DESCRIPTION_LIMIT_ERROR } from "../../../../utils/constants/translationKeys.js";
|
|
11
12
|
import "../../../../utils/conversionUtils.js";
|
|
12
13
|
import { ElementType } from "../../../../utils/types/elementType.js";
|
|
13
14
|
import "../../../../utils/types/equipmentType.js";
|
|
@@ -39,7 +40,7 @@ var OperationType = /* @__PURE__ */ ((OperationType2) => {
|
|
|
39
40
|
})(OperationType || {});
|
|
40
41
|
const schema = yup.object().shape({
|
|
41
42
|
[FieldConstants.NAME]: yup.string().trim().required(),
|
|
42
|
-
[FieldConstants.DESCRIPTION]: yup.string().optional().max(MAX_CHAR_DESCRIPTION,
|
|
43
|
+
[FieldConstants.DESCRIPTION]: yup.string().optional().max(MAX_CHAR_DESCRIPTION, DESCRIPTION_LIMIT_ERROR),
|
|
43
44
|
[FieldConstants.OPERATION_TYPE]: yup.string().oneOf(Object.values(OperationType)).required()
|
|
44
45
|
}).required();
|
|
45
46
|
const emptyFormData = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { object, number, string } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { ACTIVE_LIMITS_MIN_MAX_INVALID } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../utils/conversionUtils.js";
|
|
4
5
|
import { UNDEFINED_CONNECTION_DIRECTION } from "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
@@ -74,14 +75,14 @@ import "../../common/currentLimits/limitsPane.utils.js";
|
|
|
74
75
|
const batteryCreationFormSchema = object().shape({
|
|
75
76
|
[FieldConstants.EQUIPMENT_ID]: string().required(),
|
|
76
77
|
[FieldConstants.EQUIPMENT_NAME]: string().nullable(),
|
|
77
|
-
[FieldConstants.MAXIMUM_ACTIVE_POWER]: number().nullable().required().test("max-greater-than-min",
|
|
78
|
+
[FieldConstants.MAXIMUM_ACTIVE_POWER]: number().nullable().required().test("max-greater-than-min", ACTIVE_LIMITS_MIN_MAX_INVALID, function checkMaxGreaterThanMin(value) {
|
|
78
79
|
const min = this.parent[FieldConstants.MINIMUM_ACTIVE_POWER];
|
|
79
80
|
if (value != null && min != null) {
|
|
80
81
|
return value >= min;
|
|
81
82
|
}
|
|
82
83
|
return true;
|
|
83
84
|
}),
|
|
84
|
-
[FieldConstants.MINIMUM_ACTIVE_POWER]: number().nullable().required().test("min-less-than-max",
|
|
85
|
+
[FieldConstants.MINIMUM_ACTIVE_POWER]: number().nullable().required().test("min-less-than-max", ACTIVE_LIMITS_MIN_MAX_INVALID, function checkMinLessThanMax(value) {
|
|
85
86
|
const max = this.parent[FieldConstants.MAXIMUM_ACTIVE_POWER];
|
|
86
87
|
if (value != null && max != null) {
|
|
87
88
|
return value <= max;
|
package/dist/features/network-modifications/battery/modification/batteryModification.utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { object, number, ref, string } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { MIN_ACTIVE_POWER_MUST_BE_LESS_OR_EQUAL_TO_MAX_ACTIVE_POWER } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import { toModificationOperation } from "../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
@@ -80,7 +81,7 @@ const batteryModificationFormSchema = object().shape({
|
|
|
80
81
|
is: (maximumActivePower) => maximumActivePower != null,
|
|
81
82
|
then: (schema) => schema.max(
|
|
82
83
|
ref(FieldConstants.MAXIMUM_ACTIVE_POWER),
|
|
83
|
-
|
|
84
|
+
MIN_ACTIVE_POWER_MUST_BE_LESS_OR_EQUAL_TO_MAX_ACTIVE_POWER
|
|
84
85
|
)
|
|
85
86
|
}),
|
|
86
87
|
[FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(true),
|
package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-form.js
CHANGED
|
@@ -4,6 +4,7 @@ import { DensityLarge } from "@mui/icons-material";
|
|
|
4
4
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
7
|
+
import { NUMERIC_VALUE_OR_EMPTY_FIELD } from "../../../../../utils/constants/translationKeys.js";
|
|
7
8
|
import "../../../../../utils/conversionUtils.js";
|
|
8
9
|
import { ElementType } from "../../../../../utils/types/elementType.js";
|
|
9
10
|
import "../../../../../utils/types/equipmentType.js";
|
|
@@ -117,7 +118,7 @@ function AssignmentForm(props) {
|
|
|
117
118
|
const optionValue = getIdOrValue(option);
|
|
118
119
|
if (optionValue && optionValue !== emptyFieldLabel && optionValue !== EMPTY_FIELD_VALUE && Number.isNaN(Number(optionValue))) {
|
|
119
120
|
setError(`${name}.${index}.${FieldConstants.VALUE}`, {
|
|
120
|
-
message:
|
|
121
|
+
message: NUMERIC_VALUE_OR_EMPTY_FIELD
|
|
121
122
|
});
|
|
122
123
|
} else {
|
|
123
124
|
setError(`${name}.${index}.${FieldConstants.VALUE}`, {
|
package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
3
|
-
import { YUP_REQUIRED } from "../../../../../utils/constants/translationKeys.js";
|
|
3
|
+
import { YUP_REQUIRED, NUMERIC_VALUE_OR_EMPTY_FIELD } from "../../../../../utils/constants/translationKeys.js";
|
|
4
4
|
import "../../../../../utils/conversionUtils.js";
|
|
5
5
|
import "../../../../../utils/types/equipmentType.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
@@ -21,7 +21,7 @@ function getValueSchema(emptyValueStr, dataType, settable_to_none) {
|
|
|
21
21
|
let schema;
|
|
22
22
|
switch (dataType) {
|
|
23
23
|
case DataType.DOUBLE:
|
|
24
|
-
schema = settable_to_none ? yup.string().test("is-number-or-none",
|
|
24
|
+
schema = settable_to_none ? yup.string().test("is-number-or-none", NUMERIC_VALUE_OR_EMPTY_FIELD, (value) => {
|
|
25
25
|
return value === emptyValueStr || !Number.isNaN(Number(value));
|
|
26
26
|
}) : yup.number();
|
|
27
27
|
break;
|
|
@@ -2,7 +2,7 @@ import * as yup from "yup";
|
|
|
2
2
|
import { OHM, MICRO_SIEMENS, KILO_VOLT, MEGA_VOLT_AMPERE, MEGA_WATT, MEGA_VAR, KILO_AMPERE, SIEMENS, PERCENTAGE } from "../../../../../utils/constants/unitsConstants.js";
|
|
3
3
|
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
4
4
|
import { FILTERS } from "../../../../../utils/constants/filterConstant.js";
|
|
5
|
-
import { YUP_REQUIRED } from "../../../../../utils/constants/translationKeys.js";
|
|
5
|
+
import { WRONG_REF_OR_VALUE_ERROR, VALUE_MUST_BE_REF_WHEN_PERCENTAGE_ERROR, VALUE_MUST_BE_NUMERIC_WHEN_PERCENTAGE_ERROR, YUP_REQUIRED } from "../../../../../utils/constants/translationKeys.js";
|
|
6
6
|
import "../../../../../utils/conversionUtils.js";
|
|
7
7
|
import { EquipmentType } from "../../../../../utils/types/equipmentType.js";
|
|
8
8
|
import "react/jsx-runtime";
|
|
@@ -138,19 +138,19 @@ function getFormulaSchema() {
|
|
|
138
138
|
).required().min(1, YUP_REQUIRED),
|
|
139
139
|
[FieldConstants.EDITED_FIELD]: yup.string().required(),
|
|
140
140
|
[OPERATOR]: yup.string().required(),
|
|
141
|
-
[REFERENCE_FIELD_OR_VALUE_1]: yup.mixed().required().test("checkRefOrValue",
|
|
141
|
+
[REFERENCE_FIELD_OR_VALUE_1]: yup.mixed().required().test("checkRefOrValue", WRONG_REF_OR_VALUE_ERROR, checkValueInEquipmentFieldsOrNumeric).when([OPERATOR], {
|
|
142
142
|
is: "PERCENTAGE",
|
|
143
143
|
then: (schema) => schema.test(
|
|
144
144
|
"checkValueIsReference",
|
|
145
|
-
|
|
145
|
+
VALUE_MUST_BE_NUMERIC_WHEN_PERCENTAGE_ERROR,
|
|
146
146
|
(value) => !Number.isNaN(Number.parseFloat(value)) && Number.parseFloat(value) >= 0
|
|
147
147
|
)
|
|
148
148
|
}),
|
|
149
|
-
[REFERENCE_FIELD_OR_VALUE_2]: yup.mixed().required().test("checkRefOrValue",
|
|
149
|
+
[REFERENCE_FIELD_OR_VALUE_2]: yup.mixed().required().test("checkRefOrValue", WRONG_REF_OR_VALUE_ERROR, checkValueInEquipmentFieldsOrNumeric).when([OPERATOR], {
|
|
150
150
|
is: "PERCENTAGE",
|
|
151
151
|
then: (schema) => schema.test(
|
|
152
152
|
"checkValueIsReference",
|
|
153
|
-
|
|
153
|
+
VALUE_MUST_BE_REF_WHEN_PERCENTAGE_ERROR,
|
|
154
154
|
checkValueInEquipmentFields
|
|
155
155
|
)
|
|
156
156
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { number, bool } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { NORMALIZED_PERCENTAGE } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import "react/jsx-runtime";
|
|
@@ -13,7 +14,7 @@ const getActivePowerControlSchema = (isEquipmentModification = false) => ({
|
|
|
13
14
|
is: () => !isEquipmentModification,
|
|
14
15
|
then: (schema) => schema.required()
|
|
15
16
|
}),
|
|
16
|
-
[FieldConstants.DROOP]: number().nullable().min(0,
|
|
17
|
+
[FieldConstants.DROOP]: number().nullable().min(0, NORMALIZED_PERCENTAGE).max(100, NORMALIZED_PERCENTAGE).when([FieldConstants.FREQUENCY_REGULATION], {
|
|
17
18
|
is: (frequencyRegulation) => !isEquipmentModification && frequencyRegulation,
|
|
18
19
|
then: (schema) => schema.required()
|
|
19
20
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { object, bool, number, string } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import "react/jsx-runtime";
|
|
@@ -13,7 +14,7 @@ const getVoltageLevelAndBusOrBusBarSectionFieldsSchema = (isEquipmentModificatio
|
|
|
13
14
|
is: () => isEquipmentModification,
|
|
14
15
|
then: (schema) => schema.nullable()
|
|
15
16
|
})
|
|
16
|
-
}).test("YupRequired",
|
|
17
|
+
}).test("YupRequired", YUP_REQUIRED, (value, context) => {
|
|
17
18
|
const isEmpty = value?.[FieldConstants.ID] === null || value?.[FieldConstants.ID] === void 0 || value?.[FieldConstants.ID] === "";
|
|
18
19
|
const isEmptyRelatedField = context.parent?.[relatedFieldName] === null || context.parent?.[relatedFieldName]?.[FieldConstants.ID] === "" || context.parent?.[relatedFieldName]?.[FieldConstants.ID] === void 0;
|
|
19
20
|
return !(isEmpty && !isEmptyRelatedField);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { object, array, boolean, string, number } from "yup";
|
|
2
2
|
import { OPERATIONAL_LIMITS_GROUPS_MODIFICATION_TYPE } from "./operationalLimitsGroups/operationalLimitsGroups.types.js";
|
|
3
3
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
4
|
+
import { MUST_BE_GREATER_OR_EQUAL_TO_ZERO } from "../../../../utils/constants/translationKeys.js";
|
|
4
5
|
import { toModificationOperation } from "../../../../utils/conversionUtils.js";
|
|
5
6
|
import "../../../../utils/types/equipmentType.js";
|
|
6
7
|
import { OperationType } from "../../../../utils/types/network-modification-types.js";
|
|
@@ -69,7 +70,7 @@ function hasDuplicate(field, context) {
|
|
|
69
70
|
const temporaryLimitsValidationSchema = () => {
|
|
70
71
|
return object().shape(
|
|
71
72
|
{
|
|
72
|
-
[FieldConstants.TEMPORARY_LIMIT_DURATION]: number().nullable().min(0,
|
|
73
|
+
[FieldConstants.TEMPORARY_LIMIT_DURATION]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).when([FieldConstants.TEMPORARY_LIMIT_VALUE, FieldConstants.TEMPORARY_LIMIT_NAME], {
|
|
73
74
|
is: (value, name) => value != null || !!name,
|
|
74
75
|
then: (schema) => schema.required()
|
|
75
76
|
}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { array, object, number, ref, ValidationError } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { YUP_REQUIRED } from "../../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../../utils/types/equipmentType.js";
|
|
5
6
|
import "react/jsx-runtime";
|
|
@@ -58,7 +59,7 @@ function ifOneFieldThenAllFields(values, context) {
|
|
|
58
59
|
errors.push(
|
|
59
60
|
context.createError({
|
|
60
61
|
path: `${FieldConstants.REACTIVE_LIMITS}.${FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE}[${index}].${field}`,
|
|
61
|
-
message:
|
|
62
|
+
message: YUP_REQUIRED
|
|
62
63
|
})
|
|
63
64
|
);
|
|
64
65
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { object, number, string } from "yup";
|
|
2
2
|
import { getReactiveCapabilityCurveValidationSchemaArray, getRowEmptyFormData } from "./reactiveCapabilityCurve/reactiveCapability.utils.js";
|
|
3
3
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
4
|
+
import { REACTIVE_LIMITS_MIN_MAX_INVALID } from "../../../../utils/constants/translationKeys.js";
|
|
4
5
|
import "../../../../utils/conversionUtils.js";
|
|
5
6
|
import "../../../../utils/types/equipmentType.js";
|
|
6
7
|
import "react/jsx-runtime";
|
|
@@ -58,7 +59,7 @@ const getReactiveLimitsValidationSchema = (isEquipmentModification = false, posi
|
|
|
58
59
|
}
|
|
59
60
|
return true;
|
|
60
61
|
}
|
|
61
|
-
).test("min-less-than-max",
|
|
62
|
+
).test("min-less-than-max", REACTIVE_LIMITS_MIN_MAX_INVALID, function checkMinLessThanMax(value) {
|
|
62
63
|
const { reactiveCapabilityCurveChoice, maximumReactivePower } = this.parent;
|
|
63
64
|
if (reactiveCapabilityCurveChoice === "MINMAX" && value != null && maximumReactivePower != null) {
|
|
64
65
|
return value <= maximumReactivePower;
|
|
@@ -75,7 +76,7 @@ const getReactiveLimitsValidationSchema = (isEquipmentModification = false, posi
|
|
|
75
76
|
}
|
|
76
77
|
return true;
|
|
77
78
|
}
|
|
78
|
-
).test("max-greater-than-min",
|
|
79
|
+
).test("max-greater-than-min", REACTIVE_LIMITS_MIN_MAX_INVALID, function checkMaxGreaterThanMin(value) {
|
|
79
80
|
const { reactiveCapabilityCurveChoice, minimumReactivePower } = this.parent;
|
|
80
81
|
if (reactiveCapabilityCurveChoice === "MINMAX" && value != null && minimumReactivePower != null) {
|
|
81
82
|
return value >= minimumReactivePower;
|
package/dist/features/network-modifications/common/voltageRegulation/voltageRegulation.utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { object, string, number, bool } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { NORMALIZED_PERCENTAGE, MUST_BE_GREATER_OR_EQUAL_TO_ZERO } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import "react/jsx-runtime";
|
|
@@ -23,11 +24,11 @@ const getVoltageRegulationSchema = (isEquipmentModification = false) => ({
|
|
|
23
24
|
then: (schema) => schema.required()
|
|
24
25
|
}),
|
|
25
26
|
[FieldConstants.VOLTAGE_REGULATION_TYPE]: string().nullable(),
|
|
26
|
-
[FieldConstants.VOLTAGE_SET_POINT]: number().nullable().min(0,
|
|
27
|
+
[FieldConstants.VOLTAGE_SET_POINT]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).when([FieldConstants.VOLTAGE_REGULATION], {
|
|
27
28
|
is: (value) => !isEquipmentModification && value,
|
|
28
29
|
then: (schema) => schema.required()
|
|
29
30
|
}),
|
|
30
|
-
[FieldConstants.Q_PERCENT]: number().nullable().max(100,
|
|
31
|
+
[FieldConstants.Q_PERCENT]: number().nullable().max(100, NORMALIZED_PERCENTAGE).min(0, NORMALIZED_PERCENTAGE),
|
|
31
32
|
[FieldConstants.VOLTAGE_LEVEL]: object().nullable().shape({
|
|
32
33
|
[FieldConstants.ID]: string(),
|
|
33
34
|
[FieldConstants.NAME]: string(),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { object, number, ref, string } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { REAL_PERCENTAGE, MUST_BE_GREATER_OR_EQUAL_TO_ZERO } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../utils/conversionUtils.js";
|
|
4
5
|
import { UNDEFINED_CONNECTION_DIRECTION } from "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
@@ -78,7 +79,7 @@ const generatorCreationFormSchema = object().shape({
|
|
|
78
79
|
[FieldConstants.ENERGY_SOURCE]: string().nullable().required(),
|
|
79
80
|
[FieldConstants.MAXIMUM_ACTIVE_POWER]: number().nullable().required(),
|
|
80
81
|
[FieldConstants.MINIMUM_ACTIVE_POWER]: number().nullable().max(ref(FieldConstants.MAXIMUM_ACTIVE_POWER), "generatorMinimumActivePowerMaxValueError").required(),
|
|
81
|
-
[FieldConstants.RATED_NOMINAL_POWER]: number().nullable().min(0,
|
|
82
|
+
[FieldConstants.RATED_NOMINAL_POWER]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO),
|
|
82
83
|
...getShortCircuitFormSchema(),
|
|
83
84
|
[FieldConstants.PLANNED_ACTIVE_POWER_SET_POINT]: number().nullable().default(null).test(
|
|
84
85
|
"activePowerSetPoint",
|
|
@@ -86,8 +87,8 @@ const generatorCreationFormSchema = object().shape({
|
|
|
86
87
|
testValueWithinPowerInterval
|
|
87
88
|
),
|
|
88
89
|
[FieldConstants.MARGINAL_COST]: number().nullable(),
|
|
89
|
-
[FieldConstants.PLANNED_OUTAGE_RATE]: number().nullable().min(0,
|
|
90
|
-
[FieldConstants.FORCED_OUTAGE_RATE]: number().nullable().min(0,
|
|
90
|
+
[FieldConstants.PLANNED_OUTAGE_RATE]: number().nullable().min(0, REAL_PERCENTAGE).max(1, REAL_PERCENTAGE),
|
|
91
|
+
[FieldConstants.FORCED_OUTAGE_RATE]: number().nullable().min(0, REAL_PERCENTAGE).max(1, REAL_PERCENTAGE),
|
|
91
92
|
[FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(),
|
|
92
93
|
...getSetPointsSchema(),
|
|
93
94
|
[FieldConstants.REACTIVE_LIMITS]: getReactiveLimitsValidationSchema(),
|
package/dist/features/network-modifications/generator/modification/generatorModification.utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { object, number, ref, string } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { REAL_PERCENTAGE, MUST_BE_GREATER_OR_EQUAL_TO_ZERO, MIN_ACTIVE_POWER_MUST_BE_LESS_OR_EQUAL_TO_MAX_ACTIVE_POWER } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import { toModificationOperation } from "../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
@@ -82,15 +83,15 @@ const generatorModificationFormSchema = object().shape({
|
|
|
82
83
|
is: (maximumActivePower) => maximumActivePower != null,
|
|
83
84
|
then: (schema) => schema.max(
|
|
84
85
|
ref(FieldConstants.MAXIMUM_ACTIVE_POWER),
|
|
85
|
-
|
|
86
|
+
MIN_ACTIVE_POWER_MUST_BE_LESS_OR_EQUAL_TO_MAX_ACTIVE_POWER
|
|
86
87
|
)
|
|
87
88
|
}),
|
|
88
|
-
[FieldConstants.RATED_NOMINAL_POWER]: number().nullable().min(0,
|
|
89
|
+
[FieldConstants.RATED_NOMINAL_POWER]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO),
|
|
89
90
|
...getShortCircuitFormSchema(),
|
|
90
91
|
[FieldConstants.PLANNED_ACTIVE_POWER_SET_POINT]: number().nullable(),
|
|
91
92
|
[FieldConstants.MARGINAL_COST]: number().nullable(),
|
|
92
|
-
[FieldConstants.PLANNED_OUTAGE_RATE]: number().nullable().min(0,
|
|
93
|
-
[FieldConstants.FORCED_OUTAGE_RATE]: number().nullable().min(0,
|
|
93
|
+
[FieldConstants.PLANNED_OUTAGE_RATE]: number().nullable().min(0, REAL_PERCENTAGE).max(1, REAL_PERCENTAGE),
|
|
94
|
+
[FieldConstants.FORCED_OUTAGE_RATE]: number().nullable().min(0, REAL_PERCENTAGE).max(1, REAL_PERCENTAGE),
|
|
94
95
|
[FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(true),
|
|
95
96
|
[FieldConstants.REACTIVE_LIMITS]: getReactiveLimitsValidationSchema(true),
|
|
96
97
|
...getSetPointsSchema(true),
|
package/dist/features/network-modifications/line/characteristics/lineCharacteristicsPane.utils.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { object, number } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { MUST_BE_GREATER_OR_EQUAL_TO_ZERO } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import "react/jsx-runtime";
|
|
6
7
|
import "@mui/icons-material";
|
|
7
8
|
const getLineCharacteristicsValidationSchemaProps = (isEquipmentModification = false) => object().shape({
|
|
8
|
-
[FieldConstants.R]: isEquipmentModification ? number().nullable().min(0,
|
|
9
|
+
[FieldConstants.R]: isEquipmentModification ? number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO) : number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).required(),
|
|
9
10
|
[FieldConstants.X]: isEquipmentModification ? number().nullable() : number().nullable().required(),
|
|
10
11
|
[FieldConstants.B1]: number().nullable(),
|
|
11
|
-
[FieldConstants.G1]: number().nullable().min(0,
|
|
12
|
+
[FieldConstants.G1]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO),
|
|
12
13
|
[FieldConstants.B2]: number().nullable(),
|
|
13
|
-
[FieldConstants.G2]: number().nullable().min(0,
|
|
14
|
+
[FieldConstants.G2]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO)
|
|
14
15
|
});
|
|
15
16
|
const characteristicsValidationSchema = (id, modification) => ({
|
|
16
17
|
[id]: object().shape({
|
|
17
|
-
[FieldConstants.R]: modification ? number().nullable().min(0,
|
|
18
|
+
[FieldConstants.R]: modification ? number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO) : number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).required(),
|
|
18
19
|
[FieldConstants.X]: modification ? number().nullable() : number().nullable().required(),
|
|
19
20
|
[FieldConstants.B1]: number().nullable(),
|
|
20
|
-
[FieldConstants.G1]: number().nullable().min(0,
|
|
21
|
+
[FieldConstants.G1]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO),
|
|
21
22
|
[FieldConstants.B2]: number().nullable(),
|
|
22
|
-
[FieldConstants.G2]: number().nullable().min(0,
|
|
23
|
+
[FieldConstants.G2]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO)
|
|
23
24
|
})
|
|
24
25
|
});
|
|
25
26
|
const getCharacteristicsValidationSchema = (id, modification = false) => {
|
package/dist/features/network-modifications/shunt-compensator/common/characteristicsForm.utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { string, number, ref } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { SECTION_COUNT_MUST_BE_BETWEEN_ZERO_AND_MAXIMUM_SECTION_COUNT, MAXIMUM_SECTION_COUNT_MUST_BE_GREATER_OR_EQUAL_TO_ONE, SHUNT_COMPENSATOR_ERROR_Q_AT_NOMINAL_VOLTAGE_LESS_THAN_ZERO } from "../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../utils/types/equipmentType.js";
|
|
5
6
|
import "react/jsx-runtime";
|
|
@@ -8,22 +9,22 @@ import { SHUNT_COMPENSATOR_TYPES, CHARACTERISTICS_CHOICES, computeSwitchedOnValu
|
|
|
8
9
|
const getCharacteristicsCreateFormValidationSchema = () => ({
|
|
9
10
|
[FieldConstants.MAX_Q_AT_NOMINAL_V]: number().nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
|
|
10
11
|
is: (characteristicsChoice) => characteristicsChoice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id,
|
|
11
|
-
then: (schema) => schema.min(0,
|
|
12
|
+
then: (schema) => schema.min(0, SHUNT_COMPENSATOR_ERROR_Q_AT_NOMINAL_VOLTAGE_LESS_THAN_ZERO).required()
|
|
12
13
|
}),
|
|
13
14
|
[FieldConstants.MAX_SUSCEPTANCE]: number().nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
|
|
14
15
|
is: (characteristicsChoice) => characteristicsChoice === CHARACTERISTICS_CHOICES.SUSCEPTANCE.id,
|
|
15
16
|
then: (schema) => schema.required()
|
|
16
17
|
}),
|
|
17
|
-
[FieldConstants.MAXIMUM_SECTION_COUNT]: number().required().min(1,
|
|
18
|
-
[FieldConstants.SECTION_COUNT]: number().required().min(0,
|
|
18
|
+
[FieldConstants.MAXIMUM_SECTION_COUNT]: number().required().min(1, MAXIMUM_SECTION_COUNT_MUST_BE_GREATER_OR_EQUAL_TO_ONE),
|
|
19
|
+
[FieldConstants.SECTION_COUNT]: number().required().min(0, SECTION_COUNT_MUST_BE_BETWEEN_ZERO_AND_MAXIMUM_SECTION_COUNT).max(ref(FieldConstants.MAXIMUM_SECTION_COUNT), SECTION_COUNT_MUST_BE_BETWEEN_ZERO_AND_MAXIMUM_SECTION_COUNT),
|
|
19
20
|
[FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: number().notRequired(),
|
|
20
21
|
[FieldConstants.SWITCHED_ON_SUSCEPTANCE]: number().notRequired()
|
|
21
22
|
});
|
|
22
23
|
const getCharacteristicsModificationFormValidationSchema = () => ({
|
|
23
|
-
[FieldConstants.MAX_Q_AT_NOMINAL_V]: number().min(0,
|
|
24
|
+
[FieldConstants.MAX_Q_AT_NOMINAL_V]: number().min(0, SHUNT_COMPENSATOR_ERROR_Q_AT_NOMINAL_VOLTAGE_LESS_THAN_ZERO).nullable().default(null),
|
|
24
25
|
[FieldConstants.MAX_SUSCEPTANCE]: number().nullable().default(null),
|
|
25
|
-
[FieldConstants.MAXIMUM_SECTION_COUNT]: number().min(1,
|
|
26
|
-
[FieldConstants.SECTION_COUNT]: number().min(0,
|
|
26
|
+
[FieldConstants.MAXIMUM_SECTION_COUNT]: number().min(1, MAXIMUM_SECTION_COUNT_MUST_BE_GREATER_OR_EQUAL_TO_ONE).nullable().default(null),
|
|
27
|
+
[FieldConstants.SECTION_COUNT]: number().min(0, SECTION_COUNT_MUST_BE_BETWEEN_ZERO_AND_MAXIMUM_SECTION_COUNT).nullable().default(null),
|
|
27
28
|
[FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: number().nullable(),
|
|
28
29
|
[FieldConstants.SWITCHED_ON_SUSCEPTANCE]: number().nullable()
|
|
29
30
|
});
|
package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { object, array, string, ref, number, boolean } from "yup";
|
|
2
2
|
import { creationPropertiesSchema, getPropertiesFromModification, emptyProperties, toModificationProperties } from "../../common/properties/propertyUtils.js";
|
|
3
3
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
4
|
+
import { SHORT_CIRCUIT_CURRENT_LIMIT_MUST_BE_GREATER_OR_EQUAL_TO_ZERO, MUST_BE_GREATER_OR_EQUAL_TO_ZERO, CREATE_SUBSTATION_IN_VOLTAGE_LEVEL_IDENTICAL_ID } from "../../../../utils/constants/translationKeys.js";
|
|
4
5
|
import { convertInputValue, convertOutputValue } from "../../../../utils/conversionUtils.js";
|
|
5
6
|
import "../../../../utils/types/equipmentType.js";
|
|
6
7
|
import { MODIFICATION_TYPES } from "../../../../utils/types/modificationType.js";
|
|
@@ -101,13 +102,13 @@ const voltageLevelCreationFormSchema = object().shape({
|
|
|
101
102
|
is: (addSubstationCreation) => !addSubstationCreation,
|
|
102
103
|
then: (schema) => schema.notOneOf(
|
|
103
104
|
[ref(FieldConstants.SUBSTATION_ID), null],
|
|
104
|
-
|
|
105
|
+
CREATE_SUBSTATION_IN_VOLTAGE_LEVEL_IDENTICAL_ID
|
|
105
106
|
)
|
|
106
107
|
}).when([FieldConstants.ADD_SUBSTATION_CREATION], {
|
|
107
108
|
is: (addSubstationCreation) => addSubstationCreation,
|
|
108
109
|
then: (schema) => schema.notOneOf(
|
|
109
110
|
[ref(FieldConstants.SUBSTATION_CREATION_ID), null],
|
|
110
|
-
|
|
111
|
+
CREATE_SUBSTATION_IN_VOLTAGE_LEVEL_IDENTICAL_ID
|
|
111
112
|
)
|
|
112
113
|
}),
|
|
113
114
|
[FieldConstants.EQUIPMENT_NAME]: string().nullable(),
|
|
@@ -116,14 +117,14 @@ const voltageLevelCreationFormSchema = object().shape({
|
|
|
116
117
|
is: (addSubstationCreation) => !addSubstationCreation,
|
|
117
118
|
then: (schema) => schema.required().notOneOf(
|
|
118
119
|
[ref(FieldConstants.EQUIPMENT_ID), null],
|
|
119
|
-
|
|
120
|
+
CREATE_SUBSTATION_IN_VOLTAGE_LEVEL_IDENTICAL_ID
|
|
120
121
|
)
|
|
121
122
|
}),
|
|
122
123
|
[FieldConstants.SUBSTATION_CREATION_ID]: string().nullable().when([FieldConstants.ADD_SUBSTATION_CREATION], {
|
|
123
124
|
is: (addSubstationCreation) => addSubstationCreation,
|
|
124
125
|
then: (schema) => schema.required().notOneOf(
|
|
125
126
|
[ref(FieldConstants.EQUIPMENT_ID), null],
|
|
126
|
-
|
|
127
|
+
CREATE_SUBSTATION_IN_VOLTAGE_LEVEL_IDENTICAL_ID
|
|
127
128
|
)
|
|
128
129
|
}),
|
|
129
130
|
[FieldConstants.SUBSTATION_NAME]: string().nullable(),
|
|
@@ -135,12 +136,12 @@ const voltageLevelCreationFormSchema = object().shape({
|
|
|
135
136
|
[FieldConstants.HIDE_NOMINAL_VOLTAGE]: boolean().required(),
|
|
136
137
|
[FieldConstants.NOMINAL_V]: number().nullable().when([FieldConstants.HIDE_NOMINAL_VOLTAGE], {
|
|
137
138
|
is: (hideNominalVoltage) => !hideNominalVoltage,
|
|
138
|
-
then: (schema) => schema.min(0,
|
|
139
|
+
then: (schema) => schema.min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).required()
|
|
139
140
|
}),
|
|
140
|
-
[FieldConstants.LOW_VOLTAGE_LIMIT]: number().nullable().min(0,
|
|
141
|
-
[FieldConstants.HIGH_VOLTAGE_LIMIT]: number().nullable().min(0,
|
|
142
|
-
[FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0,
|
|
143
|
-
[FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0,
|
|
141
|
+
[FieldConstants.LOW_VOLTAGE_LIMIT]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).max(ref(FieldConstants.HIGH_VOLTAGE_LIMIT), "voltageLevelNominalVoltageMaxValueError"),
|
|
142
|
+
[FieldConstants.HIGH_VOLTAGE_LIMIT]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO),
|
|
143
|
+
[FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, SHORT_CIRCUIT_CURRENT_LIMIT_MUST_BE_GREATER_OR_EQUAL_TO_ZERO).max(ref(FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT), "ShortCircuitCurrentLimitMinMaxError"),
|
|
144
|
+
[FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, SHORT_CIRCUIT_CURRENT_LIMIT_MUST_BE_GREATER_OR_EQUAL_TO_ZERO).when([FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT], {
|
|
144
145
|
is: (lowShortCircuitCurrentLimit) => lowShortCircuitCurrentLimit != null,
|
|
145
146
|
then: (schema) => schema.required()
|
|
146
147
|
}),
|
|
@@ -2,6 +2,7 @@ import { object, number, ref, string, boolean, array } from "yup";
|
|
|
2
2
|
import { modificationPropertiesSchema, getPropertiesFromModification, toModificationProperties } from "../../common/properties/propertyUtils.js";
|
|
3
3
|
import { convertInputValue, toModificationOperation, convertOutputValue } from "../../../../utils/conversionUtils.js";
|
|
4
4
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
5
|
+
import { SHORT_CIRCUIT_CURRENT_LIMIT_MUST_BE_GREATER_OR_EQUAL_TO_ZERO, MUST_BE_GREATER_OR_EQUAL_TO_ZERO } from "../../../../utils/constants/translationKeys.js";
|
|
5
6
|
import "../../../../utils/types/equipmentType.js";
|
|
6
7
|
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
7
8
|
import { FieldType } from "../../../../utils/types/fieldType.js";
|
|
@@ -13,20 +14,20 @@ const voltageLevelModificationFormSchema = object().shape({
|
|
|
13
14
|
[FieldConstants.EQUIPMENT_NAME]: string().nullable(),
|
|
14
15
|
[FieldConstants.HIDE_SUBSTATION_FIELD]: boolean().required(),
|
|
15
16
|
[FieldConstants.SUBSTATION_ID]: string().nullable(),
|
|
16
|
-
[FieldConstants.NOMINAL_V]: number().nullable().min(0,
|
|
17
|
-
[FieldConstants.LOW_VOLTAGE_LIMIT]: number().nullable().min(0,
|
|
17
|
+
[FieldConstants.NOMINAL_V]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO),
|
|
18
|
+
[FieldConstants.LOW_VOLTAGE_LIMIT]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).when([FieldConstants.HIGH_VOLTAGE_LIMIT], {
|
|
18
19
|
is: (highVoltageLimit) => highVoltageLimit != null,
|
|
19
20
|
then: (schema) => schema.max(ref(FieldConstants.HIGH_VOLTAGE_LIMIT), "voltageLevelNominalVoltageMaxValueError")
|
|
20
21
|
}),
|
|
21
|
-
[FieldConstants.HIGH_VOLTAGE_LIMIT]: number().nullable().min(0,
|
|
22
|
-
[FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0,
|
|
22
|
+
[FieldConstants.HIGH_VOLTAGE_LIMIT]: number().nullable().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO),
|
|
23
|
+
[FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, SHORT_CIRCUIT_CURRENT_LIMIT_MUST_BE_GREATER_OR_EQUAL_TO_ZERO).when([FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT], {
|
|
23
24
|
is: (highShortCircuitCurrentLimit) => highShortCircuitCurrentLimit != null,
|
|
24
25
|
then: (schema) => schema.max(
|
|
25
26
|
ref(FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT),
|
|
26
27
|
"ShortCircuitCurrentLimitMinMaxError"
|
|
27
28
|
)
|
|
28
29
|
}),
|
|
29
|
-
[FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0,
|
|
30
|
+
[FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, SHORT_CIRCUIT_CURRENT_LIMIT_MUST_BE_GREATER_OR_EQUAL_TO_ZERO)
|
|
30
31
|
}).concat(modificationPropertiesSchema);
|
|
31
32
|
const voltageLevelModificationEmptyFormData = {
|
|
32
33
|
equipmentID: "",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as yup from "yup";
|
|
2
|
+
import { REAL_PERCENTAGE } from "../../../../utils/constants/translationKeys.js";
|
|
2
3
|
const LIMIT_REDUCTIONS_FORM = "limitReductionsForm";
|
|
3
4
|
const VOLTAGE_LEVELS_FORM = "voltageLevelsForm";
|
|
4
5
|
const IST_FORM = "istForm";
|
|
@@ -18,7 +19,7 @@ const COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS = [
|
|
|
18
19
|
const getLimitDurationsFormSchema = (nbLimits) => {
|
|
19
20
|
const limitDurationsFormSchema = {};
|
|
20
21
|
for (let i = 0; i < nbLimits; i++) {
|
|
21
|
-
limitDurationsFormSchema[LIMIT_DURATION_FORM + i] = yup.number().min(0,
|
|
22
|
+
limitDurationsFormSchema[LIMIT_DURATION_FORM + i] = yup.number().min(0, REAL_PERCENTAGE).max(1, REAL_PERCENTAGE).nullable().required();
|
|
22
23
|
}
|
|
23
24
|
return limitDurationsFormSchema;
|
|
24
25
|
};
|
|
@@ -27,7 +28,7 @@ const getLimitReductionsFormSchema = (nbTemporaryLimits) => {
|
|
|
27
28
|
[LIMIT_REDUCTIONS_FORM]: yup.array().of(
|
|
28
29
|
yup.object().shape({
|
|
29
30
|
[VOLTAGE_LEVELS_FORM]: yup.string(),
|
|
30
|
-
[IST_FORM]: yup.number().min(0,
|
|
31
|
+
[IST_FORM]: yup.number().min(0, REAL_PERCENTAGE).max(1, REAL_PERCENTAGE).nullable().required(),
|
|
31
32
|
...getLimitDurationsFormSchema(nbTemporaryLimits)
|
|
32
33
|
})
|
|
33
34
|
)
|
|
@@ -5,7 +5,7 @@ import { Grid2 } from "@mui/material";
|
|
|
5
5
|
import * as yup from "yup";
|
|
6
6
|
import { LOADS_VARIATIONS, VARIATION, LOAD_FILTERS, LOAD_MODELS_RULE, ACCURACY, CALCULATION_TYPE } from "./constants.js";
|
|
7
7
|
import { ID } from "../../../utils/constants/filterConstant.js";
|
|
8
|
-
import { YUP_REQUIRED } from "../../../utils/constants/translationKeys.js";
|
|
8
|
+
import { MUST_BE_GREATER_OR_EQUAL_TO_ZERO, YUP_REQUIRED } from "../../../utils/constants/translationKeys.js";
|
|
9
9
|
import "../../../utils/conversionUtils.js";
|
|
10
10
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
11
11
|
import { EquipmentType } from "../../../utils/types/equipmentType.js";
|
|
@@ -54,7 +54,7 @@ const formSchema = yup.object().shape({
|
|
|
54
54
|
[NAME]: yup.string().nullable().notRequired()
|
|
55
55
|
})
|
|
56
56
|
).min(1, YUP_REQUIRED),
|
|
57
|
-
[VARIATION]: yup.number().min(0,
|
|
57
|
+
[VARIATION]: yup.number().min(0, MUST_BE_GREATER_OR_EQUAL_TO_ZERO).required(),
|
|
58
58
|
[ACTIVE]: yup.boolean().nullable().notRequired()
|
|
59
59
|
})
|
|
60
60
|
)
|
|
@@ -5,6 +5,7 @@ import "@mui/icons-material";
|
|
|
5
5
|
import "react";
|
|
6
6
|
import "react-intl";
|
|
7
7
|
import "../../../components/ui/overflowableText/OverflowableText.js";
|
|
8
|
+
import { NORMALIZED_PERCENTAGE } from "../../../utils/constants/translationKeys.js";
|
|
8
9
|
import "../../../utils/conversionUtils.js";
|
|
9
10
|
import "../../../utils/types/equipmentType.js";
|
|
10
11
|
import "react-hook-form";
|
|
@@ -48,10 +49,10 @@ const getSAParametersFormSchema = (name, limitReductions) => {
|
|
|
48
49
|
limitReductions?.length ? limitReductions[0].temporaryLimitReductions.length : 0
|
|
49
50
|
);
|
|
50
51
|
const thresholdsSchema = yup.object().shape({
|
|
51
|
-
[FLOW_PROPORTIONAL_THRESHOLD]: yup.number().min(0,
|
|
52
|
-
[LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: yup.number().min(0,
|
|
52
|
+
[FLOW_PROPORTIONAL_THRESHOLD]: yup.number().min(0, NORMALIZED_PERCENTAGE).max(100, NORMALIZED_PERCENTAGE).required(),
|
|
53
|
+
[LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: yup.number().min(0, NORMALIZED_PERCENTAGE).max(100, NORMALIZED_PERCENTAGE).required(),
|
|
53
54
|
[LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: yup.number().required(),
|
|
54
|
-
[HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: yup.number().min(0,
|
|
55
|
+
[HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: yup.number().min(0, NORMALIZED_PERCENTAGE).max(100, NORMALIZED_PERCENTAGE).required(),
|
|
55
56
|
[HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: yup.number().required()
|
|
56
57
|
});
|
|
57
58
|
return yup.object().shape({
|