@gridsuite/commons-ui 0.208.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 (74) hide show
  1. package/dist/components/filter/utils/filterFormUtils.js +2 -1
  2. package/dist/components/index.js +33 -3
  3. package/dist/components/inputs/reactHookForm/booleans/RadioInput.js +2 -2
  4. package/dist/components/network-modification-table/renderers/name-cell.d.ts +2 -1
  5. package/dist/components/network-modification-table/renderers/name-cell.js +136 -19
  6. package/dist/components/network-modifications/battery/creation/BatteryCreationForm.d.ts +4 -0
  7. package/dist/components/network-modifications/battery/creation/BatteryCreationForm.js +105 -0
  8. package/dist/components/network-modifications/battery/creation/batteryCreation.types.d.ts +26 -0
  9. package/dist/components/network-modifications/battery/creation/batteryCreation.types.js +1 -0
  10. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.d.ts +79 -0
  11. package/dist/components/network-modifications/battery/creation/batteryCreation.utils.js +145 -0
  12. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.d.ts → battery/creation/index.d.ts} +3 -5
  13. package/dist/components/network-modifications/battery/creation/index.js +9 -0
  14. package/dist/components/network-modifications/{voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation → battery}/index.d.ts +1 -1
  15. package/dist/components/network-modifications/battery/index.js +9 -0
  16. package/dist/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.js +2 -2
  17. package/dist/components/network-modifications/common/index.js +5 -2
  18. package/dist/components/network-modifications/common/reactiveLimits/index.js +5 -2
  19. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/index.js +2 -1
  20. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.d.ts +10 -1
  21. package/dist/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js +30 -27
  22. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.type.d.ts +3 -3
  23. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.d.ts +33 -0
  24. package/dist/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.js +69 -35
  25. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +1 -1
  26. package/dist/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.js +3 -3
  27. package/dist/components/network-modifications/index.d.ts +2 -0
  28. package/dist/components/network-modifications/index.js +33 -3
  29. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.d.ts +6 -0
  30. package/dist/components/network-modifications/shunt-compensator/common/CharacteristicsForm.js +199 -0
  31. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.d.ts +64 -0
  32. package/dist/components/network-modifications/shunt-compensator/common/characteristicsForm.utils.js +90 -0
  33. package/dist/components/network-modifications/shunt-compensator/common/index.d.ts +10 -0
  34. package/dist/components/network-modifications/shunt-compensator/common/index.js +13 -0
  35. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.d.ts +20 -0
  36. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.types.js +1 -0
  37. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.d.ts +27 -0
  38. package/dist/components/network-modifications/shunt-compensator/common/shuntCompensator.utils.js +16 -0
  39. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.d.ts +3 -0
  40. package/dist/components/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +82 -0
  41. package/dist/components/network-modifications/shunt-compensator/creation/index.d.ts +9 -0
  42. package/dist/components/network-modifications/shunt-compensator/creation/index.js +9 -0
  43. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.d.ts +20 -0
  44. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.types.js +1 -0
  45. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.d.ts +110 -0
  46. package/dist/components/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +103 -0
  47. package/dist/components/network-modifications/shunt-compensator/index.d.ts +8 -0
  48. package/dist/components/network-modifications/shunt-compensator/index.js +20 -0
  49. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
  50. package/dist/components/network-modifications/voltageLevel/creation/index.d.ts +1 -0
  51. package/dist/components/network-modifications/voltageLevel/creation/index.js +3 -1
  52. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +6 -2
  53. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +22 -43
  54. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +1 -0
  55. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +2 -0
  56. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -1
  57. package/dist/components/network-modifications/voltageLevel/index.js +3 -1
  58. package/dist/index.js +33 -3
  59. package/dist/translations/en/networkModificationsEn.d.ts +24 -0
  60. package/dist/translations/en/networkModificationsEn.js +24 -0
  61. package/dist/translations/fr/networkModificationsFr.d.ts +24 -0
  62. package/dist/translations/fr/networkModificationsFr.js +24 -0
  63. package/dist/utils/constants/fieldConstants.d.ts +7 -0
  64. package/dist/utils/constants/fieldConstants.js +7 -0
  65. package/dist/utils/types/network-modification-metadata.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.d.ts +0 -11
  68. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js +0 -84
  69. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.d.ts +0 -6
  70. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialogSubmitButton.js +0 -11
  71. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +0 -61
  72. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.d.ts +0 -14
  73. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/createSwitchesDialog.utils.js +0 -27
  74. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/index.js +0 -4
