@gridsuite/commons-ui 0.208.0 → 0.210.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/filter/utils/filterFormUtils.js +2 -1
- package/dist/components/index.js +33 -3
- package/dist/components/inputs/reactHookForm/booleans/RadioInput.js +2 -2
- package/dist/components/network-modification-table/renderers/name-cell.d.ts +2 -1
- package/dist/components/network-modification-table/renderers/name-cell.js +136 -19
- package/dist/components/network-modifications/battery/creation/BatteryCreationForm.d.ts +4 -0
- package/dist/components/network-modifications/battery/creation/BatteryCreationForm.js +105 -0
- package/dist/components/network-modifications/battery/creation/batteryCreation.types.d.ts +26 -0
- package/dist/components/network-modifications/battery/creation/batteryCreation.types.js +1 -0
- package/dist/components/network-modifications/battery/creation/batteryCreation.utils.d.ts +79 -0
- package/dist/components/network-modifications/battery/creation/batteryCreation.utils.js +145 -0
- package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.d.ts → battery/creation/index.d.ts} +3 -5
- package/dist/components/network-modifications/battery/creation/index.js +9 -0
- package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation → battery}/index.d.ts +1 -1
- package/dist/components/network-modifications/battery/index.js +9 -0
- package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -2
- package/dist/components/network-modifications/common/index.js +5 -2
- package/dist/components/network-modifications/common/reactiveLimits/index.js +5 -2
- package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/index.js +2 -1
- package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.d.ts +10 -1
- package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +30 -27
- package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.type.d.ts +3 -3
- package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.d.ts +33 -0
- package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +69 -35
- package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +1 -1
- package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.js +3 -3
- package/dist/components/network-modifications/index.d.ts +2 -0
- package/dist/components/network-modifications/index.js +33 -3
- package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.d.ts +6 -0
- package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.js +199 -0
- package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.d.ts +64 -0
- package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +90 -0
- package/dist/components/network-modifications/shunt-compensator/common/index.d.ts +10 -0
- package/dist/components/network-modifications/shunt-compensator/common/index.js +13 -0
- package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.d.ts +20 -0
- package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.js +1 -0
- package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.d.ts +27 -0
- package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.js +16 -0
- package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.d.ts +3 -0
- package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +82 -0
- package/dist/components/network-modifications/shunt-compensator/creation/index.d.ts +9 -0
- package/dist/components/network-modifications/shunt-compensator/creation/index.js +9 -0
- package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.d.ts +20 -0
- package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.js +1 -0
- package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.d.ts +110 -0
- package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +103 -0
- package/dist/components/network-modifications/shunt-compensator/index.d.ts +8 -0
- package/dist/components/network-modifications/shunt-compensator/index.js +20 -0
- package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
- package/dist/components/network-modifications/voltageLevel/creation/index.d.ts +1 -0
- package/dist/components/network-modifications/voltageLevel/creation/index.js +3 -1
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +6 -2
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +22 -43
- package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +1 -0
- package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +2 -0
- package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -1
- package/dist/components/network-modifications/voltageLevel/index.js +3 -1
- package/dist/index.js +33 -3
- package/dist/translations/en/networkModificationsEn.d.ts +24 -0
- package/dist/translations/en/networkModificationsEn.js +24 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +24 -0
- package/dist/translations/fr/networkModificationsFr.js +24 -0
- package/dist/utils/constants/fieldConstants.d.ts +7 -0
- package/dist/utils/constants/fieldConstants.js +7 -0
- package/dist/utils/types/network-modification-metadata.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.d.ts +0 -11
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js +0 -84
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.d.ts +0 -6
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.js +0 -11
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +0 -61
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.d.ts +0 -14
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.js +0 -27
- package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/index.js +0 -4
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { object, number, string } from "yup";
|
|
2
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
|
|
4
|
+
import "../../../../utils/conversionUtils.js";
|
|
5
|
+
import { UNDEFINED_CONNECTION_DIRECTION } from "../../../../utils/types/equipmentType.js";
|
|
6
|
+
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "@mui/icons-material";
|
|
9
|
+
import { sanitizeString } from "../../../../utils/ts-utils.js";
|
|
10
|
+
import "../../../../utils/yupConfig.js";
|
|
11
|
+
import { getConnectivityWithPositionSchema, getConnectivityWithPositionEmptyFormDataProps, getConnectivityFormDataProps } from "../../common/connectivity/connectivityForm.utils.js";
|
|
12
|
+
import "@mui/material";
|
|
13
|
+
import "react";
|
|
14
|
+
import "react-intl";
|
|
15
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
16
|
+
import "react-hook-form";
|
|
17
|
+
import "localized-countries";
|
|
18
|
+
import "localized-countries/data/fr";
|
|
19
|
+
import "localized-countries/data/en";
|
|
20
|
+
import "notistack";
|
|
21
|
+
import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
22
|
+
import "../../../treeViewFinder/TreeViewFinder.js";
|
|
23
|
+
import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
24
|
+
import "../../../customAGGrid/customAggrid.js";
|
|
25
|
+
import "ag-grid-community";
|
|
26
|
+
import "react-papaparse";
|
|
27
|
+
import "react-csv-downloader";
|
|
28
|
+
import "../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
32
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
34
|
+
import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
35
|
+
import "../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
|
|
36
|
+
import "@react-querybuilder/material";
|
|
37
|
+
import "../../../filter/expert/expertFilterConstants.js";
|
|
38
|
+
import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
39
|
+
import "uuid";
|
|
40
|
+
import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
41
|
+
import "react-querybuilder";
|
|
42
|
+
import { creationPropertiesSchema, getFilledPropertiesFromModification, toModificationProperties } from "../../common/properties/propertyUtils.js";
|
|
43
|
+
import { getSetPointsSchema, getSetPointsEmptyFormData } from "../../common/setpoints/setPoints.utils.js";
|
|
44
|
+
import { getActivePowerControlSchema, getActivePowerControlEmptyFormData } from "../../common/activePowerControl/activePowerControlForm.utils.js";
|
|
45
|
+
import { getShortCircuitFormSchema, getShortCircuitEmptyFormData, getShortCircuitFormData } from "../../common/shortCircuit/shortCircuitForm.utils.js";
|
|
46
|
+
import { getReactiveLimitsValidationSchema, getReactiveLimitsEmptyFormDataProps, getReactiveLimitsFormDataProps } from "../../common/reactiveLimits/reactiveLimits.utils.js";
|
|
47
|
+
const batteryCreationFormSchema = object().shape({
|
|
48
|
+
[FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED),
|
|
49
|
+
[FieldConstants.EQUIPMENT_NAME]: string().nullable(),
|
|
50
|
+
[FieldConstants.MAXIMUM_ACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).test("max-greater-than-min", "ActiveLimitsMinMaxInvalid", function checkMaxGreaterThanMin(value) {
|
|
51
|
+
const min = this.parent[FieldConstants.MINIMUM_ACTIVE_POWER];
|
|
52
|
+
if (value != null && min != null) {
|
|
53
|
+
return value >= min;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}),
|
|
57
|
+
[FieldConstants.MINIMUM_ACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).test("min-less-than-max", "ActiveLimitsMinMaxInvalid", function checkMinLessThanMax(value) {
|
|
58
|
+
const max = this.parent[FieldConstants.MAXIMUM_ACTIVE_POWER];
|
|
59
|
+
if (value != null && max != null) {
|
|
60
|
+
return value <= max;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}),
|
|
64
|
+
[FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(false),
|
|
65
|
+
[FieldConstants.REACTIVE_LIMITS]: getReactiveLimitsValidationSchema(),
|
|
66
|
+
...getSetPointsSchema(),
|
|
67
|
+
...getActivePowerControlSchema(),
|
|
68
|
+
...getShortCircuitFormSchema()
|
|
69
|
+
}).concat(creationPropertiesSchema).required(YUP_REQUIRED);
|
|
70
|
+
const batteryCreationEmptyFormData = {
|
|
71
|
+
equipmentID: "",
|
|
72
|
+
equipmentName: "",
|
|
73
|
+
maximumActivePower: null,
|
|
74
|
+
minimumActivePower: null,
|
|
75
|
+
connectivity: getConnectivityWithPositionEmptyFormDataProps(),
|
|
76
|
+
reactiveLimits: getReactiveLimitsEmptyFormDataProps(),
|
|
77
|
+
AdditionalProperties: [],
|
|
78
|
+
...getSetPointsEmptyFormData(),
|
|
79
|
+
...getActivePowerControlEmptyFormData(),
|
|
80
|
+
...getShortCircuitEmptyFormData()
|
|
81
|
+
};
|
|
82
|
+
const batteryCreationDtoToForm = (dto) => {
|
|
83
|
+
return {
|
|
84
|
+
equipmentID: dto.equipmentId,
|
|
85
|
+
equipmentName: dto.equipmentName ?? "",
|
|
86
|
+
maximumActivePower: dto.maxP,
|
|
87
|
+
minimumActivePower: dto.minP,
|
|
88
|
+
activePowerSetpoint: dto.targetP,
|
|
89
|
+
reactivePowerSetpoint: dto.targetQ,
|
|
90
|
+
frequencyRegulation: dto.participate,
|
|
91
|
+
droop: dto.droop,
|
|
92
|
+
connectivity: getConnectivityFormDataProps({
|
|
93
|
+
voltageLevelId: dto.voltageLevelId,
|
|
94
|
+
busbarSectionId: dto.busOrBusbarSectionId,
|
|
95
|
+
connectionDirection: dto.connectionDirection,
|
|
96
|
+
connectionName: dto.connectionName,
|
|
97
|
+
connectionPosition: dto.connectionPosition,
|
|
98
|
+
terminalConnected: dto.terminalConnected
|
|
99
|
+
}),
|
|
100
|
+
reactiveLimits: getReactiveLimitsFormDataProps({
|
|
101
|
+
reactiveCapabilityCurveChoice: dto?.reactiveCapabilityCurve ? "CURVE" : "MINMAX",
|
|
102
|
+
minimumReactivePower: dto?.minQ,
|
|
103
|
+
maximumReactivePower: dto?.maxQ,
|
|
104
|
+
reactiveCapabilityCurvePoints: dto?.reactiveCapabilityCurve ? dto?.reactiveCapabilityCurvePoints : null
|
|
105
|
+
}),
|
|
106
|
+
AdditionalProperties: getFilledPropertiesFromModification(dto.properties),
|
|
107
|
+
...getShortCircuitFormData({
|
|
108
|
+
directTransX: dto.directTransX,
|
|
109
|
+
stepUpTransformerX: dto.stepUpTransformerX
|
|
110
|
+
})
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const batteryCreationFormToDto = (form) => {
|
|
114
|
+
const isReactiveCapabilityCurveOn = form.reactiveLimits.reactiveCapabilityCurveChoice === "CURVE";
|
|
115
|
+
return {
|
|
116
|
+
type: ModificationType.BATTERY_CREATION,
|
|
117
|
+
equipmentId: form.equipmentID,
|
|
118
|
+
equipmentName: sanitizeString(form.equipmentName),
|
|
119
|
+
voltageLevelId: form.connectivity.voltageLevel?.id ?? "",
|
|
120
|
+
busOrBusbarSectionId: form.connectivity.busOrBusbarSection?.id ?? "",
|
|
121
|
+
connectionDirection: form.connectivity.connectionDirection ?? UNDEFINED_CONNECTION_DIRECTION,
|
|
122
|
+
connectionName: sanitizeString(form.connectivity.connectionName),
|
|
123
|
+
connectionPosition: form.connectivity.connectionPosition,
|
|
124
|
+
terminalConnected: form.connectivity.terminalConnected,
|
|
125
|
+
properties: toModificationProperties(form),
|
|
126
|
+
minP: form.minimumActivePower,
|
|
127
|
+
maxP: form.maximumActivePower,
|
|
128
|
+
reactiveCapabilityCurve: isReactiveCapabilityCurveOn,
|
|
129
|
+
minQ: isReactiveCapabilityCurveOn ? null : form.reactiveLimits.minimumReactivePower ?? null,
|
|
130
|
+
maxQ: isReactiveCapabilityCurveOn ? null : form.reactiveLimits.maximumReactivePower ?? null,
|
|
131
|
+
reactiveCapabilityCurvePoints: isReactiveCapabilityCurveOn ? form.reactiveLimits.reactiveCapabilityCurveTable ?? null : null,
|
|
132
|
+
targetP: form.activePowerSetpoint ?? 0,
|
|
133
|
+
targetQ: form.reactivePowerSetpoint ?? 0,
|
|
134
|
+
participate: form.frequencyRegulation ?? null,
|
|
135
|
+
droop: form.droop ?? null,
|
|
136
|
+
directTransX: form.directTransX ?? null,
|
|
137
|
+
stepUpTransformerX: form.transformerReactance ?? null
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
batteryCreationDtoToForm,
|
|
142
|
+
batteryCreationEmptyFormData,
|
|
143
|
+
batteryCreationFormSchema,
|
|
144
|
+
batteryCreationFormToDto
|
|
145
|
+
};
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare function CreateSwitchesForm({ id }: Readonly<CreateSwitchesFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default CreateSwitchesForm;
|
|
7
|
+
export * from './batteryCreation.types';
|
|
8
|
+
export * from './batteryCreation.utils';
|
|
9
|
+
export * from './BatteryCreationForm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { batteryCreationDtoToForm, batteryCreationEmptyFormData, batteryCreationFormSchema, batteryCreationFormToDto } from "./batteryCreation.utils.js";
|
|
2
|
+
import { BatteryCreationForm } from "./BatteryCreationForm.js";
|
|
3
|
+
export {
|
|
4
|
+
BatteryCreationForm,
|
|
5
|
+
batteryCreationDtoToForm,
|
|
6
|
+
batteryCreationEmptyFormData,
|
|
7
|
+
batteryCreationFormSchema,
|
|
8
|
+
batteryCreationFormToDto
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { batteryCreationDtoToForm, batteryCreationEmptyFormData, batteryCreationFormSchema, batteryCreationFormToDto } from "./creation/batteryCreation.utils.js";
|
|
2
|
+
import { BatteryCreationForm } from "./creation/BatteryCreationForm.js";
|
|
3
|
+
export {
|
|
4
|
+
BatteryCreationForm,
|
|
5
|
+
batteryCreationDtoToForm,
|
|
6
|
+
batteryCreationEmptyFormData,
|
|
7
|
+
batteryCreationFormSchema,
|
|
8
|
+
batteryCreationFormToDto
|
|
9
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { number, bool } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
-
import { YUP_REQUIRED } 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";
|
|
@@ -15,7 +15,7 @@ const getActivePowerControlSchema = (isEquipmentModification = false) => ({
|
|
|
15
15
|
is: () => !isEquipmentModification,
|
|
16
16
|
then: (schema) => schema.required(YUP_REQUIRED)
|
|
17
17
|
}),
|
|
18
|
-
[FieldConstants.DROOP]: number().nullable().min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").when([FieldConstants.FREQUENCY_REGULATION], {
|
|
18
|
+
[FieldConstants.DROOP]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).min(0, "NormalizedPercentage").max(100, "NormalizedPercentage").when([FieldConstants.FREQUENCY_REGULATION], {
|
|
19
19
|
is: (frequencyRegulation) => !isEquipmentModification && frequencyRegulation,
|
|
20
20
|
then: (schema) => schema.required(YUP_REQUIRED)
|
|
21
21
|
})
|
|
@@ -18,10 +18,10 @@ import { getActivePowerControlEmptyFormData, getActivePowerControlSchema } from
|
|
|
18
18
|
import { ActivePowerControlForm } from "./activePowerControl/ActivePowerControlForm.js";
|
|
19
19
|
import { getShortCircuitEmptyFormData, getShortCircuitFormData, getShortCircuitFormSchema } from "./shortCircuit/shortCircuitForm.utils.js";
|
|
20
20
|
import { ShortCircuitForm } from "./shortCircuit/ShortCircuitForm.js";
|
|
21
|
-
import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js";
|
|
21
|
+
import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getReactiveCapabilityCurveValidationSchemaArray, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js";
|
|
22
22
|
import { ReactiveCapabilityCurveRowForm } from "./reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js";
|
|
23
23
|
import { ReactiveCapabilityCurveTableForm } from "./reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js";
|
|
24
|
-
import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsFormData, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./reactiveLimits/reactiveLimits.utils.js";
|
|
24
|
+
import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsEmptyFormDataProps, getReactiveLimitsFormData, getReactiveLimitsFormDataProps, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./reactiveLimits/reactiveLimits.utils.js";
|
|
25
25
|
import { ReactiveLimitsForm } from "./reactiveLimits/ReactiveLimitsForm.js";
|
|
26
26
|
export {
|
|
27
27
|
ActivePowerControlForm,
|
|
@@ -88,8 +88,11 @@ export {
|
|
|
88
88
|
getPropertiesFromModification,
|
|
89
89
|
getPropertyValue,
|
|
90
90
|
getReactiveCapabilityCurveValidationSchema,
|
|
91
|
+
getReactiveCapabilityCurveValidationSchemaArray,
|
|
91
92
|
getReactiveLimitsEmptyFormData,
|
|
93
|
+
getReactiveLimitsEmptyFormDataProps,
|
|
92
94
|
getReactiveLimitsFormData,
|
|
95
|
+
getReactiveLimitsFormDataProps,
|
|
93
96
|
getReactiveLimitsSchema,
|
|
94
97
|
getReactiveLimitsValidationSchema,
|
|
95
98
|
getReactivePowerSetPointSchema,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./reactiveCapabilityCurve/reactiveCapability.utils.js";
|
|
1
|
+
import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getReactiveCapabilityCurveValidationSchemaArray, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./reactiveCapabilityCurve/reactiveCapability.utils.js";
|
|
2
2
|
import { ReactiveCapabilityCurveRowForm } from "./reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js";
|
|
3
3
|
import { ReactiveCapabilityCurveTableForm } from "./reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js";
|
|
4
|
-
import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsFormData, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./reactiveLimits.utils.js";
|
|
4
|
+
import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsEmptyFormDataProps, getReactiveLimitsFormData, getReactiveLimitsFormDataProps, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./reactiveLimits.utils.js";
|
|
5
5
|
import { ReactiveLimitsForm } from "./ReactiveLimitsForm.js";
|
|
6
6
|
export {
|
|
7
7
|
INSERT,
|
|
@@ -11,8 +11,11 @@ export {
|
|
|
11
11
|
ReactiveCapabilityCurveTableForm,
|
|
12
12
|
ReactiveLimitsForm,
|
|
13
13
|
getReactiveCapabilityCurveValidationSchema,
|
|
14
|
+
getReactiveCapabilityCurveValidationSchemaArray,
|
|
14
15
|
getReactiveLimitsEmptyFormData,
|
|
16
|
+
getReactiveLimitsEmptyFormDataProps,
|
|
15
17
|
getReactiveLimitsFormData,
|
|
18
|
+
getReactiveLimitsFormDataProps,
|
|
16
19
|
getReactiveLimitsSchema,
|
|
17
20
|
getReactiveLimitsValidationSchema,
|
|
18
21
|
getRowEmptyFormData,
|
package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./reactiveCapability.utils.js";
|
|
1
|
+
import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getReactiveCapabilityCurveValidationSchemaArray, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./reactiveCapability.utils.js";
|
|
2
2
|
import { ReactiveCapabilityCurveRowForm } from "./ReactiveCapabilityCurveRowForm.js";
|
|
3
3
|
import { ReactiveCapabilityCurveTableForm } from "./ReactiveCapabilityCurveTableForm.js";
|
|
4
4
|
export {
|
|
@@ -7,6 +7,7 @@ export {
|
|
|
7
7
|
ReactiveCapabilityCurveRowForm,
|
|
8
8
|
ReactiveCapabilityCurveTableForm,
|
|
9
9
|
getReactiveCapabilityCurveValidationSchema,
|
|
10
|
+
getReactiveCapabilityCurveValidationSchemaArray,
|
|
10
11
|
getRowEmptyFormData,
|
|
11
12
|
setCurrentReactiveCapabilityCurveTable,
|
|
12
13
|
setSelectedReactiveLimits,
|
|
@@ -11,8 +11,17 @@ export declare const getRowEmptyFormData: () => {
|
|
|
11
11
|
maxQ: null;
|
|
12
12
|
minQ: null;
|
|
13
13
|
};
|
|
14
|
+
export declare const getReactiveCapabilityCurveValidationSchemaArray: (positiveAndNegativePExist?: boolean) => import('yup').ArraySchema<{
|
|
15
|
+
minQ: number | null;
|
|
16
|
+
maxQ: number | null;
|
|
17
|
+
p: number | null;
|
|
18
|
+
}[] | null | undefined, import('yup').AnyObject, "", "">;
|
|
14
19
|
export declare const getReactiveCapabilityCurveValidationSchema: (id?: FieldConstants, positiveAndNegativePExist?: boolean) => {
|
|
15
|
-
[x: string]: import('yup').ArraySchema<
|
|
20
|
+
[x: string]: import('yup').ArraySchema<{
|
|
21
|
+
minQ: number | null;
|
|
22
|
+
maxQ: number | null;
|
|
23
|
+
p: number | null;
|
|
24
|
+
}[] | null | undefined, import('yup').AnyObject, "", "">;
|
|
16
25
|
};
|
|
17
26
|
export declare function setSelectedReactiveLimits(id: string, minMaxReactiveLimits: number, setValue: UseFormSetValue<FieldValues>): void;
|
|
18
27
|
export declare function setCurrentReactiveCapabilityCurveTable(previousReactiveCapabilityCurveTable: ReactiveCapabilityCurve, fieldKey: string, setValue: UseFormSetValue<FieldValues>): void;
|
|
@@ -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_NOT_TYPE_NUMBER } from "../../../../../utils/constants/translationKeys.js";
|
|
3
4
|
import "../../../../../utils/conversionUtils.js";
|
|
4
5
|
import "../../../../../utils/types/equipmentType.js";
|
|
5
6
|
import "react/jsx-runtime";
|
|
@@ -9,9 +10,9 @@ import "../../../../../utils/yupConfig.js";
|
|
|
9
10
|
const INSERT = "INSERT";
|
|
10
11
|
const REMOVE = "REMOVE";
|
|
11
12
|
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)
|
|
13
|
+
[FieldConstants.MAX_Q]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).default(null),
|
|
14
|
+
[FieldConstants.MIN_Q]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).default(null).max(ref(FieldConstants.MAX_Q), "ReactiveCapabilityCurveCreationErrorQminPQmaxPIncoherence"),
|
|
15
|
+
[FieldConstants.P]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).default(null)
|
|
15
16
|
});
|
|
16
17
|
const getRowEmptyFormData = () => ({
|
|
17
18
|
[FieldConstants.P]: null,
|
|
@@ -67,33 +68,34 @@ function ifOneFieldThenAllFields(values, context) {
|
|
|
67
68
|
});
|
|
68
69
|
return errors.length === 0 ? true : new ValidationError(errors);
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
71
|
+
const getReactiveCapabilityCurveValidationSchemaArray = (positiveAndNegativePExist = false) => array().of(getCreationRowSchema()).nullable().when([FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE], {
|
|
72
|
+
is: "CURVE",
|
|
73
|
+
then: (schema) => {
|
|
74
|
+
let resultSchema = schema;
|
|
75
|
+
if (positiveAndNegativePExist) {
|
|
76
|
+
resultSchema = resultSchema.test(
|
|
77
|
+
"checkATLeastThereIsOneNegativeP",
|
|
78
|
+
"ReactiveCapabilityCurveCreationErrorMissingNegativeP",
|
|
79
|
+
hasAtLeastOneNegativeP
|
|
90
80
|
).test(
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
81
|
+
"checkATLeastThereIsOnePositiveP",
|
|
82
|
+
"ReactiveCapabilityCurveCreationErrorMissingPositiveP",
|
|
83
|
+
hasAtLeastOnePositiveP
|
|
94
84
|
);
|
|
95
85
|
}
|
|
96
|
-
|
|
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
|
+
const getReactiveCapabilityCurveValidationSchema = (id = FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE, positiveAndNegativePExist = false) => ({
|
|
98
|
+
[id]: getReactiveCapabilityCurveValidationSchemaArray(positiveAndNegativePExist)
|
|
97
99
|
});
|
|
98
100
|
function setSelectedReactiveLimits(id, minMaxReactiveLimits, setValue) {
|
|
99
101
|
setValue(id, minMaxReactiveLimits ? "MINMAX" : "CURVE");
|
|
@@ -144,6 +146,7 @@ export {
|
|
|
144
146
|
INSERT,
|
|
145
147
|
REMOVE,
|
|
146
148
|
getReactiveCapabilityCurveValidationSchema,
|
|
149
|
+
getReactiveCapabilityCurveValidationSchemaArray,
|
|
147
150
|
getRowEmptyFormData,
|
|
148
151
|
setCurrentReactiveCapabilityCurveTable,
|
|
149
152
|
setSelectedReactiveLimits,
|
package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.type.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
7
|
export interface ReactiveCapabilityCurvePoints {
|
|
8
|
-
p
|
|
9
|
-
maxQ
|
|
10
|
-
minQ
|
|
8
|
+
p: number | null;
|
|
9
|
+
maxQ: number | null;
|
|
10
|
+
minQ: number | null;
|
|
11
11
|
}
|
|
12
12
|
export interface MinMaxReactiveLimitsFormInfos {
|
|
13
13
|
minQ?: number | null;
|
package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.d.ts
CHANGED
|
@@ -7,6 +7,17 @@ export declare const REACTIVE_LIMIT_TYPES: readonly [{
|
|
|
7
7
|
readonly id: "CURVE";
|
|
8
8
|
readonly label: "ReactiveLimitsKindCurve";
|
|
9
9
|
}];
|
|
10
|
+
export declare const getReactiveLimitsFormDataProps: ({ reactiveCapabilityCurveChoice, minimumReactivePower, maximumReactivePower, reactiveCapabilityCurvePoints, }: {
|
|
11
|
+
reactiveCapabilityCurveChoice: string;
|
|
12
|
+
minimumReactivePower?: number | null;
|
|
13
|
+
maximumReactivePower?: number | null;
|
|
14
|
+
reactiveCapabilityCurvePoints?: ReactiveCapabilityCurvePoints[] | null;
|
|
15
|
+
}) => {
|
|
16
|
+
reactiveCapabilityCurveChoice: string;
|
|
17
|
+
minimumReactivePower: number | null;
|
|
18
|
+
maximumReactivePower: number | null;
|
|
19
|
+
reactiveCapabilityCurveTable: ReactiveCapabilityCurvePoints[];
|
|
20
|
+
};
|
|
10
21
|
export declare const getReactiveLimitsFormData: ({ id, reactiveCapabilityCurveChoice, minimumReactivePower, maximumReactivePower, reactiveCapabilityCurvePoints, }: {
|
|
11
22
|
id?: string;
|
|
12
23
|
reactiveCapabilityCurveChoice: string;
|
|
@@ -21,6 +32,16 @@ export declare const getReactiveLimitsFormData: ({ id, reactiveCapabilityCurveCh
|
|
|
21
32
|
reactiveCapabilityCurveTable: ReactiveCapabilityCurvePoints[];
|
|
22
33
|
};
|
|
23
34
|
};
|
|
35
|
+
export declare const getReactiveLimitsEmptyFormDataProps: () => {
|
|
36
|
+
reactiveCapabilityCurveChoice: string;
|
|
37
|
+
minimumReactivePower: null;
|
|
38
|
+
maximumReactivePower: null;
|
|
39
|
+
reactiveCapabilityCurveTable: {
|
|
40
|
+
p: null;
|
|
41
|
+
maxQ: null;
|
|
42
|
+
minQ: null;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
24
45
|
export declare const getReactiveLimitsEmptyFormData: (id?: FieldConstants) => {
|
|
25
46
|
[x: string]: {
|
|
26
47
|
reactiveCapabilityCurveChoice: string;
|
|
@@ -37,19 +58,31 @@ export declare const getReactiveLimitsValidationSchema: (isEquipmentModification
|
|
|
37
58
|
reactiveCapabilityCurveChoice: string;
|
|
38
59
|
minimumReactivePower: number | null | undefined;
|
|
39
60
|
maximumReactivePower: number | null | undefined;
|
|
61
|
+
reactiveCapabilityCurveTable: {
|
|
62
|
+
minQ: number | null;
|
|
63
|
+
maxQ: number | null;
|
|
64
|
+
p: number | null;
|
|
65
|
+
}[] | null | undefined;
|
|
40
66
|
}, import('yup').AnyObject, {
|
|
41
67
|
reactiveCapabilityCurveChoice: undefined;
|
|
42
68
|
minimumReactivePower: undefined;
|
|
43
69
|
maximumReactivePower: undefined;
|
|
70
|
+
reactiveCapabilityCurveTable: "";
|
|
44
71
|
}, "">;
|
|
45
72
|
export declare const getReactiveLimitsSchema: (isEquipmentModification?: boolean, positiveAndNegativePExist?: boolean, id?: FieldConstants) => {
|
|
46
73
|
[x: string]: import('yup').ObjectSchema<{
|
|
47
74
|
reactiveCapabilityCurveChoice: string;
|
|
48
75
|
minimumReactivePower: number | null | undefined;
|
|
49
76
|
maximumReactivePower: number | null | undefined;
|
|
77
|
+
reactiveCapabilityCurveTable: {
|
|
78
|
+
minQ: number | null;
|
|
79
|
+
maxQ: number | null;
|
|
80
|
+
p: number | null;
|
|
81
|
+
}[] | null | undefined;
|
|
50
82
|
}, import('yup').AnyObject, {
|
|
51
83
|
reactiveCapabilityCurveChoice: undefined;
|
|
52
84
|
minimumReactivePower: undefined;
|
|
53
85
|
maximumReactivePower: undefined;
|
|
86
|
+
reactiveCapabilityCurveTable: "";
|
|
54
87
|
}, "">;
|
|
55
88
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { object, number, string } from "yup";
|
|
2
|
-
import { getRowEmptyFormData,
|
|
2
|
+
import { getRowEmptyFormData, getReactiveCapabilityCurveValidationSchemaArray } from "./reactiveCapabilityCurve/reactiveCapability.utils.js";
|
|
3
3
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
4
|
-
import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
|
|
4
|
+
import { YUP_NOT_TYPE_NUMBER, YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
|
|
5
5
|
import "../../../../utils/conversionUtils.js";
|
|
6
6
|
import "../../../../utils/types/equipmentType.js";
|
|
7
7
|
import "react/jsx-runtime";
|
|
@@ -11,6 +11,20 @@ const REACTIVE_LIMIT_TYPES = [
|
|
|
11
11
|
{ id: "MINMAX", label: "ReactiveLimitsKindMinMax" },
|
|
12
12
|
{ id: "CURVE", label: "ReactiveLimitsKindCurve" }
|
|
13
13
|
];
|
|
14
|
+
const getReactiveLimitsFormDataProps = ({
|
|
15
|
+
reactiveCapabilityCurveChoice,
|
|
16
|
+
minimumReactivePower,
|
|
17
|
+
maximumReactivePower,
|
|
18
|
+
reactiveCapabilityCurvePoints
|
|
19
|
+
}) => ({
|
|
20
|
+
[FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: reactiveCapabilityCurveChoice,
|
|
21
|
+
[FieldConstants.MINIMUM_REACTIVE_POWER]: minimumReactivePower ?? null,
|
|
22
|
+
[FieldConstants.MAXIMUM_REACTIVE_POWER]: maximumReactivePower ?? null,
|
|
23
|
+
[FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE]: reactiveCapabilityCurvePoints ?? [
|
|
24
|
+
getRowEmptyFormData(),
|
|
25
|
+
getRowEmptyFormData()
|
|
26
|
+
]
|
|
27
|
+
});
|
|
14
28
|
const getReactiveLimitsFormData = ({
|
|
15
29
|
id = FieldConstants.REACTIVE_LIMITS,
|
|
16
30
|
reactiveCapabilityCurveChoice,
|
|
@@ -18,49 +32,69 @@ const getReactiveLimitsFormData = ({
|
|
|
18
32
|
maximumReactivePower,
|
|
19
33
|
reactiveCapabilityCurvePoints
|
|
20
34
|
}) => ({
|
|
21
|
-
[id]: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
[id]: getReactiveLimitsFormDataProps({
|
|
36
|
+
reactiveCapabilityCurveChoice,
|
|
37
|
+
minimumReactivePower,
|
|
38
|
+
maximumReactivePower,
|
|
39
|
+
reactiveCapabilityCurvePoints
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
const getReactiveLimitsEmptyFormDataProps = () => ({
|
|
43
|
+
[FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: "MINMAX",
|
|
44
|
+
[FieldConstants.MINIMUM_REACTIVE_POWER]: null,
|
|
45
|
+
[FieldConstants.MAXIMUM_REACTIVE_POWER]: null,
|
|
46
|
+
[FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE]: [getRowEmptyFormData(), getRowEmptyFormData()]
|
|
30
47
|
});
|
|
31
48
|
const getReactiveLimitsEmptyFormData = (id = FieldConstants.REACTIVE_LIMITS) => ({
|
|
32
|
-
[id]:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
[id]: getReactiveLimitsEmptyFormDataProps()
|
|
50
|
+
});
|
|
51
|
+
const getReactiveLimitsValidationSchema = (isEquipmentModification = false, positiveAndNegativePExist = false) => object().shape({
|
|
52
|
+
[FieldConstants.REACTIVE_CAPABILITY_CURVE_CHOICE]: string().nullable().required(YUP_REQUIRED),
|
|
53
|
+
[FieldConstants.MINIMUM_REACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).test(
|
|
54
|
+
"min-reactive-power-required",
|
|
55
|
+
"MinReactivePowerRequired",
|
|
56
|
+
function validateMinReactivePowerRequired(value) {
|
|
57
|
+
const { reactiveCapabilityCurveChoice, maximumReactivePower } = this.parent;
|
|
58
|
+
if (reactiveCapabilityCurveChoice === "MINMAX" && !isEquipmentModification && maximumReactivePower != null && value == null) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
).test("min-less-than-max", "ReactiveLimitsMinMaxInvalid", function checkMinLessThanMax(value) {
|
|
64
|
+
const { reactiveCapabilityCurveChoice, maximumReactivePower } = this.parent;
|
|
65
|
+
if (reactiveCapabilityCurveChoice === "MINMAX" && value != null && maximumReactivePower != null) {
|
|
66
|
+
return value <= maximumReactivePower;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}),
|
|
70
|
+
[FieldConstants.MAXIMUM_REACTIVE_POWER]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).test(
|
|
71
|
+
"max-reactive-power-required",
|
|
72
|
+
"MaxReactivePowerRequired",
|
|
73
|
+
function validateMaxReactivePowerRequired(value) {
|
|
74
|
+
const { reactiveCapabilityCurveChoice, minimumReactivePower } = this.parent;
|
|
75
|
+
if (reactiveCapabilityCurveChoice === "MINMAX" && !isEquipmentModification && minimumReactivePower != null && value == null) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
).test("max-greater-than-min", "ReactiveLimitsMinMaxInvalid", function checkMaxGreaterThanMin(value) {
|
|
81
|
+
const { reactiveCapabilityCurveChoice, minimumReactivePower } = this.parent;
|
|
82
|
+
if (reactiveCapabilityCurveChoice === "MINMAX" && value != null && minimumReactivePower != null) {
|
|
83
|
+
return value >= minimumReactivePower;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}),
|
|
87
|
+
[FieldConstants.REACTIVE_CAPABILITY_CURVE_TABLE]: getReactiveCapabilityCurveValidationSchemaArray(positiveAndNegativePExist)
|
|
38
88
|
});
|
|
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
89
|
const getReactiveLimitsSchema = (isEquipmentModification = false, positiveAndNegativePExist = false, id = FieldConstants.REACTIVE_LIMITS) => ({
|
|
58
90
|
[id]: getReactiveLimitsValidationSchema(isEquipmentModification, positiveAndNegativePExist)
|
|
59
91
|
});
|
|
60
92
|
export {
|
|
61
93
|
REACTIVE_LIMIT_TYPES,
|
|
62
94
|
getReactiveLimitsEmptyFormData,
|
|
95
|
+
getReactiveLimitsEmptyFormDataProps,
|
|
63
96
|
getReactiveLimitsFormData,
|
|
97
|
+
getReactiveLimitsFormDataProps,
|
|
64
98
|
getReactiveLimitsSchema,
|
|
65
99
|
getReactiveLimitsValidationSchema
|
|
66
100
|
};
|
|
@@ -36,7 +36,7 @@ const getActivePowerSetPointSchema = (isEquipmentModification = false) => ({
|
|
|
36
36
|
}).when([], {
|
|
37
37
|
is: () => !isEquipmentModification,
|
|
38
38
|
then: (schema) => {
|
|
39
|
-
return schema.required(YUP_REQUIRED).nonNullable(
|
|
39
|
+
return schema.required(YUP_REQUIRED).nonNullable(YUP_REQUIRED).test(
|
|
40
40
|
"activePowerSetPoint",
|
|
41
41
|
"ActivePowerMustBeZeroOrBetweenMinAndMaxActivePower",
|
|
42
42
|
testValueWithinPowerIntervalOrEqualToZero
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { number } from "yup";
|
|
2
2
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
-
import { YUP_REQUIRED } 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";
|
|
@@ -14,8 +14,8 @@ const getShortCircuitEmptyFormData = () => {
|
|
|
14
14
|
};
|
|
15
15
|
const getShortCircuitFormSchema = (isEquipmentModification = false) => {
|
|
16
16
|
return {
|
|
17
|
-
[FieldConstants.TRANSFORMER_REACTANCE]: number().nullable(),
|
|
18
|
-
[FieldConstants.TRANSIENT_REACTANCE]: number().nullable().when([FieldConstants.TRANSFORMER_REACTANCE], {
|
|
17
|
+
[FieldConstants.TRANSFORMER_REACTANCE]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER),
|
|
18
|
+
[FieldConstants.TRANSIENT_REACTANCE]: number().nullable().typeError(YUP_NOT_TYPE_NUMBER).when([FieldConstants.TRANSFORMER_REACTANCE], {
|
|
19
19
|
is: (transformerReactance) => isEquipmentModification && transformerReactance != null,
|
|
20
20
|
then: (schema) => schema.required(YUP_REQUIRED)
|
|
21
21
|
})
|