@gridsuite/commons-ui 0.209.0 → 0.210.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/components/filter/utils/filterFormUtils.js +2 -1
  2. package/dist/components/index.js +21 -1
  3. package/dist/components/inputs/reactHookForm/booleans/RadioInput.js +1 -1
  4. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.js +3 -3
  5. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -2
  6. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +4 -3
  7. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +3 -3
  8. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +1 -1
  9. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.js +3 -3
  10. package/dist/components/network-modifications/index.d.ts +1 -0
  11. package/dist/components/network-modifications/index.js +21 -1
  12. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.d.ts +6 -0
  13. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.js +199 -0
  14. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.d.ts +64 -0
  15. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +90 -0
  16. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.d.ts → shunt-compensator/common/index.d.ts} +4 -5
  17. package/dist/components/network-modifications/shunt-compensator/common/index.js +13 -0
  18. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.d.ts +20 -0
  19. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.js +1 -0
  20. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.d.ts +27 -0
  21. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.js +16 -0
  22. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.d.ts +3 -0
  23. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +82 -0
  24. package/dist/components/network-modifications/shunt-compensator/creation/index.d.ts +9 -0
  25. package/dist/components/network-modifications/shunt-compensator/creation/index.js +9 -0
  26. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.d.ts +20 -0
  27. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.js +1 -0
  28. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.d.ts +110 -0
  29. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +103 -0
  30. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation → shunt-compensator}/index.d.ts +2 -1
  31. package/dist/components/network-modifications/shunt-compensator/index.js +20 -0
  32. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
  33. package/dist/components/network-modifications/voltageLevel/creation/index.d.ts +1 -0
  34. package/dist/components/network-modifications/voltageLevel/creation/index.js +3 -1
  35. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +6 -2
  36. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +22 -43
  37. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +1 -0
  38. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +2 -0
  39. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -1
  40. package/dist/components/network-modifications/voltageLevel/index.js +3 -1
  41. package/dist/index.js +21 -1
  42. package/dist/translations/en/networkModificationsEn.d.ts +14 -0
  43. package/dist/translations/en/networkModificationsEn.js +14 -0
  44. package/dist/translations/fr/networkModificationsFr.d.ts +14 -0
  45. package/dist/translations/fr/networkModificationsFr.js +14 -0
  46. package/dist/utils/constants/fieldConstants.d.ts +7 -0
  47. package/dist/utils/constants/fieldConstants.js +7 -0
  48. package/package.json +1 -1
  49. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.d.ts +0 -11
  50. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js +0 -84
  51. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.d.ts +0 -6
  52. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.js +0 -11
  53. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +0 -61
  54. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.d.ts +0 -14
  55. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.js +0 -27
  56. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/index.js +0 -4