@@ -51,7 +51,8 @@ const CONTINGENCY_LIST_EQUIPMENTS = {
51
51
  };
52
52
  const FILTER_EQUIPMENTS = {
53
53
  ...BASE_EQUIPMENTS,
54
- [EquipmentType.HVDC_LINE]: ALL_EQUIPMENTS[EquipmentType.HVDC_LINE]
54
+ [EquipmentType.HVDC_LINE]: ALL_EQUIPMENTS[EquipmentType.HVDC_LINE],
55
+ [EquipmentType.VSC_CONVERTER_STATION]: ALL_EQUIPMENTS[EquipmentType.VSC_CONVERTER_STATION]
55
56
  };
56
57
  export {
57
58
  CONTINGENCY_LIST_EQUIPMENTS,
@@ -215,10 +215,10 @@ import { getActivePowerControlEmptyFormData, getActivePowerControlSchema } from
215
215
  import { ActivePowerControlForm } from "./network-modifications/common/activePowerControl/ActivePowerControlForm.js";
216
216
  import { getShortCircuitEmptyFormData, getShortCircuitFormData, getShortCircuitFormSchema } from "./network-modifications/common/shortCircuit/shortCircuitForm.utils.js";
217
217
  import { ShortCircuitForm } from "./network-modifications/common/shortCircuit/ShortCircuitForm.js";
218
- import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js";
218
+ import { INSERT, REMOVE, getReactiveCapabilityCurveValidationSchema, getReactiveCapabilityCurveValidationSchemaArray, getRowEmptyFormData, setCurrentReactiveCapabilityCurveTable, setSelectedReactiveLimits, toReactiveCapabilityCurveChoiceForGeneratorCreation, toReactiveCapabilityCurveChoiceForGeneratorModification } from "./network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.js";
219
219
  import { ReactiveCapabilityCurveRowForm } from "./network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js";
220
220
  import { ReactiveCapabilityCurveTableForm } from "./network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js";
221
- import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsFormData, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./network-modifications/common/reactiveLimits/reactiveLimits.utils.js";
221
+ import { REACTIVE_LIMIT_TYPES, getReactiveLimitsEmptyFormData, getReactiveLimitsEmptyFormDataProps, getReactiveLimitsFormData, getReactiveLimitsFormDataProps, getReactiveLimitsSchema, getReactiveLimitsValidationSchema } from "./network-modifications/common/reactiveLimits/reactiveLimits.utils.js";
222
222
  import { ReactiveLimitsForm } from "./network-modifications/common/reactiveLimits/ReactiveLimitsForm.js";
223
223
  import { getHvdcLccDeletionSchema } from "./network-modifications/equipmentDeletion/hvdcLccDeletion/hvdcLccDeletion.utils.js";
224
224
  import { ShuntCompensatorSelectionForm } from "./network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js";
@@ -232,12 +232,13 @@ import { substationCreationDtoToForm, substationCreationEmptyFormData, substatio
232
232
  import { SubstationModificationForm } from "./network-modifications/substation/modification/SubstationModificationForm.js";
233
233
  import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./network-modifications/substation/modification/substationModification.utils.js";
234
234
  import { SwitchesBetweenSections } from "./network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js";
235
+ import "react";
235
236
  import "react-hook-form";
236
237
  import "../utils/conversionUtils.js";
237
238
  import "../utils/types/equipmentType.js";
238
239
  import "@mui/icons-material";
239
240
  import "../utils/yupConfig.js";
240
- import "react";
241
+ import { MAX_SECTIONS_COUNT } from "./network-modifications/voltageLevel/creation/voltageLevel.constants.js";
241
242
  import { VoltageLevelCreationForm } from "./network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js";
242
243
  import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js";
243
244
  import { SwitchKind } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.types.js";
@@ -255,6 +256,13 @@ import { EQUIPMENT_TYPE_ORDER, byFilterDeletionDtoToForm, byFilterDeletionFormSc
255
256
  import { ModificationByAssignmentForm } from "./network-modifications/by-filter/assignment/modification-by-assignment-form.js";
256
257
  import { emptyModificationByAssignmentFormData, modificationByAssignmentDtoToForm, modificationByAssignmentFormSchema, modificationByAssignmentFormToDto } from "./network-modifications/by-filter/assignment/modificationByAssignment.utils.js";
257
258
  import { DataType as DataType2 } from "./network-modifications/by-filter/assignment/assignment/assignment.type.js";
259
+ import { batteryCreationDtoToForm, batteryCreationEmptyFormData, batteryCreationFormSchema, batteryCreationFormToDto } from "./network-modifications/battery/creation/batteryCreation.utils.js";
260
+ import { BatteryCreationForm } from "./network-modifications/battery/creation/BatteryCreationForm.js";
261
+ import { CHARACTERISTICS_CHOICES, SHUNT_COMPENSATOR_TYPES, computeSwitchedOnValue } from "./network-modifications/shunt-compensator/common/shuntCompensator.utils.js";
262
+ import { CharacteristicsForm } from "./network-modifications/shunt-compensator/common/CharacteristicsForm.js";
263
+ import { getCharacteristicsCreateFormDataFromSearchCopy, getCharacteristicsEmptyFormData, getCharacteristicsFormData, getCharacteristicsFormValidationSchema } from "./network-modifications/shunt-compensator/common/characteristicsForm.utils.js";
264
+ import { ShuntCompensatorCreationForm } from "./network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js";
265
+ import { shuntCompensatorCreationDtoToForm, shuntCompensatorCreationEmptyFormData, shuntCompensatorCreationFormSchema, shuntCompensatorCreationFormToDto } from "./network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js";
258
266
  import { BuildStatusChip } from "./node/build-status-chip.js";
259
267
  import { BuildStatus } from "./node/constant.js";
260
268
  import { COLUMNS_WITHOUT_BORDER, DEPTH_CELL_WIDTH, DROP_FORBIDDEN_INDICATOR_BOTTOM, DROP_FORBIDDEN_INDICATOR_TOP, DROP_INDICATOR_BOTTOM, DROP_INDICATOR_TOP, MODIFICATION_ROW_HEIGHT, createCellBorderColor, createCellContentWrapperSx, createCellStyle, createEditDescriptionStyle, createHeaderCellStyle, createModificationNameCellStyle, createNameCellLabelBoxSx, createNameCellRootStyle, createRootNetworkChipCellSx, createRowSx, networkModificationTableStyles } from "./network-modification-table/network-modification-table-styles.js";
@@ -290,6 +298,7 @@ export {
290
298
  AutocompleteWithFavorites,
291
299
  BALANCE_TYPE,
292
300
  BASE_MODIFICATION_TABLE_COLUMNS,
301
+ BatteryCreationForm,
293
302
  BooleanCellRenderer,
294
303
  BooleanInput,
295
304
  BooleanNullableCellRenderer,
@@ -302,6 +311,7 @@ export {
302
311
  ByFilterDeletionForm,
303
312
  CALCULATION_TYPE,
304
313
  CENTER_LABEL,
314
+ CHARACTERISTICS_CHOICES,
305
315
  COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS,
306
316
  COLUMNS_DEFINITIONS_HVDCS,
307
317
  COLUMNS_DEFINITIONS_INJECTIONS,
@@ -325,6 +335,7 @@ export {
325
335
  CUSTOM_AGGRID_THEME,
326
336
  CancelButton,
327
337
  CardErrorBoundary,
338
+ CharacteristicsForm,
328
339
  CheckBoxList,
329
340
  CheckboxInput,
330
341
  CheckboxNullableInput,
@@ -484,6 +495,7 @@ export {
484
495
  MARGIN_CALCULATION_START_TIME,
485
496
  MAX_COMPOSITE_NESTING_DEPTH,
486
497
  MAX_ROWS_NUMBER,
498
+ MAX_SECTIONS_COUNT,
487
499
  MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION,
488
500
  MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION,
489
501
  MODIFICATION_ROW_HEIGHT,
@@ -598,6 +610,7 @@ export {
598
610
  SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS,
599
611
  SHUNT_COMPENSATORS_SELECTION_TYPE,
600
612
  SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
613
+ SHUNT_COMPENSATOR_TYPES,
601
614
  SHUNT_COMPENSATOR_TYPE_OPTIONS,
602
615
  SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON,
603
616
  SPECIFIC_PARAMETERS,
@@ -624,6 +637,7 @@ export {
624
637
  ShortCircuitForm,
625
638
  ShortCircuitParametersEditionDialog,
626
639
  ShortCircuitParametersInLine,
640
+ ShuntCompensatorCreationForm,
627
641
  ShuntCompensatorSelectionForm,
628
642
  SignInCallbackHandler,
629
643
  SilentRenewCallbackHandler,
@@ -676,10 +690,15 @@ export {
676
690
  VoltageLevelModificationForm,
677
691
  WRITE_SLACK_BUS,
678
692
  alertThresholdMarks,
693
+ batteryCreationDtoToForm,
694
+ batteryCreationEmptyFormData,
695
+ batteryCreationFormSchema,
696
+ batteryCreationFormToDto,
679
697
  buildNewBusbarSections,
680
698
  byFilterDeletionDtoToForm,
681
699
  byFilterDeletionFormSchema,
682
700
  byFilterDeletionFormToDto,
701
+ computeSwitchedOnValue,
683
702
  computeTagMinSize,
684
703
  copyEquipmentPropertiesForCreation,
685
704
  countRules,
@@ -728,6 +747,10 @@ export {
728
747
  getBranchActiveReactivePowerEmptyFormDataProperties,
729
748
  getBranchActiveReactivePowerValidationSchema,
730
749
  getBranchActiveReactivePowerValidationSchemaProperties,
750
+ getCharacteristicsCreateFormDataFromSearchCopy,
751
+ getCharacteristicsEmptyFormData,
752
+ getCharacteristicsFormData,
753
+ getCharacteristicsFormValidationSchema,
731
754
  getCon1andCon2WithPositionValidationSchema,
732
755
  getConcatenatedProperties,
733
756
  getConnectivityBusBarSectionData,
@@ -771,8 +794,11 @@ export {
771
794
  getPropertyValue,
772
795
  getRangeInputSchema,
773
796
  getReactiveCapabilityCurveValidationSchema,
797
+ getReactiveCapabilityCurveValidationSchemaArray,
774
798
  getReactiveLimitsEmptyFormData,
799
+ getReactiveLimitsEmptyFormDataProps,
775
800
  getReactiveLimitsFormData,
801
+ getReactiveLimitsFormDataProps,
776
802
  getReactiveLimitsSchema,
777
803
  getReactiveLimitsValidationSchema,
778
804
  getReactivePowerSetPointSchema,
@@ -827,6 +853,10 @@ export {
827
853
  saveExplicitNamingFilter,
828
854
  setCurrentReactiveCapabilityCurveTable,
829
855
  setSelectedReactiveLimits,
856
+ shuntCompensatorCreationDtoToForm,
857
+ shuntCompensatorCreationEmptyFormData,
858
+ shuntCompensatorCreationFormSchema,
859
+ shuntCompensatorCreationFormToDto,
830
860
  standardTextField,
831
861
  styles,
832
862
  substationCreationDtoToForm,
@@ -6,10 +6,10 @@ import { FieldLabel } from "../utils/FieldLabel.js";
6
6
  function RadioInput({ name, label, id, options, formProps }) {
7
7
  const {
8
8
  field: { onChange, value }
9
- } = useController({ name });
9
+ } = useController({ name, defaultValue: "" });
10
10
  return /* @__PURE__ */ jsxs(FormControl, { children: [
11
11
  label && /* @__PURE__ */ jsx(FormLabel, { id: id ?? label, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
12
- /* @__PURE__ */ jsx(RadioGroup, { row: true, "aria-labelledby": id ?? label, value, onChange, ...formProps, children: options.map((option) => /* @__PURE__ */ jsx(
12
+ /* @__PURE__ */ jsx(RadioGroup, { row: true, "aria-labelledby": id ?? label, value: value ?? "", onChange, ...formProps, children: options.map((option) => /* @__PURE__ */ jsx(
13
13
  FormControlLabel,
14
14
  {
15
15
  control: /* @__PURE__ */ jsx(Radio, {}),
@@ -2,6 +2,7 @@ import { Row } from '@tanstack/react-table';
2
2
  import { ComposedModificationMetadata } from '../../../utils';
3
3
  interface NameCellProps {
4
4
  row: Row<ComposedModificationMetadata>;
5
+ onEditNameCell?: (modification: ComposedModificationMetadata, newName: string) => void;
5
6
  }
6
- export declare function NameCell({ row }: Readonly<NameCellProps>): import("react/jsx-runtime").JSX.Element;
7
+ export declare function NameCell({ row, onEditNameCell }: Readonly<NameCellProps>): import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useCallback, useMemo } from "react";
2
+ import { useCallback, useMemo, useState, useRef } from "react";
3
3
  import { useIntl } from "react-intl";
4
- import { useTheme, Box, IconButton } from "@mui/material";
4
+ import { useTheme, Box, IconButton, InputBase } from "@mui/material";
5
5
  import { KeyboardArrowDown, KeyboardArrowRight } from "@mui/icons-material";
6
6
  import { CustomTooltip } from "../../tooltip/CustomTooltip.js";
7
7
  import { networkModificationTableStyles, createNameCellLabelBoxSx, createModificationNameCellStyle, createNameCellRootStyle } from "../network-modification-table-styles.js";
@@ -16,11 +16,21 @@ import "localized-countries";
16
16
  import "localized-countries/data/fr";
17
17
  import "localized-countries/data/en";
18
18
  import "notistack";
19
- function NameCell({ row }) {
19
+ const MIN_CHAR_WIDTH = 30;
20
+ function measureTextPx(text, font) {
21
+ const ctx = document.createElement("canvas").getContext("2d");
22
+ if (ctx) {
23
+ ctx.font = font;
24
+ return ctx.measureText(text).width;
25
+ }
26
+ return text.length * 8;
27
+ }
28
+ function NameCell({ row, onEditNameCell }) {
20
29
  const intl = useIntl();
21
30
  const theme = useTheme();
22
31
  const { computeLabel } = useModificationLabelComputer();
23
32
  const { depth } = row;
33
+ const isComposite = isCompositeModification(row.original);
24
34
  const getModificationLabel = useCallback(
25
35
  (modification, formatBold = true) => {
26
36
  return intl.formatMessage(
@@ -31,17 +41,87 @@ function NameCell({ row }) {
31
41
  [computeLabel, intl]
32
42
  );
33
43
  const label = useMemo(() => getModificationLabel(row.original), [getModificationLabel, row.original]);
44
+ const compositeName = useMemo(() => {
45
+ if (!isComposite) {
46
+ return "";
47
+ }
48
+ try {
49
+ return JSON.parse(row.original.messageValues)?.name ?? "";
50
+ } catch {
51
+ return "";
52
+ }
53
+ }, [isComposite, row.original.messageValues]);
54
+ const [isEditing, setIsEditing] = useState(false);
55
+ const [draftName, setDraftName] = useState("");
56
+ const [inputBaseWidthPx, setInputBaseWidthPx] = useState(null);
57
+ const labelRef = useRef(null);
58
+ const inputRef = useRef(null);
59
+ const isEditingRef = useRef(false);
60
+ const stopEditing = useCallback(() => {
61
+ isEditingRef.current = false;
62
+ setIsEditing(false);
63
+ setInputBaseWidthPx(null);
64
+ }, []);
65
+ const handleBlur = useCallback(() => {
66
+ if (!isEditingRef.current) {
67
+ return;
68
+ }
69
+ const trimmed = draftName.trim();
70
+ if (trimmed !== "" && trimmed !== compositeName) {
71
+ onEditNameCell?.(row.original, trimmed);
72
+ }
73
+ stopEditing();
74
+ }, [compositeName, draftName, onEditNameCell, row.original, stopEditing]);
75
+ const handleLabelClick = useCallback(
76
+ (e) => {
77
+ e.stopPropagation();
78
+ setDraftName(compositeName);
79
+ if (labelRef.current) {
80
+ const style = globalThis.getComputedStyle(labelRef.current);
81
+ const font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
82
+ const px = compositeName.length >= MIN_CHAR_WIDTH ? measureTextPx(compositeName, font) + 20 : measureTextPx("a".repeat(MIN_CHAR_WIDTH), font) + 20;
83
+ setInputBaseWidthPx(px);
84
+ }
85
+ isEditingRef.current = true;
86
+ setIsEditing(true);
87
+ requestAnimationFrame(() => {
88
+ inputRef.current?.focus();
89
+ inputRef.current?.select();
90
+ });
91
+ },
92
+ [compositeName]
93
+ );
94
+ const handleKeyDown = useCallback(
95
+ (e) => {
96
+ if (e.key === "Enter") {
97
+ const trimmed = draftName.trim();
98
+ if (trimmed !== "" && trimmed !== compositeName) {
99
+ onEditNameCell?.(row.original, trimmed);
100
+ }
101
+ stopEditing();
102
+ inputRef.current?.blur();
103
+ } else if (e.key === "Escape") {
104
+ stopEditing();
105
+ inputRef.current?.blur();
106
+ }
107
+ },
108
+ [compositeName, draftName, onEditNameCell, row.original, stopEditing]
109
+ );
34
110
  const renderDepthBox = () => {
35
111
  const depthLevelCount = depth;
36
- return Array.from({ length: depthLevelCount }, (_, i) => /* @__PURE__ */ jsx(
37
- DepthBox,
38
- {
39
- firstLevel: i === 0,
40
- displayAsFolder: isCompositeModification(row.original) && i === depthLevelCount - 1
41
- },
42
- i
43
- ));
112
+ return Array.from({ length: depthLevelCount }, (_, i) => /* @__PURE__ */ jsx(DepthBox, { firstLevel: i === 0, displayAsFolder: isComposite && i === depthLevelCount - 1 }, i));
44
113
  };
114
+ const compositeReadModeProps = isComposite ? {
115
+ ref: labelRef,
116
+ onClick: handleLabelClick,
117
+ sx: {
118
+ cursor: "text",
119
+ "&:hover": {
120
+ textDecoration: "underline dotted",
121
+ textDecorationColor: theme.palette.text.secondary
122
+ }
123
+ }
124
+ } : {};
45
125
  return /* @__PURE__ */ jsxs(
46
126
  Box,
47
127
  {
@@ -52,7 +132,7 @@ function NameCell({ row }) {
52
132
  children: [
53
133
  renderDepthBox(),
54
134
  /* @__PURE__ */ jsxs(Box, { sx: networkModificationTableStyles.nameCellInnerRow, children: [
55
- isCompositeModification(row.original) && /* @__PURE__ */ jsx(Box, { sx: networkModificationTableStyles.nameCellTogglerBox, children: /* @__PURE__ */ jsx(
135
+ isComposite && /* @__PURE__ */ jsx(Box, { sx: networkModificationTableStyles.nameCellTogglerBox, children: /* @__PURE__ */ jsx(
56
136
  IconButton,
57
137
  {
58
138
  size: "small",
@@ -65,16 +145,53 @@ function NameCell({ row }) {
65
145
  children: row.getIsExpanded() ? /* @__PURE__ */ jsx(KeyboardArrowDown, { fontSize: "small" }) : /* @__PURE__ */ jsx(KeyboardArrowRight, { fontSize: "small" })
66
146
  }
67
147
  ) }),
68
- /* @__PURE__ */ jsx(Box, { sx: createNameCellLabelBoxSx(row.getIsExpanded(), depth), children: /* @__PURE__ */ jsx(CustomTooltip, { disableFocusListener: true, disableTouchListener: true, title: label, children: /* @__PURE__ */ jsx(
148
+ /* @__PURE__ */ jsx(Box, { sx: createNameCellLabelBoxSx(row.getIsExpanded(), depth), children: isComposite && isEditing ? /* @__PURE__ */ jsx(
69
149
  Box,
70
150
  {
71
- sx: mergeSx(
72
- networkModificationTableStyles.modificationLabel,
73
- createModificationNameCellStyle(row.original.activated)
74
- ),
75
- children: label
151
+ sx: mergeSx(networkModificationTableStyles.modificationLabel, {
152
+ display: "inline-flex",
153
+ width: inputBaseWidthPx ? `${inputBaseWidthPx}px` : `${MIN_CHAR_WIDTH}ch`,
154
+ maxWidth: "100%",
155
+ flexShrink: 0
156
+ }),
157
+ children: /* @__PURE__ */ jsx(
158
+ InputBase,
159
+ {
160
+ inputRef,
161
+ value: draftName,
162
+ onChange: (e) => setDraftName(e.target.value),
163
+ onBlur: handleBlur,
164
+ onKeyDown: handleKeyDown,
165
+ onMouseDown: (e) => e.stopPropagation(),
166
+ sx: {
167
+ width: "100%",
168
+ fontSize: "inherit",
169
+ fontFamily: "inherit",
170
+ color: "inherit",
171
+ "& .MuiInputBase-input": {
172
+ border: `1px solid ${theme.palette.primary.main}`,
173
+ borderRadius: `${theme.shape.borderRadius}px`,
174
+ backgroundColor: theme.palette.background.paper
175
+ }
176
+ }
177
+ }
178
+ )
76
179
  }
77
- ) }) })
180
+ ) : (
181
+ /* Read mode */
182
+ /* @__PURE__ */ jsx(CustomTooltip, { disableFocusListener: true, disableTouchListener: true, title: label, children: /* @__PURE__ */ jsx(
183
+ Box,
184
+ {
185
+ ...compositeReadModeProps,
186
+ sx: mergeSx(
187
+ networkModificationTableStyles.modificationLabel,
188
+ createModificationNameCellStyle(row.original.activated),
189
+ compositeReadModeProps.sx
190
+ ),
191
+ children: label
192
+ }
193
+ ) })
194
+ ) })
78
195
  ] })
79
196
  ]
80
197
  }
@@ -0,0 +1,4 @@
1
+ import { ConnectivityNetworkProps } from '../../common';
2
+ export interface BatteryCreationFormProps extends ConnectivityNetworkProps {
3
+ }
4
+ export declare function BatteryCreationForm({ voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, }: Readonly<BatteryCreationFormProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,105 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import { filledTextField } from "../../common/form.utils.js";
4
+ import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
5
+ import "react";
6
+ import "react-hook-form";
7
+ import { ActivePowerAdornment } from "../../../../utils/constants/adornments.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 "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
20
+ import "yup";
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 { FloatInput } from "../../../inputs/reactHookForm/numbers/FloatInput.js";
28
+ import { TextInput } from "../../../inputs/reactHookForm/text/TextInput.js";
29
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
30
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
31
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
32
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
33
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
34
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
35
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
36
+ import "../../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
37
+ import "@react-querybuilder/material";
38
+ import "../../../filter/expert/expertFilterConstants.js";
39
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
40
+ import "uuid";
41
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
42
+ import "react-querybuilder";
43
+ import "../../common/properties/propertyUtils.js";
44
+ import GridSection from "../../../grid/grid-section.js";
45
+ import { SetPointsForm } from "../../common/setpoints/SetPointsForm.js";
46
+ import { ConnectivityForm } from "../../common/connectivity/ConnectivityForm.js";
47
+ import { ActivePowerControlForm } from "../../common/activePowerControl/ActivePowerControlForm.js";
48
+ import { ShortCircuitForm } from "../../common/shortCircuit/ShortCircuitForm.js";
49
+ import GridItem from "../../../grid/grid-item.js";
50
+ import { ReactiveLimitsForm } from "../../common/reactiveLimits/ReactiveLimitsForm.js";
51
+ function BatteryCreationForm({
52
+ voltageLevelOptions,
53
+ fetchBusesOrBusbarSections,
54
+ PositionDiagramPane
55
+ }) {
56
+ const batteryIdField = /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.EQUIPMENT_ID, label: "ID", formProps: { autoFocus: true, ...filledTextField } });
57
+ const batteryNameField = /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.EQUIPMENT_NAME, label: "Name", formProps: filledTextField });
58
+ const connectivityForm = /* @__PURE__ */ jsx(
59
+ ConnectivityForm,
60
+ {
61
+ voltageLevelOptions,
62
+ PositionDiagramPane,
63
+ fetchBusesOrBusbarSections
64
+ }
65
+ );
66
+ const maximumActivePowerField = /* @__PURE__ */ jsx(
67
+ FloatInput,
68
+ {
69
+ name: FieldConstants.MAXIMUM_ACTIVE_POWER,
70
+ label: "MaximumActivePowerText",
71
+ adornment: ActivePowerAdornment
72
+ }
73
+ );
74
+ const minimumActivePowerField = /* @__PURE__ */ jsx(
75
+ FloatInput,
76
+ {
77
+ name: FieldConstants.MINIMUM_ACTIVE_POWER,
78
+ label: "MinimumActivePowerText",
79
+ adornment: ActivePowerAdornment
80
+ }
81
+ );
82
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
83
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
84
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: batteryIdField }),
85
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: batteryNameField })
86
+ ] }),
87
+ /* @__PURE__ */ jsx(GridSection, { title: "Connectivity" }),
88
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, children: /* @__PURE__ */ jsx(GridItem, { size: 12, children: connectivityForm }) }),
89
+ /* @__PURE__ */ jsx(GridSection, { title: "ActiveLimits" }),
90
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
91
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: minimumActivePowerField }),
92
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: maximumActivePowerField })
93
+ ] }),
94
+ /* @__PURE__ */ jsx(GridSection, { title: "ReactiveLimits" }),
95
+ /* @__PURE__ */ jsx(ReactiveLimitsForm, {}),
96
+ /* @__PURE__ */ jsx(SetPointsForm, {}),
97
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, paddingTop: 2, children: /* @__PURE__ */ jsx(ActivePowerControlForm, {}) }),
98
+ /* @__PURE__ */ jsx(GridSection, { title: "ShortCircuit" }),
99
+ /* @__PURE__ */ jsx(ShortCircuitForm, {}),
100
+ /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "battery" })
101
+ ] });
102
+ }
103
+ export {
104
+ BatteryCreationForm
105
+ };
@@ -0,0 +1,26 @@
1
+ import { Property, ReactiveCapabilityCurvePoints } from '../../common';
2
+ import { ModificationType } from '../../../../utils';
3
+ export interface BatteryCreationDto {
4
+ type: ModificationType;
5
+ equipmentId: string;
6
+ equipmentName: string | null;
7
+ minP: number;
8
+ maxP: number;
9
+ reactiveCapabilityCurve?: boolean | null;
10
+ targetP: number;
11
+ targetQ: number;
12
+ voltageLevelId: string | null;
13
+ busOrBusbarSectionId: string | null;
14
+ reactiveCapabilityCurvePoints: ReactiveCapabilityCurvePoints[] | null;
15
+ directTransX: number | null;
16
+ stepUpTransformerX: number | null;
17
+ participate: boolean | null;
18
+ droop: number | null;
19
+ maxQ: number | null;
20
+ minQ: number | null;
21
+ connectionDirection: string | null;
22
+ connectionName?: string | null;
23
+ connectionPosition?: number | null;
24
+ terminalConnected?: boolean | null;
25
+ properties: Property[] | null;
26
+ }
@@ -0,0 +1,79 @@
1
+ import { InferType } from 'yup';
2
+ import { DeepNullable } from '../../../../utils';
3
+ import { BatteryCreationDto } from './batteryCreation.types';
4
+ export declare const batteryCreationFormSchema: import('yup').ObjectSchema<NonNullable<{
5
+ transformerReactance: number | null | undefined;
6
+ directTransX: number | null | undefined;
7
+ frequencyRegulation: boolean | null | undefined;
8
+ droop: number | null | undefined;
9
+ reactivePowerSetpoint: number | null | undefined;
10
+ activePowerSetpoint: number | undefined;
11
+ equipmentID: string;
12
+ equipmentName: string | null | undefined;
13
+ maximumActivePower: number;
14
+ minimumActivePower: number;
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
+ reactiveLimits: {
28
+ minimumReactivePower?: number | null | undefined;
29
+ maximumReactivePower?: number | null | undefined;
30
+ reactiveCapabilityCurveTable?: {
31
+ minQ: number | null;
32
+ maxQ: number | null;
33
+ p: number | null;
34
+ }[] | null | undefined;
35
+ reactiveCapabilityCurveChoice: string;
36
+ };
37
+ } & {
38
+ AdditionalProperties: {
39
+ previousValue?: string | null | undefined;
40
+ added: NonNullable<boolean | undefined>;
41
+ deletionMark: NonNullable<boolean | undefined>;
42
+ name: string;
43
+ value: string;
44
+ }[] | undefined;
45
+ }>, import('yup').AnyObject, {
46
+ transformerReactance: undefined;
47
+ directTransX: undefined;
48
+ frequencyRegulation: undefined;
49
+ droop: undefined;
50
+ reactivePowerSetpoint: undefined;
51
+ activePowerSetpoint: undefined;
52
+ equipmentID: undefined;
53
+ equipmentName: undefined;
54
+ maximumActivePower: undefined;
55
+ minimumActivePower: undefined;
56
+ connectivity: {
57
+ voltageLevel: {
58
+ id: undefined;
59
+ };
60
+ busOrBusbarSection: {
61
+ id: undefined;
62
+ };
63
+ connectionDirection: undefined;
64
+ connectionName: undefined;
65
+ connectionPosition: undefined;
66
+ terminalConnected: undefined;
67
+ };
68
+ reactiveLimits: {
69
+ reactiveCapabilityCurveChoice: undefined;
70
+ minimumReactivePower: undefined;
71
+ maximumReactivePower: undefined;
72
+ reactiveCapabilityCurveTable: "";
73
+ };
74
+ AdditionalProperties: "";
75
+ }, "">;
76
+ export type BatteryCreationFormData = InferType<typeof batteryCreationFormSchema>;
77
+ export declare const batteryCreationEmptyFormData: DeepNullable<BatteryCreationFormData>;
78
+ export declare const batteryCreationDtoToForm: (dto: BatteryCreationDto) => BatteryCreationFormData;
79
+ export declare const batteryCreationFormToDto: (form: BatteryCreationFormData) => BatteryCreationDto;