@gridsuite/commons-ui 0.266.0 → 0.267.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 (33) hide show
  1. package/dist/components/ui/inputs/checkbox-autocomplete/checkbox-autocomplete.js +2 -1
  2. package/dist/components/ui/reactHookForm/CheckboxNullableInput.js +4 -2
  3. package/dist/components/ui/reactHookForm/autocompleteInputs/MultipleAutocompleteInput.js +3 -2
  4. package/dist/components/ui/reactHookForm/booleans/BooleanInput.d.ts +1 -1
  5. package/dist/components/ui/reactHookForm/booleans/BooleanInput.js +4 -6
  6. package/dist/components/ui/reactHookForm/tableInputs/table-numerical-input.js +4 -2
  7. package/dist/components/ui/reactHookForm/tableInputs/table-text-input.d.ts +1 -1
  8. package/dist/components/ui/reactHookForm/tableInputs/table-text-input.js +2 -3
  9. package/dist/components/ui/reactHookForm/text/ExpandingTextField.js +15 -13
  10. package/dist/components/ui/reactHookForm/text/TextInput.js +4 -2
  11. package/dist/components/ui/reactHookForm/text/UniqueNameInput.js +4 -2
  12. package/dist/components/ui/reactHookForm/utils/TextFieldWithAdornment.js +2 -1
  13. package/dist/features/index.js +7 -0
  14. package/dist/features/network-modifications/common/connectivity/connectivity.type.d.ts +1 -1
  15. package/dist/features/network-modifications/index.js +7 -0
  16. package/dist/features/network-modifications/voltageLevel/index.d.ts +1 -0
  17. package/dist/features/network-modifications/voltageLevel/index.js +7 -0
  18. package/dist/features/network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.d.ts +6 -0
  19. package/dist/features/network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.js +135 -0
  20. package/dist/features/network-modifications/voltageLevel/topology/index.d.ts +9 -0
  21. package/dist/features/network-modifications/voltageLevel/topology/index.js +9 -0
  22. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.types.d.ts +8 -0
  23. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.types.js +1 -0
  24. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.d.ts +25 -0
  25. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.js +48 -0
  26. package/dist/index.js +7 -0
  27. package/dist/translations/en/networkModificationsEn.d.ts +7 -0
  28. package/dist/translations/en/networkModificationsEn.js +9 -1
  29. package/dist/translations/fr/networkModificationsFr.d.ts +7 -0
  30. package/dist/translations/fr/networkModificationsFr.js +9 -1
  31. package/dist/utils/constants/fieldConstants.d.ts +9 -0
  32. package/dist/utils/constants/fieldConstants.js +9 -0
  33. package/package.json +1 -1
