@gridsuite/commons-ui 0.252.0 → 0.254.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 (40) hide show
  1. package/dist/components/composite/filter/FilterCreationDialog.js +2 -3
  2. package/dist/components/composite/filter/expert/ExpertFilterEditionDialog.js +2 -3
  3. package/dist/components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +2 -3
  4. package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +43 -49
  5. package/dist/features/network-modifications/battery/batteryDialog.type.d.ts +6 -0
  6. package/dist/features/network-modifications/battery/creation/BatteryCreationForm.d.ts +5 -1
  7. package/dist/features/network-modifications/battery/creation/BatteryCreationForm.js +19 -3
  8. package/dist/features/network-modifications/battery/creation/batteryCreation.types.d.ts +5 -0
  9. package/dist/features/network-modifications/battery/creation/batteryCreation.utils.d.ts +32 -0
  10. package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +21 -1
  11. package/dist/features/network-modifications/common/voltageRegulation/VoltageRegulationForm.d.ts +2 -1
  12. package/dist/features/network-modifications/common/voltageRegulation/VoltageRegulationForm.js +3 -2
  13. package/dist/features/parameters/common/limitreductions/limit-reduction-table-cell.js +18 -2
  14. package/dist/features/parameters/common/limitreductions/limit-reductions-table-form.js +1 -1
  15. package/dist/features/parameters/common/parameter-field.js +1 -9
  16. package/dist/features/parameters/common/voltage-level-table/custom-voltage-level-table.d.ts +3 -2
  17. package/dist/features/parameters/common/voltage-level-table/custom-voltage-level-table.js +47 -29
  18. package/dist/features/parameters/loadflow/load-flow-parameters-dialog.js +3 -3
  19. package/dist/features/parameters/network-visualizations/map-parameters.js +1 -12
  20. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js +3 -3
  21. package/dist/features/parameters/network-visualizations/single-line-diagram-parameters.js +2 -13
  22. package/dist/features/parameters/parameters-style.d.ts +0 -1
  23. package/dist/features/parameters/parameters-style.js +0 -1
  24. package/dist/features/parameters/pcc-min/pcc-min-parameters-dialog.js +3 -3
  25. package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +3 -3
  26. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +3 -3
  27. package/dist/features/parameters/short-circuit/short-circuit-parameters-dialog.js +3 -3
  28. package/dist/features/parameters/voltage-init/voltage-init-parameters-dialog.js +3 -3
  29. package/dist/index.js +7 -4
  30. package/dist/services/index.js +3 -3
  31. package/dist/services/networkModification.d.ts +9 -17
  32. package/dist/services/networkModification.js +16 -19
  33. package/dist/utils/form-utils.d.ts +2 -0
  34. package/dist/utils/form-utils.js +7 -0
  35. package/dist/utils/index.d.ts +1 -0
  36. package/dist/utils/index.js +4 -1
  37. package/dist/utils/types/index.js +2 -1
  38. package/dist/utils/types/types.d.ts +5 -0
  39. package/dist/utils/types/types.js +7 -1
  40. package/package.json +1 -1
@@ -15,6 +15,7 @@ import { MAX_CHAR_DESCRIPTION } from "../../../utils/constants/uiConstants.js";
15
15
  import { EXPERT_FILTER_QUERY } from "./expert/expertFilterConstants.js";
16
16
  import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./explicitNaming/ExplicitNamingFilterConstants.js";
17
17
  import { snackWithFallback } from "../../../utils/error.js";
