@gridsuite/commons-ui 0.255.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/composite/reactQueryBuilder/CustomReactQueryBuilder.js +7 -4
- package/dist/components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +2 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +2 -1
- package/dist/features/index.js +16 -0
- package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +3 -2
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabsContent.d.ts +5 -1
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabsContent.js +50 -10
- package/dist/features/network-modifications/battery/modification/BatteryModificationForm.d.ts +5 -1
- package/dist/features/network-modifications/battery/modification/BatteryModificationForm.js +4 -2
- package/dist/features/network-modifications/battery/modification/batteryModification.types.d.ts +6 -0
- package/dist/features/network-modifications/battery/modification/batteryModification.utils.d.ts +32 -0
- package/dist/features/network-modifications/battery/modification/batteryModification.utils.js +23 -2
- 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-constants.d.ts +10 -0
- package/dist/features/network-modifications/by-filter/formula/formula/formula-constants.js +10 -0
- package/dist/features/network-modifications/by-filter/formula/formula/formula-form.d.ts +12 -0
- package/dist/features/network-modifications/by-filter/formula/formula/formula-form.js +139 -0
- package/dist/features/network-modifications/by-filter/formula/formula/formula-utils.d.ts +40 -0
- package/dist/features/network-modifications/by-filter/formula/formula/formula-utils.js +164 -0
- package/dist/features/network-modifications/by-filter/formula/formula/formula.type.d.ts +27 -0
- package/dist/features/network-modifications/by-filter/formula/formula/formula.type.js +1 -0
- package/dist/features/network-modifications/by-filter/formula/formula/reference-autocomplete-input.d.ts +15 -0
- package/dist/features/network-modifications/by-filter/formula/formula/reference-autocomplete-input.js +123 -0
- package/dist/features/network-modifications/by-filter/formula/index.d.ts +11 -0
- package/dist/features/network-modifications/by-filter/formula/index.js +18 -0
- package/dist/features/network-modifications/by-filter/formula/modification-by-formula-form.d.ts +1 -0
- package/dist/features/network-modifications/by-filter/formula/modification-by-formula-form.js +110 -0
- package/dist/features/network-modifications/by-filter/formula/modificationByFormula.utils.d.ts +32 -0
- package/dist/features/network-modifications/by-filter/formula/modificationByFormula.utils.js +126 -0
- package/dist/features/network-modifications/by-filter/index.d.ts +1 -0
- package/dist/features/network-modifications/by-filter/index.js +17 -1
- 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/VoltageRegulationForm.js +1 -1
- 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/index.js +16 -0
- 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 +43 -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 +16 -30
- package/dist/translations/en/networkModificationsEn.js +10 -35
- 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 +16 -30
- package/dist/translations/fr/networkModificationsFr.js +10 -35
- 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/fieldConstants.d.ts +1 -0
- package/dist/utils/constants/fieldConstants.js +1 -0
- 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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useFormContext } from "react-hook-form";
|
|
3
|
+
import { Box, Grid2 } from "@mui/material";
|
|
4
|
+
import FormulaForm from "./formula/formula-form.js";
|
|
5
|
+
import { getFormulaInitialValue } from "./formula/formula-utils.js";
|
|
6
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
7
|
+
import "../../../../utils/conversionUtils.js";
|
|
8
|
+
import { EquipmentType } from "../../../../utils/types/equipmentType.js";
|
|
9
|
+
import "@mui/icons-material";
|
|
10
|
+
import { mergeSx } from "../../../../utils/styles.js";
|
|
11
|
+
import "react-intl";
|
|
12
|
+
import "../../../../components/ui/overflowableText/OverflowableText.js";
|
|
13
|
+
import "react";
|
|
14
|
+
import "localized-countries";
|
|
15
|
+
import "localized-countries/data/fr";
|
|
16
|
+
import "localized-countries/data/en";
|
|
17
|
+
import "notistack";
|
|
18
|
+
import "../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
19
|
+
import "yup";
|
|
20
|
+
import "../../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
21
|
+
import "../../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
22
|
+
import { SelectWithConfirmationInput } from "../../../../components/ui/reactHookForm/selectInputs/SelectWithConfirmationInput.js";
|
|
23
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
24
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
25
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
28
|
+
import "../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
29
|
+
import { ExpandableInput } from "../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
30
|
+
import "../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
|
|
31
|
+
import "@hello-pangea/dnd";
|
|
32
|
+
import { unscrollableDialogStyles } from "../../../../components/ui/dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
33
|
+
import "../../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
34
|
+
import "../../../../components/ui/snackbarProvider/SnackbarProvider.js";
|
|
35
|
+
import "mui-nested-menu";
|
|
36
|
+
import "react-resizable-panels";
|
|
37
|
+
import "react-papaparse";
|
|
38
|
+
import "react-dom";
|
|
39
|
+
import "autosuggest-highlight/match";
|
|
40
|
+
import "autosuggest-highlight/parse";
|
|
41
|
+
import "clsx";
|
|
42
|
+
import "../../../../components/composite/filter/FilterCreationDialog.js";
|
|
43
|
+
import "../../../../components/composite/filter/HeaderFilterForm.js";
|
|
44
|
+
import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
45
|
+
import "../../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
46
|
+
import "../../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
47
|
+
import "../../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
48
|
+
import "react-querybuilder";
|
|
49
|
+
import "uuid";
|
|
50
|
+
import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
51
|
+
import "../../../../components/composite/filter/utils/filterFormUtils.js";
|
|
52
|
+
import { GridItem } from "../../../../components/composite/grid/grid-item.js";
|
|
53
|
+
import "@react-querybuilder/material";
|
|
54
|
+
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
55
|
+
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
56
|
+
import "../../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
57
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
58
|
+
import "ag-grid-community";
|
|
59
|
+
import "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
60
|
+
import "../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
|
|
61
|
+
import "mathjs";
|
|
62
|
+
import "../../../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
63
|
+
import "react-window";
|
|
64
|
+
import "../../../../components/composite/report/report-treeview/treeview-item.js";
|
|
65
|
+
import "../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
66
|
+
import { FORMULAS } from "./formula/formula-constants.js";
|
|
67
|
+
const EQUIPMENT_TYPE_OPTIONS = [
|
|
68
|
+
EquipmentType.GENERATOR,
|
|
69
|
+
EquipmentType.BATTERY,
|
|
70
|
+
EquipmentType.SHUNT_COMPENSATOR,
|
|
71
|
+
EquipmentType.VOLTAGE_LEVEL,
|
|
72
|
+
EquipmentType.LOAD,
|
|
73
|
+
EquipmentType.TWO_WINDINGS_TRANSFORMER,
|
|
74
|
+
EquipmentType.LINE
|
|
75
|
+
];
|
|
76
|
+
function ModificationByFormulaForm() {
|
|
77
|
+
const { setValue, getValues } = useFormContext();
|
|
78
|
+
const equipmentTypeField = /* @__PURE__ */ jsx(
|
|
79
|
+
SelectWithConfirmationInput,
|
|
80
|
+
{
|
|
81
|
+
name: FieldConstants.EQUIPMENT_TYPE,
|
|
82
|
+
label: "EquipmentType",
|
|
83
|
+
options: EQUIPMENT_TYPE_OPTIONS,
|
|
84
|
+
onValidate: () => {
|
|
85
|
+
setValue(
|
|
86
|
+
FORMULAS,
|
|
87
|
+
getValues(FORMULAS).map(() => ({
|
|
88
|
+
...getFormulaInitialValue()
|
|
89
|
+
}))
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
const formulasField = /* @__PURE__ */ jsx(
|
|
95
|
+
ExpandableInput,
|
|
96
|
+
{
|
|
97
|
+
name: FORMULAS,
|
|
98
|
+
Field: FormulaForm,
|
|
99
|
+
addButtonLabel: "addNewFormula",
|
|
100
|
+
initialValue: getFormulaInitialValue()
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
return /* @__PURE__ */ jsxs(Box, { sx: mergeSx(unscrollableDialogStyles.unscrollableContainer, { height: "100%" }), children: [
|
|
104
|
+
/* @__PURE__ */ jsx(Grid2, { container: true, sx: unscrollableDialogStyles.unscrollableHeader, children: /* @__PURE__ */ jsx(GridItem, { size: 2.15, children: equipmentTypeField }) }),
|
|
105
|
+
/* @__PURE__ */ jsx(Grid2, { container: true, sx: unscrollableDialogStyles.scrollableContent, children: /* @__PURE__ */ jsx(GridItem, { size: 12, children: formulasField }) })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
ModificationByFormulaForm
|
|
110
|
+
};
|
package/dist/features/network-modifications/by-filter/formula/modificationByFormula.utils.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DeepNullable } from '../../../../utils';
|
|
2
|
+
import { ModificationByFormulaDto } from './formula/formula.type';
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) 2026, RTE (http://www.rte-france.com)
|
|
5
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
7
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
8
|
+
*/
|
|
9
|
+
import * as yup from 'yup';
|
|
10
|
+
export declare const modificationByFormulaFormSchema: yup.ObjectSchema<{
|
|
11
|
+
equipmentType: string;
|
|
12
|
+
formulas: {
|
|
13
|
+
filters: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
specificMetadata: {
|
|
17
|
+
type?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
20
|
+
editedField: string;
|
|
21
|
+
operator: string;
|
|
22
|
+
referenceFieldOrValue1: {};
|
|
23
|
+
referenceFieldOrValue2: {};
|
|
24
|
+
}[] | undefined;
|
|
25
|
+
}, yup.AnyObject, {
|
|
26
|
+
equipmentType: undefined;
|
|
27
|
+
formulas: "";
|
|
28
|
+
}, "">;
|
|
29
|
+
export type ModificationByFormulaFormData = yup.InferType<typeof modificationByFormulaFormSchema>;
|
|
30
|
+
export declare const emptyModificationFormData: DeepNullable<ModificationByFormulaFormData>;
|
|
31
|
+
export declare const modificationByFormulaDtoToForm: (dto: ModificationByFormulaDto) => ModificationByFormulaFormData;
|
|
32
|
+
export declare const modificationByFormulaFormToDto: (formData: ModificationByFormulaFormData) => ModificationByFormulaDto;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as yup from "yup";
|
|
2
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { convertInputValue, convertOutputValue } from "../../../../utils/conversionUtils.js";
|
|
4
|
+
import "../../../../utils/types/equipmentType.js";
|
|
5
|
+
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
import "@mui/icons-material";
|
|
8
|
+
import { getFormulaSchema, getFormulaInitialValue } from "./formula/formula-utils.js";
|
|
9
|
+
import { FORMULAS, OPERATOR, REFERENCE_FIELD_OR_VALUE_2, REFERENCE_FIELD_OR_VALUE_1 } from "./formula/formula-constants.js";
|
|
10
|
+
const modificationByFormulaFormSchema = yup.object().shape({
|
|
11
|
+
[FieldConstants.EQUIPMENT_TYPE]: yup.string().required(),
|
|
12
|
+
[FORMULAS]: getFormulaSchema()
|
|
13
|
+
}).required();
|
|
14
|
+
const emptyModificationFormData = {
|
|
15
|
+
[FieldConstants.EQUIPMENT_TYPE]: "",
|
|
16
|
+
[FORMULAS]: [getFormulaInitialValue()]
|
|
17
|
+
};
|
|
18
|
+
function shouldConvert(isNumber1, isNumber2, operator) {
|
|
19
|
+
switch (operator) {
|
|
20
|
+
case "DIVISION":
|
|
21
|
+
if (isNumber1 && isNumber2) {
|
|
22
|
+
return { convertValue1: true, convertValue2: false };
|
|
23
|
+
}
|
|
24
|
+
return { convertValue1: false, convertValue2: false };
|
|
25
|
+
case "MULTIPLICATION":
|
|
26
|
+
case "PERCENTAGE":
|
|
27
|
+
if (isNumber1 && isNumber2) {
|
|
28
|
+
return { convertValue1: false, convertValue2: true };
|
|
29
|
+
}
|
|
30
|
+
return { convertValue1: false, convertValue2: false };
|
|
31
|
+
default:
|
|
32
|
+
return { convertValue1: true, convertValue2: true };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function shouldConvertFromNumber(input1, input2, operator) {
|
|
36
|
+
const isNumber1 = input1 !== null && !Number.isNaN(input1);
|
|
37
|
+
const isNumber2 = input2 !== null && !Number.isNaN(input2);
|
|
38
|
+
return shouldConvert(isNumber1, isNumber2, operator);
|
|
39
|
+
}
|
|
40
|
+
function shouldConvertFromString(input1, input2, operator) {
|
|
41
|
+
const isNumber1 = input1 !== null && !Number.isNaN(Number.parseFloat(input1.replace(",", ".")));
|
|
42
|
+
const isNumber2 = input2 !== null && !Number.isNaN(Number.parseFloat(input2.replace(",", ".")));
|
|
43
|
+
return shouldConvert(isNumber1, isNumber2, operator);
|
|
44
|
+
}
|
|
45
|
+
const modificationByFormulaDtoToForm = (dto) => {
|
|
46
|
+
const formulas = dto.formulaInfosList?.map((formula) => {
|
|
47
|
+
const shouldConverts = shouldConvertFromNumber(
|
|
48
|
+
formula?.fieldOrValue1?.value,
|
|
49
|
+
formula?.fieldOrValue2?.value,
|
|
50
|
+
formula?.operator
|
|
51
|
+
);
|
|
52
|
+
const valueConverted1 = shouldConverts.convertValue1 ? convertInputValue(formula.editedField, formula?.fieldOrValue1?.value) : formula?.fieldOrValue1?.value;
|
|
53
|
+
const valueConverted2 = shouldConverts.convertValue2 ? convertInputValue(formula.editedField, formula?.fieldOrValue2?.value) : formula?.fieldOrValue2?.value;
|
|
54
|
+
const ref1 = valueConverted1?.toString() ?? formula?.fieldOrValue1?.equipmentField;
|
|
55
|
+
const ref2 = valueConverted2?.toString() ?? formula?.fieldOrValue2?.equipmentField;
|
|
56
|
+
return {
|
|
57
|
+
[REFERENCE_FIELD_OR_VALUE_1]: ref1,
|
|
58
|
+
[REFERENCE_FIELD_OR_VALUE_2]: ref2,
|
|
59
|
+
[FieldConstants.EDITED_FIELD]: formula.editedField,
|
|
60
|
+
[OPERATOR]: formula.operator,
|
|
61
|
+
[FieldConstants.FILTERS]: formula.filters
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
[FieldConstants.EQUIPMENT_TYPE]: dto.identifiableType,
|
|
66
|
+
[FORMULAS]: formulas
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
function getFieldOrConvertedUnitValue(input, fieldType, convert) {
|
|
70
|
+
const value = input.replace(",", ".");
|
|
71
|
+
const isNumber = !Number.isNaN(Number.parseFloat(value));
|
|
72
|
+
if (isNumber) {
|
|
73
|
+
return {
|
|
74
|
+
value: convert ? convertOutputValue(fieldType, value) : value,
|
|
75
|
+
equipmentField: null
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
value: null,
|
|
80
|
+
equipmentField: input
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const modificationByFormulaFormToDto = (formData) => {
|
|
84
|
+
const formulas = formData[FORMULAS]?.map((formula) => {
|
|
85
|
+
const shouldConverts = shouldConvertFromString(
|
|
86
|
+
formula[REFERENCE_FIELD_OR_VALUE_1],
|
|
87
|
+
formula[REFERENCE_FIELD_OR_VALUE_2],
|
|
88
|
+
formula[OPERATOR]
|
|
89
|
+
);
|
|
90
|
+
const fieldOrValue1 = getFieldOrConvertedUnitValue(
|
|
91
|
+
formula[REFERENCE_FIELD_OR_VALUE_1],
|
|
92
|
+
formula[FieldConstants.EDITED_FIELD],
|
|
93
|
+
shouldConverts.convertValue1
|
|
94
|
+
);
|
|
95
|
+
const fieldOrValue2 = getFieldOrConvertedUnitValue(
|
|
96
|
+
formula[REFERENCE_FIELD_OR_VALUE_2],
|
|
97
|
+
formula[FieldConstants.EDITED_FIELD],
|
|
98
|
+
shouldConverts.convertValue2
|
|
99
|
+
);
|
|
100
|
+
const filters = formula[FieldConstants.FILTERS]?.map((filter) => {
|
|
101
|
+
return {
|
|
102
|
+
id: filter.id,
|
|
103
|
+
name: filter.name,
|
|
104
|
+
specificMetadata: filter.specificMetadata
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
fieldOrValue1,
|
|
109
|
+
fieldOrValue2,
|
|
110
|
+
filters,
|
|
111
|
+
operator: formula.operator,
|
|
112
|
+
editedField: formula.editedField
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
type: ModificationType.BY_FORMULA_MODIFICATION,
|
|
117
|
+
identifiableType: formData[FieldConstants.EQUIPMENT_TYPE],
|
|
118
|
+
formulaInfosList: formulas ?? []
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
export {
|
|
122
|
+
emptyModificationFormData,
|
|
123
|
+
modificationByFormulaDtoToForm,
|
|
124
|
+
modificationByFormulaFormSchema,
|
|
125
|
+
modificationByFormulaFormToDto
|
|
126
|
+
};
|
|
@@ -3,17 +3,33 @@ import { EQUIPMENT_TYPE_ORDER, byFilterDeletionDtoToForm, byFilterDeletionFormSc
|
|
|
3
3
|
import { ModificationByAssignmentForm } from "./assignment/modification-by-assignment-form.js";
|
|
4
4
|
import { emptyModificationByAssignmentFormData, modificationByAssignmentDtoToForm, modificationByAssignmentFormSchema, modificationByAssignmentFormToDto } from "./assignment/modificationByAssignment.utils.js";
|
|
5
5
|
import { DataType } from "./assignment/assignment/assignment.type.js";
|
|
6
|
+
import { ModificationByFormulaForm } from "./formula/modification-by-formula-form.js";
|
|
7
|
+
import { EQUIPMENTS_FIELDS, getFormulaInitialValue, getFormulaSchema } from "./formula/formula/formula-utils.js";
|
|
8
|
+
import { emptyModificationFormData, modificationByFormulaDtoToForm, modificationByFormulaFormSchema, modificationByFormulaFormToDto } from "./formula/modificationByFormula.utils.js";
|
|
9
|
+
import { FORMULAS, OPERATOR, REFERENCE_FIELD_OR_VALUE_1, REFERENCE_FIELD_OR_VALUE_2 } from "./formula/formula/formula-constants.js";
|
|
6
10
|
export {
|
|
7
11
|
DataType as AssignmentDataType,
|
|
8
12
|
ByFilterDeletionForm,
|
|
13
|
+
EQUIPMENTS_FIELDS,
|
|
9
14
|
EQUIPMENT_TYPE_ORDER,
|
|
15
|
+
FORMULAS,
|
|
10
16
|
ModificationByAssignmentForm,
|
|
17
|
+
ModificationByFormulaForm,
|
|
18
|
+
OPERATOR,
|
|
19
|
+
REFERENCE_FIELD_OR_VALUE_1,
|
|
20
|
+
REFERENCE_FIELD_OR_VALUE_2,
|
|
11
21
|
byFilterDeletionDtoToForm,
|
|
12
22
|
byFilterDeletionFormSchema,
|
|
13
23
|
byFilterDeletionFormToDto,
|
|
14
24
|
emptyFormData,
|
|
15
25
|
emptyModificationByAssignmentFormData,
|
|
26
|
+
emptyModificationFormData,
|
|
27
|
+
getFormulaInitialValue,
|
|
28
|
+
getFormulaSchema,
|
|
16
29
|
modificationByAssignmentDtoToForm,
|
|
17
30
|
modificationByAssignmentFormSchema,
|
|
18
|
-
modificationByAssignmentFormToDto
|
|
31
|
+
modificationByAssignmentFormToDto,
|
|
32
|
+
modificationByFormulaDtoToForm,
|
|
33
|
+
modificationByFormulaFormSchema,
|
|
34
|
+
modificationByFormulaFormToDto
|
|
19
35
|
};
|
|
@@ -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/VoltageRegulationForm.js
CHANGED
|
@@ -84,7 +84,7 @@ function VoltageRegulationForm({
|
|
|
84
84
|
}
|
|
85
85
|
) }),
|
|
86
86
|
isDistantRegulation && /* @__PURE__ */ jsxs(Grid2, { container: true, size: 12, spacing: 2, children: [
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
87
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, sx: { alignSelf: "center", justifyContent: "end" }, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "RegulatingTerminalGenerator" }) }),
|
|
88
88
|
/* @__PURE__ */ jsx(GridItem, { size: 8, children: /* @__PURE__ */ jsx(
|
|
89
89
|
RegulatingTerminalForm,
|
|
90
90
|
{
|
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),
|
|
@@ -102,6 +102,10 @@ import { EQUIPMENT_TYPE_ORDER, byFilterDeletionDtoToForm, byFilterDeletionFormSc
|
|
|
102
102
|
import { ModificationByAssignmentForm } from "./by-filter/assignment/modification-by-assignment-form.js";
|
|
103
103
|
import { emptyModificationByAssignmentFormData, modificationByAssignmentDtoToForm, modificationByAssignmentFormSchema, modificationByAssignmentFormToDto } from "./by-filter/assignment/modificationByAssignment.utils.js";
|
|
104
104
|
import { DataType } from "./by-filter/assignment/assignment/assignment.type.js";
|
|
105
|
+
import { ModificationByFormulaForm } from "./by-filter/formula/modification-by-formula-form.js";
|
|
106
|
+
import { EQUIPMENTS_FIELDS, getFormulaInitialValue, getFormulaSchema } from "./by-filter/formula/formula/formula-utils.js";
|
|
107
|
+
import { emptyModificationFormData, modificationByFormulaDtoToForm, modificationByFormulaFormSchema, modificationByFormulaFormToDto } from "./by-filter/formula/modificationByFormula.utils.js";
|
|
108
|
+
import { FORMULAS, OPERATOR, REFERENCE_FIELD_OR_VALUE_1, REFERENCE_FIELD_OR_VALUE_2 } from "./by-filter/formula/formula/formula-constants.js";
|
|
105
109
|
import { generatorCreationDtoToForm, generatorCreationEmptyFormData, generatorCreationFormSchema, generatorCreationFormToDto } from "./generator/creation/generatorCreation.utils.js";
|
|
106
110
|
import { GeneratorCreationForm } from "./generator/creation/GeneratorCreationForm.js";
|
|
107
111
|
import { generatorModificationDtoToForm, generatorModificationEmptyFormData, generatorModificationFormSchema, generatorModificationFormToDto } from "./generator/modification/generatorModification.utils.js";
|
|
@@ -155,8 +159,10 @@ export {
|
|
|
155
159
|
CHARACTERISTICS_CHOICES,
|
|
156
160
|
CharacteristicsForm,
|
|
157
161
|
ConnectivityForm,
|
|
162
|
+
EQUIPMENTS_FIELDS,
|
|
158
163
|
EQUIPMENT_TYPE_ORDER,
|
|
159
164
|
EquipmentDeletionForm,
|
|
165
|
+
FORMULAS,
|
|
160
166
|
GENERATOR_TAB_FIELDS,
|
|
161
167
|
GeneratorCreationForm,
|
|
162
168
|
GeneratorDialogHeader,
|
|
@@ -189,7 +195,9 @@ export {
|
|
|
189
195
|
LoadForm,
|
|
190
196
|
MAX_SECTIONS_COUNT,
|
|
191
197
|
ModificationByAssignmentForm,
|
|
198
|
+
ModificationByFormulaForm,
|
|
192
199
|
OPERATIONAL_LIMITS_GROUPS_MODIFICATION_TYPE,
|
|
200
|
+
OPERATOR,
|
|
193
201
|
OperationalLimitsGroupTabLabel,
|
|
194
202
|
OperationalLimitsGroups,
|
|
195
203
|
PowerMeasurementsForm,
|
|
@@ -197,6 +205,8 @@ export {
|
|
|
197
205
|
PropertiesForm,
|
|
198
206
|
PropertyForm,
|
|
199
207
|
REACTIVE_LIMIT_TYPES,
|
|
208
|
+
REFERENCE_FIELD_OR_VALUE_1,
|
|
209
|
+
REFERENCE_FIELD_OR_VALUE_2,
|
|
200
210
|
REGULATION_TYPES,
|
|
201
211
|
REMOVE,
|
|
202
212
|
ReactiveCapabilityCurveRowForm,
|
|
@@ -251,6 +261,7 @@ export {
|
|
|
251
261
|
emptyFormData,
|
|
252
262
|
emptyLineSegment,
|
|
253
263
|
emptyModificationByAssignmentFormData,
|
|
264
|
+
emptyModificationFormData,
|
|
254
265
|
emptyProperties,
|
|
255
266
|
equipmentDeletionDtoToForm,
|
|
256
267
|
equipmentDeletionEmptyFormData,
|
|
@@ -310,6 +321,8 @@ export {
|
|
|
310
321
|
getCreateSwitchesEmptyFormData,
|
|
311
322
|
getCreateSwitchesValidationSchema,
|
|
312
323
|
getFilledPropertiesFromModification,
|
|
324
|
+
getFormulaInitialValue,
|
|
325
|
+
getFormulaSchema,
|
|
313
326
|
getHvdcLccDeletionSchema,
|
|
314
327
|
getInjectionActiveReactivePowerEditDataProperties,
|
|
315
328
|
getInjectionActiveReactivePowerEmptyFormData,
|
|
@@ -374,6 +387,9 @@ export {
|
|
|
374
387
|
modificationByAssignmentDtoToForm,
|
|
375
388
|
modificationByAssignmentFormSchema,
|
|
376
389
|
modificationByAssignmentFormToDto,
|
|
390
|
+
modificationByFormulaDtoToForm,
|
|
391
|
+
modificationByFormulaFormSchema,
|
|
392
|
+
modificationByFormulaFormToDto,
|
|
377
393
|
modificationPropertiesSchema,
|
|
378
394
|
newEquipmentDeletionDto,
|
|
379
395
|
sanitizeLimitNames,
|
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
|
});
|