@gridsuite/commons-ui 0.176.0 → 0.178.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/index.js +25 -1
- package/dist/components/inputs/index.js +2 -0
- package/dist/components/inputs/reactHookForm/index.js +2 -0
- package/dist/components/inputs/reactHookForm/numbers/IntegerInput.js +1 -1
- package/dist/components/inputs/reactHookForm/selectInputs/EnumInput.d.ts +18 -0
- package/dist/components/inputs/reactHookForm/selectInputs/EnumInput.js +28 -0
- package/dist/components/inputs/reactHookForm/selectInputs/index.d.ts +1 -0
- package/dist/components/inputs/reactHookForm/selectInputs/index.js +2 -0
- package/dist/components/network-modifications/index.d.ts +1 -0
- package/dist/components/network-modifications/index.js +23 -1
- package/dist/components/network-modifications/voltage-level/creation/VoltageLevelCreationForm.d.ts +11 -0
- package/dist/components/network-modifications/voltage-level/creation/VoltageLevelCreationForm.js +174 -0
- package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.d.ts +7 -0
- package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.js +54 -0
- package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.d.ts +7 -0
- package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.js +73 -0
- package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/index.d.ts +8 -0
- package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/index.js +6 -0
- package/dist/components/network-modifications/voltage-level/creation/index.d.ts +11 -0
- package/dist/components/network-modifications/voltage-level/creation/index.js +24 -0
- package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.d.ts +5 -0
- package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.js +76 -0
- package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationCreationSection.d.ts +6 -0
- package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationCreationSection.js +61 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.d.ts +7 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.js +119 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.d.ts +11 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.js +82 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialogSubmitButton.d.ts +6 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialogSubmitButton.js +11 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesForm.d.ts +11 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesForm.js +70 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/createSwitchesDialog.utils.d.ts +14 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/createSwitchesDialog.utils.js +27 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/index.d.ts +7 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/index.js +4 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/index.d.ts +8 -0
- package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/index.js +6 -0
- package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.d.ts +34 -0
- package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.js +9 -0
- package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.d.ts +155 -0
- package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.js +248 -0
- package/dist/components/network-modifications/voltage-level/index.d.ts +7 -0
- package/dist/components/network-modifications/voltage-level/index.js +24 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-content.d.ts +1 -2
- package/dist/components/parameters/short-circuit/short-circuit-parameters-content.js +4 -7
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.d.ts +1 -3
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -3
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.d.ts +1 -2
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +2 -9
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.d.ts +1 -2
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -3
- package/dist/index.js +26 -1
- package/dist/services/index.js +2 -1
- package/dist/services/networkModification.d.ts +1 -0
- package/dist/services/networkModification.js +15 -1
- package/dist/translations/en/networkModificationsEn.d.ts +35 -0
- package/dist/translations/en/networkModificationsEn.js +35 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +35 -0
- package/dist/translations/fr/networkModificationsFr.js +35 -0
- package/dist/utils/constants/fieldConstants.d.ts +22 -1
- package/dist/utils/constants/fieldConstants.js +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { Paper, Box, IconButton } from "@mui/material";
|
|
4
|
+
import { useFormContext } from "react-hook-form";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
7
|
+
import "../../../../../utils/conversionUtils.js";
|
|
8
|
+
import "../../../../../utils/types/equipmentType.js";
|
|
9
|
+
import "@mui/icons-material";
|
|
10
|
+
import "../../../../../utils/yupConfig.js";
|
|
11
|
+
import { LineSeparator } from "../../../../parameters/common/line-separator.js";
|
|
12
|
+
import "localized-countries";
|
|
13
|
+
import "localized-countries/data/fr";
|
|
14
|
+
import "localized-countries/data/en";
|
|
15
|
+
import "notistack";
|
|
16
|
+
import "../../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
17
|
+
import "../../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
18
|
+
import "../../../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
19
|
+
import "../../../../treeViewFinder/TreeViewFinder.js";
|
|
20
|
+
import "../../../../overflowableText/OverflowableText.js";
|
|
21
|
+
import "yup";
|
|
22
|
+
import "../../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
23
|
+
import "../../../../customAGGrid/customAggrid.js";
|
|
24
|
+
import "ag-grid-community";
|
|
25
|
+
import "react-papaparse";
|
|
26
|
+
import "react-csv-downloader";
|
|
27
|
+
import "../../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
32
|
+
import "@react-querybuilder/material";
|
|
33
|
+
import "../../../../filter/expert/expertFilterConstants.js";
|
|
34
|
+
import "../../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
35
|
+
import "uuid";
|
|
36
|
+
import "../../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
37
|
+
import "react-querybuilder";
|
|
38
|
+
import "../../../../parameters/common/widget/parameter-line-slider.js";
|
|
39
|
+
import "../../../../parameters/common/limitreductions/columns-definitions.js";
|
|
40
|
+
import "../../../../parameters/common/contingency-table/columns-definitions.js";
|
|
41
|
+
import "../../../../parameters/network-visualizations/constants.js";
|
|
42
|
+
import "@hookform/resolvers/yup";
|
|
43
|
+
import "../../../../filter/HeaderFilterForm.js";
|
|
44
|
+
import "../../../../parameters/loadflow/load-flow-parameters-context.js";
|
|
45
|
+
import "../../../../parameters/loadflow/load-flow-parameters-content.js";
|
|
46
|
+
import "../../../../parameters/short-circuit/short-circuit-parameters-content.js";
|
|
47
|
+
import "@hello-pangea/dnd";
|
|
48
|
+
import "../../../../parameters/sensi/utils.js";
|
|
49
|
+
import "../../../../parameters/sensi/columns-definitions.js";
|
|
50
|
+
import "../../../../parameters/dynamic-margin-calculation/time-delay-parameters.js";
|
|
51
|
+
import "../../../../parameters/dynamic-margin-calculation/loads-variations-parameters.js";
|
|
52
|
+
import "../../../../parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js";
|
|
53
|
+
function SubstationAutocompleteAddButton({ children, ...rest }) {
|
|
54
|
+
const { setValue, getValues } = useFormContext();
|
|
55
|
+
const intl = useIntl();
|
|
56
|
+
const handleCreateSubstation = useCallback(() => {
|
|
57
|
+
setValue(FieldConstants.SUBSTATION_CREATION_ID, getValues(FieldConstants.SUBSTATION_ID));
|
|
58
|
+
setValue(FieldConstants.ADD_SUBSTATION_CREATION, true);
|
|
59
|
+
}, [setValue, getValues]);
|
|
60
|
+
return /* @__PURE__ */ jsx(Paper, { ...rest, children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
61
|
+
children,
|
|
62
|
+
/* @__PURE__ */ jsx(LineSeparator, {}),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
IconButton,
|
|
65
|
+
{
|
|
66
|
+
color: "primary",
|
|
67
|
+
sx: { justifyContent: "flex-start", fontSize: "medium", width: "100%" },
|
|
68
|
+
onMouseDown: handleCreateSubstation,
|
|
69
|
+
children: `${intl.formatMessage({ id: "CreateSubstation" })} : ${getValues(FieldConstants.SUBSTATION_ID)}`
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }) });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
SubstationAutocompleteAddButton
|
|
76
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface SubstationCreationSectionProps {
|
|
2
|
+
showDeleteButton?: boolean;
|
|
3
|
+
onDelete?: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function SubstationCreationSection({ showDeleteButton, onDelete, }: Readonly<SubstationCreationSectionProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid, Tooltip, IconButton } from "@mui/material";
|
|
3
|
+
import { Delete } from "@mui/icons-material";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import "../../../../overflowableText/OverflowableText.js";
|
|
6
|
+
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
7
|
+
import "../../../../../utils/conversionUtils.js";
|
|
8
|
+
import "../../../../../utils/types/equipmentType.js";
|
|
9
|
+
import "../../../../../utils/yupConfig.js";
|
|
10
|
+
import "react";
|
|
11
|
+
import "react-hook-form";
|
|
12
|
+
import "localized-countries";
|
|
13
|
+
import "localized-countries/data/fr";
|
|
14
|
+
import "localized-countries/data/en";
|
|
15
|
+
import "notistack";
|
|
16
|
+
import "../../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
17
|
+
import "yup";
|
|
18
|
+
import "../../../../treeViewFinder/TreeViewFinder.js";
|
|
19
|
+
import "../../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
20
|
+
import "../../../../customAGGrid/customAggrid.js";
|
|
21
|
+
import "ag-grid-community";
|
|
22
|
+
import "react-papaparse";
|
|
23
|
+
import "react-csv-downloader";
|
|
24
|
+
import { TextInput } from "../../../../inputs/reactHookForm/text/TextInput.js";
|
|
25
|
+
import "../../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
30
|
+
import "../../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
31
|
+
import { CountrySelectionInput } from "../../../../inputs/reactHookForm/CountrySelectionInput.js";
|
|
32
|
+
import "@react-querybuilder/material";
|
|
33
|
+
import "../../../../filter/expert/expertFilterConstants.js";
|
|
34
|
+
import "../../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
35
|
+
import "uuid";
|
|
36
|
+
import "../../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
37
|
+
import "react-querybuilder";
|
|
38
|
+
import { PropertiesForm } from "../../../common/properties/PropertiesForm.js";
|
|
39
|
+
import GridSection from "../../../../grid/grid-section.js";
|
|
40
|
+
import { LineSeparator } from "../../../../parameters/common/line-separator.js";
|
|
41
|
+
function SubstationCreationSection({
|
|
42
|
+
showDeleteButton = true,
|
|
43
|
+
onDelete
|
|
44
|
+
}) {
|
|
45
|
+
const intl = useIntl();
|
|
46
|
+
return /* @__PURE__ */ jsxs(Grid, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, container: true, spacing: 2 }),
|
|
48
|
+
/* @__PURE__ */ jsx(GridSection, { title: intl.formatMessage({ id: "CreateSubstation" }) }),
|
|
49
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.SUBSTATION_CREATION_ID, label: "SubstationId" }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.SUBSTATION_NAME, label: "substationName" }) }),
|
|
52
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsx(CountrySelectionInput, { name: FieldConstants.COUNTRY, label: "Country", size: "small" }) }),
|
|
53
|
+
showDeleteButton && onDelete && /* @__PURE__ */ jsx(Grid, { item: true, xs: 1, children: /* @__PURE__ */ jsx(Tooltip, { title: intl.formatMessage({ id: "DeleteRows" }), children: /* @__PURE__ */ jsx(IconButton, { onClick: onDelete, children: /* @__PURE__ */ jsx(Delete, {}) }) }) })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsx(PropertiesForm, { id: FieldConstants.SUBSTATION_CREATION, networkElementType: "substation" }),
|
|
56
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, paddingTop: 2, children: /* @__PURE__ */ jsx(LineSeparator, {}) })
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
SubstationCreationSection
|
|
61
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
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 declare function SwitchesBetweenSections(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
3
|
+
import { useState, useCallback, useRef, useEffect } from "react";
|
|
4
|
+
import { useFormContext, useWatch } from "react-hook-form";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { ArrowDropDown } from "@mui/icons-material";
|
|
7
|
+
import { FieldConstants } from "../../../../../utils/constants/fieldConstants.js";
|
|
8
|
+
import "../../../../../utils/conversionUtils.js";
|
|
9
|
+
import "../../../../../utils/types/equipmentType.js";
|
|
10
|
+
import "../../../../../utils/yupConfig.js";
|
|
11
|
+
import { SwitchKind } from "../voltageLevelCreation.types.js";
|
|
12
|
+
import GridItem from "../../../../grid/grid-item.js";
|
|
13
|
+
import "../../../../overflowableText/OverflowableText.js";
|
|
14
|
+
import "localized-countries";
|
|
15
|
+
import "localized-countries/data/fr";
|
|
16
|
+
import "localized-countries/data/en";
|
|
17
|
+
import "notistack";
|
|
18
|
+
import "../../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
19
|
+
import "yup";
|
|
20
|
+
import "../../../../treeViewFinder/TreeViewFinder.js";
|
|
21
|
+
import "../../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
22
|
+
import "../../../../customAGGrid/customAggrid.js";
|
|
23
|
+
import "ag-grid-community";
|
|
24
|
+
import "react-papaparse";
|
|
25
|
+
import "react-csv-downloader";
|
|
26
|
+
import { TextInput } from "../../../../inputs/reactHookForm/text/TextInput.js";
|
|
27
|
+
import "../../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
32
|
+
import "../../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
33
|
+
import "@react-querybuilder/material";
|
|
34
|
+
import "../../../../filter/expert/expertFilterConstants.js";
|
|
35
|
+
import "../../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
36
|
+
import "uuid";
|
|
37
|
+
import "../../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
38
|
+
import "react-querybuilder";
|
|
39
|
+
import { CreateSwitchesDialog } from "./creation/CreateSwitchesDialog.js";
|
|
40
|
+
function SwitchesBetweenSections() {
|
|
41
|
+
const { getValues, setValue } = useFormContext();
|
|
42
|
+
const [openCreateSwitchesDialog, setOpenCreateSwitchesDialog] = useState(false);
|
|
43
|
+
const watchSectionCount = useWatch({ name: FieldConstants.SECTION_COUNT });
|
|
44
|
+
const watchSwitchesBetweenSections = useWatch({
|
|
45
|
+
name: FieldConstants.SWITCHES_BETWEEN_SECTIONS
|
|
46
|
+
});
|
|
47
|
+
const addIconAdornment = useCallback((clickCallback) => {
|
|
48
|
+
return /* @__PURE__ */ jsx(IconButton, { onClick: clickCallback, children: /* @__PURE__ */ jsx(ArrowDropDown, {}) });
|
|
49
|
+
}, []);
|
|
50
|
+
const handleClickOpenSwitchesPane = useCallback(() => {
|
|
51
|
+
if (watchSectionCount > 1) {
|
|
52
|
+
setOpenCreateSwitchesDialog(true);
|
|
53
|
+
}
|
|
54
|
+
}, [watchSectionCount]);
|
|
55
|
+
const intl = useIntl();
|
|
56
|
+
const setSwitchesKinds = useCallback(
|
|
57
|
+
(data) => {
|
|
58
|
+
const map = data[FieldConstants.SWITCH_KINDS].map((switchData) => {
|
|
59
|
+
return intl.formatMessage({ id: switchData[FieldConstants.SWITCH_KIND] });
|
|
60
|
+
});
|
|
61
|
+
setValue(FieldConstants.SWITCHES_BETWEEN_SECTIONS, map.join(" / "), {
|
|
62
|
+
shouldValidate: true,
|
|
63
|
+
shouldDirty: true
|
|
64
|
+
});
|
|
65
|
+
setValue(FieldConstants.SWITCH_KINDS, data[FieldConstants.SWITCH_KINDS]);
|
|
66
|
+
},
|
|
67
|
+
[intl, setValue]
|
|
68
|
+
);
|
|
69
|
+
const handleCreateSwitchesDialog = useCallback(
|
|
70
|
+
(data) => {
|
|
71
|
+
setSwitchesKinds(data);
|
|
72
|
+
},
|
|
73
|
+
[setSwitchesKinds]
|
|
74
|
+
);
|
|
75
|
+
const sectionCountRef = useRef(watchSectionCount);
|
|
76
|
+
const switchesBetweenSectionsRef = useRef(watchSwitchesBetweenSections);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (sectionCountRef.current !== watchSectionCount && switchesBetweenSectionsRef.current === watchSwitchesBetweenSections) {
|
|
79
|
+
const initialKindDisconnector = { switchKind: SwitchKind.DISCONNECTOR };
|
|
80
|
+
let list = [];
|
|
81
|
+
if (watchSectionCount >= 1) {
|
|
82
|
+
list = new Array(watchSectionCount - 1).fill(initialKindDisconnector);
|
|
83
|
+
}
|
|
84
|
+
const data = { switchKinds: list };
|
|
85
|
+
setSwitchesKinds(data);
|
|
86
|
+
}
|
|
87
|
+
sectionCountRef.current = watchSectionCount;
|
|
88
|
+
switchesBetweenSectionsRef.current = watchSwitchesBetweenSections;
|
|
89
|
+
}, [watchSectionCount, watchSwitchesBetweenSections, setSwitchesKinds]);
|
|
90
|
+
if (Number.isNaN(watchSectionCount) || watchSectionCount <= 1) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: /* @__PURE__ */ jsx(
|
|
95
|
+
TextInput,
|
|
96
|
+
{
|
|
97
|
+
name: FieldConstants.SWITCHES_BETWEEN_SECTIONS,
|
|
98
|
+
label: "SwitchesBetweenSections",
|
|
99
|
+
formProps: {
|
|
100
|
+
multiline: true
|
|
101
|
+
},
|
|
102
|
+
customAdornment: addIconAdornment(handleClickOpenSwitchesPane)
|
|
103
|
+
}
|
|
104
|
+
) }),
|
|
105
|
+
openCreateSwitchesDialog && /* @__PURE__ */ jsx(
|
|
106
|
+
CreateSwitchesDialog,
|
|
107
|
+
{
|
|
108
|
+
openCreateSwitchesDialog,
|
|
109
|
+
setOpenCreateSwitchesDialog,
|
|
110
|
+
handleCreateSwitchesDialog,
|
|
111
|
+
sectionCount: getValues(FieldConstants.SECTION_COUNT),
|
|
112
|
+
switchKinds: getValues(FieldConstants.SWITCH_KINDS)
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
SwitchesBetweenSections
|
|
119
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CreateSwitchesFormData, SwitchKindFormData } from '../../voltageLevelCreation.types';
|
|
3
|
+
interface CreateSwitchesDialogProps {
|
|
4
|
+
sectionCount: number;
|
|
5
|
+
handleCreateSwitchesDialog: (data: CreateSwitchesFormData) => void;
|
|
6
|
+
setOpenCreateSwitchesDialog: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
+
openCreateSwitchesDialog: boolean;
|
|
8
|
+
switchKinds: SwitchKindFormData[];
|
|
9
|
+
}
|
|
10
|
+
export declare function CreateSwitchesDialog({ sectionCount, handleCreateSwitchesDialog, setOpenCreateSwitchesDialog, openCreateSwitchesDialog, switchKinds, }: Readonly<CreateSwitchesDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogActions } from "@mui/material";
|
|
3
|
+
import { useForm } from "react-hook-form";
|
|
4
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { object } from "yup";
|
|
7
|
+
import { getCreateSwitchesValidationSchema, getCreateSwitchesEmptyFormData } from "../../voltageLevelCreation.utils.js";
|
|
8
|
+
import { FieldConstants } from "../../../../../../utils/constants/fieldConstants.js";
|
|
9
|
+
import "../../../../../../utils/conversionUtils.js";
|
|
10
|
+
import "../../../../../../utils/types/equipmentType.js";
|
|
11
|
+
import "@mui/icons-material";
|
|
12
|
+
import "../../../../../../utils/yupConfig.js";
|
|
13
|
+
import "react-intl";
|
|
14
|
+
import "../../../../../overflowableText/OverflowableText.js";
|
|
15
|
+
import "localized-countries";
|
|
16
|
+
import "localized-countries/data/fr";
|
|
17
|
+
import "localized-countries/data/en";
|
|
18
|
+
import "notistack";
|
|
19
|
+
import { CustomFormProvider } from "../../../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
20
|
+
import { CancelButton } from "../../../../../inputs/reactHookForm/utils/CancelButton.js";
|
|
21
|
+
import "../../../../../treeViewFinder/TreeViewFinder.js";
|
|
22
|
+
import "../../../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
23
|
+
import "../../../../../customAGGrid/customAggrid.js";
|
|
24
|
+
import "ag-grid-community";
|
|
25
|
+
import "react-papaparse";
|
|
26
|
+
import "react-csv-downloader";
|
|
27
|
+
import "../../../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
32
|
+
import "../../../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
33
|
+
import "@react-querybuilder/material";
|
|
34
|
+
import "../../../../../filter/expert/expertFilterConstants.js";
|
|
35
|
+
import "../../../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
36
|
+
import "uuid";
|
|
37
|
+
import "../../../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
38
|
+
import "react-querybuilder";
|
|
39
|
+
import CreateSwitchesForm from "./CreateSwitchesForm.js";
|
|
40
|
+
import { CreateSwitchesDialogSubmitButton } from "./CreateSwitchesDialogSubmitButton.js";
|
|
41
|
+
const formSchema = object().shape({
|
|
42
|
+
...getCreateSwitchesValidationSchema()
|
|
43
|
+
});
|
|
44
|
+
function CreateSwitchesDialog({
|
|
45
|
+
sectionCount,
|
|
46
|
+
handleCreateSwitchesDialog,
|
|
47
|
+
setOpenCreateSwitchesDialog,
|
|
48
|
+
openCreateSwitchesDialog,
|
|
49
|
+
switchKinds
|
|
50
|
+
}) {
|
|
51
|
+
const emptyFormData = getCreateSwitchesEmptyFormData(sectionCount);
|
|
52
|
+
const formMethods = useForm({
|
|
53
|
+
defaultValues: emptyFormData,
|
|
54
|
+
resolver: yupResolver(formSchema)
|
|
55
|
+
});
|
|
56
|
+
const { reset } = formMethods;
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (switchKinds?.length > 0) {
|
|
59
|
+
reset({
|
|
60
|
+
[FieldConstants.SWITCH_KINDS]: switchKinds
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, [switchKinds, reset]);
|
|
64
|
+
const handleCloseDialog = () => {
|
|
65
|
+
reset(emptyFormData);
|
|
66
|
+
setOpenCreateSwitchesDialog(false);
|
|
67
|
+
};
|
|
68
|
+
const handleSave = (data) => {
|
|
69
|
+
handleCreateSwitchesDialog(data);
|
|
70
|
+
handleCloseDialog();
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsx(Dialog, { open: openCreateSwitchesDialog, fullWidth: true, children: /* @__PURE__ */ jsxs(CustomFormProvider, { validationSchema: formSchema, ...formMethods, children: [
|
|
73
|
+
/* @__PURE__ */ jsx(CreateSwitchesForm, { id: FieldConstants.SWITCH_KINDS }),
|
|
74
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
75
|
+
/* @__PURE__ */ jsx(CancelButton, { onClick: handleCloseDialog }),
|
|
76
|
+
/* @__PURE__ */ jsx(CreateSwitchesDialogSubmitButton, { handleSave })
|
|
77
|
+
] })
|
|
78
|
+
] }) });
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
CreateSwitchesDialog
|
|
82
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CreateSwitchesFormData } from '../../voltageLevelCreation.types';
|
|
2
|
+
interface CreateSwitchesDialogSubmitButtonProps {
|
|
3
|
+
handleSave: (data: CreateSwitchesFormData) => void | Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare function CreateSwitchesDialogSubmitButton({ handleSave }: Readonly<CreateSwitchesDialogSubmitButtonProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@mui/material";
|
|
3
|
+
import { useFormContext } from "react-hook-form";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
function CreateSwitchesDialogSubmitButton({ handleSave }) {
|
|
6
|
+
const { handleSubmit } = useFormContext();
|
|
7
|
+
return /* @__PURE__ */ jsx(Button, { onClick: handleSubmit(handleSave), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) });
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
CreateSwitchesDialogSubmitButton
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
interface CreateSwitchesFormProps {
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
declare function CreateSwitchesForm({ id }: Readonly<CreateSwitchesFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default CreateSwitchesForm;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DialogTitle, DialogContent, Grid } from "@mui/material";
|
|
3
|
+
import { useFieldArray } from "react-hook-form";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { FieldConstants } from "../../../../../../utils/constants/fieldConstants.js";
|
|
6
|
+
import "../../../../../../utils/conversionUtils.js";
|
|
7
|
+
import "../../../../../../utils/types/equipmentType.js";
|
|
8
|
+
import "@mui/icons-material";
|
|
9
|
+
import "../../../../../../utils/yupConfig.js";
|
|
10
|
+
import { SWITCH_TYPE } from "../../voltageLevelCreation.utils.js";
|
|
11
|
+
import "../../../../../overflowableText/OverflowableText.js";
|
|
12
|
+
import "react";
|
|
13
|
+
import "localized-countries";
|
|
14
|
+
import "localized-countries/data/fr";
|
|
15
|
+
import "localized-countries/data/en";
|
|
16
|
+
import "notistack";
|
|
17
|
+
import "../../../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
18
|
+
import "yup";
|
|
19
|
+
import "../../../../../treeViewFinder/TreeViewFinder.js";
|
|
20
|
+
import "../../../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
21
|
+
import "../../../../../customAGGrid/customAggrid.js";
|
|
22
|
+
import "ag-grid-community";
|
|
23
|
+
import "react-papaparse";
|
|
24
|
+
import "react-csv-downloader";
|
|
25
|
+
import "../../../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
26
|
+
import { EnumInput } from "../../../../../inputs/reactHookForm/selectInputs/EnumInput.js";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
31
|
+
import "../../../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
32
|
+
import "@react-querybuilder/material";
|
|
33
|
+
import "../../../../../filter/expert/expertFilterConstants.js";
|
|
34
|
+
import "../../../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
35
|
+
import "uuid";
|
|
36
|
+
import "../../../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
37
|
+
import "react-querybuilder";
|
|
38
|
+
function CreateSwitchesForm({ id }) {
|
|
39
|
+
const { fields: rows } = useFieldArray({ name: `${id}` });
|
|
40
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "SwitchesBetweenSections" }) }),
|
|
42
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(
|
|
43
|
+
Grid,
|
|
44
|
+
{
|
|
45
|
+
container: true,
|
|
46
|
+
spacing: 2,
|
|
47
|
+
direction: "column",
|
|
48
|
+
style: {
|
|
49
|
+
paddingTop: "5px"
|
|
50
|
+
},
|
|
51
|
+
children: rows.map((value, index) => /* @__PURE__ */ jsx(Grid, { container: true, item: true, children: /* @__PURE__ */ jsx(
|
|
52
|
+
EnumInput,
|
|
53
|
+
{
|
|
54
|
+
options: Object.values(SWITCH_TYPE),
|
|
55
|
+
name: `${id}.${index}.${FieldConstants.SWITCH_KIND}`,
|
|
56
|
+
label: "SwitchBetweenSectionsLabel",
|
|
57
|
+
labelValues: {
|
|
58
|
+
index1: String(index + 1),
|
|
59
|
+
index2: String(index + 2)
|
|
60
|
+
},
|
|
61
|
+
size: "small"
|
|
62
|
+
}
|
|
63
|
+
) }, value.id))
|
|
64
|
+
}
|
|
65
|
+
) })
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
CreateSwitchesForm as default
|
|
70
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldConstants } from '../../../../../../utils';
|
|
2
|
+
export declare const getSwitchTypeSchema: () => import('yup').ObjectSchema<{
|
|
3
|
+
switchKind: string;
|
|
4
|
+
}, import('yup').AnyObject, {
|
|
5
|
+
switchKind: undefined;
|
|
6
|
+
}, "">;
|
|
7
|
+
export declare const getCreateSwitchesValidationSchema: (id?: FieldConstants) => {
|
|
8
|
+
[x: string]: import('yup').ArraySchema<{
|
|
9
|
+
switchKind: string;
|
|
10
|
+
}[] | null | undefined, import('yup').AnyObject, "", "">;
|
|
11
|
+
};
|
|
12
|
+
export declare const getCreateSwitchesEmptyFormData: (sectionCount: number, id?: FieldConstants) => {
|
|
13
|
+
[x: string]: any[];
|
|
14
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { object, string, array } from "yup";
|
|
2
|
+
import { FieldConstants } from "../../../../../../utils/constants/fieldConstants.js";
|
|
3
|
+
import { YUP_REQUIRED } from "../../../../../../utils/constants/translationKeys.js";
|
|
4
|
+
import "../../../../../../utils/conversionUtils.js";
|
|
5
|
+
import "../../../../../../utils/types/equipmentType.js";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
import "@mui/icons-material";
|
|
8
|
+
import "../../../../../../utils/yupConfig.js";
|
|
9
|
+
const getSwitchTypeSchema = () => object().shape({
|
|
10
|
+
[FieldConstants.SWITCH_KIND]: string().nullable().required(YUP_REQUIRED)
|
|
11
|
+
});
|
|
12
|
+
const getCreateSwitchesValidationSchema = (id = FieldConstants.SWITCH_KINDS) => {
|
|
13
|
+
return {
|
|
14
|
+
[id]: array().nullable().of(getSwitchTypeSchema())
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const createSwitchesEmptyFormData = () => ({
|
|
18
|
+
[FieldConstants.SWITCH_KIND]: ""
|
|
19
|
+
});
|
|
20
|
+
const getCreateSwitchesEmptyFormData = (sectionCount, id = FieldConstants.SWITCH_KINDS) => ({
|
|
21
|
+
[id]: new Array(sectionCount - 1).fill(createSwitchesEmptyFormData())
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
getCreateSwitchesEmptyFormData,
|
|
25
|
+
getCreateSwitchesValidationSchema,
|
|
26
|
+
getSwitchTypeSchema
|
|
27
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
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 { CreateSwitchesDialog } from './CreateSwitchesDialog';
|
|
@@ -0,0 +1,8 @@
|
|
|
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 './creation';
|
|
8
|
+
export * from './SwitchesBetweenSections';
|
package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Property } from '../../common';
|
|
2
|
+
import { SubstationCreationDto } from '../../substation';
|
|
3
|
+
export interface CouplingDevice {
|
|
4
|
+
busbarSectionId1: string;
|
|
5
|
+
busbarSectionId2: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SwitchKindFormData {
|
|
8
|
+
switchKind: SwitchKind;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateSwitchesFormData {
|
|
11
|
+
switchKinds: SwitchKindFormData[];
|
|
12
|
+
}
|
|
13
|
+
export declare enum SwitchKind {
|
|
14
|
+
BREAKER = "BREAKER",
|
|
15
|
+
DISCONNECTOR = "DISCONNECTOR",
|
|
16
|
+
LOAD_BREAK_SWITCH = "LOAD_BREAK_SWITCH"
|
|
17
|
+
}
|
|
18
|
+
export type VoltageLevelCreationDto = {
|
|
19
|
+
type: string;
|
|
20
|
+
equipmentId: string;
|
|
21
|
+
equipmentName: string | null;
|
|
22
|
+
substationId: string | null;
|
|
23
|
+
substationCreation: SubstationCreationDto | null;
|
|
24
|
+
nominalV: number | null;
|
|
25
|
+
lowVoltageLimit: number | null;
|
|
26
|
+
highVoltageLimit: number | null;
|
|
27
|
+
ipMin: number | null;
|
|
28
|
+
ipMax: number | null;
|
|
29
|
+
busbarCount: number;
|
|
30
|
+
sectionCount: number;
|
|
31
|
+
switchKinds: SwitchKind[];
|
|
32
|
+
couplingDevices: CouplingDevice[];
|
|
33
|
+
properties: Property[] | null;
|
|
34
|
+
};
|
package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var SwitchKind = /* @__PURE__ */ ((SwitchKind2) => {
|
|
2
|
+
SwitchKind2["BREAKER"] = "BREAKER";
|
|
3
|
+
SwitchKind2["DISCONNECTOR"] = "DISCONNECTOR";
|
|
4
|
+
SwitchKind2["LOAD_BREAK_SWITCH"] = "LOAD_BREAK_SWITCH";
|
|
5
|
+
return SwitchKind2;
|
|
6
|
+
})(SwitchKind || {});
|
|
7
|
+
export {
|
|
8
|
+
SwitchKind
|
|
9
|
+
};
|