@@ -105,6 +105,7 @@ function CheckboxAutocomplete({
105
105
  disableCloseOnSelect: true,
106
106
  size: "small",
107
107
  disableListWrap: true,
108
+ slots: { popper: StyledPopper },
108
109
  options,
109
110
  noOptionsText: intl.formatMessage({ id: "noOption" }),
110
111
  getOptionLabel,
@@ -116,8 +117,8 @@ function CheckboxAutocomplete({
116
117
  inputValue,
117
118
  onChange: handleChange,
118
119
  onBlur: handleBlur,
119
- slots: { popper: StyledPopper },
120
120
  slotProps: {
121
+ ...otherProps?.slotProps,
121
122
  listbox: { component: virtualize ? VirtualizedList : void 0 }
122
123
  }
123
124
  }
@@ -36,6 +36,7 @@ function CheckboxNullableInput({
36
36
  onChange?.(newValue);
37
37
  }, [rhfOnChange, onChange, value]);
38
38
  const currentLabel = typeof label === "function" ? label(value) : label;
39
+ const { slotProps, ...otherFormProps } = formProps ?? {};
39
40
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, size: "small", children: [
40
41
  /* @__PURE__ */ jsx(
41
42
  FormControlLabel,
@@ -51,9 +52,10 @@ function CheckboxNullableInput({
51
52
  slotProps: {
52
53
  input: {
53
54
  "aria-label": "primary checkbox"
54
- }
55
+ },
56
+ ...slotProps
55
57
  },
56
- ...formProps
58
+ ...otherFormProps
57
59
  }
58
60
  ),
59
61
  label: !label ? "" : intl.formatMessage({
@@ -20,6 +20,7 @@ function MultipleAutocompleteInput({ name, ...props }) {
20
20
  const newValues = values.map((val) => val.trim());
21
21
  return newValues.filter((val, index) => newValues.indexOf(val) === index);
22
22
  };
23
+ const { slotProps, ...otherProps } = props;
23
24
  return /* @__PURE__ */ jsx(
24
25
  AutocompleteInput,
25
26
  {
@@ -34,8 +35,8 @@ function MultipleAutocompleteInput({ name, ...props }) {
34
35
  onBlur: handleOnBlur,
35
36
  blurOnSelect: false,
36
37
  multiple: true,
37
- slotProps: { chip: { size: "small" } },
38
- ...props
38
+ slotProps: { chip: { size: "small" }, ...slotProps },
39
+ ...otherProps
39
40
  }
40
41
  );
41
42
  }
@@ -8,5 +8,5 @@ export type BooleanInputProps<TInput extends InputTypes> = {
8
8
  formProps?: InputProps<TInput>;
9
9
  Input: TInput;
10
10
  };
11
- export declare function BooleanInput<TInput extends InputTypes>({ name, label, formProps, Input, ...props }: Readonly<BooleanInputProps<TInput>>): JSX.Element;
11
+ export declare function BooleanInput<TInput extends InputTypes>({ name, label, formProps, Input, }: Readonly<BooleanInputProps<TInput>>): JSX.Element;
12
12
  export {};
@@ -7,10 +7,9 @@ function BooleanInput({
7
7
  name,
8
8
  label,
9
9
  formProps,
10
- Input,
11
- ...props
10
+ Input
12
11
  }) {
13
- const { onChange, ...otherFormProps } = formProps ?? { onChange: void 0 };
12
+ const { onChange, slotProps, ...otherFormProps } = formProps ?? { onChange: void 0 };
14
13
  const {
15
14
  field: { onChange: onChangeRhf, value, ref }
16
15
  } = useController({ name });
@@ -28,9 +27,8 @@ function BooleanInput({
28
27
  checked: value,
29
28
  onChange: handleChangeValue,
30
29
  inputRef: ref,
31
- slotProps: { input: { "aria-label": "primary checkbox" } },
32
- ...otherFormProps,
33
- ...props
30
+ slotProps: { input: { "aria-label": "primary checkbox" }, ...slotProps },
31
+ ...otherFormProps
34
32
  }
35
33
  );
36
34
  if (label) {
@@ -64,6 +64,7 @@ function TableNumericalInput({
64
64
  const handleClearValue = () => {
65
65
  onChange(outputTransform(previousValue));
66
66
  };
67
+ const { slotProps, ...otherProps } = props;
67
68
  return /* @__PURE__ */ jsx(
68
69
  TextField,
69
70
  {
@@ -103,10 +104,11 @@ function TableNumericalInput({
103
104
  // to have '.' as decimal separator
104
105
  ...inputProps
105
106
  }
106
- }
107
+ },
108
+ ...slotProps
107
109
  },
108
110
  ...hideErrorMessage ? {} : genHelperError(error?.message),
109
- ...props
111
+ ...otherProps
110
112
  }
111
113
  );
112
114
  }
@@ -4,5 +4,5 @@ interface TableTextInputProps {
4
4
  hideErrorMessage?: boolean;
5
5
  inputProps?: InputBaseComponentProps;
6
6
  }
7
- export declare function TableTextInput({ name, hideErrorMessage, inputProps, ...props }: Readonly<TableTextInputProps>): import("react").JSX.Element;
7
+ export declare function TableTextInput({ name, hideErrorMessage, inputProps }: Readonly<TableTextInputProps>): import("react").JSX.Element;
8
8
  export {};
@@ -5,7 +5,7 @@ import "react-intl";
5
5
  import "react";
6
6
  import "@mui/icons-material";
7
7
  import { genHelperError } from "../utils/functions.js";
8
- function TableTextInput({ name, hideErrorMessage, inputProps, ...props }) {
8
+ function TableTextInput({ name, hideErrorMessage, inputProps }) {
9
9
  const {
10
10
  field: { onChange, value, ref },
11
11
  fieldState: { error }
@@ -37,8 +37,7 @@ function TableTextInput({ name, hideErrorMessage, inputProps, ...props }) {
37
37
  }
38
38
  }
39
39
  },
40
- ...hideErrorMessage ? {} : genHelperError(error?.message),
41
- ...props
40
+ ...hideErrorMessage ? {} : genHelperError(error?.message)
42
41
  }
43
42
  );
44
43
  }
@@ -27,34 +27,36 @@ function ExpandingTextField({
27
27
  const descriptionLength = descriptionWatch?.length ?? 0;
28
28
  const descriptionCounter = `${descriptionLength}/${maxCharactersNumber}`;
29
29
  const rowsToDisplay = isFocused ? rows : minRows;
30
+ const { slotProps, ...otherProps } = textFieldFormProps ?? {};
30
31
  const formProps = {
31
32
  size: "medium",
32
33
  multiline: true,
33
34
  onFocus: handleFocus,
34
35
  onBlur: handleBlur,
35
- InputProps: {
36
- style: {
37
- textOverflow: "ellipsis",
38
- overflow: "hidden",
39
- // disable scrolling
40
- whiteSpace: "pre",
41
- resize: "none"
42
- // or 'horizontal' for horizontal resizing
43
- },
44
- inputProps: { "data-testid": "DescriptionInputField" }
45
- },
46
36
  helperText: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: descriptionCounter }),
47
37
  slotProps: {
38
+ input: {
39
+ style: {
40
+ textOverflow: "ellipsis",
41
+ overflow: "hidden",
42
+ // disable scrolling
43
+ whiteSpace: "pre",
44
+ resize: "none"
45
+ // or 'horizontal' for horizontal resizing
46
+ },
47
+ inputProps: { "data-testid": "DescriptionInputField" }
48
+ },
48
49
  formHelperText: {
49
50
  sx: {
50
51
  ml: "auto",
51
52
  color: (theme) => isOverTheLimit ? theme.palette.error.main : theme.palette.text.secondary
52
53
  }
53
- }
54
+ },
55
+ ...slotProps
54
56
  },
55
57
  ...rowsToDisplay && { rows: rowsToDisplay },
56
58
  ...sx && { sx },
57
- ...textFieldFormProps
59
+ ...otherProps
58
60
  };
59
61
  return /* @__PURE__ */ jsx(TextInput, { name, label, formProps, ...otherTexFieldProps });
60
62
  }
@@ -56,6 +56,7 @@ function TextInput({
56
56
  values: labelValues,
57
57
  optional: !isFieldRequired(name, validationSchema, getValues()) && !formProps?.disabled && !removeOptional
58
58
  });
59
+ const { slotProps, ...otherFormProps } = formProps ?? {};
59
60
  return /* @__PURE__ */ jsx(
60
61
  Field,
61
62
  {
@@ -73,7 +74,8 @@ function TextInput({
73
74
  clearable && transformedValue !== void 0 && transformedValue !== "" && /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, size: "small", children: /* @__PURE__ */ jsx(Clear, { fontSize: "small" }) }),
74
75
  customAdornment && { ...customAdornment }
75
76
  ] })
76
- }
77
+ },
78
+ ...slotProps
77
79
  },