18
+ import { isDisabledValidationButton } from "../../../utils/form-utils.js";
18
19
  const emptyFormData = {
19
20
  [FieldConstants.NAME]: "",
20
21
  [FieldConstants.DESCRIPTION]: "",
@@ -47,8 +48,6 @@ function FilterCreationDialog({
47
48
  const {
48
49
  formState: { errors }
49
50
  } = formMethods;
50
- const nameError = errors[FieldConstants.NAME];
51
- const isValidating = errors.root?.isValidating;
52
51
  const onSubmit = useCallback(
53
52
  (filterForm) => {
54
53
  if (filterType?.id === FilterType.EXPLICIT_NAMING.id) {
@@ -106,7 +105,7 @@ function FilterCreationDialog({
106
105
  isDeveloperMode
107
106
  },
108
107
  titleId,
109
- disabledSave: !!nameError || !!isValidating,
108
+ disabledSave: isDisabledValidationButton(errors),
110
109
  unscrollableFullHeight: true,
111
110
  children: /* @__PURE__ */ jsx(
112
111
  FilterForm,
@@ -16,6 +16,7 @@ import { importExpertRules } from "./expertFilterUtils.js";
16
16
  import { HeaderFilterSchema } from "../HeaderFilterForm.js";
17
17
  import { EXPERT_FILTER_QUERY } from "./expertFilterConstants.js";
18
18
  import { snackWithFallback } from "../../../../utils/error.js";
19
+ import { isDisabledValidationButton } from "../../../../utils/form-utils.js";
19
20
  const formSchema = yup.object().shape({
20
21
  ...HeaderFilterSchema,
21
22
  ...expertFilterSchema
@@ -44,8 +45,6 @@ function ExpertFilterEditionDialog({
44
45
  reset,
45
46
  formState: { errors }
46
47
  } = formMethods;
47
- const nameError = errors[FieldConstants.NAME];
48
- const isValidating = errors.root?.isValidating;
49
48
  useEffect(() => {
50
49
  if (id && open) {
51
50
  setDataFetchStatus(FetchStatus.FETCHING);
@@ -100,7 +99,7 @@ function ExpertFilterEditionDialog({
100
99
  isDeveloperMode
101
100
  },
102
101
  titleId,
103
- disabledSave: !!nameError || !!isValidating,
102
+ disabledSave: isDisabledValidationButton(errors),
104
103
  isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
105
104
  unscrollableFullHeight: true,
106
105
  children: isDataReady && /* @__PURE__ */ jsx(FilterForm, { activeDirectory, filterType: FilterType.EXPERT, isEditing: true })
@@ -17,6 +17,7 @@ import { NO_ITEM_SELECTION_FOR_COPY } from "../../../../utils/directory-utils.js
17
17
  import { HeaderFilterSchema } from "../HeaderFilterForm.js";
18
18
  import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterConstants.js";
19
19
  import { snackWithFallback } from "../../../../utils/error.js";
20
+ import { isDisabledValidationButton } from "../../../../utils/form-utils.js";
20
21
  const formSchema = yup.object().shape({
21
22
  ...HeaderFilterSchema,
22
23
  ...explicitNamingFilterSchema
@@ -45,8 +46,6 @@ function ExplicitNamingFilterEditionDialog({
45
46
  reset,
46
47
  formState: { errors }
47
48
  } = formMethods;
48
- const nameError = errors[FieldConstants.NAME];
49
- const isValidating = errors.root?.isValidating;
50
49
  useEffect(() => {
51
50
  if (id && open) {
52
51
  setDataFetchStatus(FetchStatus.FETCHING);
@@ -103,7 +102,7 @@ function ExplicitNamingFilterEditionDialog({
103
102
  isDeveloperMode
104
103
  },
105
104
  titleId,
106
- disabledSave: !!nameError || !!isValidating,
105
+ disabledSave: isDisabledValidationButton(errors),
107
106
  isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
108
107
  unscrollableFullHeight: true,
109
108
  children: isDataReady && /* @__PURE__ */ jsx(FilterForm, { activeDirectory, filterType: FilterType.EXPLICIT_NAMING, isEditing: true })
@@ -13,7 +13,7 @@ import { snackWithFallback } from "../../utils/error.js";
13
13
  import "../../utils/types/equipmentType.js";
14
14
  import "@mui/icons-material";
15
15
  import { injectForbiddenChips, CHIP_ATTR } from "./drag-forbidden-chip.js";
16
- import { changeCompositeSubModificationOrder, changeNetworkModificationOrder } from "../../services/networkModification.js";
16
+ import { moveModification, ModificationContainerType } from "../../services/networkModification.js";
17
17
  import "localized-countries";
18
18
  import "localized-countries/data/fr";
19
19
  import "localized-countries/data/en";
@@ -97,40 +97,6 @@ const useModificationsDragAndDrop = ({
97
97
  },
98
98
  [containerRef, isDropForbidden, rows]
99
99
  );
100
- const handleDragEndComposite = useCallback(
101
- (sourceRow, targetRow, droppingIntoExpandedComposite, isDraggingDown) => {
102
- const movingUuid = sourceRow.original.uuid;
103
- const sourceCompositeUuid = sourceRow.depth > 0 ? sourceRow.getParentRow()?.original.uuid ?? null : null;
104
- const targetCompositeUuid = getTargetCompositeUuid(droppingIntoExpandedComposite, targetRow);
105
- const targetSiblings = getTargetSiblings(targetCompositeUuid, rows);
106
- let beforeUuid;
107
- if (droppingIntoExpandedComposite) {
108
- beforeUuid = targetSiblings[0]?.original.uuid ?? null;
109
- } else {
110
- const landingIndexInSiblings = targetSiblings.findIndex(
111
- (r) => r.original.uuid === targetRow.original.uuid
112
- );
113
- const beforeSiblingIndex = isDraggingDown ? landingIndexInSiblings + 1 : landingIndexInSiblings;
114
- beforeUuid = targetSiblings[beforeSiblingIndex]?.original.uuid ?? null;
115
- }
116
- const previousComposed = composedModifications;
117
- setComposedModifications(
118
- (prev) => moveSubModificationInTree(movingUuid, sourceCompositeUuid, targetCompositeUuid, beforeUuid, prev)
119
- );
120
- changeCompositeSubModificationOrder(
121
- studyUuid,
122
- currentNodeUuid,
123
- movingUuid,
124
- sourceCompositeUuid,
125
- targetCompositeUuid,
126
- beforeUuid
127
- ).catch((error) => {
128
- snackWithFallback(snackError, error, { headerId: "errReorderModificationMsg" });
129
- setComposedModifications(previousComposed);
130
- });
131
- },
132
- [rows, studyUuid, currentNodeUuid, snackError, composedModifications, setComposedModifications]
133
- );
134
100
  const handleDragEnd = useCallback(
135
101
  (result) => {
136
102
  clearRowDragIndicators(containerRef.current);
@@ -144,37 +110,65 @@ const useModificationsDragAndDrop = ({
144
110
  if (isDropForbidden(sourceRow, targetRow)) {
145
111
  return;
146
112
  }
147
- const isSubRowInvolved = sourceRow.depth > 0 || targetRow.depth > 0;
113
+ const movingUuid = sourceRow.original.uuid;
114
+ const sourceCompositeUuid = sourceRow.depth > 0 ? sourceRow.getParentRow()?.original.uuid ?? null : null;
148
115
  const isDraggingDown = destination.index > source.index;
149
116
  const droppingIntoExpandedComposite = isDraggingDown && targetRow.getIsExpanded();
150
- if (isSubRowInvolved || droppingIntoExpandedComposite) {
151
- handleDragEndComposite(sourceRow, targetRow, droppingIntoExpandedComposite, isDraggingDown);
117
+ const isSubRowInvolved = sourceRow.depth > 0 || targetRow.depth > 0;
118
+ const targetCompositeUuid = getTargetCompositeUuid(droppingIntoExpandedComposite, targetRow);
119
+ const sourceContainerId = sourceRow.depth > 0 ? sourceRow.getParentRow()?.original.uuid ?? null : null;
120
+ const targetContainerId = targetCompositeUuid;
121
+ const previousModifications = [...composedModifications];
122
+ let beforeUuid;
123
+ if (droppingIntoExpandedComposite || isSubRowInvolved) {
124
+ const targetSiblings = getTargetSiblings(targetCompositeUuid, rows);
125
+ if (droppingIntoExpandedComposite) {
126
+ beforeUuid = targetSiblings[0]?.original.uuid ?? null;
127
+ } else {
128
+ const landingIndexInSiblings = targetSiblings.findIndex(
129
+ (r) => r.original.uuid === targetRow.original.uuid
130
+ );
131
+ const beforeSiblingIndex = isDraggingDown ? landingIndexInSiblings + 1 : landingIndexInSiblings;
132
+ beforeUuid = targetSiblings[beforeSiblingIndex]?.original.uuid ?? null;
133
+ }
134
+ setComposedModifications(
135
+ (prev) => moveSubModificationInTree(movingUuid, sourceCompositeUuid, targetCompositeUuid, beforeUuid, prev)
136
+ );
152
137
  } else {
153
- const sourceDepth0Uuid = sourceRow.original.uuid;
154
- const targetDepth0Uuid = targetRow.original.uuid;
155
- const oldPosition = composedModifications.findIndex((m) => m.uuid === sourceDepth0Uuid);
156
- const newPosition = composedModifications.findIndex((m) => m.uuid === targetDepth0Uuid);
138
+ const oldPosition = composedModifications.findIndex((m) => m.uuid === sourceRow.original.uuid);
139
+ const newPosition = composedModifications.findIndex((m) => m.uuid === targetRow.original.uuid);
157
140
  if (oldPosition === -1 || newPosition === -1 || oldPosition === newPosition || !currentNodeUuid) {
158
141
  return;
159
142
  }
160
- const previousModifications = [...composedModifications];
161
143
  const updatedModifications = [...composedModifications];
162
144
  const [movedItem] = updatedModifications.splice(oldPosition, 1);
163
145
  updatedModifications.splice(newPosition, 0, movedItem);
146
+ beforeUuid = updatedModifications[newPosition + 1]?.uuid ?? null;
164
147
  setComposedModifications(updatedModifications);
165
- const before = updatedModifications[newPosition + 1]?.uuid ?? null;
166
- changeNetworkModificationOrder(studyUuid, currentNodeUuid, movedItem.uuid, before).catch((error) => {
167
- snackWithFallback(snackError, error, { headerId: "errReorderModificationMsg" });
168
- setComposedModifications(previousModifications);
169
- });
170
148
  }
149
+ moveModification(
150
+ studyUuid,
151
+ currentNodeUuid,
152
+ movingUuid,
153
+ {
154
+ id: sourceContainerId,
155
+ type: sourceContainerId ? ModificationContainerType.COMPOSITE : ModificationContainerType.GROUP
156
+ },
157
+ {
158
+ id: targetContainerId,
159
+ type: targetContainerId ? ModificationContainerType.COMPOSITE : ModificationContainerType.GROUP
160
+ },
161
+ beforeUuid
162
+ ).catch((error) => {
163
+ snackWithFallback(snackError, error, { headerId: "errReorderModificationMsg" });
164
+ setComposedModifications(previousModifications);
165
+ });
171
166
  },
172
167
  [
173
168
  containerRef,
174
169
  onDragEnd,
175
170
  rows,
176
171
  isDropForbidden,
177
- handleDragEndComposite,
178
172
  composedModifications,
179
173
  currentNodeUuid,
180
174
  setComposedModifications,
@@ -10,10 +10,16 @@ export interface BatteryFormInfos {
10
10
  minP: number;
11
11
  targetP: number;
12
12
  targetQ: number;
13
+ targetV: number;
14
+ voltageRegulatorOn: boolean;
13
15
  connectablePosition: ConnectablePositionFormInfos;
14
16
  minMaxReactiveLimits: MinMaxReactiveLimitsFormInfos;
15
17
  activePowerControl: ActivePowerControlInfos;
16
18
  batteryShortCircuit: ShortCircuitInfos;
19
+ regulatingTerminalId: string;
20
+ regulatingTerminalVlId: string;
21
+ regulatingTerminalConnectableId: string;
22
+ regulatingTerminalConnectableType: string;
17
23
  reactiveCapabilityCurvePoints: ReactiveCapabilityCurvePoints[];
18
24
  voltageLevelId: string;
19
25
  busOrBusbarSectionId: string;
@@ -1,4 +1,8 @@
1
1
  import { ConnectivityNetworkProps } from '../../common';
2
+ import { EquipmentType, Identifiable } from '../../../../utils';
2
3
  export interface BatteryCreationFormProps extends ConnectivityNetworkProps {
4
+ fetchVoltageLevelEquipments: (voltageLevelId: string) => Promise<(Identifiable & {
5
+ type: EquipmentType;
6
+ })[]>;
3
7
  }
4
- export declare function BatteryCreationForm({ voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, }: Readonly<BatteryCreationFormProps>): import("react").JSX.Element;
8
+ export declare function BatteryCreationForm({ voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, fetchVoltageLevelEquipments, }: Readonly<BatteryCreationFormProps>): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { Grid2 } from "@mui/material";
2
+ import { Box, Grid2 } from "@mui/material";
3
3
  import { filledTextField } from "../../common/form.utils.js";
4
4
  import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
5
5
  import "react";
@@ -18,6 +18,7 @@ import "notistack";
18
18
  import "../../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
19
19
  import "yup";
20
20
  import "../../../../components/ui/treeViewFinder/TreeViewFinder.js";
21
+ import { SwitchInput } from "../../../../components/ui/reactHookForm/booleans/SwitchInput.js";
21
22
  import { FloatInput } from "../../../../components/ui/reactHookForm/numbers/FloatInput.js";
22
23
  import { TextInput } from "../../../../components/ui/reactHookForm/text/TextInput.js";
23
24
  import "../../../../components/ui/reactHookForm/numbers/RangeInput.js";
@@ -71,13 +72,15 @@ import { ActivePowerControlForm } from "../../common/activePowerControl/ActivePo
71
72
  import { ShortCircuitForm } from "../../common/shortCircuit/ShortCircuitForm.js";
72
73
  import { ReactiveLimitsForm } from "../../common/reactiveLimits/ReactiveLimitsForm.js";
73
74
  import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
75
+ import { VoltageRegulationForm } from "../../common/voltageRegulation/VoltageRegulationForm.js";
74
76
  import "@mui/material/colors";
75
77
  import "@mui/x-charts";
76
78
  import "../../common/currentLimits/limitsPane.utils.js";
77
79
  function BatteryCreationForm({
78
80
  voltageLevelOptions,
79
81
  fetchBusesOrBusbarSections,
80
- PositionDiagramPane
82
+ PositionDiagramPane,
83
+ fetchVoltageLevelEquipments
81
84
  }) {
82
85
  const batteryIdField = /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.EQUIPMENT_ID, label: "ID", formProps: { autoFocus: true, ...filledTextField } });
83
86
  const batteryNameField = /* @__PURE__ */ jsx(TextInput, { name: FieldConstants.EQUIPMENT_NAME, label: "Name", formProps: filledTextField });
@@ -105,6 +108,15 @@ function BatteryCreationForm({
105
108
  adornment: ActivePowerAdornment
106
109
  }
107
110
  );
111
+ const voltageRegulationField = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(SwitchInput, { name: FieldConstants.VOLTAGE_REGULATION, label: "VoltageRegulationText" }) });
112
+ const voltageRegulationForm = /* @__PURE__ */ jsx(
113
+ VoltageRegulationForm,
114
+ {
115
+ voltageLevelOptions,
116
+ fetchVoltageLevelEquipments,
117
+ isGenerator: false
118
+ }
119
+ );
108
120
  return /* @__PURE__ */ jsxs(Fragment, { children: [
109
121
  /* @__PURE__ */ jsxs(Grid2, { container: true, spacing: 2, children: [
110
122
  /* @__PURE__ */ jsx(GridItem, { size: 4, children: batteryIdField }),
@@ -120,7 +132,11 @@ function BatteryCreationForm({
120
132
  /* @__PURE__ */ jsx(GridSection, { title: "ReactiveLimits" }),
121
133
  /* @__PURE__ */ jsx(ReactiveLimitsForm, {}),
122
134
  /* @__PURE__ */ jsx(SetPointsForm, {}),
123
- /* @__PURE__ */ jsx(Grid2, { container: true, spacing: 2, paddingTop: 2, children: /* @__PURE__ */ jsx(ActivePowerControlForm, {}) }),
135
+ /* @__PURE__ */ jsxs(Grid2, { container: true, spacing: 2, paddingTop: 2, children: [
136
+ /* @__PURE__ */ jsx(GridItem, { size: 4, children: voltageRegulationField }),
137
+ voltageRegulationForm,
138
+ /* @__PURE__ */ jsx(ActivePowerControlForm, {})
139
+ ] }),
124
140
  /* @__PURE__ */ jsx(GridSection, { title: "ShortCircuit" }),
125
141
  /* @__PURE__ */ jsx(ShortCircuitForm, {}),
126
142
  /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "battery" })
@@ -9,6 +9,11 @@ export interface BatteryCreationDto {
9
9
  reactiveCapabilityCurve?: boolean | null;
10
10
  targetP: number;
11
11
  targetQ: number;
12
+ targetV: number | null;
13
+ voltageRegulationOn: boolean | null;
14
+ regulatingTerminalId: string | null;
15
+ regulatingTerminalType: string | null;
16
+ regulatingTerminalVlId: string | null;
12
17
  voltageLevelId: string | null;
13
18
  busOrBusbarSectionId: string | null;
14
19
  reactiveCapabilityCurvePoints: ReactiveCapabilityCurvePoints[] | null;
@@ -6,6 +6,22 @@ export declare const batteryCreationFormSchema: import('yup').ObjectSchema<NonNu
6
6
  directTransX: number | null | undefined;
7
7
  frequencyRegulation: boolean | null | undefined;
8
8
  droop: number | null | undefined;
9
+ voltageRegulation: boolean | null | undefined;
10
+ voltageRegulationType: string | null | undefined;
11
+ voltageSetpoint: number | null | undefined;
12
+ qPercent: number | null | undefined;
13
+ voltageLevel: {
14
+ id?: string | undefined;
15
+ name?: string | undefined;
16
+ nominalVoltage?: string | undefined;
17
+ substationId?: string | undefined;
18
+ topologyKind?: string | null | undefined;
19
+ } | null;
20
+ equipment: {
21
+ id?: string | undefined;
22
+ name?: string | null | undefined;
23
+ type?: string | undefined;
24
+ } | null;
9
25
  reactivePowerSetpoint: number | null | undefined;
10
26
  activePowerSetpoint: number | undefined;
11
27
  equipmentID: string;
@@ -47,6 +63,22 @@ export declare const batteryCreationFormSchema: import('yup').ObjectSchema<NonNu
47
63
  directTransX: undefined;
48
64
  frequencyRegulation: undefined;
49
65
  droop: undefined;
66
+ voltageRegulation: undefined;
67
+ voltageRegulationType: undefined;
68
+ voltageSetpoint: undefined;
69
+ qPercent: undefined;
70
+ voltageLevel: {
71
+ id: undefined;
72
+ name: undefined;
73
+ substationId: undefined;
74
+ nominalVoltage: undefined;
75
+ topologyKind: undefined;
76
+ };
77
+ equipment: {
78
+ id: undefined;
79
+ name: undefined;
80
+ type: undefined;
81
+ };
50
82
  reactivePowerSetpoint: undefined;
51
83
  activePowerSetpoint: undefined;
52
84
  equipmentID: undefined;
@@ -66,6 +66,8 @@ import { getActivePowerControlSchema, getActivePowerControlEmptyFormData } from
66
66
  import { getShortCircuitFormSchema, getShortCircuitEmptyFormData, getShortCircuitFormData } from "../../common/shortCircuit/shortCircuitForm.utils.js";
67
67
  import { getReactiveLimitsValidationSchema, getReactiveLimitsEmptyFormDataProps, getReactiveLimitsFormDataProps } from "../../common/reactiveLimits/reactiveLimits.utils.js";
68
68
  import "../../common/regulatingTerminal/RegulatingTerminalForm.js";
69
+ import { getRegulatingTerminalEquipmentData, getRegulatingTerminalVoltageLevelData } from "../../common/regulatingTerminal/regulatingTerminal.utils.js";
70
+ import { getVoltageRegulationSchema, getVoltageRegulationEmptyFormData, REGULATION_TYPES } from "../../common/voltageRegulation/voltageRegulation.utils.js";
69
71
  import "@mui/material/colors";
70
72
  import "@mui/x-charts";
71
73
  import "../../common/currentLimits/limitsPane.utils.js";
@@ -89,6 +91,7 @@ const batteryCreationFormSchema = object().shape({
89
91
  [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(false),
90
92
  [FieldConstants.REACTIVE_LIMITS]: getReactiveLimitsValidationSchema(),
91
93
  ...getSetPointsSchema(),
94
+ ...getVoltageRegulationSchema(),
92
95
  ...getActivePowerControlSchema(),
93
96
  ...getShortCircuitFormSchema()
94
97
  }).concat(creationPropertiesSchema).required();
@@ -101,6 +104,7 @@ const batteryCreationEmptyFormData = {
101
104
  reactiveLimits: getReactiveLimitsEmptyFormDataProps(),
102
105
  AdditionalProperties: [],
103
106
  ...getSetPointsEmptyFormData(),
107
+ ...getVoltageRegulationEmptyFormData(),
104
108
  ...getActivePowerControlEmptyFormData(),
105
109
  ...getShortCircuitEmptyFormData()
106
110
  };
@@ -128,6 +132,16 @@ const batteryCreationDtoToForm = (dto) => {
128
132
  maximumReactivePower: dto?.maxQ,
129
133
  reactiveCapabilityCurvePoints: dto?.reactiveCapabilityCurve ? dto?.reactiveCapabilityCurvePoints : null
130
134
  }),
135
+ voltageLevel: getRegulatingTerminalVoltageLevelData({
136
+ voltageLevelId: dto.regulatingTerminalVlId
137
+ }),
138
+ equipment: getRegulatingTerminalEquipmentData({
139
+ equipmentId: dto.regulatingTerminalId,
140
+ equipmentType: dto.regulatingTerminalType ?? void 0
141
+ }),
142
+ voltageRegulationType: dto?.regulatingTerminalId ? REGULATION_TYPES.DISTANT.id : REGULATION_TYPES.LOCAL.id,
143
+ voltageRegulation: dto.voltageRegulationOn,
144
+ voltageSetpoint: dto.targetV,
131
145
  AdditionalProperties: getFilledPropertiesFromModification(dto.properties),
132
146
  ...getShortCircuitFormData({
133
147
  directTransX: dto.directTransX,
@@ -137,6 +151,7 @@ const batteryCreationDtoToForm = (dto) => {
137
151
  };
138
152
  const batteryCreationFormToDto = (form) => {
139
153
  const isReactiveCapabilityCurveOn = form.reactiveLimits.reactiveCapabilityCurveChoice === "CURVE";
154
+ const isDistantRegulation = form[FieldConstants.VOLTAGE_REGULATION_TYPE] === REGULATION_TYPES.DISTANT.id;
140
155
  return {
141
156
  type: ModificationType.BATTERY_CREATION,
142
157
  equipmentId: form.equipmentID,
@@ -156,10 +171,15 @@ const batteryCreationFormToDto = (form) => {
156
171
  reactiveCapabilityCurvePoints: isReactiveCapabilityCurveOn ? form.reactiveLimits.reactiveCapabilityCurveTable ?? null : null,
157
172
  targetP: form.activePowerSetpoint ?? 0,
158
173
  targetQ: form.reactivePowerSetpoint ?? 0,
174
+ targetV: form.voltageSetpoint ?? null,
175
+ voltageRegulationOn: form.voltageRegulation ?? null,
159
176
  participate: form.frequencyRegulation ?? null,
160
177
  droop: form.droop ?? null,
161
178
  directTransX: form.directTransX ?? null,
162
- stepUpTransformerX: form.transformerReactance ?? null
179
+ stepUpTransformerX: form.transformerReactance ?? null,
180
+ regulatingTerminalId: isDistantRegulation ? form.equipment?.id ?? null : null,
181
+ regulatingTerminalType: isDistantRegulation ? form.equipment?.type ?? null : null,
182
+ regulatingTerminalVlId: isDistantRegulation ? form.voltageLevel?.id ?? null : null
163
183
  };
164
184
  };
165
185
  export {
@@ -13,5 +13,6 @@ export interface VoltageRegulationFormProps {
13
13
  })[]>;
14
14
  previousValues?: VoltageRegulationFormPreviousValues;
15
15
  isEquipmentModification?: boolean;
16
+ isGenerator?: boolean;
16
17
  }
17
- export declare function VoltageRegulationForm({ voltageLevelOptions, fetchVoltageLevelEquipments, previousValues, isEquipmentModification, }: Readonly<VoltageRegulationFormProps>): import("react").JSX.Element;
18
+ export declare function VoltageRegulationForm({ voltageLevelOptions, fetchVoltageLevelEquipments, previousValues, isEquipmentModification, isGenerator, }: Readonly<VoltageRegulationFormProps>): import("react").JSX.Element;
@@ -40,7 +40,8 @@ function VoltageRegulationForm({
40
40
  voltageLevelOptions,
41
41
  fetchVoltageLevelEquipments,
42
42
  previousValues,
43
- isEquipmentModification
43
+ isEquipmentModification,
44
+ isGenerator = true
44
45
  }) {
45
46
  const intl = useIntl();
46
47
  const previousRegulationType = useMemo(() => {
@@ -95,7 +96,7 @@ function VoltageRegulationForm({
95
96
  equipmentSectionType: previousEquipmentSectionType
96
97
  }
97
98
  ) }),
98
- /* @__PURE__ */ jsx(GridItem, { size: 4, offset: 4, children: /* @__PURE__ */ jsx(
99
+ isGenerator && /* @__PURE__ */ jsx(GridItem, { size: 4, offset: 4, children: /* @__PURE__ */ jsx(
99
100
  FloatInput,
100
101
  {
101
102
  name: FieldConstants.Q_PERCENT,
@@ -38,7 +38,8 @@ function LimitReductionTableCell({
38
38
  column,
39
39
  limits
40
40
  }) {
41
- return column.dataKey === VOLTAGE_LEVELS_FORM && limits[rowIndex] ? /* @__PURE__ */ jsx(
41
+ const isVoltageLevelColumn = column.dataKey === VOLTAGE_LEVELS_FORM;
42
+ return isVoltageLevelColumn && limits[rowIndex] ? /* @__PURE__ */ jsx(
42
43
  CustomTooltip,
43
44
  {
44
45
  title: /* @__PURE__ */ jsx(
@@ -53,7 +54,22 @@ function LimitReductionTableCell({
53
54
  ),
54
55
  children: /* @__PURE__ */ jsx(TableCell, { sx: { fontWeight: "bold" }, children: /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${LIMIT_REDUCTIONS_FORM}[${rowIndex}].${column.dataKey}` }) })
55
56
  }
56
- ) : /* @__PURE__ */ jsx(TableCell, { sx: { fontWeight: "bold" }, children: column.dataKey === VOLTAGE_LEVELS_FORM ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${LIMIT_REDUCTIONS_FORM}[${rowIndex}].${column.dataKey}` }) : /* @__PURE__ */ jsx(FloatInput, { name: `${LIMIT_REDUCTIONS_FORM}[${rowIndex}].${column.dataKey}` }) });
57
+ ) : /* @__PURE__ */ jsx(TableCell, { sx: { fontWeight: "bold", p: 0.75 }, children: isVoltageLevelColumn ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${LIMIT_REDUCTIONS_FORM}[${rowIndex}].${column.dataKey}` }) : /* @__PURE__ */ jsx(
58
+ FloatInput,
59
+ {
60
+ formProps: {
61
+ sx: {
62
+ "& .MuiInputBase-root": {
63
+ padding: 0
64
+ },
65
+ "& .MuiInputBase-input": {
66
+ textAlign: "right"
67
+ }
68
+ }
69
+ },
70
+ name: `${LIMIT_REDUCTIONS_FORM}[${rowIndex}].${column.dataKey}`
71
+ }
72
+ ) });
57
73
  }
58
74
  export {
59
75
  LimitReductionTableCell
@@ -56,7 +56,7 @@ function LimitReductionsTableForm({ limits }) {
56
56
  {
57
57
  formName: LIMIT_REDUCTIONS_FORM,
58
58
  columnsDefinition,
59
- tableHeight: 450,
59
+ tableMinWidth: 600,
60
60
  limits
61
61
  }
62
62
  );
@@ -41,13 +41,6 @@ import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
41
41
  import "mui-nested-menu";
42
42
  import "react-resizable-panels";
43
43
  import "react-papaparse";
44
- import { LineSeparator } from "./line-separator.js";
45
- import "./parameter-layout/parameter-layout-provider.js";
46
- import "./widget/parameter-line-slider.js";
47
- import "./contingency-table/contingency-table.js";
48
- import "./contingency-table/columns-definitions.js";
49
- import "@hookform/resolvers/yup";
50
- import "../../../components/composite/filter/HeaderFilterForm.js";
51
44
  function ParameterField({
52
45
  id,
53
46
  name,
@@ -117,8 +110,7 @@ function ParameterField({
117
110
  const INPUT_GRID_SIZE = 12 - LABEL_GRID_SIZE;
118
111
  return /* @__PURE__ */ jsxs(Grid2, { container: true, spacing: 1, paddingTop: 1, justifyContent: "space-between", sx: { width: "100%" }, children: [
119
112
  /* @__PURE__ */ jsx(Grid2, { size: LABEL_GRID_SIZE, children: /* @__PURE__ */ jsx(CustomTooltip, { title: description, children: /* @__PURE__ */ jsx(Typography, { sx: parametersStyles.parameterName, children: label ? /* @__PURE__ */ jsx(FormattedMessage, { id: label }) : name }) }, name) }),
120
- /* @__PURE__ */ jsx(Grid2, { container: true, size: INPUT_GRID_SIZE, sx: parametersStyles.controlItem, children: renderField() }),
121
- /* @__PURE__ */ jsx(LineSeparator, {})
113
+ /* @__PURE__ */ jsx(Grid2, { container: true, size: INPUT_GRID_SIZE, sx: parametersStyles.controlItem, children: renderField() })
122
114
  ] }, name);
123
115
  }
124
116
  export {
@@ -1,9 +1,10 @@
1
1
  import { LimitReductionIColumnsDef, ILimitReductionsByVoltageLevel } from '../limitreductions/columns-definitions';
2
2
  interface LimitReductionsTableProps {
3
3
  columnsDefinition: LimitReductionIColumnsDef[];
4
- tableHeight: number;
4
+ tableHeight?: number;
5
+ tableMinWidth?: number;
5
6
  formName: string;
6
7
  limits?: ILimitReductionsByVoltageLevel[];
7
8
  }
8
- export declare function CustomVoltageLevelTable({ formName, columnsDefinition, tableHeight, limits, }: Readonly<LimitReductionsTableProps>): import("react").JSX.Element;
9
+ export declare function CustomVoltageLevelTable({ formName, columnsDefinition, tableHeight, tableMinWidth, limits, }: Readonly<LimitReductionsTableProps>): import("react").JSX.Element;
9
10
  export {};
@@ -5,10 +5,16 @@ import { CustomTooltip } from "../../../../components/ui/tooltip/CustomTooltip.j
5
5
  import { LIMIT_REDUCTIONS_FORM } from "../limitreductions/columns-definitions.js";
6
6
  import { LimitReductionTableRow } from "../limitreductions/limit-reduction-table-row.js";
7
7
  import { CustomVoltageLevelTableRow } from "./custom-voltage-level-table-row.js";
8
+ const stickyFirstColumnSx = {
9
+ position: "sticky",
10
+ left: 0,
11
+ backgroundColor: "background.paper"
12
+ };
8
13
  function CustomVoltageLevelTable({
9
14
  formName,
10
15
  columnsDefinition,
11
16
  tableHeight,
17
+ tableMinWidth,
12
18
  limits
13
19
  }) {
14
20
  const { fields: rows } = useFieldArray({
@@ -18,41 +24,53 @@ function CustomVoltageLevelTable({
18
24
  TableContainer,
19
25
  {
20
26
  sx: {
21
- height: tableHeight,
27
+ ...tableHeight ? { height: tableHeight } : {},
22
28
  width: "inherit",
29
+ overflowX: "auto",
23
30
  border: "solid 0px rgba(0,0,0,0.1)"
24
31
  },
25
- children: /* @__PURE__ */ jsxs(Table, { stickyHeader: true, size: "small", sx: { tableLayout: "fixed" }, children: [
26
- /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: columnsDefinition.map((column) => /* @__PURE__ */ jsx(CustomTooltip, { title: column.tooltip, children: /* @__PURE__ */ jsx(
27
- TableCell,
28
- {
29
- sx: {
32
+ children: /* @__PURE__ */ jsxs(
33
+ Table,
34
+ {
35
+ stickyHeader: true,
36
+ size: "small",
37
+ sx: {
38
+ tableLayout: "fixed",
39
+ ...tableMinWidth ? { minWidth: tableMinWidth } : {},
40
+ "& th:first-of-type": {
41
+ ...stickyFirstColumnSx,
42
+ zIndex: 3,
30
43
  textAlign: "center"
31
44
  },
32
- children: column.label
45
+ "& td:first-of-type": {
46
+ ...stickyFirstColumnSx,
47
+ zIndex: 1
48
+ }
33
49
  },
34
- column.dataKey
35
- ) })) }) }),
36
- /* @__PURE__ */ jsx(TableBody, { children: rows.map(
37
- (row, index) => formName === LIMIT_REDUCTIONS_FORM && limits ? /* @__PURE__ */ jsx(
38
- LimitReductionTableRow,
39
- {
40
- columnsDefinition,
41
- index,
42
- limits
43
- },
44
- `${row.id}`
45
- ) : /* @__PURE__ */ jsx(
46
- CustomVoltageLevelTableRow,
47
- {
48
- columnsDefinition,
49
- index,
50
- formName
51
- },
52
- `${row.id}`
53
- )
54
- ) })
55
- ] })
50
+ children: [
51
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: columnsDefinition.map((column) => /* @__PURE__ */ jsx(CustomTooltip, { title: column.tooltip, children: /* @__PURE__ */ jsx(TableCell, { sx: { textAlign: "center" }, children: column.label }, column.dataKey) })) }) }),
52
+ /* @__PURE__ */ jsx(TableBody, { children: rows.map(
53
+ (row, index) => formName === LIMIT_REDUCTIONS_FORM && limits ? /* @__PURE__ */ jsx(
54
+ LimitReductionTableRow,
55
+ {
56
+ columnsDefinition,
57
+ index,
58
+ limits
59
+ },
60
+ `${row.id}`
61
+ ) : /* @__PURE__ */ jsx(
62
+ CustomVoltageLevelTableRow,
63
+ {
64
+ columnsDefinition,
65
+ index,
66
+ formName
67
+ },
68
+ `${row.id}`
69
+ )
70
+ ) })
71
+ ]
72
+ }
73
+ )
56
74
  }
57
75
  );
58
76
  }