@@ -0,0 +1,90 @@
1
+ import { string, number, ref } from "yup";
2
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
+ import { YUP_REQUIRED, YUP_NOT_TYPE_NUMBER } 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
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./shuntCompensator.utils.js";
10
+ const getCharacteristicsCreateFormValidationSchema = () => ({
11
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
12
+ is: (characteristicsChoice) => characteristicsChoice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id,
13
+ then: (schema) => schema.min(0, "ShuntCompensatorErrorQAtNominalVoltageLessThanZero").required(YUP_REQUIRED)
14
+ }),
15
+ [FieldConstants.MAX_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
16
+ is: (characteristicsChoice) => characteristicsChoice === CHARACTERISTICS_CHOICES.SUSCEPTANCE.id,
17
+ then: (schema) => schema.required(YUP_REQUIRED)
18
+ }),
19
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).min(1, "MaximumSectionCountMustBeGreaterOrEqualToOne"),
20
+ [FieldConstants.SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).required(YUP_REQUIRED).min(0, "SectionCountMustBeBetweenZeroAndMaximumSectionCount").max(ref(FieldConstants.MAXIMUM_SECTION_COUNT), "SectionCountMustBeBetweenZeroAndMaximumSectionCount"),
21
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).notRequired(),
22
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).notRequired()
23
+ });
24
+ const getCharacteristicsModificationFormValidationSchema = () => ({
25
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).min(0, "ShuntCompensatorErrorQAtNominalVoltageLessThanZero").nullable().default(null),
26
+ [FieldConstants.MAX_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable().default(null),
27
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).min(1, "MaximumSectionCountMustBeGreaterOrEqualToOne").nullable().default(null),
28
+ [FieldConstants.SECTION_COUNT]: number().typeError(YUP_NOT_TYPE_NUMBER).min(0, "SectionCountMustBeBetweenZeroAndMaximumSectionCount").nullable().default(null),
29
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable(),
30
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: number().typeError(YUP_NOT_TYPE_NUMBER).nullable()
31
+ });
32
+ const getCharacteristicsFormValidationSchema = (isModification) => {
33
+ const baseSchema = {
34
+ [FieldConstants.CHARACTERISTICS_CHOICE]: string().required(YUP_REQUIRED),
35
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: string().nullable().default(null).when([FieldConstants.CHARACTERISTICS_CHOICE], {
36
+ is: (choice) => choice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id && !isModification,
37
+ then: (schema) => schema.oneOf([SHUNT_COMPENSATOR_TYPES.CAPACITOR.id, SHUNT_COMPENSATOR_TYPES.REACTOR.id]).required(YUP_REQUIRED)
38
+ })
39
+ };
40
+ const additionalSchema = isModification ? getCharacteristicsModificationFormValidationSchema() : getCharacteristicsCreateFormValidationSchema();
41
+ return {
42
+ ...baseSchema,
43
+ ...additionalSchema
44
+ };
45
+ };
46
+ const getCharacteristicsEmptyFormData = () => ({
47
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: null,
48
+ [FieldConstants.SECTION_COUNT]: null,
49
+ [FieldConstants.CHARACTERISTICS_CHOICE]: CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id,
50
+ [FieldConstants.MAX_SUSCEPTANCE]: null,
51
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: null,
52
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: null,
53
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: null,
54
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: null
55
+ });
56
+ const getCharacteristicsFormData = ({
57
+ maxSusceptance,
58
+ maxQAtNominalV,
59
+ shuntCompensatorType,
60
+ sectionCount,
61
+ maximumSectionCount
62
+ }) => ({
63
+ [FieldConstants.CHARACTERISTICS_CHOICE]: maxSusceptance == null ? CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id : CHARACTERISTICS_CHOICES.SUSCEPTANCE.id,
64
+ [FieldConstants.MAX_SUSCEPTANCE]: maxSusceptance,
65
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: shuntCompensatorType ?? null,
66
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: maxQAtNominalV,
67
+ [FieldConstants.SECTION_COUNT]: sectionCount ?? null,
68
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: maximumSectionCount ?? null,
69
+ [FieldConstants.SWITCHED_ON_Q_AT_NOMINAL_V]: maxQAtNominalV != null && sectionCount != null && maximumSectionCount != null ? computeSwitchedOnValue(sectionCount, maximumSectionCount, maxQAtNominalV) : null,
70
+ [FieldConstants.SWITCHED_ON_SUSCEPTANCE]: maxSusceptance != null && sectionCount != null && maximumSectionCount != null ? computeSwitchedOnValue(sectionCount, maximumSectionCount, maxSusceptance) : null
71
+ });
72
+ const getCharacteristicsCreateFormDataFromSearchCopy = ({
73
+ bPerSection,
74
+ qAtNominalV,
75
+ sectionCount,
76
+ maximumSectionCount
77
+ }) => ({
78
+ [FieldConstants.CHARACTERISTICS_CHOICE]: CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id,
79
+ [FieldConstants.MAX_SUSCEPTANCE]: bPerSection && maximumSectionCount && bPerSection * maximumSectionCount,
80
+ [FieldConstants.SHUNT_COMPENSATOR_TYPE]: bPerSection && bPerSection > 0 ? SHUNT_COMPENSATOR_TYPES.CAPACITOR.id : SHUNT_COMPENSATOR_TYPES.REACTOR.id,
81
+ [FieldConstants.MAX_Q_AT_NOMINAL_V]: qAtNominalV && maximumSectionCount && qAtNominalV * maximumSectionCount,
82
+ [FieldConstants.SECTION_COUNT]: sectionCount,
83
+ [FieldConstants.MAXIMUM_SECTION_COUNT]: maximumSectionCount
84
+ });
85
+ export {
86
+ getCharacteristicsCreateFormDataFromSearchCopy,
87
+ getCharacteristicsEmptyFormData,
88
+ getCharacteristicsFormData,
89
+ getCharacteristicsFormValidationSchema
90
+ };
@@ -4,8 +4,7 @@
4
4
  * License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