78
80
  inputRef: ref,
79
81
  ...clearable && adornment && {
@@ -89,7 +91,7 @@ function TextInput({
89
91
  }
90
92
  ),
91
93
  ...genHelperError(error?.message),
92
- ...formProps,
94
+ ...otherFormProps,
93
95
  ...adornment && { ...finalAdornment }
94
96
  },
95
97
  id ?? label
@@ -41,6 +41,7 @@ function UniqueNameInput({
41
41
  isValidating && /* @__PURE__ */ jsx(CircularProgress, { size: "1rem" }),
42
42
  showOk && /* @__PURE__ */ jsx(Check, { style: { color: "green" } })
43
43
  ] });
44
+ const { slotProps, ...otherFormProps } = formProps ?? {};
44
45
  return /* @__PURE__ */ jsx(
45
46
  TextField,
46
47
  {
@@ -64,9 +65,10 @@ function UniqueNameInput({
64
65
  inputProps: {
65
66
  "data-testid": "NameInputField"
66
67
  }
67
- }
68
+ },
69
+ ...slotProps
68
70
  },
69
- ...formProps
71
+ ...otherFormProps
70
72
  }
71
73
  );
72
74
  }
@@ -3,7 +3,7 @@ import { useState, useCallback } from "react";
3
3
  import { Clear } from "@mui/icons-material";
4
4
  import { InputAdornment, IconButton, TextField } from "@mui/material";
