@gridsuite/commons-ui 0.268.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/components/composite/agGridTable/BottomTableButtons.js +1 -1
- package/dist/components/ui/reactHookForm/DirectoryItemsInput.js +1 -1
- 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/features/parameters/loadflow/load-flow-provider-specific-parameters.js +10 -1
- package/dist/features/topBar/TopBar.js +2 -2
- package/dist/index.js +13 -1
- package/dist/translations/en/businessErrorsEn.d.ts +14 -0
- package/dist/translations/en/businessErrorsEn.js +15 -1
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/en/networkModificationsEn.d.ts +17 -0
- package/dist/translations/en/networkModificationsEn.js +20 -2
- package/dist/translations/en/specificParameters.d.ts +96 -0
- package/dist/translations/en/specificParameters.js +95 -0
- package/dist/translations/fr/businessErrorsFr.d.ts +14 -0
- package/dist/translations/fr/businessErrorsFr.js +15 -1
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +17 -0
- package/dist/translations/fr/networkModificationsFr.js +20 -2
- package/dist/translations/fr/specificParameters.d.ts +96 -0
- package/dist/translations/fr/specificParameters.js +95 -0
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ function BottomTableButtons({
|
|
|
39
39
|
) }),
|
|
40
40
|
csvProps?.extraButtons && /* @__PURE__ */ jsx(Grid, { children: csvProps.extraButtons }),
|
|
41
41
|
/* @__PURE__ */ jsxs(Grid, { sx: { marginLeft: "auto" }, children: [
|
|
42
|
-
/* @__PURE__ */ jsx(InnerColoredButton, { onClick: handleAddRow, "aria-label": "Add row", children: /* @__PURE__ */ jsx(ControlPoint, {}) }),
|
|
42
|
+
/* @__PURE__ */ jsx(InnerColoredButton, { onClick: handleAddRow, "aria-label": "Add row", children: /* @__PURE__ */ jsx(ControlPoint, { "data-testid": "ControlPointIcon" }) }),
|
|
43
43
|
/* @__PURE__ */ jsx(
|
|
44
44
|
InnerColoredButton,
|
|
45
45
|
{
|
|
@@ -230,7 +230,7 @@ function DirectoryItemsInput({
|
|
|
230
230
|
}
|
|
231
231
|
),
|
|
232
232
|
renderValue: (directoryElements) => /* @__PURE__ */ jsxs(Box, { sx: styles.renderDirectoryElements, children: [
|
|
233
|
-
/* @__PURE__ */ jsx(CustomTooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { size: "small", disabled: disable, children: /* @__PURE__ */ jsx(DriveFolderUpload, {}) }) }) }),
|
|
233
|
+
/* @__PURE__ */ jsx(CustomTooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { size: "small", disabled: disable, children: /* @__PURE__ */ jsx(DriveFolderUpload, { "data-testid": "DriveFolderUploadIcon" }) }) }) }),
|
|
234
234
|
directoryElements?.map((item, index) => {
|
|
235
235
|
const elementName = watchedElements?.[index]?.[NAME] ?? getValues(`${name}.${index}.${NAME}`) ?? item?.[NAME];
|
|
236
236
|
const equipmentTypeShortLabel = getEquipmentTypeShortLabel(
|
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;
|