- interface CreateSwitchesFormProps {
8
- id: string;
9
- }
10
- declare function CreateSwitchesForm({ id }: Readonly<CreateSwitchesFormProps>): import("react/jsx-runtime").JSX.Element;
11
- export default CreateSwitchesForm;
7
+ export * from './shuntCompensator.types';
8
+ export * from './shuntCompensator.utils';
9
+ export * from './CharacteristicsForm';
10
+ export * from './characteristicsForm.utils';
@@ -0,0 +1,13 @@
1
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./shuntCompensator.utils.js";
2
+ import { CharacteristicsForm } from "./CharacteristicsForm.js";
3
+ import { getCharacteristicsCreateFormDataFromSearchCopy, getCharacteristicsEmptyFormData, getCharacteristicsFormData, getCharacteristicsFormValidationSchema } from "./characteristicsForm.utils.js";
4
+ export {
5
+ CHARACTERISTICS_CHOICES,
6
+ CharacteristicsForm,
7
+ SHUNT_COMPENSATOR_TYPES,
8
+ computeSwitchedOnValue,
9
+ getCharacteristicsCreateFormDataFromSearchCopy,
10
+ getCharacteristicsEmptyFormData,
11
+ getCharacteristicsFormData,
12
+ getCharacteristicsFormValidationSchema
13
+ };
@@ -0,0 +1,20 @@
1
+ import { ConnectablePositionFormInfos } from '../../common/connectivity/connectivity.type';
2
+ import { MeasurementInfo } from '../../common/measurements/measurement.type';
3
+ export interface ShuntCompensatorFormInfos {
4
+ id: string;
5
+ name: string;
6
+ voltageLevelId: string;
7
+ terminalConnected: boolean | null;
8
+ busOrBusbarSectionId?: string;
9
+ connectablePosition: ConnectablePositionFormInfos;
10
+ q?: number;
11
+ targetV?: number;
12
+ targetDeadband?: number;
13
+ sectionCount: number;
14
+ bPerSection?: number;
15
+ qAtNominalV?: number;
16
+ maximumSectionCount: number;
17
+ isLinear?: boolean;
18
+ measurementQ: MeasurementInfo | undefined;
19
+ properties: Record<string, string> | undefined;
20
+ }
@@ -0,0 +1,27 @@
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 const SHUNT_COMPENSATOR_TYPES: {
8
+ readonly REACTOR: {
9
+ readonly id: "REACTOR";
10
+ readonly label: "Reactor";
11
+ };
12
+ readonly CAPACITOR: {
13
+ readonly id: "CAPACITOR";
14
+ readonly label: "Capacitor";
15
+ };
16
+ };
17
+ export declare const CHARACTERISTICS_CHOICES: {
18
+ readonly Q_AT_NOMINAL_V: {
19
+ readonly id: "Q_AT_NOMINAL_V";
20
+ readonly label: "QatNominalVLabel";
21
+ };
22
+ readonly SUSCEPTANCE: {
23
+ readonly id: "SUSCEPTANCE";
24
+ readonly label: "SusceptanceLabel";
25
+ };
26
+ };
27
+ export declare const computeSwitchedOnValue: (sectionCount: number, maximumSectionCount: number, linkedSwitchedOnValue: number) => number;
@@ -0,0 +1,16 @@
1
+ const SHUNT_COMPENSATOR_TYPES = {
2
+ REACTOR: { id: "REACTOR", label: "Reactor" },
3
+ CAPACITOR: { id: "CAPACITOR", label: "Capacitor" }
4
+ };
5
+ const CHARACTERISTICS_CHOICES = {
6
+ Q_AT_NOMINAL_V: { id: "Q_AT_NOMINAL_V", label: "QatNominalVLabel" },
7
+ SUSCEPTANCE: { id: "SUSCEPTANCE", label: "SusceptanceLabel" }
8
+ };
9
+ const computeSwitchedOnValue = (sectionCount, maximumSectionCount, linkedSwitchedOnValue) => {
10
+ return linkedSwitchedOnValue / maximumSectionCount * sectionCount;
11
+ };
12
+ export {
13
+ CHARACTERISTICS_CHOICES,
14
+ SHUNT_COMPENSATOR_TYPES,
15
+ computeSwitchedOnValue
16
+ };
@@ -0,0 +1,3 @@
1
+ import { ConnectivityNetworkProps } from '../../common/connectivity/connectivity.type';
2
+ export type ShuntCompensatorCreationFormProps = ConnectivityNetworkProps;
3
+ export declare function ShuntCompensatorCreationForm({ voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, }: Readonly<ShuntCompensatorCreationFormProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,82 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import "react-intl";
4
+ import "../../../overflowableText/OverflowableText.js";
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 "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/arrows_input.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 "../../../inputs/reactHookForm/expandableInput/ExpandableInput.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 GridSection from "../../../grid/grid-section.js";
40
+ import { ConnectivityForm } from "../../common/connectivity/ConnectivityForm.js";
41
+ import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
42
+ import { filledTextField } from "../../common/form.utils.js";
43
+ import "../../common/properties/propertyUtils.js";
44
+ import { CharacteristicsForm } from "../common/CharacteristicsForm.js";
45
+ function ShuntCompensatorCreationForm({
46
+ voltageLevelOptions = [],
47
+ fetchBusesOrBusbarSections,
48
+ PositionDiagramPane
49
+ }) {
50
+ return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 2, children: [
51
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
52
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
53
+ TextInput,
54
+ {
55
+ name: FieldConstants.EQUIPMENT_ID,
56
+ label: "ID",
57
+ formProps: { autoFocus: true, ...filledTextField }
58
+ }
59
+ ) }),
60
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.EQUIPMENT_NAME, label: "Name", formProps: filledTextField }) })
61
+ ] }) }),
62
+ /* @__PURE__ */ jsxs(Grid, { item: true, children: [
63
+ /* @__PURE__ */ jsx(GridSection, { title: "Connectivity" }),
64
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
65
+ ConnectivityForm,
66
+ {
67
+ voltageLevelOptions,
68
+ PositionDiagramPane,
69
+ fetchBusesOrBusbarSections
70
+ }
71
+ ) }) })
72
+ ] }),
73
+ /* @__PURE__ */ jsxs(Grid, { item: true, children: [
74
+ /* @__PURE__ */ jsx(GridSection, { title: "Characteristics" }),
75
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(CharacteristicsForm, { isModification: false }) }) })
76
+ ] }),
77
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "shuntCompensator" }) })
78
+ ] });
79
+ }
80
+ export {
81
+ ShuntCompensatorCreationForm
82
+ };
@@ -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 './ShuntCompensatorCreationForm';
8
+ export * from './shuntCompensatorCreation.types';
9
+ export * from './shuntCompensatorCreation.utils';
@@ -0,0 +1,9 @@
1
+ import { ShuntCompensatorCreationForm } from "./ShuntCompensatorCreationForm.js";
2
+ import { shuntCompensatorCreationDtoToForm, shuntCompensatorCreationEmptyFormData, shuntCompensatorCreationFormSchema, shuntCompensatorCreationFormToDto } from "./shuntCompensatorCreation.utils.js";
3
+ export {
4
+ ShuntCompensatorCreationForm,
5
+ shuntCompensatorCreationDtoToForm,
6
+ shuntCompensatorCreationEmptyFormData,
7
+ shuntCompensatorCreationFormSchema,
8
+ shuntCompensatorCreationFormToDto
9
+ };
@@ -0,0 +1,20 @@
1
+ import { ModificationType } from '../../../../utils';
2
+ import { Property } from '../../common';
3
+ export interface ShuntCompensatorCreationDto {
4
+ type: ModificationType;
5
+ uuid?: string;
6
+ equipmentId: string;
7
+ equipmentName: string | null;
8
+ maxSusceptance: number | null;
9
+ maxQAtNominalV: number | null;
10
+ shuntCompensatorType: string | null;
11
+ sectionCount: number | null;
12
+ maximumSectionCount: number | null;
13
+ voltageLevelId: string;
14
+ busOrBusbarSectionId: string;
15
+ connectionDirection: string | null;
16
+ connectionName?: string | null;
17
+ connectionPosition?: number | null;
18
+ terminalConnected?: boolean | null;
19
+ properties: Property[] | null;
20
+ }
@@ -0,0 +1,110 @@
1
+ import { InferType } from 'yup';
2
+ import { DeepNullable } from '../../../../utils';
3
+ import { ShuntCompensatorCreationDto } from './shuntCompensatorCreation.types';
4
+ export declare const shuntCompensatorCreationFormSchema: import('yup').ObjectSchema<NonNullable<({
5
+ maxQAtNominalV: number | null;
6
+ maxSusceptance: number | null;
7
+ maximumSectionCount: number | null;
8
+ sectionCount: number | null;
9
+ switchedOnQAtNominalV: number | null | undefined;
10
+ switchedOnSusceptance: number | null | undefined;
11
+ characteristicsChoice: string;
12
+ shuntCompensatorType: string | null;
13
+ equipmentID: string;
14
+ equipmentName: string | null | undefined;
15
+ connectivity: {
16
+ terminalConnected?: boolean | null | undefined;
17
+ connectionDirection?: string | null | undefined;
18
+ connectionName?: string | undefined;
19
+ connectionPosition?: number | null | undefined;
20
+ busOrBusbarSection: {
21
+ id?: string | undefined;
22
+ } | null;
23
+ voltageLevel: {
24
+ id?: string | undefined;
25
+ } | null;
26
+ };
27
+ } | {
28
+ maxQAtNominalV: number | null;
29
+ maxSusceptance: number | null;
30
+ maximumSectionCount: number;
31
+ sectionCount: number;
32
+ switchedOnQAtNominalV: import('yup').Maybe<number | undefined>;
33
+ switchedOnSusceptance: import('yup').Maybe<number | undefined>;
34
+ characteristicsChoice: string;
35
+ shuntCompensatorType: string | null;
36
+ equipmentID: string;
37
+ equipmentName: string | null | undefined;
38
+ connectivity: {
39
+ terminalConnected?: boolean | null | undefined;
40
+ connectionDirection?: string | null | undefined;
41
+ connectionName?: string | undefined;
42
+ connectionPosition?: number | null | undefined;
43
+ busOrBusbarSection: {
44
+ id?: string | undefined;
45
+ } | null;
46
+ voltageLevel: {
47
+ id?: string | undefined;
48
+ } | null;
49
+ };
50
+ }) & {
51
+ AdditionalProperties: {
52
+ previousValue?: string | null | undefined;
53
+ added: NonNullable<boolean | undefined>;
54
+ deletionMark: NonNullable<boolean | undefined>;
55
+ name: string;
56
+ value: string;
57
+ }[] | undefined;
58
+ }>, import('yup').AnyObject, {
59
+ maxQAtNominalV: null;
60
+ maxSusceptance: null;
61
+ maximumSectionCount: null;
62
+ sectionCount: null;
63
+ switchedOnQAtNominalV: undefined;
64
+ switchedOnSusceptance: undefined;
65
+ characteristicsChoice: undefined;
66
+ shuntCompensatorType: null;
67
+ equipmentID: undefined;
68
+ equipmentName: undefined;
69
+ connectivity: {
70
+ voltageLevel: {
71
+ id: undefined;
72
+ };
73
+ busOrBusbarSection: {
74
+ id: undefined;
75
+ };
76
+ connectionDirection: undefined;
77
+ connectionName: undefined;
78
+ connectionPosition: undefined;
79
+ terminalConnected: undefined;
80
+ };
81
+ AdditionalProperties: "";
82
+ } | {
83
+ maxQAtNominalV: null;
84
+ maxSusceptance: null;
85
+ maximumSectionCount: undefined;
86
+ sectionCount: undefined;
87
+ switchedOnQAtNominalV: undefined;
88
+ switchedOnSusceptance: undefined;
89
+ characteristicsChoice: undefined;
90
+ shuntCompensatorType: null;
91
+ equipmentID: undefined;
92
+ equipmentName: undefined;
93
+ connectivity: {
94
+ voltageLevel: {
95
+ id: undefined;
96
+ };
97
+ busOrBusbarSection: {
98
+ id: undefined;
99
+ };
100
+ connectionDirection: undefined;
101
+ connectionName: undefined;
102
+ connectionPosition: undefined;
103
+ terminalConnected: undefined;
104
+ };
105
+ AdditionalProperties: "";
106
+ }, "">;
107
+ export type ShuntCompensatorCreationFormData = InferType<typeof shuntCompensatorCreationFormSchema>;
108
+ export declare const shuntCompensatorCreationEmptyFormData: DeepNullable<ShuntCompensatorCreationFormData>;
109
+ export declare const shuntCompensatorCreationDtoToForm: (shuntDto: ShuntCompensatorCreationDto) => ShuntCompensatorCreationFormData;
110
+ export declare const shuntCompensatorCreationFormToDto: (shuntForm: ShuntCompensatorCreationFormData) => ShuntCompensatorCreationDto;
@@ -0,0 +1,103 @@
1
+ import { object, string } 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 { UNDEFINED_CONNECTION_DIRECTION } from "../../../../utils/types/equipmentType.js";
6
+ import { ModificationType } from "../../../../utils/types/modificationType.js";
7
+ import "react/jsx-runtime";
8
+ import "@mui/icons-material";
9
+ import { sanitizeString } from "../../../../utils/ts-utils.js";
10
+ import "../../../../utils/yupConfig.js";
11
+ import "react";
12
+ import "react-hook-form";
13
+ import { creationPropertiesSchema, getFilledPropertiesFromModification, toModificationProperties } from "../../common/properties/propertyUtils.js";
14
+ import "@mui/material";
15
+ import "react-intl";
16
+ import "../../../overflowableText/OverflowableText.js";
17
+ import "localized-countries";
18
+ import "localized-countries/data/fr";
19
+ import "localized-countries/data/en";
20
+ import "notistack";
21
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
22
+ import "../../../treeViewFinder/TreeViewFinder.js";
23
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
24
+ import "../../../customAGGrid/customAggrid.js";
25
+ import "ag-grid-community";
26
+ import "react-papaparse";
27
+ import "react-csv-downloader";
28
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
29
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
30
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
31
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
32
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
33
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
34
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
35
+ import "../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
36
+ import "@react-querybuilder/material";
37
+ import "../../../filter/expert/expertFilterConstants.js";
38
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
39
+ import "uuid";
40
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
41
+ import "react-querybuilder";
42
+ import { getConnectivityWithPositionSchema, getConnectivityWithPositionEmptyFormDataProps, getConnectivityFormDataProps } from "../../common/connectivity/connectivityForm.utils.js";
43
+ import { CHARACTERISTICS_CHOICES } from "../common/shuntCompensator.utils.js";
44
+ import { getCharacteristicsFormValidationSchema, getCharacteristicsEmptyFormData, getCharacteristicsFormData } from "../common/characteristicsForm.utils.js";
45
+ const shuntCompensatorCreationFormSchema = object().shape({
46
+ [FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED),
47
+ [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
48
+ [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(false),
49
+ ...getCharacteristicsFormValidationSchema(false)
50
+ }).concat(creationPropertiesSchema).required(YUP_REQUIRED);
51
+ const shuntCompensatorCreationEmptyFormData = {
52
+ [FieldConstants.EQUIPMENT_ID]: "",
53
+ [FieldConstants.EQUIPMENT_NAME]: "",
54
+ [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionEmptyFormDataProps(),
55
+ ...getCharacteristicsEmptyFormData(),
56
+ [FieldConstants.ADDITIONAL_PROPERTIES]: []
57
+ };
58
+ const shuntCompensatorCreationDtoToForm = (shuntDto) => ({
59
+ [FieldConstants.EQUIPMENT_ID]: shuntDto.equipmentId,
60
+ [FieldConstants.EQUIPMENT_NAME]: shuntDto.equipmentName ?? "",
61
+ [FieldConstants.CONNECTIVITY]: getConnectivityFormDataProps({
62
+ voltageLevelId: shuntDto.voltageLevelId,
63
+ busbarSectionId: shuntDto.busOrBusbarSectionId,
64
+ connectionDirection: shuntDto.connectionDirection,
65
+ connectionName: shuntDto.connectionName,
66
+ connectionPosition: shuntDto.connectionPosition,
67
+ terminalConnected: shuntDto.terminalConnected
68
+ }),
69
+ ...getCharacteristicsFormData({
70
+ maxSusceptance: shuntDto.maxSusceptance ?? null,
71
+ maxQAtNominalV: shuntDto.maxQAtNominalV ?? null,
72
+ shuntCompensatorType: shuntDto.shuntCompensatorType,
73
+ sectionCount: shuntDto.sectionCount,
74
+ maximumSectionCount: shuntDto.maximumSectionCount
75
+ }),
76
+ [FieldConstants.ADDITIONAL_PROPERTIES]: getFilledPropertiesFromModification(shuntDto?.properties)
77
+ });
78
+ const shuntCompensatorCreationFormToDto = (shuntForm) => {
79
+ const choice = shuntForm[FieldConstants.CHARACTERISTICS_CHOICE];
80
+ return {
81
+ type: ModificationType.SHUNT_COMPENSATOR_CREATION,
82
+ equipmentId: shuntForm[FieldConstants.EQUIPMENT_ID],
83
+ equipmentName: sanitizeString(shuntForm[FieldConstants.EQUIPMENT_NAME]),
84
+ maxSusceptance: choice === CHARACTERISTICS_CHOICES.SUSCEPTANCE.id ? shuntForm[FieldConstants.MAX_SUSCEPTANCE] ?? null : null,
85
+ maxQAtNominalV: choice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id ? shuntForm[FieldConstants.MAX_Q_AT_NOMINAL_V] ?? null : null,
86
+ shuntCompensatorType: choice === CHARACTERISTICS_CHOICES.Q_AT_NOMINAL_V.id ? shuntForm[FieldConstants.SHUNT_COMPENSATOR_TYPE] ?? null : null,
87
+ sectionCount: shuntForm[FieldConstants.SECTION_COUNT] ?? null,
88
+ maximumSectionCount: shuntForm[FieldConstants.MAXIMUM_SECTION_COUNT] ?? null,
89
+ voltageLevelId: shuntForm[FieldConstants.CONNECTIVITY]?.voltageLevel?.id ?? "",
90
+ busOrBusbarSectionId: shuntForm[FieldConstants.CONNECTIVITY]?.busOrBusbarSection?.id ?? "",
91
+ connectionDirection: shuntForm[FieldConstants.CONNECTIVITY]?.connectionDirection ?? UNDEFINED_CONNECTION_DIRECTION,
92
+ connectionName: sanitizeString(shuntForm[FieldConstants.CONNECTIVITY]?.connectionName),
93
+ connectionPosition: shuntForm[FieldConstants.CONNECTIVITY]?.connectionPosition ?? null,
94
+ terminalConnected: shuntForm[FieldConstants.CONNECTIVITY]?.terminalConnected ?? null,
95
+ properties: toModificationProperties(shuntForm)
96
+ };
97
+ };
98
+ export {
99
+ shuntCompensatorCreationDtoToForm,
100
+ shuntCompensatorCreationEmptyFormData,
101
+ shuntCompensatorCreationFormSchema,
102
+ shuntCompensatorCreationFormToDto
103
+ };
@@ -4,4 +4,5 @@
4
4
  * License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
- export { CreateSwitchesDialog } from './CreateSwitchesDialog';
7
+ export * from './common';
8
+ export * from './creation';
@@ -0,0 +1,20 @@
1
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./common/shuntCompensator.utils.js";
2
+ import { CharacteristicsForm } from "./common/CharacteristicsForm.js";
3
+ import { getCharacteristicsCreateFormDataFromSearchCopy, getCharacteristicsEmptyFormData, getCharacteristicsFormData, getCharacteristicsFormValidationSchema } from "./common/characteristicsForm.utils.js";
4
+ import { ShuntCompensatorCreationForm } from "./creation/ShuntCompensatorCreationForm.js";
5
+ import { shuntCompensatorCreationDtoToForm, shuntCompensatorCreationEmptyFormData, shuntCompensatorCreationFormSchema, shuntCompensatorCreationFormToDto } from "./creation/shuntCompensatorCreation.utils.js";
6
+ export {
7
+ CHARACTERISTICS_CHOICES,
8
+ CharacteristicsForm,
9
+ SHUNT_COMPENSATOR_TYPES,
10
+ ShuntCompensatorCreationForm,
11
+ computeSwitchedOnValue,
12
+ getCharacteristicsCreateFormDataFromSearchCopy,
13
+ getCharacteristicsEmptyFormData,
14
+ getCharacteristicsFormData,
15
+ getCharacteristicsFormValidationSchema,
16
+ shuntCompensatorCreationDtoToForm,
17
+ shuntCompensatorCreationEmptyFormData,
18
+ shuntCompensatorCreationFormSchema,
19
+ shuntCompensatorCreationFormToDto
20
+ };
@@ -37,7 +37,7 @@ import "uuid";
37
37
  import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
38
38
  import "react-querybuilder";
39
39
  import { VoltageLevelTab, VOLTAGE_LEVEL_TAB_FIELDS } from "./voltageLevel.constants.js";
40
- import "./tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js";
40
+ import "./voltageLevelCreation.utils.js";
41
41
  import { StructureTab } from "./tabs/structureTab/StructureTab.js";
42
42
  import { SubstationTab } from "./tabs/substationTab/SubstationTab.js";
43
43
  import { CharacteristicsTab } from "./tabs/characteristicsTab/CharacteristicsTab.js";
@@ -5,6 +5,7 @@
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
7
  export { SwitchesBetweenSections } from './tabs';
8
+ export { MAX_SECTIONS_COUNT } from './voltageLevel.constants';
8
9
  export * from './VoltageLevelCreationForm';
9
10
  export * from './voltageLevelCreation.utils';
10
11
  export * from './voltageLevelCreation.types';
@@ -1,6 +1,7 @@
1
1
  import { SwitchesBetweenSections } from "./tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js";
2
2
  import "react/jsx-runtime";
3
3
  import "@mui/material";
4
+ import "react";
4
5
  import "react-hook-form";
5
6
  import "react-intl";
6
7
  import "../../../overflowableText/OverflowableText.js";
@@ -8,7 +9,6 @@ import "../../../../utils/conversionUtils.js";
8
9
  import "../../../../utils/types/equipmentType.js";
9
10
  import "@mui/icons-material";
10
11
  import "../../../../utils/yupConfig.js";
11
- import "react";
12
12
  import "localized-countries";
13
13
  import "localized-countries/data/fr";
14
14
  import "localized-countries/data/en";
@@ -36,10 +36,12 @@ import "uuid";
36
36
  import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
37
37
  import "react-querybuilder";
38
38
  import "../../common/properties/propertyUtils.js";
39
+ import { MAX_SECTIONS_COUNT } from "./voltageLevel.constants.js";
39
40
  import { VoltageLevelCreationForm } from "./VoltageLevelCreationForm.js";
40
41
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./voltageLevelCreation.utils.js";
41
42
  import { SwitchKind } from "./voltageLevelCreation.types.js";
42
43
  export {
44
+ MAX_SECTIONS_COUNT,
43
45
  SWITCH_TYPE,
44
46
  SwitchKind,
45
47
  SwitchesBetweenSections,
@@ -1,6 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Grid } from "@mui/material";
3
- import { useWatch } from "react-hook-form";
3
+ import { useEffect } from "react";
4
+ import { useFormContext, useWatch } from "react-hook-form";
4
5
  import GridSection from "../../../../../grid/grid-section.js";
5
6
  import "react-intl";
6
7
  import "../../../../../overflowableText/OverflowableText.js";
@@ -9,7 +10,6 @@ import "../../../../../../utils/conversionUtils.js";
9
10
  import "../../../../../../utils/types/equipmentType.js";
10
11
  import "@mui/icons-material";
11
12
  import "../../../../../../utils/yupConfig.js";
12
- import "react";
13
13
  import "localized-countries";
14
14
  import "localized-countries/data/fr";
15
15
  import "localized-countries/data/en";
@@ -40,8 +40,12 @@ import "react-querybuilder";
40
40
  import { SwitchesBetweenSections } from "./switchesBetweenSections/SwitchesBetweenSections.js";
41
41
  import { CouplingOmnibusForm } from "./couplingOmnibus/CouplingOmnibusForm.js";
42
42
  function StructureTab() {
43
+ const { trigger } = useFormContext();
43
44
  const watchBusBarCount = useWatch({ name: FieldConstants.BUS_BAR_COUNT });
44
45
  const watchSectionCount = useWatch({ name: FieldConstants.SECTION_COUNT });
46
+ useEffect(() => {
47
+ trigger(FieldConstants.SECTION_COUNT);
48
+ }, [watchSectionCount, trigger]);
45
49
  const displayOmnibus = watchBusBarCount > 1 || watchSectionCount > 1;
46
50
  return /* @__PURE__ */ jsxs(Fragment, { children: [
47
51
  /* @__PURE__ */ jsx(GridSection, { title: "BusBarSections" }),