5
5
  function TextFieldWithAdornment(props) {
6
- const { adornmentPosition, adornmentText, value, variant, handleClearValue, ...otherProps } = props;
6
+ const { adornmentPosition, adornmentText, value, variant, handleClearValue, slotProps, ...otherProps } = props;
7
7
  const [isFocused, setIsFocused] = useState(false);
8
8
  const getAdornmentStyle = useCallback((innerVariant) => {
9
9
  if (innerVariant === "filled") {
@@ -54,6 +54,7 @@ function TextFieldWithAdornment(props) {
54
54
  onFocus: () => setIsFocused(true),
55
55
  onBlur: () => setIsFocused(false),
56
56
  slotProps: {
57
+ ...slotProps,
57
58
  input: adornmentPosition === "start" ? withStartAdornmentText() : withEndAdornmentText()
58
59
  }
59
60
  }
@@ -162,6 +162,8 @@ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, ge
162
162
  import { SwitchKind } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.types.js";
163
163
  import { VoltageLevelModificationForm } from "./network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js";
164
164
  import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./network-modifications/voltageLevel/modification/voltageLevelModification.utils.js";
165
+ import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.js";
166
+ import { CreateVoltageLevelTopologyForm } from "./network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.js";
165
167
  import { LOAD_TAB_FIELDS, LoadDialogTab } from "./network-modifications/load/common/load.utils.js";
166
168
  import { LoadDialogTabs } from "./network-modifications/load/common/LoadDialogTabs.js";
167
169
  import { LoadDialogTabsContent } from "./network-modifications/load/common/LoadDialogTabsContent.js";
@@ -307,6 +309,7 @@ export {
307
309
  ConnectivityForm,
308
310
  ContingencyTable,
309
311
  CreateParameterDialog,
312
+ CreateVoltageLevelTopologyForm,
310
313
  CustomVoltageLevelTable,
311
314
  CustomVoltageLevelTableCell,
312
315
  CustomVoltageLevelTableRow,
@@ -637,6 +640,10 @@ export {
637
640
  createPropertyModification,
638
641
  createRootNetworkChipCellSx,
639
642
  createRowSx,
643
+ createVoltageLevelTopologyDtoToForm,
644
+ createVoltageLevelTopologyEmptyFormData,
645
+ createVoltageLevelTopologyFormSchema,
646
+ createVoltageLevelTopologyFormToDto,
640
647
  creationPropertiesSchema,
641
648
  dispatchUser,
642
649
  emptyFormData,
@@ -21,7 +21,7 @@ export interface Connectivity {
21
21
  connectionPosition?: number;
22
22
  terminalConnected?: boolean;
23
23
  }
24
- type PositionDiagramPaneType = React.ComponentType<{
24
+ export type PositionDiagramPaneType = React.ComponentType<{
25
25
  open: boolean;
26
26
  onClose: () => void;
27
27
  voltageLevelId: string;
@@ -90,6 +90,8 @@ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, ge
90
90
  import { SwitchKind } from "./voltageLevel/creation/voltageLevelCreation.types.js";
91
91
  import { VoltageLevelModificationForm } from "./voltageLevel/modification/VoltageLevelModificationForm.js";
92
92
  import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./voltageLevel/modification/voltageLevelModification.utils.js";
93
+ import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./voltageLevel/topology/voltageLevelTopologyCreation.utils.js";
94
+ import { CreateVoltageLevelTopologyForm } from "./voltageLevel/topology/CreateVoltageLevelTopologyForm.js";
93
95
  import { LOAD_TAB_FIELDS, LoadDialogTab } from "./load/common/load.utils.js";
94
96
  import { LoadDialogTabs } from "./load/common/LoadDialogTabs.js";
95
97
  import { LoadDialogTabsContent } from "./load/common/LoadDialogTabsContent.js";
@@ -159,6 +161,7 @@ export {
159
161
  CHARACTERISTICS_CHOICES,
160
162
  CharacteristicsForm,
161
163
  ConnectivityForm,
164
+ CreateVoltageLevelTopologyForm,
162
165
  EQUIPMENTS_FIELDS,
163
166
  EQUIPMENT_TYPE_ORDER,
164
167
  EquipmentDeletionForm,
@@ -257,6 +260,10 @@ export {
257
260
  copyEquipmentPropertiesForCreation,
258
261
  createConnectivityData,
259
262
  createPropertyModification,
263
+ createVoltageLevelTopologyDtoToForm,
264
+ createVoltageLevelTopologyEmptyFormData,
265
+ createVoltageLevelTopologyFormSchema,
266
+ createVoltageLevelTopologyFormToDto,
260
267
  creationPropertiesSchema,
261
268
  emptyFormData,
262
269
  emptyLineSegment,
@@ -7,3 +7,4 @@
7
7
  export * from './creation';
8
8
  export * from './voltage-level.type';
9
9
  export * from './modification';
10
+ export * from './topology';
@@ -68,7 +68,10 @@ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, ge
68
68
  import { SwitchKind } from "./creation/voltageLevelCreation.types.js";
69
69
  import { VoltageLevelModificationForm } from "./modification/VoltageLevelModificationForm.js";
70
70
  import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./modification/voltageLevelModification.utils.js";
71
+ import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./topology/voltageLevelTopologyCreation.utils.js";
72
+ import { CreateVoltageLevelTopologyForm } from "./topology/CreateVoltageLevelTopologyForm.js";
71
73
  export {
74
+ CreateVoltageLevelTopologyForm,
72
75
  MAX_SECTIONS_COUNT,
73
76
  SWITCH_TYPE,
74
77
  SwitchKind,
@@ -76,6 +79,10 @@ export {
76
79
  VoltageLevelCreationForm,
77
80
  VoltageLevelModificationForm,
78
81
  buildNewBusbarSections,
82
+ createVoltageLevelTopologyDtoToForm,
83
+ createVoltageLevelTopologyEmptyFormData,
84
+ createVoltageLevelTopologyFormSchema,
85
+ createVoltageLevelTopologyFormToDto,
79
86
  getCreateSwitchesEmptyFormData,
80
87
  getCreateSwitchesValidationSchema,
81
88
  translateSwitchKinds,
@@ -0,0 +1,6 @@
1
+ import { PositionDiagramPaneType } from '../../common';
2
+ export interface CreateVoltageLevelTopologyFormProps {
3
+ voltageLevelId: string;
4
+ PositionDiagramPane?: PositionDiagramPaneType;
5
+ }
6
+ export declare function CreateVoltageLevelTopologyForm({ voltageLevelId, PositionDiagramPane, }: Readonly<CreateVoltageLevelTopologyFormProps>): import("react").JSX.Element;
@@ -0,0 +1,135 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useState, useMemo } from "react";
3
+ import { TextField, Stack, Grid, Button, Tooltip, Box } from "@mui/material";
4
+ import { useIntl, FormattedMessage } from "react-intl";
5
+ import { InfoOutlined } from "@mui/icons-material";
6
+ import "../../../../components/ui/overflowableText/OverflowableText.js";
7
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
8
+ import "../../../../utils/conversionUtils.js";
9
+ import "../../../../utils/types/equipmentType.js";
10
+ import "react-hook-form";
11
+ import "localized-countries";
12
+ import "localized-countries/data/fr";
13
+ import "localized-countries/data/en";
14
+ import "notistack";
15
+ import "../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
16
+ import { useCustomFormContext } from "../../../../components/ui/reactHookForm/provider/useCustomFormContext.js";
17
+ import "yup";
18
+ import "../../../../components/ui/treeViewFinder/TreeViewFinder.js";
19
+ import { IntegerInput } from "../../../../components/ui/reactHookForm/numbers/IntegerInput.js";
20
+ import "../../../../components/ui/reactHookForm/numbers/RangeInput.js";
21
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
22
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
23
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
24
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
25
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
26
+ import "../../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
27
+ import "../../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
28
+ import "../../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
29
+ import "@hello-pangea/dnd";
30
+ import "../../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
31
+ import "../../../../components/ui/snackbarProvider/SnackbarProvider.js";
32
+ import "mui-nested-menu";
33
+ import "react-resizable-panels";
34
+ import "react-papaparse";
35
+ import { SwitchesBetweenSections } from "../creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js";
36
+ import { filledTextField } from "../../common/form.utils.js";
37
+ import "../../common/properties/propertyUtils.js";
38
+ import "react-dom";
39
+ import "autosuggest-highlight/match";
40
+ import "autosuggest-highlight/parse";
41
+ import "clsx";
42
+ import "../../../../components/composite/filter/FilterCreationDialog.js";
43
+ import "../../../../components/composite/filter/HeaderFilterForm.js";
44
+ import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
45
+ import "../../../../components/composite/filter/expert/ExpertFilterForm.js";
46
+ import "../../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
47
+ import "../../../../components/composite/filter/expert/expertFilterConstants.js";
48
+ import "react-querybuilder";
49
+ import "uuid";
50
+ import "../../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
51
+ import "../../../../components/composite/filter/utils/filterFormUtils.js";
52
+ import "@react-querybuilder/material";
53
+ import "../../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
54
+ import "../../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
55
+ import "../../../../components/composite/agGridTable/BottomTableButtons.js";
56
+ import "../../../../components/composite/agGridTable/CustomAgGridTable.js";
57
+ import "ag-grid-community";
58
+ import "../../../../components/composite/customAGGrid/customAggrid.js";
59
+ import "../../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
60
+ import "mathjs";
61
+ import "../../../../components/composite/report/report-viewer/log-table/log-table.js";
62
+ import "react-window";
63
+ import "../../../../components/composite/report/report-treeview/treeview-item.js";
64
+ import "../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
65
+ import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
66
+ import "@mui/material/colors";
67
+ import "@mui/x-charts";
68
+ import "../../common/currentLimits/limitsPane.utils.js";
69
+ import "../creation/voltageLevel.constants.js";
70
+ import "../creation/voltageLevelCreation.utils.js";
71
+ function CreateVoltageLevelTopologyForm({
72
+ voltageLevelId,
73
+ PositionDiagramPane
74
+ }) {
75
+ const [isDiagramPaneOpen, setIsDiagramPaneOpen] = useState(false);
76
+ const intl = useIntl();
77
+ const { isNodeBuilt } = useCustomFormContext();
78
+ const handleCloseDiagramPane = () => {
79
+ setIsDiagramPaneOpen(false);
80
+ };
81
+ const handleClickOpenDiagramPane = () => {
82
+ setIsDiagramPaneOpen(true);
83
+ };
84
+ const voltageLevelIdField = useMemo(
85
+ () => /* @__PURE__ */ jsx(
86
+ TextField,
87
+ {
88
+ size: "small",
89
+ fullWidth: true,
90
+ label: intl.formatMessage({ id: "VoltageLevelId" }),
91
+ value: voltageLevelId ?? "",
92
+ slotProps: {
93
+ input: {
94
+ readOnly: true
95
+ }
96
+ },
97
+ disabled: true,
98
+ ...filledTextField
99
+ }
100
+ ),
101
+ [intl, voltageLevelId]
102
+ );
103
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
104
+ /* @__PURE__ */ jsxs(Stack, { children: [
105
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsxs(Stack, { spacing: 2, children: [
106
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 3, alignItems: "center", children: [
107
+ /* @__PURE__ */ jsx(Grid, { size: 4, children: voltageLevelIdField }),
108
+ PositionDiagramPane && isNodeBuilt && /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, children: [
109
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(Button, { onClick: handleClickOpenDiagramPane, variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "CreateCouplingDeviceDiagramButton" }) }) }),
110
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(
111
+ Tooltip,
112
+ {
113
+ title: intl.formatMessage({ id: "builtNodeTooltipForDiagram" }),
114
+ children: /* @__PURE__ */ jsx(InfoOutlined, { color: "info", fontSize: "small" })
115
+ }
116
+ ) })
117
+ ] }) })
118
+ ] }) }),
119
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 3, children: /* @__PURE__ */ jsx(Grid, { size: 4, children: /* @__PURE__ */ jsx(IntegerInput, { name: FieldConstants.SECTION_COUNT, label: "SectionCount" }) }) }) })
120
+ ] }) }),
121
+ /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(SwitchesBetweenSections, {}) })
122
+ ] }),
123
+ PositionDiagramPane && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
124
+ PositionDiagramPane,
125
+ {
126
+ open: isDiagramPaneOpen,
127
+ onClose: handleCloseDiagramPane,
128
+ voltageLevelId
129
+ }
130
+ ) })
131
+ ] });
132
+ }
133
+ export {
134
+ CreateVoltageLevelTopologyForm
135
+ };
@@ -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 './voltageLevelTopologyCreation.types';
8
+ export * from './voltageLevelTopologyCreation.utils';
9
+ export * from './CreateVoltageLevelTopologyForm';
@@ -0,0 +1,9 @@
1
+ import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./voltageLevelTopologyCreation.utils.js";
2
+ import { CreateVoltageLevelTopologyForm } from "./CreateVoltageLevelTopologyForm.js";
3
+ export {
4
+ CreateVoltageLevelTopologyForm,
5
+ createVoltageLevelTopologyDtoToForm,
6
+ createVoltageLevelTopologyEmptyFormData,
7
+ createVoltageLevelTopologyFormSchema,
8
+ createVoltageLevelTopologyFormToDto
9
+ };
@@ -0,0 +1,8 @@
1
+ import { ModificationType } from '../../../../utils';
2
+ export interface CreateVoltageLevelTopologyInfos {
3
+ type: ModificationType;
4
+ uuid?: string;
5
+ voltageLevelId: string;
6
+ sectionCount?: number | null;
7
+ switchKinds?: string[] | null;
8
+ }
@@ -0,0 +1,25 @@
1
+ import { IntlShape } from 'react-intl';
2
+ import { DeepNullable } from '../../../../utils';
3
+ import { CreateVoltageLevelTopologyInfos } from './voltageLevelTopologyCreation.types';
4
+ /**
5
+ * Copyright (c) 2026, RTE (http://www.rte-france.com)
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ */
10
+ import * as yup from 'yup';
11
+ export declare const createVoltageLevelTopologyFormSchema: yup.ObjectSchema<{
12
+ sectionCount: number | null;
13
+ switchesBetweenSections: string | null | undefined;
14
+ switchKinds: {
15
+ switchKind: string;
16
+ }[] | null | undefined;
17
+ }, yup.AnyObject, {
18
+ sectionCount: undefined;
19
+ switchesBetweenSections: undefined;
20
+ switchKinds: "";
21
+ }, "">;
22
+ export type CreateVoltageLevelTopologyDialogSchemaForm = yup.InferType<typeof createVoltageLevelTopologyFormSchema>;
23
+ export declare const createVoltageLevelTopologyEmptyFormData: DeepNullable<CreateVoltageLevelTopologyDialogSchemaForm>;
24
+ export declare const createVoltageLevelTopologyDtoToForm: (editData: CreateVoltageLevelTopologyInfos | undefined, intl: IntlShape) => DeepNullable<CreateVoltageLevelTopologyDialogSchemaForm>;
25
+ export declare const createVoltageLevelTopologyFormToDto: (voltageLevelTopology: CreateVoltageLevelTopologyDialogSchemaForm, voltageLevelId: string) => CreateVoltageLevelTopologyInfos;
@@ -0,0 +1,48 @@
1
+ import * as yup from "yup";
2
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
+ import "../../../../utils/conversionUtils.js";
4
+ import "../../../../utils/types/equipmentType.js";
5
+ import { ModificationType } from "../../../../utils/types/modificationType.js";
6
+ import "react/jsx-runtime";
7
+ import "@mui/icons-material";
8
+ import { MAX_SECTIONS_COUNT } from "../creation/voltageLevel.constants.js";
9
+ const createVoltageLevelTopologyFormSchema = yup.object().shape({
10
+ [FieldConstants.SECTION_COUNT]: yup.number().required().nullable().min(1, "AtLeastOneSectionAdded").max(MAX_SECTIONS_COUNT, "SectionCountMustBeLessThanOrEqualToTwenty"),
11
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: yup.string().nullable().when([FieldConstants.SECTION_COUNT], {
12
+ is: (sectionCount) => sectionCount > 1,
13
+ then: (schema) => schema.required()
14
+ }),
15
+ [FieldConstants.SWITCH_KINDS]: yup.array().of(
16
+ yup.object().shape({
17
+ [FieldConstants.SWITCH_KIND]: yup.string().required()
18
+ })
19
+ ).nullable()
20
+ }).required();
21
+ const createVoltageLevelTopologyEmptyFormData = {
22
+ [FieldConstants.SECTION_COUNT]: null,
23
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: "",
24
+ [FieldConstants.SWITCH_KINDS]: []
25
+ };
26
+ const createVoltageLevelTopologyDtoToForm = (editData, intl) => {
27
+ const switchKinds = editData?.switchKinds?.map((switchKind) => ({ [FieldConstants.SWITCH_KIND]: switchKind })) || [];
28
+ const switchesBetweenSections = editData?.switchKinds?.map((switchKind) => intl.formatMessage({ id: switchKind })).join(" / ") || "";
29
+ return {
30
+ [FieldConstants.SECTION_COUNT]: editData?.sectionCount ?? null,
31
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: switchesBetweenSections,
32
+ [FieldConstants.SWITCH_KINDS]: switchKinds
33
+ };
34
+ };
35
+ const createVoltageLevelTopologyFormToDto = (voltageLevelTopology, voltageLevelId) => ({
36
+ type: ModificationType.CREATE_VOLTAGE_LEVEL_TOPOLOGY,
37
+ voltageLevelId,
38
+ sectionCount: voltageLevelTopology[FieldConstants.SECTION_COUNT],
39
+ switchKinds: voltageLevelTopology[FieldConstants.SWITCH_KINDS]?.map(
40
+ (switchKindData) => switchKindData[FieldConstants.SWITCH_KIND]
41
+ )
42
+ });
43
+ export {
44
+ createVoltageLevelTopologyDtoToForm,
45
+ createVoltageLevelTopologyEmptyFormData,
46
+ createVoltageLevelTopologyFormSchema,
47
+ createVoltageLevelTopologyFormToDto
48
+ };
package/dist/index.js CHANGED
@@ -357,6 +357,8 @@ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, ge
357
357
  import { SwitchKind } from "./features/network-modifications/voltageLevel/creation/voltageLevelCreation.types.js";
