@gridsuite/commons-ui 0.269.0 → 0.270.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/features/index.js +9 -1
- package/dist/features/network-modifications/index.js +9 -1
- package/dist/features/network-modifications/voltageLevel/index.d.ts +1 -0
- package/dist/features/network-modifications/voltageLevel/index.js +9 -1
- package/dist/features/network-modifications/voltageLevel/section/VoltageLevelSectionCreationForm.d.ts +10 -0
- package/dist/features/network-modifications/voltageLevel/section/VoltageLevelSectionCreationForm.js +375 -0
- package/dist/features/network-modifications/voltageLevel/section/index.d.ts +9 -0
- package/dist/features/network-modifications/voltageLevel/section/index.js +10 -0
- package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.types.d.ts +15 -0
- package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.types.js +1 -0
- package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.utils.d.ts +48 -0
- package/dist/features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.utils.js +100 -0
- package/dist/index.js +9 -1
- package/dist/translations/en/networkModificationsEn.d.ts +17 -0
- package/dist/translations/en/networkModificationsEn.js +20 -2
- package/dist/translations/fr/networkModificationsFr.d.ts +17 -0
- package/dist/translations/fr/networkModificationsFr.js +20 -2
- package/package.json +1 -1
package/dist/features/index.js
CHANGED
|
@@ -166,6 +166,8 @@ import { VoltageLevelModificationForm } from "./network-modifications/voltageLev
|
|
|
166
166
|
import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./network-modifications/voltageLevel/modification/voltageLevelModification.utils.js";
|
|
167
167
|
import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.js";
|
|
168
168
|
import { CreateVoltageLevelTopologyForm } from "./network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.js";
|
|
169
|
+
import { VoltageLevelSectionCreationForm } from "./network-modifications/voltageLevel/section/VoltageLevelSectionCreationForm.js";
|
|
170
|
+
import { POSITION_NEW_SECTION_SIDE, voltageLevelSectionCreationDtoToForm, voltageLevelSectionCreationEmptyFormData, voltageLevelSectionCreationFormSchema, voltageLevelSectionCreationFormToDto } from "./network-modifications/voltageLevel/section/voltageLevelSectionCreation.utils.js";
|
|
169
171
|
import { LOAD_TAB_FIELDS, LoadDialogTab } from "./network-modifications/load/common/load.utils.js";
|
|
170
172
|
import { LoadDialogTabs } from "./network-modifications/load/common/LoadDialogTabs.js";
|
|
171
173
|
import { LoadDialogTabsContent } from "./network-modifications/load/common/LoadDialogTabsContent.js";
|
|
@@ -490,6 +492,7 @@ export {
|
|
|
490
492
|
PARAM_STATE_ESTIMATION,
|
|
491
493
|
PARAM_SUBSTATION_LAYOUT,
|
|
492
494
|
PHASE_SHIFTER_REGULATION_ON,
|
|
495
|
+
POSITION_NEW_SECTION_SIDE,
|
|
493
496
|
PRIORITY,
|
|
494
497
|
PROVIDER,
|
|
495
498
|
PSTS_EQUIPMENT_TYPES,
|
|
@@ -624,6 +627,7 @@ export {
|
|
|
624
627
|
VoltageLevelConnectivityForm,
|
|
625
628
|
VoltageLevelCreationForm,
|
|
626
629
|
VoltageLevelModificationForm,
|
|
630
|
+
VoltageLevelSectionCreationForm,
|
|
627
631
|
VoltageRegulationForm,
|
|
628
632
|
WRITE_SLACK_BUS,
|
|
629
633
|
addGlobalFilterId,
|
|
@@ -921,5 +925,9 @@ export {
|
|
|
921
925
|
voltageLevelModificationFormToDto,
|
|
922
926
|
voltageLevelModificationWithMeasurementsDtoToForm,
|
|
923
927
|
voltageLevelModificationWithMeasurementsFormSchema,
|
|
924
|
-
voltageLevelModificationWithMeasurementsFormToDto
|
|
928
|
+
voltageLevelModificationWithMeasurementsFormToDto,
|
|
929
|
+
voltageLevelSectionCreationDtoToForm,
|
|
930
|
+
voltageLevelSectionCreationEmptyFormData,
|
|
931
|
+
voltageLevelSectionCreationFormSchema,
|
|
932
|
+
voltageLevelSectionCreationFormToDto
|
|
925
933
|
};
|
|
@@ -94,6 +94,8 @@ import { VoltageLevelModificationForm } from "./voltageLevel/modification/Voltag
|
|
|
94
94
|
import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./voltageLevel/modification/voltageLevelModification.utils.js";
|
|
95
95
|
import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./voltageLevel/topology/voltageLevelTopologyCreation.utils.js";
|
|
96
96
|
import { CreateVoltageLevelTopologyForm } from "./voltageLevel/topology/CreateVoltageLevelTopologyForm.js";
|
|
97
|
+
import { VoltageLevelSectionCreationForm } from "./voltageLevel/section/VoltageLevelSectionCreationForm.js";
|
|
98
|
+
import { POSITION_NEW_SECTION_SIDE, voltageLevelSectionCreationDtoToForm, voltageLevelSectionCreationEmptyFormData, voltageLevelSectionCreationFormSchema, voltageLevelSectionCreationFormToDto } from "./voltageLevel/section/voltageLevelSectionCreation.utils.js";
|
|
97
99
|
import { LOAD_TAB_FIELDS, LoadDialogTab } from "./load/common/load.utils.js";
|
|
98
100
|
import { LoadDialogTabs } from "./load/common/LoadDialogTabs.js";
|
|
99
101
|
import { LoadDialogTabsContent } from "./load/common/LoadDialogTabsContent.js";
|
|
@@ -214,6 +216,7 @@ export {
|
|
|
214
216
|
OPERATOR,
|
|
215
217
|
OperationalLimitsGroupTabLabel,
|
|
216
218
|
OperationalLimitsGroups,
|
|
219
|
+
POSITION_NEW_SECTION_SIDE,
|
|
217
220
|
PowerMeasurementsForm,
|
|
218
221
|
PowerWithValidityForm,
|
|
219
222
|
PropertiesForm,
|
|
@@ -253,6 +256,7 @@ export {
|
|
|
253
256
|
VoltageLevelConnectivityForm,
|
|
254
257
|
VoltageLevelCreationForm,
|
|
255
258
|
VoltageLevelModificationForm,
|
|
259
|
+
VoltageLevelSectionCreationForm,
|
|
256
260
|
VoltageRegulationForm,
|
|
257
261
|
addModificationTypeToOpLimitsGroups,
|
|
258
262
|
addModificationTypeToTemporaryLimits,
|
|
@@ -469,5 +473,9 @@ export {
|
|
|
469
473
|
voltageLevelModificationFormToDto,
|
|
470
474
|
voltageLevelModificationWithMeasurementsDtoToForm,
|
|
471
475
|
voltageLevelModificationWithMeasurementsFormSchema,
|
|
472
|
-
voltageLevelModificationWithMeasurementsFormToDto
|
|
476
|
+
voltageLevelModificationWithMeasurementsFormToDto,
|
|
477
|
+
voltageLevelSectionCreationDtoToForm,
|
|
478
|
+
voltageLevelSectionCreationEmptyFormData,
|
|
479
|
+
voltageLevelSectionCreationFormSchema,
|
|
480
|
+
voltageLevelSectionCreationFormToDto
|
|
473
481
|
};
|
|
@@ -72,15 +72,19 @@ import { VoltageLevelModificationForm } from "./modification/VoltageLevelModific
|
|
|
72
72
|
import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./modification/voltageLevelModification.utils.js";
|
|
73
73
|
import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./topology/voltageLevelTopologyCreation.utils.js";
|
|
74
74
|
import { CreateVoltageLevelTopologyForm } from "./topology/CreateVoltageLevelTopologyForm.js";
|
|
75
|
+
import { VoltageLevelSectionCreationForm } from "./section/VoltageLevelSectionCreationForm.js";
|
|
76
|
+
import { POSITION_NEW_SECTION_SIDE, voltageLevelSectionCreationDtoToForm, voltageLevelSectionCreationEmptyFormData, voltageLevelSectionCreationFormSchema, voltageLevelSectionCreationFormToDto } from "./section/voltageLevelSectionCreation.utils.js";
|
|
75
77
|
export {
|
|
76
78
|
CouplingDeviceCreationForm,
|
|
77
79
|
CreateVoltageLevelTopologyForm,
|
|
78
80
|
MAX_SECTIONS_COUNT,
|
|
81
|
+
POSITION_NEW_SECTION_SIDE,
|
|
79
82
|
SWITCH_TYPE,
|
|
80
83
|
SwitchKind,
|
|
81
84
|
SwitchesBetweenSections,
|
|
82
85
|
VoltageLevelCreationForm,
|
|
83
86
|
VoltageLevelModificationForm,
|
|
87
|
+
VoltageLevelSectionCreationForm,
|
|
84
88
|
buildNewBusbarSections,
|
|
85
89
|
couplingDeviceCreationDtoToForm,
|
|
86
90
|
couplingDeviceCreationFormSchema,
|
|
@@ -103,5 +107,9 @@ export {
|
|
|
103
107
|
voltageLevelModificationFormToDto,
|
|
104
108
|
voltageLevelModificationWithMeasurementsDtoToForm,
|
|
105
109
|
voltageLevelModificationWithMeasurementsFormSchema,
|
|
106
|
-
voltageLevelModificationWithMeasurementsFormToDto
|
|
110
|
+
voltageLevelModificationWithMeasurementsFormToDto,
|
|
111
|
+
voltageLevelSectionCreationDtoToForm,
|
|
112
|
+
voltageLevelSectionCreationEmptyFormData,
|
|
113
|
+
voltageLevelSectionCreationFormSchema,
|
|
114
|
+
voltageLevelSectionCreationFormToDto
|
|
107
115
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PositionDiagramPaneType } from '../../common/connectivity/connectivity.type';
|
|
2
|
+
import { BusBarSections } from './voltageLevelSectionCreation.types';
|
|
3
|
+
export interface VoltageLevelSectionCreationFormProps {
|
|
4
|
+
busBarSectionInfos?: BusBarSections;
|
|
5
|
+
allBusbarSectionsList?: string[];
|
|
6
|
+
isSymmetricalNbBusBarSections?: boolean;
|
|
7
|
+
isNotFoundOrNotSupported?: boolean;
|
|
8
|
+
PositionDiagramPane?: PositionDiagramPaneType;
|
|
9
|
+
}
|
|
10
|
+
export declare function VoltageLevelSectionCreationForm({ busBarSectionInfos, allBusbarSectionsList, isSymmetricalNbBusBarSections, isNotFoundOrNotSupported, PositionDiagramPane, }: Readonly<VoltageLevelSectionCreationFormProps>): import("react").JSX.Element;
|
package/dist/features/network-modifications/voltageLevel/section/VoltageLevelSectionCreationForm.js
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useMemo, useCallback } from "react";
|
|
3
|
+
import { TextField, Tooltip, Box, Grid, Button, Typography, Slider } from "@mui/material";
|
|
4
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
|
+
import { InfoOutlined } from "@mui/icons-material";
|
|
6
|
+
import { useFormContext, useWatch } from "react-hook-form";
|
|
7
|
+
import "../../../../components/ui/overflowableText/OverflowableText.js";
|
|
8
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
9
|
+
import "../../../../utils/conversionUtils.js";
|
|
10
|
+
import "../../../../utils/types/equipmentType.js";
|
|
11
|
+
import { areIdsEqual, getObjectId } from "../../../../utils/ts-utils.js";
|
|
12
|
+
import "localized-countries";
|
|
13
|
+
import "localized-countries/data/fr";
|
|
14
|
+
import "localized-countries/data/en";
|
|
15
|
+
import "notistack";
|
|
16
|
+
import "../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
17
|
+
import { useCustomFormContext } from "../../../../components/ui/reactHookForm/provider/useCustomFormContext.js";
|
|
18
|
+
import "yup";
|
|
19
|
+
import "../../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
20
|
+
import { AutocompleteInput } from "../../../../components/ui/reactHookForm/autocompleteInputs/AutocompleteInput.js";
|
|
21
|
+
import { SwitchInput } from "../../../../components/ui/reactHookForm/booleans/SwitchInput.js";
|
|
22
|
+
import "../../../../components/ui/reactHookForm/numbers/RangeInput.js";
|
|
23
|
+
import { SelectInput } from "../../../../components/ui/reactHookForm/selectInputs/SelectInput.js";
|
|
24
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
25
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
|
|
29
|
+
import "../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
30
|
+
import "../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
31
|
+
import "../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
|
|
32
|
+
import "@hello-pangea/dnd";
|
|
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 { GridSection } from "../../../../components/composite/grid/grid-section.js";
|
|
39
|
+
import { filledTextField } from "../../common/form.utils.js";
|
|
40
|
+
import "../../common/properties/propertyUtils.js";
|
|
41
|
+
import "react-dom";
|
|
42
|
+
import "autosuggest-highlight/match";
|
|
43
|
+
import "autosuggest-highlight/parse";
|
|
44
|
+
import "clsx";
|
|
45
|
+
import "../../../../components/composite/filter/FilterCreationDialog.js";
|
|
46
|
+
import "../../../../components/composite/filter/HeaderFilterForm.js";
|
|
47
|
+
import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
48
|
+
import "../../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
49
|
+
import "../../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
50
|
+
import "../../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
51
|
+
import "react-querybuilder";
|
|
52
|
+
import "uuid";
|
|
53
|
+
import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
54
|
+
import "../../../../components/composite/filter/utils/filterFormUtils.js";
|
|
55
|
+
import "@react-querybuilder/material";
|
|
56
|
+
import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
57
|
+
import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
58
|
+
import "../../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
59
|
+
import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
60
|
+
import "ag-grid-community";
|
|
61
|
+
import "../../../../components/composite/customAGGrid/customAggrid.js";
|
|
62
|
+
import "../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
|
|
63
|
+
import "mathjs";
|
|
64
|
+
import "../../../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
65
|
+
import "react-window";
|
|
66
|
+
import "../../../../components/composite/report/report-treeview/treeview-item.js";
|
|
67
|
+
import "../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
68
|
+
import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
|
|
69
|
+
import "@mui/material/colors";
|
|
70
|
+
import "@mui/x-charts";
|
|
71
|
+
import "../../common/currentLimits/limitsPane.utils.js";
|
|
72
|
+
import { SWITCH_TYPE } from "../creation/voltageLevelCreation.utils.js";
|
|
73
|
+
import "../creation/voltageLevel.constants.js";
|
|
74
|
+
import { POSITION_NEW_SECTION_SIDE } from "./voltageLevelSectionCreation.utils.js";
|
|
75
|
+
const getArrayPosition = (data, selectedOptionId) => {
|
|
76
|
+
if (!selectedOptionId || !data) {
|
|
77
|
+
return { position: -1, length: 0 };
|
|
78
|
+
}
|
|
79
|
+
const matchingArray = Object.values(data).find(
|
|
80
|
+
(array) => Array.isArray(array) && array.indexOf(selectedOptionId) !== -1
|
|
81
|
+
);
|
|
82
|
+
if (matchingArray) {
|
|
83
|
+
return { position: matchingArray.indexOf(selectedOptionId), length: matchingArray.length };
|
|
84
|
+
}
|
|
85
|
+
return { position: -1, length: 0 };
|
|
86
|
+
};
|
|
87
|
+
function VoltageLevelSectionCreationForm({
|
|
88
|
+
busBarSectionInfos,
|
|
89
|
+
allBusbarSectionsList,
|
|
90
|
+
isSymmetricalNbBusBarSections = false,
|
|
91
|
+
isNotFoundOrNotSupported = false,
|
|
92
|
+
PositionDiagramPane
|
|
93
|
+
}) {
|
|
94
|
+
const intl = useIntl();
|
|
95
|
+
const { isNodeBuilt, isUpdate } = useCustomFormContext();
|
|
96
|
+
const [isDiagramPaneOpen, setIsDiagramPaneOpen] = useState(false);
|
|
97
|
+
const [busBarSectionsIdOptions, setBusBarSectionsIdOptions] = useState([]);
|
|
98
|
+
const [isNotRequiredSwitchBefore, setIsNotRequiredSwitchBefore] = useState(false);
|
|
99
|
+
const [isNotRequiredSwitchAfter, setIsNotRequiredSwitchAfter] = useState(false);
|
|
100
|
+
const { setValue } = useFormContext();
|
|
101
|
+
const voltageLevelId = useWatch({ name: FieldConstants.EQUIPMENT_ID });
|
|
102
|
+
const busbarIndex = useWatch({ name: FieldConstants.BUS_BAR_INDEX });
|
|
103
|
+
const selectedOption = useWatch({ name: FieldConstants.BUSBAR_SECTION_ID });
|
|
104
|
+
const selectedPositionOption = useWatch({ name: FieldConstants.IS_AFTER_BUSBAR_SECTION_ID });
|
|
105
|
+
const isFreeInputMode = !busBarSectionInfos;
|
|
106
|
+
const voltageLevelIdField = /* @__PURE__ */ jsx(
|
|
107
|
+
TextField,
|
|
108
|
+
{
|
|
109
|
+
size: "small",
|
|
110
|
+
fullWidth: true,
|
|
111
|
+
label: intl.formatMessage({ id: "VoltageLevelId" }),
|
|
112
|
+
value: voltageLevelId ?? "",
|
|
113
|
+
slotProps: {
|
|
114
|
+
input: {
|
|
115
|
+
readOnly: true
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
disabled: true,
|
|
119
|
+
...filledTextField
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
const switchValue = useWatch({ name: FieldConstants.NEW_SWITCH_STATES });
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (busBarSectionInfos && busbarIndex) {
|
|
125
|
+
const selectedKey = busbarIndex?.id;
|
|
126
|
+
setValue(FieldConstants.ALL_BUS_BAR_SECTIONS, false);
|
|
127
|
+
if (selectedKey === "all") {
|
|
128
|
+
setValue(FieldConstants.ALL_BUS_BAR_SECTIONS, true);
|
|
129
|
+
if (allBusbarSectionsList && Array.isArray(allBusbarSectionsList)) {
|
|
130
|
+
const options2 = allBusbarSectionsList.filter((id) => Boolean(id)).map((id) => ({
|
|
131
|
+
id,
|
|
132
|
+
label: id
|
|
133
|
+
}));
|
|
134
|
+
setBusBarSectionsIdOptions(options2);
|
|
135
|
+
} else {
|
|
136
|
+
setBusBarSectionsIdOptions([]);
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const sections = busBarSectionInfos[selectedKey];
|
|
141
|
+
if (!sections || !Array.isArray(sections)) {
|
|
142
|
+
setBusBarSectionsIdOptions([]);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const options = sections.filter((id) => Boolean(id)).map((id) => ({
|
|
146
|
+
id,
|
|
147
|
+
label: id
|
|
148
|
+
}));
|
|
149
|
+
setBusBarSectionsIdOptions(options);
|
|
150
|
+
} else {
|
|
151
|
+
setBusBarSectionsIdOptions([]);
|
|
152
|
+
}
|
|
153
|
+
}, [allBusbarSectionsList, busBarSectionInfos, intl, busbarIndex, setValue]);
|
|
154
|
+
const arrayPosition = useMemo(
|
|
155
|
+
() => busBarSectionInfos && getArrayPosition(busBarSectionInfos, selectedOption?.id),
|
|
156
|
+
[busBarSectionInfos, selectedOption?.id]
|
|
157
|
+
);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (selectedOption && selectedPositionOption && busBarSectionInfos && arrayPosition) {
|
|
160
|
+
const selectedSectionIndex = arrayPosition.position;
|
|
161
|
+
const busBarSections = arrayPosition.length - 1;
|
|
162
|
+
if (selectedSectionIndex === 0 && selectedPositionOption === POSITION_NEW_SECTION_SIDE.BEFORE.id) {
|
|
163
|
+
setValue(FieldConstants.SWITCH_BEFORE_NOT_REQUIRED, true);
|
|
164
|
+
setIsNotRequiredSwitchBefore(true);
|
|
165
|
+
} else {
|
|
166
|
+
setValue(FieldConstants.SWITCH_BEFORE_NOT_REQUIRED, false);
|
|
167
|
+
setIsNotRequiredSwitchBefore(false);
|
|
168
|
+
}
|
|
169
|
+
if (busBarSections === selectedSectionIndex && selectedPositionOption === POSITION_NEW_SECTION_SIDE.AFTER.id) {
|
|
170
|
+
setValue(FieldConstants.SWITCH_AFTER_NOT_REQUIRED, true);
|
|
171
|
+
setIsNotRequiredSwitchAfter(true);
|
|
172
|
+
} else {
|
|
173
|
+
setValue(FieldConstants.SWITCH_AFTER_NOT_REQUIRED, false);
|
|
174
|
+
setIsNotRequiredSwitchAfter(false);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (isUpdate && isNodeBuilt) {
|
|
178
|
+
setValue(FieldConstants.SWITCH_AFTER_NOT_REQUIRED, true);
|
|
179
|
+
setValue(FieldConstants.SWITCH_BEFORE_NOT_REQUIRED, true);
|
|
180
|
+
}
|
|
181
|
+
}, [selectedOption, setValue, busBarSectionInfos, selectedPositionOption, arrayPosition, isUpdate, isNodeBuilt]);
|
|
182
|
+
const busBarIndexOptions = useMemo(() => {
|
|
183
|
+
if (busBarSectionInfos) {
|
|
184
|
+
const sortedOptions = Object.keys(busBarSectionInfos || {}).sort((a, b) => parseInt(a, 10) - parseInt(b, 10)).map((key) => ({
|
|
185
|
+
id: key,
|
|
186
|
+
label: key
|
|
187
|
+
}));
|
|
188
|
+
const allOption = {
|
|
189
|
+
id: "all",
|
|
190
|
+
label: intl.formatMessage({ id: "allBusbarSections" }),
|
|
191
|
+
disabled: !isSymmetricalNbBusBarSections
|
|
192
|
+
};
|
|
193
|
+
return [...sortedOptions, allOption];
|
|
194
|
+
}
|
|
195
|
+
return [];
|
|
196
|
+
}, [busBarSectionInfos, intl, isSymmetricalNbBusBarSections]);
|
|
197
|
+
const getOptionLabel = (object) => {
|
|
198
|
+
if (typeof object === "string") {
|
|
199
|
+
return object;
|
|
200
|
+
}
|
|
201
|
+
if (object?.id === "all") {
|
|
202
|
+
return intl.formatMessage({ id: "allBusbarSections" }) ?? "";
|
|
203
|
+
}
|
|
204
|
+
return String(object?.id ?? "");
|
|
205
|
+
};
|
|
206
|
+
const isOptionEqualToValue = (val1, val2) => {
|
|
207
|
+
const getId = (option) => {
|
|
208
|
+
return typeof option === "string" ? option : String(option?.id ?? "");
|
|
209
|
+
};
|
|
210
|
+
return getId(val1) === getId(val2);
|
|
211
|
+
};
|
|
212
|
+
const handleChangeBusbarIndex = useCallback(() => {
|
|
213
|
+
if (!isFreeInputMode) {
|
|
214
|
+
setValue(FieldConstants.BUSBAR_SECTION_ID, null);
|
|
215
|
+
}
|
|
216
|
+
}, [isFreeInputMode, setValue]);
|
|
217
|
+
const freeInputOutputTransform = useCallback(
|
|
218
|
+
(value) => typeof value === "string" ? { id: value, label: value } : value,
|
|
219
|
+
[]
|
|
220
|
+
);
|
|
221
|
+
const busbarCountField = /* @__PURE__ */ jsx(
|
|
222
|
+
AutocompleteInput,
|
|
223
|
+
{
|
|
224
|
+
name: FieldConstants.BUS_BAR_INDEX,
|
|
225
|
+
label: "Busbar",
|
|
226
|
+
onChangeCallback: handleChangeBusbarIndex,
|
|
227
|
+
options: busBarIndexOptions,
|
|
228
|
+
getOptionLabel,
|
|
229
|
+
isOptionEqualToValue,
|
|
230
|
+
allowNewValue: isFreeInputMode,
|
|
231
|
+
outputTransform: freeInputOutputTransform,
|
|
232
|
+
renderOption: (props, option) => {
|
|
233
|
+
const allOptionsDisabled = option.id === "all" && option?.disabled;
|
|
234
|
+
const { key, ...otherProps } = props;
|
|
235
|
+
return /* @__PURE__ */ jsx("li", { ...otherProps, children: /* @__PURE__ */ jsxs("div", { children: [
|
|
236
|
+
/* @__PURE__ */ jsx("div", { children: getOptionLabel(option) }),
|
|
237
|
+
allOptionsDisabled && /* @__PURE__ */ jsx(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
style: {
|
|
241
|
+
fontSize: "0.85rem",
|
|
242
|
+
color: "red",
|
|
243
|
+
marginTop: "2px"
|
|
244
|
+
},
|
|
245
|
+
children: intl.formatMessage({ id: "allOptionHelperText" })
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
] }) }, key);
|
|
249
|
+
},
|
|
250
|
+
getOptionDisabled: (option) => option?.disabled,
|
|
251
|
+
size: "small",
|
|
252
|
+
disabled: isNotFoundOrNotSupported
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
const busbarSectionsField = /* @__PURE__ */ jsx(
|
|
256
|
+
AutocompleteInput,
|
|
257
|
+
{
|
|
258
|
+
name: FieldConstants.BUSBAR_SECTION_ID,
|
|
259
|
+
label: "BusBarSectionsReference",
|
|
260
|
+
options: busBarSectionsIdOptions,
|
|
261
|
+
getOptionLabel: getObjectId,
|
|
262
|
+
isOptionEqualToValue: areIdsEqual,
|
|
263
|
+
allowNewValue: isFreeInputMode,
|
|
264
|
+
outputTransform: freeInputOutputTransform,
|
|
265
|
+
size: "small",
|
|
266
|
+
disabled: !busbarIndex || isNotFoundOrNotSupported
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
const positionSideNewSectionField = /* @__PURE__ */ jsx(
|
|
270
|
+
SelectInput,
|
|
271
|
+
{
|
|
272
|
+
name: FieldConstants.IS_AFTER_BUSBAR_SECTION_ID,
|
|
273
|
+
label: "isAfterBusBarSectionId",
|
|
274
|
+
options: Object.values(POSITION_NEW_SECTION_SIDE),
|
|
275
|
+
size: "small",
|
|
276
|
+
disabled: !busbarIndex || isNotFoundOrNotSupported
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
const switchBeforeField = /* @__PURE__ */ jsx(
|
|
280
|
+
SelectInput,
|
|
281
|
+
{
|
|
282
|
+
name: FieldConstants.SWITCHES_BEFORE_SECTIONS,
|
|
283
|
+
label: "switchesBeforeSections",
|
|
284
|
+
options: Object.values(SWITCH_TYPE),
|
|
285
|
+
size: "small",
|
|
286
|
+
disabled: !busbarIndex || isNotRequiredSwitchBefore || isNotFoundOrNotSupported
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
const switchAfterField = /* @__PURE__ */ jsx(
|
|
290
|
+
SelectInput,
|
|
291
|
+
{
|
|
292
|
+
name: FieldConstants.SWITCHES_AFTER_SECTIONS,
|
|
293
|
+
label: "switchesAfterSections",
|
|
294
|
+
options: Object.values(SWITCH_TYPE),
|
|
295
|
+
size: "small",
|
|
296
|
+
disabled: !busbarIndex || isNotRequiredSwitchAfter || isNotFoundOrNotSupported
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
const newSwitchState = /* @__PURE__ */ jsx(
|
|
300
|
+
SwitchInput,
|
|
301
|
+
{
|
|
302
|
+
name: FieldConstants.NEW_SWITCH_STATES,
|
|
303
|
+
label: switchValue ? "areSwitchesClosed" : "areSwitchesOpen"
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
const getLabelDescription = useCallback(() => {
|
|
307
|
+
return intl.formatMessage({ id: "newSection" });
|
|
308
|
+
}, [intl]);
|
|
309
|
+
const newSectionField = /* @__PURE__ */ jsx(
|
|
310
|
+
Slider,
|
|
311
|
+
{
|
|
312
|
+
min: 0,
|
|
313
|
+
max: 3,
|
|
314
|
+
step: 0.1,
|
|
315
|
+
value: 1.5,
|
|
316
|
+
track: false,
|
|
317
|
+
valueLabelFormat: getLabelDescription,
|
|
318
|
+
valueLabelDisplay: "on",
|
|
319
|
+
size: "medium",
|
|
320
|
+
disabled: true,
|
|
321
|
+
sx: {
|
|
322
|
+
"& .MuiSlider-thumb": {
|
|
323
|
+
backgroundColor: "#1976d2",
|
|
324
|
+
color: "#1976d2",
|
|
325
|
+
"&:hover": {
|
|
326
|
+
backgroundColor: "#1976d2"
|
|
327
|
+
},
|
|
328
|
+
"&.Mui-disabled": {
|
|
329
|
+
backgroundColor: "#1976d2",
|
|
330
|
+
color: "#1976d2"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
const handleCloseDiagramPane = useCallback(() => {
|
|
337
|
+
setIsDiagramPaneOpen(false);
|
|
338
|
+
}, []);
|
|
339
|
+
const handleClickOpenDiagramPane = useCallback(() => {
|
|
340
|
+
setIsDiagramPaneOpen(true);
|
|
341
|
+
}, []);
|
|
342
|
+
const diagramToolTip = /* @__PURE__ */ jsx(Tooltip, { sx: { paddingLeft: 1 }, title: intl.formatMessage({ id: "builtNodeTooltipForDiagram" }), children: /* @__PURE__ */ jsx(InfoOutlined, { color: "info", fontSize: "medium" }) });
|
|
343
|
+
return /* @__PURE__ */ jsxs(Box, { sx: { p: 2 }, children: [
|
|
344
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
345
|
+
/* @__PURE__ */ jsx(Grid, { size: 12, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, alignItems: "center", children: [
|
|
346
|
+
/* @__PURE__ */ jsx(Grid, { size: { xs: 12, md: 6 }, children: voltageLevelIdField }),
|
|
347
|
+
PositionDiagramPane && isNodeBuilt && /* @__PURE__ */ jsxs(Grid, { size: { xs: 12, md: 3 }, children: [
|
|
348
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleClickOpenDiagramPane, variant: "outlined", size: "small", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "CreateCouplingDeviceDiagramButton" }) }),
|
|
349
|
+
diagramToolTip
|
|
350
|
+
] })
|
|
351
|
+
] }) }),
|
|
352
|
+
isNotFoundOrNotSupported && /* @__PURE__ */ jsx(Grid, { size: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", color: "red", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "notValidVoltageLevel" }) }) }),
|
|
353
|
+
/* @__PURE__ */ jsx(Grid, { size: 12, children: /* @__PURE__ */ jsx(GridSection, { title: "SectionPosition" }) }),
|
|
354
|
+
/* @__PURE__ */ jsx(Grid, { size: 4, children: busbarCountField }),
|
|
355
|
+
/* @__PURE__ */ jsx(Grid, { size: 4, children: busbarSectionsField }),
|
|
356
|
+
/* @__PURE__ */ jsx(Grid, { size: 4, children: positionSideNewSectionField }),
|
|
357
|
+
/* @__PURE__ */ jsx(Grid, { size: 12, children: /* @__PURE__ */ jsx(GridSection, { title: "Switch" }) }),
|
|
358
|
+
/* @__PURE__ */ jsx(Grid, { size: { xs: 12, sm: 4 }, children: switchBeforeField }),
|
|
359
|
+
/* @__PURE__ */ jsx(Grid, { size: { xs: 12, sm: 4 }, children: newSectionField }),
|
|
360
|
+
/* @__PURE__ */ jsx(Grid, { size: { xs: 12, sm: 4 }, children: switchAfterField }),
|
|
361
|
+
/* @__PURE__ */ jsx(Grid, { size: 12, children: newSwitchState })
|
|
362
|
+
] }),
|
|
363
|
+
PositionDiagramPane && /* @__PURE__ */ jsx(
|
|
364
|
+
PositionDiagramPane,
|
|
365
|
+
{
|
|
366
|
+
open: isDiagramPaneOpen,
|
|
367
|
+
onClose: handleCloseDiagramPane,
|
|
368
|
+
voltageLevelId
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
] });
|
|
372
|
+
}
|
|
373
|
+
export {
|
|
374
|
+
VoltageLevelSectionCreationForm
|
|
375
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './VoltageLevelSectionCreationForm';
|
|
8
|
+
export * from './voltageLevelSectionCreation.types';
|
|
9
|
+
export * from './voltageLevelSectionCreation.utils';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VoltageLevelSectionCreationForm } from "./VoltageLevelSectionCreationForm.js";
|
|
2
|
+
import { POSITION_NEW_SECTION_SIDE, voltageLevelSectionCreationDtoToForm, voltageLevelSectionCreationEmptyFormData, voltageLevelSectionCreationFormSchema, voltageLevelSectionCreationFormToDto } from "./voltageLevelSectionCreation.utils.js";
|
|
3
|
+
export {
|
|
4
|
+
POSITION_NEW_SECTION_SIDE,
|
|
5
|
+
VoltageLevelSectionCreationForm,
|
|
6
|
+
voltageLevelSectionCreationDtoToForm,
|
|
7
|
+
voltageLevelSectionCreationEmptyFormData,
|
|
8
|
+
voltageLevelSectionCreationFormSchema,
|
|
9
|
+
voltageLevelSectionCreationFormToDto
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { ModificationType } from '../../../../utils';
|
|
3
|
+
export type BusBarSections = Record<string, string[]>;
|
|
4
|
+
export interface VoltageLevelSectionCreationDto {
|
|
5
|
+
type: ModificationType;
|
|
6
|
+
uuid?: UUID;
|
|
7
|
+
voltageLevelId: string;
|
|
8
|
+
busbarIndex: string | null;
|
|
9
|
+
busbarSectionId: string | null;
|
|
10
|
+
allBusbars: boolean;
|
|
11
|
+
afterBusbarSectionId: boolean;
|
|
12
|
+
leftSwitchKind: string | null;
|
|
13
|
+
rightSwitchKind: string | null;
|
|
14
|
+
switchOpen: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { InferType } from 'yup';
|
|
2
|
+
import { DeepNullable } from '../../../../utils';
|
|
3
|
+
import { BusBarSections, VoltageLevelSectionCreationDto } from './voltageLevelSectionCreation.types';
|
|
4
|
+
export declare const POSITION_NEW_SECTION_SIDE: {
|
|
5
|
+
readonly BEFORE: {
|
|
6
|
+
readonly id: "BEFORE";
|
|
7
|
+
readonly label: "Before";
|
|
8
|
+
};
|
|
9
|
+
readonly AFTER: {
|
|
10
|
+
readonly id: "AFTER";
|
|
11
|
+
readonly label: "After";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const voltageLevelSectionCreationFormSchema: import('yup').ObjectSchema<{
|
|
15
|
+
equipmentID: string;
|
|
16
|
+
busbarIndex: {
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
busbarSectionId: {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
isAfterBusBarSectionId: string;
|
|
23
|
+
switchesBeforeSections: string | null | undefined;
|
|
24
|
+
switchesAfterSections: string | null | undefined;
|
|
25
|
+
allBusbarSections: boolean | undefined;
|
|
26
|
+
newSwitchStates: boolean | undefined;
|
|
27
|
+
switchBeforeNotRequired: boolean | undefined;
|
|
28
|
+
switchAfterNotRequired: boolean | undefined;
|
|
29
|
+
}, import('yup').AnyObject, {
|
|
30
|
+
equipmentID: undefined;
|
|
31
|
+
busbarIndex: {
|
|
32
|
+
id: undefined;
|
|
33
|
+
};
|
|
34
|
+
busbarSectionId: {
|
|
35
|
+
id: undefined;
|
|
36
|
+
};
|
|
37
|
+
isAfterBusBarSectionId: undefined;
|
|
38
|
+
switchesBeforeSections: undefined;
|
|
39
|
+
switchesAfterSections: undefined;
|
|
40
|
+
allBusbarSections: undefined;
|
|
41
|
+
newSwitchStates: undefined;
|
|
42
|
+
switchBeforeNotRequired: undefined;
|
|
43
|
+
switchAfterNotRequired: undefined;
|
|
44
|
+
}, "">;
|
|
45
|
+
export type VoltageLevelSectionCreationFormData = InferType<typeof voltageLevelSectionCreationFormSchema>;
|
|
46
|
+
export declare const voltageLevelSectionCreationEmptyFormData: DeepNullable<VoltageLevelSectionCreationFormData>;
|
|
47
|
+
export declare const voltageLevelSectionCreationDtoToForm: (dto: VoltageLevelSectionCreationDto) => VoltageLevelSectionCreationFormData;
|
|
48
|
+
export declare const voltageLevelSectionCreationFormToDto: (form: VoltageLevelSectionCreationFormData, busBarSectionInfos?: BusBarSections) => VoltageLevelSectionCreationDto;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { object, boolean, string } from "yup";
|
|
2
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import "../../../../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
|
+
const POSITION_NEW_SECTION_SIDE = {
|
|
9
|
+
BEFORE: { id: "BEFORE", label: "Before" },
|
|
10
|
+
AFTER: { id: "AFTER", label: "After" }
|
|
11
|
+
};
|
|
12
|
+
const voltageLevelSectionCreationFormSchema = object().shape({
|
|
13
|
+
[FieldConstants.EQUIPMENT_ID]: string().required(),
|
|
14
|
+
[FieldConstants.BUS_BAR_INDEX]: object().nullable().required().shape({
|
|
15
|
+
[FieldConstants.ID]: string().nullable().required()
|
|
16
|
+
}),
|
|
17
|
+
[FieldConstants.BUSBAR_SECTION_ID]: object().nullable().required().shape({
|
|
18
|
+
[FieldConstants.ID]: string().nullable().required()
|
|
19
|
+
}),
|
|
20
|
+
[FieldConstants.IS_AFTER_BUSBAR_SECTION_ID]: string().nullable().required(),
|
|
21
|
+
[FieldConstants.SWITCHES_BEFORE_SECTIONS]: string().nullable().when([FieldConstants.IS_AFTER_BUSBAR_SECTION_ID, FieldConstants.SWITCH_BEFORE_NOT_REQUIRED], {
|
|
22
|
+
is: (isAfterBusBarSectionId, switchBeforeNotRequired) => isAfterBusBarSectionId === POSITION_NEW_SECTION_SIDE.BEFORE.id && switchBeforeNotRequired,
|
|
23
|
+
then: (schema) => schema.notRequired(),
|
|
24
|
+
otherwise: (schema) => schema.required()
|
|
25
|
+
}),
|
|
26
|
+
[FieldConstants.SWITCHES_AFTER_SECTIONS]: string().nullable().when([FieldConstants.IS_AFTER_BUSBAR_SECTION_ID, FieldConstants.SWITCH_AFTER_NOT_REQUIRED], {
|
|
27
|
+
is: (isAfterBusBarSectionId, switchAfterNotRequired) => isAfterBusBarSectionId === POSITION_NEW_SECTION_SIDE.AFTER.id && switchAfterNotRequired,
|
|
28
|
+
then: (schema) => schema.notRequired(),
|
|
29
|
+
otherwise: (schema) => schema.required()
|
|
30
|
+
}),
|
|
31
|
+
[FieldConstants.ALL_BUS_BAR_SECTIONS]: boolean(),
|
|
32
|
+
[FieldConstants.NEW_SWITCH_STATES]: boolean(),
|
|
33
|
+
[FieldConstants.SWITCH_BEFORE_NOT_REQUIRED]: boolean(),
|
|
34
|
+
[FieldConstants.SWITCH_AFTER_NOT_REQUIRED]: boolean()
|
|
35
|
+
}).required();
|
|
36
|
+
const voltageLevelSectionCreationEmptyFormData = {
|
|
37
|
+
[FieldConstants.EQUIPMENT_ID]: "",
|
|
38
|
+
[FieldConstants.BUS_BAR_INDEX]: null,
|
|
39
|
+
[FieldConstants.BUSBAR_SECTION_ID]: null,
|
|
40
|
+
[FieldConstants.IS_AFTER_BUSBAR_SECTION_ID]: null,
|
|
41
|
+
[FieldConstants.SWITCHES_BEFORE_SECTIONS]: null,
|
|
42
|
+
[FieldConstants.SWITCHES_AFTER_SECTIONS]: null,
|
|
43
|
+
[FieldConstants.ALL_BUS_BAR_SECTIONS]: false,
|
|
44
|
+
[FieldConstants.NEW_SWITCH_STATES]: true,
|
|
45
|
+
[FieldConstants.SWITCH_BEFORE_NOT_REQUIRED]: false,
|
|
46
|
+
[FieldConstants.SWITCH_AFTER_NOT_REQUIRED]: false
|
|
47
|
+
};
|
|
48
|
+
const getBusBarIndexValue = ({
|
|
49
|
+
busbarIndex,
|
|
50
|
+
allBusbars
|
|
51
|
+
}) => {
|
|
52
|
+
if (allBusbars) {
|
|
53
|
+
return { id: "all" };
|
|
54
|
+
}
|
|
55
|
+
return { id: busbarIndex ?? "" };
|
|
56
|
+
};
|
|
57
|
+
const getBusBarSectionValue = ({ busbarSectionId }) => {
|
|
58
|
+
return { id: busbarSectionId ?? "" };
|
|
59
|
+
};
|
|
60
|
+
const findBusbarKeyForSection = (busBarSectionInfos, sectionId) => {
|
|
61
|
+
if (!sectionId) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return Object.keys(busBarSectionInfos || {}).find((key) => busBarSectionInfos?.[key]?.includes(sectionId)) ?? null;
|
|
65
|
+
};
|
|
66
|
+
const voltageLevelSectionCreationDtoToForm = (dto) => {
|
|
67
|
+
return {
|
|
68
|
+
equipmentID: dto.voltageLevelId,
|
|
69
|
+
busbarIndex: getBusBarIndexValue({
|
|
70
|
+
busbarIndex: dto.busbarIndex,
|
|
71
|
+
allBusbars: dto.allBusbars
|
|
72
|
+
}),
|
|
73
|
+
allBusbarSections: dto.allBusbars ?? false,
|
|
74
|
+
busbarSectionId: getBusBarSectionValue({ busbarSectionId: dto.busbarSectionId }),
|
|
75
|
+
isAfterBusBarSectionId: dto.afterBusbarSectionId ? POSITION_NEW_SECTION_SIDE.AFTER.id : POSITION_NEW_SECTION_SIDE.BEFORE.id,
|
|
76
|
+
switchesBeforeSections: dto.leftSwitchKind ?? null,
|
|
77
|
+
switchesAfterSections: dto.rightSwitchKind ?? null,
|
|
78
|
+
newSwitchStates: !(dto.switchOpen ?? true)
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const voltageLevelSectionCreationFormToDto = (form, busBarSectionInfos) => {
|
|
82
|
+
return {
|
|
83
|
+
type: ModificationType.CREATE_VOLTAGE_LEVEL_SECTION,
|
|
84
|
+
voltageLevelId: form.equipmentID,
|
|
85
|
+
busbarIndex: form.allBusbarSections ? findBusbarKeyForSection(busBarSectionInfos, form.busbarSectionId?.id) : form.busbarIndex?.id ?? null,
|
|
86
|
+
busbarSectionId: form.busbarSectionId?.id ?? null,
|
|
87
|
+
allBusbars: form.allBusbarSections ?? false,
|
|
88
|
+
afterBusbarSectionId: form.isAfterBusBarSectionId === POSITION_NEW_SECTION_SIDE.AFTER.id,
|
|
89
|
+
leftSwitchKind: form.switchesBeforeSections ?? null,
|
|
90
|
+
rightSwitchKind: form.switchesAfterSections ?? null,
|
|
91
|
+
switchOpen: !form.newSwitchStates
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export {
|
|
95
|
+
POSITION_NEW_SECTION_SIDE,
|
|
96
|
+
voltageLevelSectionCreationDtoToForm,
|
|
97
|
+
voltageLevelSectionCreationEmptyFormData,
|
|
98
|
+
voltageLevelSectionCreationFormSchema,
|
|
99
|
+
voltageLevelSectionCreationFormToDto
|
|
100
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -362,6 +362,8 @@ import { VoltageLevelModificationForm } from "./features/network-modifications/v
|
|
|
362
362
|
import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./features/network-modifications/voltageLevel/modification/voltageLevelModification.utils.js";
|
|
363
363
|
import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.js";
|
|
364
364
|
import { CreateVoltageLevelTopologyForm } from "./features/network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.js";
|
|
365
|
+
import { VoltageLevelSectionCreationForm } from "./features/network-modifications/voltageLevel/section/VoltageLevelSectionCreationForm.js";
|
|
366
|
+
import { POSITION_NEW_SECTION_SIDE, voltageLevelSectionCreationDtoToForm, voltageLevelSectionCreationEmptyFormData, voltageLevelSectionCreationFormSchema, voltageLevelSectionCreationFormToDto } from "./features/network-modifications/voltageLevel/section/voltageLevelSectionCreation.utils.js";
|
|
365
367
|
import { LOAD_TAB_FIELDS, LoadDialogTab } from "./features/network-modifications/load/common/load.utils.js";
|
|
366
368
|
import { LoadDialogTabs } from "./features/network-modifications/load/common/LoadDialogTabs.js";
|
|
367
369
|
import { LoadDialogTabsContent } from "./features/network-modifications/load/common/LoadDialogTabsContent.js";
|
|
@@ -1001,6 +1003,7 @@ export {
|
|
|
1001
1003
|
PERCENTAGE,
|
|
1002
1004
|
PHASE_REGULATION_MODE_OPTIONS,
|
|
1003
1005
|
PHASE_SHIFTER_REGULATION_ON,
|
|
1006
|
+
POSITION_NEW_SECTION_SIDE,
|
|
1004
1007
|
PREFIX_CONFIG_NOTIFICATION_WS,
|
|
1005
1008
|
PREFIX_DIRECTORY_NOTIFICATION_WS,
|
|
1006
1009
|
PREFIX_MONITOR_NOTIFICATION_WS,
|
|
@@ -1221,6 +1224,7 @@ export {
|
|
|
1221
1224
|
VoltageLevelConnectivityForm,
|
|
1222
1225
|
VoltageLevelCreationForm,
|
|
1223
1226
|
VoltageLevelModificationForm,
|
|
1227
|
+
VoltageLevelSectionCreationForm,
|
|
1224
1228
|
VoltageRegulationForm,
|
|
1225
1229
|
VoltageUnitIcon,
|
|
1226
1230
|
WRITE_SLACK_BUS,
|
|
@@ -1821,5 +1825,9 @@ export {
|
|
|
1821
1825
|
voltageLevelModificationFormToDto,
|
|
1822
1826
|
voltageLevelModificationWithMeasurementsDtoToForm,
|
|
1823
1827
|
voltageLevelModificationWithMeasurementsFormSchema,
|
|
1824
|
-
voltageLevelModificationWithMeasurementsFormToDto
|
|
1828
|
+
voltageLevelModificationWithMeasurementsFormToDto,
|
|
1829
|
+
voltageLevelSectionCreationDtoToForm,
|
|
1830
|
+
voltageLevelSectionCreationEmptyFormData,
|
|
1831
|
+
voltageLevelSectionCreationFormSchema,
|
|
1832
|
+
voltageLevelSectionCreationFormToDto
|
|
1825
1833
|
};
|
|
@@ -335,4 +335,21 @@ export declare const networkModificationsEn: {
|
|
|
335
335
|
CreateCouplingDevice: string;
|
|
336
336
|
CouplingDeviceText: string;
|
|
337
337
|
CouplingDeviceBusBarSectionToolTipText: string;
|
|
338
|
+
CreateVoltageLevelSection: string;
|
|
339
|
+
VoltageLevelSectionCreationError: string;
|
|
340
|
+
BusBarSectionsReference: string;
|
|
341
|
+
notValidVoltageLevel: string;
|
|
342
|
+
SectionPosition: string;
|
|
343
|
+
isAfterBusBarSectionId: string;
|
|
344
|
+
Switch: string;
|
|
345
|
+
newSection: string;
|
|
346
|
+
switchesAfterSections: string;
|
|
347
|
+
switchesBeforeSections: string;
|
|
348
|
+
Busbar: string;
|
|
349
|
+
Before: string;
|
|
350
|
+
After: string;
|
|
351
|
+
allBusbarSections: string;
|
|
352
|
+
allOptionHelperText: string;
|
|
353
|
+
areSwitchesOpen: string;
|
|
354
|
+
areSwitchesClosed: string;
|
|
338
355
|
};
|
|
@@ -320,7 +320,7 @@ const networkModificationsEn = {
|
|
|
320
320
|
copyLink: "Copy link",
|
|
321
321
|
linkCopied: "Link copied",
|
|
322
322
|
linkCopyError: "Error while attempting to copy link",
|
|
323
|
-
// Voltage level
|
|
323
|
+
// Voltage level creation
|
|
324
324
|
CreateVoltageLevelTopology: "Adding a busbar",
|
|
325
325
|
CreateVoltageLevelTopologyError: "Error while creating a voltage level topology",
|
|
326
326
|
CreateCouplingDeviceDiagramButton: "Show voltage level",
|
|
@@ -331,7 +331,25 @@ const networkModificationsEn = {
|
|
|
331
331
|
// Voltage level coupling device creation
|
|
332
332
|
CreateCouplingDevice: "Add a coupling device",
|
|
333
333
|
CouplingDeviceText: "Bus bar sections",
|
|
334
|
-
CouplingDeviceBusBarSectionToolTipText: "If both bus bar sections have a different section number it creates an omnibus otherwise a coupling device"
|
|
334
|
+
CouplingDeviceBusBarSectionToolTipText: "If both bus bar sections have a different section number it creates an omnibus otherwise a coupling device",
|
|
335
|
+
// Voltage level section creation
|
|
336
|
+
CreateVoltageLevelSection: "Add busbar section",
|
|
337
|
+
VoltageLevelSectionCreationError: "Error while creating a section",
|
|
338
|
+
BusBarSectionsReference: "Busbar reference section",
|
|
339
|
+
notValidVoltageLevel: "Invalid voltage level to add busbar section. Please re-create the voltage level.",
|
|
340
|
+
SectionPosition: "Position",
|
|
341
|
+
isAfterBusBarSectionId: "New section side",
|
|
342
|
+
Switch: "Switch",
|
|
343
|
+
newSection: "New section",
|
|
344
|
+
switchesAfterSections: "Switch after",
|
|
345
|
+
switchesBeforeSections: "Switch before",
|
|
346
|
+
Busbar: "Busbar",
|
|
347
|
+
Before: "Before",
|
|
348
|
+
After: "After",
|
|
349
|
+
allBusbarSections: "All",
|
|
350
|
+
allOptionHelperText: "Busbars have different sections (number or index)",
|
|
351
|
+
areSwitchesOpen: "Open",
|
|
352
|
+
areSwitchesClosed: "Closed"
|
|
335
353
|
};
|
|
336
354
|
export {
|
|
337
355
|
networkModificationsEn
|
|
@@ -335,4 +335,21 @@ export declare const networkModificationsFr: {
|
|
|
335
335
|
CreateCouplingDevice: string;
|
|
336
336
|
CouplingDeviceText: string;
|
|
337
337
|
CouplingDeviceBusBarSectionToolTipText: string;
|
|
338
|
+
CreateVoltageLevelSection: string;
|
|
339
|
+
VoltageLevelSectionCreationError: string;
|
|
340
|
+
BusBarSectionsReference: string;
|
|
341
|
+
notValidVoltageLevel: string;
|
|
342
|
+
SectionPosition: string;
|
|
343
|
+
isAfterBusBarSectionId: string;
|
|
344
|
+
Switch: string;
|
|
345
|
+
newSection: string;
|
|
346
|
+
switchesAfterSections: string;
|
|
347
|
+
switchesBeforeSections: string;
|
|
348
|
+
Busbar: string;
|
|
349
|
+
Before: string;
|
|
350
|
+
After: string;
|
|
351
|
+
allBusbarSections: string;
|
|
352
|
+
allOptionHelperText: string;
|
|
353
|
+
areSwitchesOpen: string;
|
|
354
|
+
areSwitchesClosed: string;
|
|
338
355
|
};
|
|
@@ -320,7 +320,7 @@ const networkModificationsFr = {
|
|
|
320
320
|
copyLink: "Copier le lien",
|
|
321
321
|
linkCopied: "Lien copié",
|
|
322
322
|
linkCopyError: "Erreur lors de la copie du lien",
|
|
323
|
-
// Voltage level
|
|
323
|
+
// Voltage level
|
|
324
324
|
CreateVoltageLevelTopology: "Ajouter un jeu de barre",
|
|
325
325
|
CreateVoltageLevelTopologyError: "Erreur lors de la création d'une topologie de poste",
|
|
326
326
|
CreateCouplingDeviceDiagramButton: "Voir le poste",
|
|
@@ -331,7 +331,25 @@ const networkModificationsFr = {
|
|
|
331
331
|
// Voltage level coupling device creation
|
|
332
332
|
CreateCouplingDevice: "Ajouter un couplage ou un omnibus",
|
|
333
333
|
CouplingDeviceText: "Sections de jeu de barre",
|
|
334
|
-
CouplingDeviceBusBarSectionToolTipText: "Si les deux sections de barre sélectionnées ont des numéros de tronçon/section différents la modification crée un omnibus, autrement elle crée un couplage"
|
|
334
|
+
CouplingDeviceBusBarSectionToolTipText: "Si les deux sections de barre sélectionnées ont des numéros de tronçon/section différents la modification crée un omnibus, autrement elle crée un couplage",
|
|
335
|
+
// Voltage level section creation
|
|
336
|
+
CreateVoltageLevelSection: "Ajouter un tronçon ou une section",
|
|
337
|
+
VoltageLevelSectionCreationError: "Erreur lors de la création d'une section",
|
|
338
|
+
BusBarSectionsReference: "Section de jeu de barres de référence",
|
|
339
|
+
notValidVoltageLevel: "Poste invalide pour l'ajout de section/tronçon. Veuillez re-créer le poste.",
|
|
340
|
+
SectionPosition: "Position",
|
|
341
|
+
isAfterBusBarSectionId: "Côté de la nouvelle section",
|
|
342
|
+
Switch: "Organes de coupure",
|
|
343
|
+
newSection: "Nouvelle section",
|
|
344
|
+
switchesAfterSections: "OC après",
|
|
345
|
+
switchesBeforeSections: "OC avant",
|
|
346
|
+
Busbar: "Jeu de barres",
|
|
347
|
+
Before: "Avant",
|
|
348
|
+
After: "Après",
|
|
349
|
+
allBusbarSections: "Tous",
|
|
350
|
+
allOptionHelperText: "Tous les jeux de barres n'ont pas les mêmes sections (index et nombre)",
|
|
351
|
+
areSwitchesOpen: "Ouverts",
|
|
352
|
+
areSwitchesClosed: "Fermés"
|
|
335
353
|
};
|
|
336
354
|
export {
|
|
337
355
|
networkModificationsFr
|