358
358
  import { VoltageLevelModificationForm } from "./features/network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js";
359
359
  import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto, voltageLevelModificationWithMeasurementsDtoToForm, voltageLevelModificationWithMeasurementsFormSchema, voltageLevelModificationWithMeasurementsFormToDto } from "./features/network-modifications/voltageLevel/modification/voltageLevelModification.utils.js";
360
+ import { createVoltageLevelTopologyDtoToForm, createVoltageLevelTopologyEmptyFormData, createVoltageLevelTopologyFormSchema, createVoltageLevelTopologyFormToDto } from "./features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.js";
361
+ import { CreateVoltageLevelTopologyForm } from "./features/network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.js";
360
362
  import { LOAD_TAB_FIELDS, LoadDialogTab } from "./features/network-modifications/load/common/load.utils.js";
361
363
  import { LoadDialogTabs } from "./features/network-modifications/load/common/LoadDialogTabs.js";
362
364
  import { LoadDialogTabsContent } from "./features/network-modifications/load/common/LoadDialogTabsContent.js";
@@ -629,6 +631,7 @@ export {
629
631
  CountrySelectionInput,
630
632
  CountryValueEditor,
631
633
  CreateParameterDialog,
634
+ CreateVoltageLevelTopologyForm,
632
635
  CsvDownloadButton,
633
636
  CsvExport,
634
637
  CsvPicker,
@@ -1261,6 +1264,10 @@ export {
1261
1264
  createPropertyModification,
1262
1265
  createRootNetworkChipCellSx,
1263
1266
  createRowSx,
1267
+ createVoltageLevelTopologyDtoToForm,
1268
+ createVoltageLevelTopologyEmptyFormData,
1269
+ createVoltageLevelTopologyFormSchema,
1270
+ createVoltageLevelTopologyFormToDto,
1264
1271
  creationPropertiesSchema,
1265
1272
  csvEn,
1266
1273
  csvFr,
@@ -300,4 +300,11 @@ export declare const networkModificationsEn: {
300
300
  copyLink: string;
301
301
  linkCopied: string;
302
302
  linkCopyError: string;
303
+ CreateVoltageLevelTopology: string;
304
+ CreateVoltageLevelTopologyError: string;
305
+ CreateCouplingDeviceDiagramButton: string;
306
+ builtNodeTooltipForDiagram: string;
307
+ AtLeastOneSectionAdded: string;
308
+ SectionCount: string;
309
+ VoltageLevelId: string;
303
310
  };
@@ -294,7 +294,15 @@ const networkModificationsEn = {
294
294
  StateEstimationTab: "State estimation",
295
295
  copyLink: "Copy link",
296
296
  linkCopied: "Link copied",
297
- linkCopyError: "Error while attempting to copy link"
297
+ linkCopyError: "Error while attempting to copy link",
298
+ // Voltage level topology creation
299
+ CreateVoltageLevelTopology: "Adding a busbar",
300
+ CreateVoltageLevelTopologyError: "Error while creating a voltage level topology",
301
+ CreateCouplingDeviceDiagramButton: "Show voltage level",
302
+ builtNodeTooltipForDiagram: "Current diagram taking into account all applied modifications",
303
+ AtLeastOneSectionAdded: "At least one busbar section must be added",
304
+ SectionCount: "Section count",
305
+ VoltageLevelId: "Voltage level ID"
298
306
  };
299
307
  export {
300
308
  networkModificationsEn
@@ -300,4 +300,11 @@ export declare const networkModificationsFr: {
300
300
  copyLink: string;
301
301
  linkCopied: string;
302
302
  linkCopyError: string;
303
+ CreateVoltageLevelTopology: string;
304
+ CreateVoltageLevelTopologyError: string;
305
+ CreateCouplingDeviceDiagramButton: string;
306
+ builtNodeTooltipForDiagram: string;
307
+ AtLeastOneSectionAdded: string;
308
+ SectionCount: string;
309
+ VoltageLevelId: string;
303
310
  };
@@ -294,7 +294,15 @@ const networkModificationsFr = {
294
294
  StateEstimationTab: "Estimation d'état",
295
295
  copyLink: "Copier le lien",
296
296
  linkCopied: "Lien copié",
297
- linkCopyError: "Erreur lors de la copie du lien"
297
+ linkCopyError: "Erreur lors de la copie du lien",
298
+ // Voltage level topology creation
299
+ CreateVoltageLevelTopology: "Ajouter un jeu de barre",
300
+ CreateVoltageLevelTopologyError: "Erreur lors de la création d'une topologie de poste",
301
+ CreateCouplingDeviceDiagramButton: "Voir le poste",
302
+ builtNodeTooltipForDiagram: "Diagramme courant prenant en compte toutes les modifications réalisées",
303
+ AtLeastOneSectionAdded: "Il faut ajouter au moins une section de jeu de barre",
304
+ SectionCount: "Nombre de sections",
305
+ VoltageLevelId: "ID Poste"
298
306
  };
299
307
  export {
300
308
  networkModificationsFr
@@ -113,10 +113,19 @@ export declare enum FieldConstants {
113
113
  SWITCH_KINDS = "switchKinds",
114
114
  SWITCH_KIND = "switchKind",
115
115
  ADD_SUBSTATION_CREATION = "addSubstationCreationId",
116
+ ALL_BUS_BAR_SECTIONS = "allBusbarSections",
116
117
  BUS_BAR_COUNT = "busbarCount",
118
+ BUS_BAR_INDEX = "busbarIndex",
117
119
  BUS_BAR_SECTION_ID1 = "busbarSectionId1",
118
120
  BUS_BAR_SECTION_ID2 = "busbarSectionId2",
121
+ BUSBAR_SECTION_ID = "busbarSectionId",
119
122
  COUPLING_OMNIBUS = "couplingOmnibus",
123
+ IS_AFTER_BUSBAR_SECTION_ID = "isAfterBusBarSectionId",
124
+ NEW_SWITCH_STATES = "newSwitchStates",
125
+ SWITCH_AFTER_NOT_REQUIRED = "switchAfterNotRequired",
126
+ SWITCH_BEFORE_NOT_REQUIRED = "switchBeforeNotRequired",
127
+ SWITCHES_AFTER_SECTIONS = "switchesAfterSections",
128
+ SWITCHES_BEFORE_SECTIONS = "switchesBeforeSections",
120
129
  ENABLE_OLG_MODIFICATION = "enableOLGModification",
121
130
  HIDE_BUS_BAR_SECTION = "hideBusBarSection",
122
131
  HIDE_NOMINAL_VOLTAGE = "hideNominalVoltage",
@@ -107,10 +107,19 @@ var FieldConstants = /* @__PURE__ */ ((FieldConstants2) => {
107
107
  FieldConstants2["SWITCH_KINDS"] = "switchKinds";
108
108
  FieldConstants2["SWITCH_KIND"] = "switchKind";
109
109
  FieldConstants2["ADD_SUBSTATION_CREATION"] = "addSubstationCreationId";
110
+ FieldConstants2["ALL_BUS_BAR_SECTIONS"] = "allBusbarSections";
110
111
  FieldConstants2["BUS_BAR_COUNT"] = "busbarCount";
112
+ FieldConstants2["BUS_BAR_INDEX"] = "busbarIndex";
111
113
  FieldConstants2["BUS_BAR_SECTION_ID1"] = "busbarSectionId1";
112
114
  FieldConstants2["BUS_BAR_SECTION_ID2"] = "busbarSectionId2";
115
+ FieldConstants2["BUSBAR_SECTION_ID"] = "busbarSectionId";
113
116
  FieldConstants2["COUPLING_OMNIBUS"] = "couplingOmnibus";
117
+ FieldConstants2["IS_AFTER_BUSBAR_SECTION_ID"] = "isAfterBusBarSectionId";
118
+ FieldConstants2["NEW_SWITCH_STATES"] = "newSwitchStates";
119
+ FieldConstants2["SWITCH_AFTER_NOT_REQUIRED"] = "switchAfterNotRequired";
120
+ FieldConstants2["SWITCH_BEFORE_NOT_REQUIRED"] = "switchBeforeNotRequired";
121
+ FieldConstants2["SWITCHES_AFTER_SECTIONS"] = "switchesAfterSections";
122
+ FieldConstants2["SWITCHES_BEFORE_SECTIONS"] = "switchesBeforeSections";
114
123
  FieldConstants2["ENABLE_OLG_MODIFICATION"] = "enableOLGModification";
115
124
  FieldConstants2["HIDE_BUS_BAR_SECTION"] = "hideBusBarSection";
116
125
  FieldConstants2["HIDE_NOMINAL_VOLTAGE"] = "hideNominalVoltage";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.266.0",
3
+ "version": "0.267.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",