@gridsuite/commons-ui 0.189.0 → 0.191.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 (157) hide show
  1. package/dist/components/customAGGrid/cell-renderers.js +28 -26
  2. package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -0
  3. package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +1 -0
  4. package/dist/components/dnd-table/dnd-table.js +72 -34
  5. package/dist/components/filter/HeaderFilterForm.js +1 -0
  6. package/dist/components/filter/expert/ExpertFilterForm.js +1 -0
  7. package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +1 -0
  8. package/dist/components/index.js +16 -6
  9. package/dist/components/inputs/index.js +2 -0
  10. package/dist/components/inputs/reactHookForm/expandableInput/ExpandableInput.d.ts +5 -5
  11. package/dist/components/inputs/reactHookForm/expandableInput/ExpandableInput.js +66 -54
  12. package/dist/components/inputs/reactHookForm/index.js +2 -0
  13. package/dist/components/inputs/reactHookForm/selectInputs/SelectWithConfirmationInput.d.ts +9 -0
  14. package/dist/components/inputs/reactHookForm/selectInputs/SelectWithConfirmationInput.js +64 -0
  15. package/dist/components/inputs/reactHookForm/selectInputs/index.d.ts +1 -0
  16. package/dist/components/inputs/reactHookForm/selectInputs/index.js +3 -1
  17. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-constants.d.ts +16 -0
  18. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-constants.js +402 -0
  19. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-form.d.ts +12 -0
  20. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-form.js +218 -0
  21. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.d.ts +21 -0
  22. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.js +89 -0
  23. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment.type.d.ts +28 -0
  24. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment.type.js +12 -0
  25. package/dist/components/network-modifications/by-filter/assignment/index.d.ts +10 -0
  26. package/dist/components/network-modifications/by-filter/assignment/index.js +11 -0
  27. package/dist/components/network-modifications/by-filter/assignment/modification-by-assignment-form.d.ts +7 -0
  28. package/dist/components/network-modifications/by-filter/assignment/modification-by-assignment-form.js +89 -0
  29. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.types.d.ts +7 -0
  30. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.types.js +1 -0
  31. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.utils.d.ts +22 -0
  32. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.utils.js +55 -0
  33. package/dist/components/network-modifications/by-filter/deletion/ByFilterDeletionForm.js +1 -0
  34. package/dist/components/network-modifications/by-filter/index.d.ts +1 -0
  35. package/dist/components/network-modifications/by-filter/index.js +10 -1
  36. package/dist/components/network-modifications/common/connectivity/ConnectivityForm.js +1 -0
  37. package/dist/components/network-modifications/common/measurements/PowerWithValidityForm.js +1 -0
  38. package/dist/components/network-modifications/common/properties/PropertyForm.js +1 -0
  39. package/dist/components/network-modifications/common/setpoints/SetPointsForm.js +1 -0
  40. package/dist/components/network-modifications/equipmentDeletion/EquipmentDeletionForm.js +1 -0
  41. package/dist/components/network-modifications/equipmentDeletion/equipmentDeletion.utils.js +1 -0
  42. package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js +1 -0
  43. package/dist/components/network-modifications/hooks/index.d.ts +7 -0
  44. package/dist/components/network-modifications/hooks/index.js +4 -0
  45. package/dist/components/network-modifications/hooks/useTabsWithError.d.ts +15 -0
  46. package/dist/components/network-modifications/hooks/useTabsWithError.js +28 -0
  47. package/dist/components/network-modifications/index.d.ts +1 -0
  48. package/dist/components/network-modifications/index.js +15 -6
  49. package/dist/components/network-modifications/load/common/LoadDialogHeader.js +1 -0
  50. package/dist/components/network-modifications/load/common/LoadForm.d.ts +1 -1
  51. package/dist/components/network-modifications/load/common/LoadForm.js +7 -27
  52. package/dist/components/network-modifications/load/common/index.js +2 -1
  53. package/dist/components/network-modifications/load/common/load.utils.d.ts +7 -11
  54. package/dist/components/network-modifications/load/common/load.utils.js +30 -4
  55. package/dist/components/network-modifications/load/creation/loadCreation.utils.js +1 -0
  56. package/dist/components/network-modifications/load/index.js +2 -1
  57. package/dist/components/network-modifications/load/modification/loadModification.utils.js +1 -0
  58. package/dist/components/network-modifications/substation/creation/SubstationCreationForm.js +1 -0
  59. package/dist/components/network-modifications/substation/modification/SubstationModificationForm.js +1 -0
  60. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +10 -29
  61. package/dist/components/network-modifications/voltageLevel/creation/index.js +2 -5
  62. package/dist/components/network-modifications/voltageLevel/creation/tabs/characteristicsTab/CharacteristicsTab.js +1 -0
  63. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +1 -0
  64. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +1 -0
  65. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesDialog.js +1 -0
  66. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +1 -0
  67. package/dist/components/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationCreationSection.js +1 -0
  68. package/dist/components/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationTab.js +1 -0
  69. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +8 -12
  70. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +53 -5
  71. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.d.ts +0 -4
  72. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +1 -16
  73. package/dist/components/network-modifications/voltageLevel/index.js +2 -5
  74. package/dist/components/network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js +1 -0
  75. package/dist/components/parameters/common/ProviderParam.js +1 -0
  76. package/dist/components/parameters/common/contingency-table/columns-definitions.js +1 -0
  77. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +1 -0
  78. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +1 -0
  79. package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +1 -0
  80. package/dist/components/parameters/common/parameter-dnd-table-field.js +1 -0
  81. package/dist/components/parameters/common/parameter-field.js +1 -0
  82. package/dist/components/parameters/common/parameter-table/table-cell.js +1 -0
  83. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +1 -0
  84. package/dist/components/parameters/common/widget/parameter-float.js +1 -0
  85. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +1 -0
  86. package/dist/components/parameters/common/widget/parameter-line-slider.js +1 -0
  87. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -0
  88. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +1 -0
  89. package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js +2 -0
  90. package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +1 -0
  91. package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.js +1 -0
  92. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +1 -0
  93. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -0
  94. package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +1 -0
  95. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +1 -0
  96. package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -0
  97. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +1 -0
  98. package/dist/components/parameters/loadflow/load-flow-parameters-form.js +1 -0
  99. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +1 -0
  100. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +1 -0
  101. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +1 -0
  102. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -0
  103. package/dist/components/parameters/network-visualizations/map-parameters.js +1 -0
  104. package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +1 -0
  105. package/dist/components/parameters/network-visualizations/network-visualizations-form.js +1 -0
  106. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +1 -0
  107. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -0
  108. package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +1 -0
  109. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -0
  110. package/dist/components/parameters/pcc-min/pcc-min-form-utils.js +1 -0
  111. package/dist/components/parameters/pcc-min/pcc-min-parameters-dialog.js +1 -0
  112. package/dist/components/parameters/pcc-min/pcc-min-parameters-form.js +1 -0
  113. package/dist/components/parameters/pcc-min/pcc-min-parameters-inline.js +1 -0
  114. package/dist/components/parameters/pcc-min/use-pcc-min-parameters-form.js +1 -0
  115. package/dist/components/parameters/security-analysis/columns-definitions.js +1 -0
  116. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -0
  117. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +1 -0
  118. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +1 -0
  119. package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +1 -0
  120. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +1 -0
  121. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +1 -0
  122. package/dist/components/parameters/sensi/columns-definitions.js +1 -0
  123. package/dist/components/parameters/sensi/sensitivity-Flow-parameters.js +1 -0
  124. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -0
  125. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -0
  126. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +1 -0
  127. package/dist/components/parameters/sensi/sensitivity-parameters-selector.js +1 -0
  128. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -0
  129. package/dist/components/parameters/sensi/utils.js +1 -0
  130. package/dist/components/parameters/short-circuit/short-circuit-general-tab-panel.js +1 -0
  131. package/dist/components/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -0
  132. package/dist/components/parameters/short-circuit/short-circuit-icc-material-table-cell.js +1 -0
  133. package/dist/components/parameters/short-circuit/short-circuit-parameters-content.js +1 -0
  134. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -0
  135. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +1 -0
  136. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -0
  137. package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.js +1 -0
  138. package/dist/components/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +1 -0
  139. package/dist/components/parameters/short-circuit/short-circuit-study-area-tab-panel.js +1 -0
  140. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -0
  141. package/dist/components/parameters/util/make-component-utils.js +1 -0
  142. package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +1 -0
  143. package/dist/components/parameters/voltage-init/general-parameters.js +1 -0
  144. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +2 -0
  145. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +2 -0
  146. package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.js +1 -0
  147. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +1 -0
  148. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +1 -0
  149. package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +1 -0
  150. package/dist/index.js +16 -6
  151. package/dist/translations/en/networkModificationsEn.d.ts +51 -0
  152. package/dist/translations/en/networkModificationsEn.js +51 -0
  153. package/dist/translations/fr/networkModificationsFr.d.ts +51 -0
  154. package/dist/translations/fr/networkModificationsFr.js +51 -0
  155. package/dist/utils/constants/fieldConstants.d.ts +2 -0
  156. package/dist/utils/constants/fieldConstants.js +2 -0
  157. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Checkbox, Box, Tooltip } from "@mui/material";
3
- import { useRef, useState, useEffect } from "react";
3
+ import { useRef, useState } from "react";
4
4
  import { useIntl } from "react-intl";
5
5
  import { isBlankOrEmpty } from "../../utils/conversionUtils.js";
6
6
  import "../../utils/types/equipmentType.js";
@@ -118,25 +118,15 @@ function MessageLogCellRenderer({
118
118
  }) {
119
119
  const marginLeft = (param.data?.depth ?? 0) * 2;
120
120
  const textRef = useRef(null);
121
- const [isEllipsisActive, setIsEllipsisActive] = useState(false);
122
- const checkEllipsis = () => {
121
+ const [showTooltip, setShowTooltip] = useState(false);
122
+ const handleMouseEnter = () => {
123
123
  if (textRef.current) {
124
- const zoomLevel = window.devicePixelRatio;
125
- const adjustedScrollWidth = textRef.current.scrollWidth / zoomLevel;
126
- const adjustedClientWidth = textRef.current.clientWidth / zoomLevel;
127
- setIsEllipsisActive(adjustedScrollWidth > adjustedClientWidth);
124
+ setShowTooltip(textRef.current.scrollWidth > textRef.current.clientWidth);
128
125
  }
129
126
  };
130
- useEffect(() => {
131
- checkEllipsis();
132
- const resizeObserver = new ResizeObserver(() => checkEllipsis());
133
- if (textRef.current) {
134
- resizeObserver.observe(textRef.current);
135
- }
136
- return () => {
137
- resizeObserver.disconnect();
138
- };
139
- }, [param.value]);
127
+ const handleMouseLeave = () => {
128
+ setShowTooltip(false);
129
+ };
140
130
  const escapeRegExp = (string) => {
141
131
  return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
142
132
  };
@@ -166,17 +156,29 @@ function MessageLogCellRenderer({
166
156
  return /* @__PURE__ */ jsx("span", { children: part }, key);
167
157
  }) });
168
158
  };
169
- return /* @__PURE__ */ jsx(Box, { sx: mergeSx(styles.tableCell), children: /* @__PURE__ */ jsx(Tooltip, { disableFocusListener: true, disableTouchListener: true, title: isEllipsisActive ? param.value : "", children: /* @__PURE__ */ jsx(
170
- Box,
159
+ return /* @__PURE__ */ jsx(Box, { sx: mergeSx(styles.tableCell), children: /* @__PURE__ */ jsx(
160
+ Tooltip,
171
161
  {
172
- ref: textRef,
173
- sx: {
174
- ...styles.overflow,
175
- marginLeft
176
- },
177
- children: renderHighlightedText(param.value)
162
+ disableFocusListener: true,
163
+ disableTouchListener: true,
164
+ disableHoverListener: true,
165
+ open: showTooltip,
166
+ title: param.value,
167
+ children: /* @__PURE__ */ jsx(
168
+ Box,
169
+ {
170
+ ref: textRef,
171
+ onMouseEnter: handleMouseEnter,
172
+ onMouseLeave: handleMouseLeave,
173
+ sx: {
174
+ ...styles.overflow,
175
+ marginLeft
176
+ },
177
+ children: renderHighlightedText(param.value)
178
+ }
179
+ )
178
180
  }
179
- ) }) });
181
+ ) });
180
182
  }
181
183
  function ContingencyCellRenderer({
182
184
  value
@@ -33,6 +33,7 @@ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
33
33
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
34
34
  import "@material-symbols/svg-400/outlined/add_notes.svg?react";
35
35
  import "../descriptionModificationDialog/DescriptionModificationDialog.js";
36
+ import "../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
36
37
  import "@react-querybuilder/material";
37
38
  import "../../filter/expert/expertFilterConstants.js";
38
39
  import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -27,6 +27,7 @@ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
27
27
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
28
28
  import "@material-symbols/svg-400/outlined/add_notes.svg?react";
29
29
  import "../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
30
+ import "../inputs/reactHookForm/expandableInput/ExpandableInput.js";
30
31
  import "@react-querybuilder/material";
31
32
  import "../filter/expert/expertFilterConstants.js";
32
33
  import "../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -1,5 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useMemo } from "react";
2
+ import { createPortal } from "react-dom";
3
+ import { useState, useRef, useCallback, useMemo } from "react";
3
4
  import { useFormContext, useWatch } from "react-hook-form";
4
5
  import { Grid, TableContainer, Table, TableHead, TableRow, TableCell, Box, TableBody, Tooltip, Checkbox } from "@mui/material";
5
6
  import { DragIndicator } from "@mui/icons-material";
@@ -12,6 +13,7 @@ import { DndTableAddRowsDialog } from "./dnd-table-add-rows-dialog.js";
12
13
  import "../overflowableText/OverflowableText.js";
13
14
  import "../../utils/conversionUtils.js";
14
15
  import "../../utils/types/equipmentType.js";
16
+ import { mergeSx } from "../../utils/styles.js";
15
17
  import "../../utils/yupConfig.js";
16
18
  import { ChipItemsInput } from "../inputs/reactHookForm/chip-items-input.js";
17
19
  import { DirectoryItemsInput } from "../inputs/reactHookForm/DirectoryItemsInput.js";
@@ -39,6 +41,7 @@ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
39
41
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
40
42
  import "@material-symbols/svg-400/outlined/add_notes.svg?react";
41
43
  import "../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
44
+ import "../inputs/reactHookForm/expandableInput/ExpandableInput.js";
42
45
  import "notistack";
43
46
  import "@react-querybuilder/material";
44
47
  import "../filter/expert/expertFilterConstants.js";
@@ -88,18 +91,19 @@ function MultiCheckbox({
88
91
  }
89
92
  );
90
93
  }
91
- function DefaultTableCell({ arrayFormName, rowIndex, column, ...props }) {
92
- return /* @__PURE__ */ jsx(TableCell, { sx: { padding: 1 }, children: /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${arrayFormName}[${rowIndex}].${column.dataKey}`, ...props }) }, column.dataKey);
94
+ function DefaultTableCell({ arrayFormName, rowIndex, column, width, ...props }) {
95
+ return /* @__PURE__ */ jsx(TableCell, { sx: mergeSx({ padding: 1 }, width), children: /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${arrayFormName}[${rowIndex}].${column.dataKey}`, ...props }) }, column.dataKey);
93
96
  }
94
97
  function EditableTableCell({
95
98
  arrayFormName,
96
99
  rowIndex,
97
100
  column,
101
+ width,
98
102
  previousValue,
99
103
  valueModified,
100
104
  ...props
101
105
  }) {
102
- return /* @__PURE__ */ jsxs(TableCell, { sx: { padding: 0.5, maxWidth: column.maxWidth }, children: [
106
+ return /* @__PURE__ */ jsxs(TableCell, { sx: mergeSx({ padding: 0.5, maxWidth: column.maxWidth }, width), children: [
103
107
  column.type === DndColumnType.NUMERIC && /* @__PURE__ */ jsx(
104
108
  TableNumericalInput,
105
109
  {
@@ -185,7 +189,7 @@ function DndTable(props) {
185
189
  remove
186
190
  } = useFieldArrayOutput;
187
191
  const [openAddRowsDialog, setOpenAddRowsDialog] = useState(false);
188
- function renderTableCell(rowId, rowIndex, column) {
192
+ function renderTableCell(rowId, rowIndex, column, width) {
189
193
  const CustomTableCell = column.editable ? EditableTableCell : DefaultTableCell;
190
194
  return /* @__PURE__ */ jsx(
191
195
  CustomTableCell,
@@ -195,7 +199,8 @@ function DndTable(props) {
195
199
  column,
196
200
  disabled: disableTableCell ? disableTableCell(rowIndex, column, arrayFormName, previousValues) : disabled,
197
201
  previousValue: getPreviousValue ? getPreviousValue(rowIndex, column, arrayFormName, previousValues) : void 0,
198
- valueModified: isValueModified ? isValueModified(rowIndex, arrayFormName) : false
202
+ valueModified: isValueModified ? isValueModified(rowIndex, arrayFormName) : false,
203
+ width
199
204
  },
200
205
  rowId + column.dataKey
201
206
  );
@@ -277,7 +282,25 @@ function DndTable(props) {
277
282
  }
278
283
  }
279
284
  };
285
+ const dragCellWidthsRef = useRef([]);
286
+ const cellIdxRef = useRef(0);
287
+ const onBeforeDragStart = useCallback((start) => {
288
+ const row = document.querySelector(`[data-rfd-draggable-id="${start.draggableId}"]`);
289
+ if (row) {
290
+ dragCellWidthsRef.current = Array.from(row.cells, (cell) => cell.offsetWidth);
291
+ }
292
+ }, []);
293
+ const nextLockedWidthSx = useCallback((isDragging) => {
294
+ const cellWidths = dragCellWidthsRef.current;
295
+ const cellIdx = cellIdxRef.current;
296
+ if (!isDragging || cellWidths[cellIdx] == null) {
297
+ return void 0;
298
+ }
299
+ cellIdxRef.current += 1;
300
+ return { width: cellWidths[cellIdx], boxSizing: "border-box" };
301
+ }, []);
280
302
  const onDragEnd = (result) => {
303
+ dragCellWidthsRef.current = [];
281
304
  if (!result.destination) {
282
305
  return;
283
306
  }
@@ -309,33 +332,48 @@ function DndTable(props) {
309
332
  draggableId: row.id.toString(),
310
333
  index,
311
334
  isDragDisabled: disableDragAndDrop,
312
- children: (provided) => /* @__PURE__ */ jsxs(TableRow, { ref: provided.innerRef, ...provided.draggableProps, children: [
313
- !disableDragAndDrop && /* @__PURE__ */ jsx(
314
- Tooltip,
315
- {
316
- title: intl.formatMessage({
317
- id: "DragAndDrop"
318
- }),
319
- placement: "right",
320
- children: /* @__PURE__ */ jsx(
321
- TableCell,
322
- {
323
- sx: { textAlign: "center" },
324
- ...disabled ? {} : { ...provided.dragHandleProps },
325
- children: /* @__PURE__ */ jsx(DragIndicator, {})
326
- }
327
- )
328
- }
329
- ),
330
- /* @__PURE__ */ jsx(TableCell, { sx: { textAlign: "center" }, children: /* @__PURE__ */ jsx(
331
- CheckboxInput,
332
- {
333
- name: `${arrayFormName}[${index}].${SELECTED}`,
334
- formProps: { disabled }
335
- }
336
- ) }),
337
- columnsDefinition.map((column) => renderTableCell(row.id, index, column))
338
- ] })
335
+ children: (provided, snapshot) => {
336
+ cellIdxRef.current = 0;
337
+ const tableRow = /* @__PURE__ */ jsxs(TableRow, { ref: provided.innerRef, ...provided.draggableProps, children: [
338
+ !disableDragAndDrop && /* @__PURE__ */ jsx(
339
+ Tooltip,
340
+ {
341
+ title: intl.formatMessage({
342
+ id: "DragAndDrop"
343
+ }),
344
+ placement: "right",
345
+ children: /* @__PURE__ */ jsx(
346
+ TableCell,
347
+ {
348
+ sx: mergeSx(
349
+ { textAlign: "center" },
350
+ nextLockedWidthSx(snapshot.isDragging)
351
+ ),
352
+ ...disabled ? {} : { ...provided.dragHandleProps },
353
+ children: /* @__PURE__ */ jsx(DragIndicator, {})
354
+ }
355
+ )
356
+ }
357
+ ),
358
+ /* @__PURE__ */ jsx(
359
+ TableCell,
360
+ {
361
+ sx: mergeSx({ textAlign: "center" }, nextLockedWidthSx(snapshot.isDragging)),
362
+ children: /* @__PURE__ */ jsx(
363
+ CheckboxInput,
364
+ {
365
+ name: `${arrayFormName}[${index}].${SELECTED}`,
366
+ formProps: { disabled }
367
+ }
368
+ )
369
+ }
370
+ ),
371
+ columnsDefinition.map(
372
+ (column) => renderTableCell(row.id, index, column, nextLockedWidthSx(snapshot.isDragging))
373
+ )
374
+ ] });
375
+ return snapshot.isDragging ? createPortal(tableRow, document.body) : tableRow;
376
+ }
339
377
  },
340
378
  row.id
341
379
  )),
@@ -344,7 +382,7 @@ function DndTable(props) {
344
382
  }
345
383
  return /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 1, children: [
346
384
  /* @__PURE__ */ jsxs(Grid, { item: true, container: true, children: [
347
- /* @__PURE__ */ jsx(DragDropContext, { onDragEnd, children: /* @__PURE__ */ jsx(Droppable, { droppableId: "tapTable", isDropDisabled: disabled, children: (provided) => /* @__PURE__ */ jsx(
385
+ /* @__PURE__ */ jsx(DragDropContext, { onBeforeDragStart, onDragEnd, children: /* @__PURE__ */ jsx(Droppable, { droppableId: "tapTable", isDropDisabled: disabled, children: (provided) => /* @__PURE__ */ jsx(
348
386
  TableContainer,
349
387
  {
350
388
  ref: provided.innerRef,
@@ -31,6 +31,7 @@ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
31
31
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
32
32
  import "@material-symbols/svg-400/outlined/add_notes.svg?react";
33
33
  import "../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
34
+ import "../inputs/reactHookForm/expandableInput/ExpandableInput.js";
34
35
  import "@react-querybuilder/material";
35
36
  import "./expert/expertFilterConstants.js";
36
37
  import "../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -40,6 +40,7 @@ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
40
40
  import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
41
41
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
42
42
  import "@material-symbols/svg-400/outlined/add_notes.svg?react";
43
+ import "../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
43
44
  import "@react-querybuilder/material";
44
45
  import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
45
46
  yup.setLocale({
@@ -42,6 +42,7 @@ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
42
42
  import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
43
43
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
44
44
  import "@material-symbols/svg-400/outlined/add_notes.svg?react";
45
+ import "../../inputs/reactHookForm/expandableInput/ExpandableInput.js";
45
46
  import "@react-querybuilder/material";
46
47
  import "../expert/expertFilterConstants.js";
47
48
  import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -87,6 +87,7 @@ import { CountriesInput } from "./inputs/reactHookForm/selectInputs/CountriesInp
87
87
  import { InputWithPopupConfirmation } from "./inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
88
88
  import { MuiSelectInput } from "./inputs/reactHookForm/selectInputs/MuiSelectInput.js";
89
89
  import { SelectInput } from "./inputs/reactHookForm/selectInputs/SelectInput.js";
90
+ import { SelectWithConfirmationInput } from "./inputs/reactHookForm/selectInputs/SelectWithConfirmationInput.js";
90
91
  import { EnumInput } from "./inputs/reactHookForm/selectInputs/EnumInput.js";
91
92
  import { TableNumericalInput } from "./inputs/reactHookForm/tableInputs/table-numerical-input.js";
92
93
  import { TableTextInput } from "./inputs/reactHookForm/tableInputs/table-text-input.js";
@@ -209,6 +210,7 @@ import { useHvdcLccDeletion } from "./network-modifications/equipmentDeletion/hv
209
210
  import { HvdcLccDeletionSpecificForm } from "./network-modifications/equipmentDeletion/hvdcLccDeletion/HvdcLccDeletionSpecificForm.js";
210
211
  import { equipmentDeletionDtoToForm, equipmentDeletionEmptyFormData, equipmentDeletionFormSchema, equipmentDeletionFormToDto, newEquipmentDeletionDto } from "./network-modifications/equipmentDeletion/equipmentDeletion.utils.js";
211
212
  import { EquipmentDeletionForm } from "./network-modifications/equipmentDeletion/EquipmentDeletionForm.js";
213
+ import { useTabsWithError } from "./network-modifications/hooks/useTabsWithError.js";
212
214
  import { SubstationCreationForm } from "./network-modifications/substation/creation/SubstationCreationForm.js";
213
215
  import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./network-modifications/substation/creation/substationCreation.utils.js";
214
216
  import { SubstationModificationForm } from "./network-modifications/substation/modification/SubstationModificationForm.js";
@@ -221,11 +223,11 @@ import "@mui/icons-material";
221
223
  import "../utils/yupConfig.js";
222
224
  import "react";
223
225
  import { VoltageLevelCreationForm } from "./network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js";
224
- import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, isAdditionalInformationTabError, isCharacteristicsTabError, isStructureTabError, isSubstationTabError, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js";
226
+ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js";
225
227
  import { SwitchKind } from "./network-modifications/voltageLevel/creation/voltageLevelCreation.types.js";
226
228
  import { VoltageLevelModificationForm } from "./network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js";
227
229
  import { voltageLevelModificationDtoToForm, voltageLevelModificationEmptyFormData, voltageLevelModificationFormSchema, voltageLevelModificationFormToDto } from "./network-modifications/voltageLevel/modification/voltageLevelModification.utils.js";
228
- import { LoadDialogTab } from "./network-modifications/load/common/load.utils.js";
230
+ import { LOAD_TAB_FIELDS, LoadDialogTab } from "./network-modifications/load/common/load.utils.js";
229
231
  import { LoadDialogTabs } from "./network-modifications/load/common/LoadDialogTabs.js";
230
232
  import { LoadDialogTabsContent } from "./network-modifications/load/common/LoadDialogTabsContent.js";
231
233
  import { LoadDialogHeader } from "./network-modifications/load/common/LoadDialogHeader.js";
@@ -234,6 +236,9 @@ import { loadCreationDtoToForm, loadCreationEmptyFormData, loadCreationFormSchem
234
236
  import { loadModificationDtoToForm, loadModificationEmptyFormData, loadModificationFormSchema, loadModificationFormToDto } from "./network-modifications/load/modification/loadModification.utils.js";
235
237
  import { ByFilterDeletionForm } from "./network-modifications/by-filter/deletion/ByFilterDeletionForm.js";
236
238
  import { EQUIPMENT_TYPE_ORDER, byFilterDeletionDtoToForm, byFilterDeletionFormSchema, byFilterDeletionFormToDto, emptyFormData } from "./network-modifications/by-filter/deletion/byFilterDeletion.utils.js";
239
+ import { ModificationByAssignmentForm } from "./network-modifications/by-filter/assignment/modification-by-assignment-form.js";
240
+ import { emptyModificationByAssignmentFormData, modificationByAssignmentDtoToForm, modificationByAssignmentFormSchema, modificationByAssignmentFormToDto } from "./network-modifications/by-filter/assignment/modificationByAssignment.utils.js";
241
+ import { DataType as DataType2 } from "./network-modifications/by-filter/assignment/assignment/assignment.type.js";
237
242
  import { BuildStatusChip } from "./node/build-status-chip.js";
238
243
  import { BuildStatus } from "./node/constant.js";
239
244
  export {
@@ -245,6 +250,7 @@ export {
245
250
  AnnouncementBanner,
246
251
  AnnouncementNotification,
247
252
  ArrowsOutputIcon,
253
+ DataType2 as AssignmentDataType,
248
254
  AuthenticationRouter,
249
255
  default2 as AuthenticationRouterErrorDisplay,
250
256
  AutocompleteInput,
@@ -402,6 +408,7 @@ export {
402
408
  LOAD_INCREASE_START_TIME,
403
409
  LOAD_INCREASE_STOP_TIME,
404
410
  LOAD_MODELS_RULE,
411
+ LOAD_TAB_FIELDS,
405
412
  LOAD_TYPE_OPTIONS,
406
413
  LOW_VOLTAGE_LIMIT,
407
414
  LabelledButton,
@@ -436,6 +443,7 @@ export {
436
443
  MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES,
437
444
  MessageLogCellRenderer,
438
445
  MidFormError,
446
+ ModificationByAssignmentForm,
439
447
  ModifyElementSelection,
440
448
  MuiSelectInput,
441
449
  MultipleAutocompleteInput,
@@ -549,6 +557,7 @@ export {
549
557
  SecurityAnalysisParametersInline,
550
558
  SelectClearable,
551
559
  SelectInput,
560
+ SelectWithConfirmationInput,
552
561
  SensiBranchesTabValues,
553
562
  SensiHvdcs,
554
563
  SensiInjection,
@@ -625,6 +634,7 @@ export {
625
634
  dispatchUser,
626
635
  doesNodeHasChildren,
627
636
  emptyFormData,
637
+ emptyModificationByAssignmentFormData,
628
638
  emptyProperties,
629
639
  equipmentDeletionDtoToForm,
630
640
  equipmentDeletionEmptyFormData,
@@ -702,13 +712,9 @@ export {
702
712
  initializedProperty,
703
713
  intlInitialVoltageProfileMode,
704
714
  intlPredefinedParametersOptions,
705
- isAdditionalInformationTabError,
706
- isCharacteristicsTabError,
707
715
  isFieldRequired,
708
716
  isFloatNumber,
709
717
  isIntegerNumber,
710
- isStructureTabError,
711
- isSubstationTabError,
712
718
  isValidComputingType,
713
719
  italicFontTextField,
714
720
  loadCreationDtoToForm,
@@ -722,6 +728,9 @@ export {
722
728
  login,
723
729
  logout,
724
730
  mergeModificationAndEquipmentProperties,
731
+ modificationByAssignmentDtoToForm,
732
+ modificationByAssignmentFormSchema,
733
+ modificationByAssignmentFormToDto,
725
734
  modificationPropertiesSchema,
726
735
  newEquipmentDeletionDto,
727
736
  onlyStartedGeneratorsOptions,
@@ -756,6 +765,7 @@ export {
756
765
  useHvdcLccDeletion,
757
766
  useListenerManager,
758
767
  useNotificationsListener,
768
+ useTabsWithError,
759
769
  useValid,
760
770
  voltageLevelCreationDtoToForm,
761
771
  voltageLevelCreationEmptyFormData,
@@ -30,6 +30,7 @@ import { CountriesInput } from "./reactHookForm/selectInputs/CountriesInput.js";
30
30
  import { InputWithPopupConfirmation } from "./reactHookForm/selectInputs/InputWithPopupConfirmation.js";
31
31
  import { MuiSelectInput } from "./reactHookForm/selectInputs/MuiSelectInput.js";
32
32
  import { SelectInput } from "./reactHookForm/selectInputs/SelectInput.js";
33
+ import { SelectWithConfirmationInput } from "./reactHookForm/selectInputs/SelectWithConfirmationInput.js";
33
34
  import { EnumInput } from "./reactHookForm/selectInputs/EnumInput.js";
34
35
  import { TableNumericalInput } from "./reactHookForm/tableInputs/table-numerical-input.js";
35
36
  import { TableTextInput } from "./reactHookForm/tableInputs/table-text-input.js";
@@ -120,6 +121,7 @@ export {
120
121
  RuleValueEditor,
121
122
  SelectClearable,
122
123
  SelectInput,
124
+ SelectWithConfirmationInput,
123
125
  SliderInput,
124
126
  SubmitButton,
125
127
  SwitchInput,
@@ -4,6 +4,10 @@
4
4
  * License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
+ export type ExpandableInputHandle = {
8
+ replaceItems: (newItems: any[]) => void;
9
+ appendItem: (newItem: any) => void;
10
+ };
7
11
  export interface ExpandableInputProps {
8
12
  name: string;
9
13
  Field: React.ComponentType<any>;
@@ -17,8 +21,4 @@ export interface ExpandableInputProps {
17
21
  disabled?: boolean;
18
22
  disabledDeletion?: (idx: number) => boolean;
19
23
  }
20
- export declare function ExpandableInput({ name, Field, // Used to display each object of an array
21
- fieldProps, // Props to pass to Field
22
- addButtonLabel, initialValue, // Initial value to display when we add a new entry to array
23
- getDeletionMark, deleteCallback, alignItems, // default value for a flex container
24
- watchProps, disabled, disabledDeletion, }: Readonly<ExpandableInputProps>): import("react/jsx-runtime").JSX.Element;
24
+ export declare const ExpandableInput: import('react').ForwardRefExoticComponent<Readonly<ExpandableInputProps> & import('react').RefAttributes<unknown>>;
@@ -3,6 +3,7 @@ import { useFieldArray } from "react-hook-form";
3
3
  import { Grid, Button } from "@mui/material";
4
4
  import { ControlPoint } from "@mui/icons-material";
5
5
  import { FormattedMessage } from "react-intl";
6
+ import { forwardRef, useImperativeHandle } from "react";
6
7
  import { DeletableRow } from "./DeletableRow.js";
7
8
  import { ErrorInput } from "../errorManagement/ErrorInput.js";
8
9
  import { MidFormError } from "../errorManagement/MidFormError.js";
@@ -20,61 +21,72 @@ const styles = {
20
21
  paddingLeft: theme.spacing(2)
21
22
  })
22
23
  };
23
- function ExpandableInput({
24
- name,
25
- Field,
26
- // Used to display each object of an array
27
- fieldProps,
28
- // Props to pass to Field
29
- addButtonLabel,
30
- initialValue,
31
- // Initial value to display when we add a new entry to array
32
- getDeletionMark,
33
- deleteCallback,
34
- alignItems = "stretch",
35
- // default value for a flex container
36
- watchProps = true,
37
- disabled = false,
38
- disabledDeletion
39
- }) {
40
- const {
41
- fields: values,
42
- append,
43
- remove
44
- } = useFieldArray({
45
- name
46
- });
47
- return /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 2, children: [
48
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: MidFormError }) }),
49
- watchProps && values.map((value, idx) => /* @__PURE__ */ jsx(
50
- DeletableRow,
51
- {
52
- alignItems,
53
- onClick: () => {
54
- const shouldRemove = deleteCallback ? deleteCallback(idx) : true;
55
- if (shouldRemove) {
56
- remove(idx);
57
- }
24
+ const ExpandableInput = forwardRef(
25
+ ({
26
+ name,
27
+ Field,
28
+ // Used to display each object of an array
29
+ fieldProps,
30
+ // Props to pass to Field
31
+ addButtonLabel,
32
+ initialValue,
33
+ // Initial value to display when we add a new entry to array
34
+ getDeletionMark,
35
+ deleteCallback,
36
+ alignItems = "stretch",
37
+ // default value for a flex container
38
+ watchProps = true,
39
+ disabled = false,
40
+ disabledDeletion
41
+ }, ref) => {
42
+ const {
43
+ fields: values,
44
+ append,
45
+ remove,
46
+ replace
47
+ } = useFieldArray({
48
+ name
49
+ });
50
+ useImperativeHandle(
51
+ ref,
52
+ () => ({
53
+ replaceItems: (newItems) => replace(newItems),
54
+ appendItem: (newItem) => append(newItem)
55
+ }),
56
+ [append, replace]
57
+ );
58
+ return /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 2, children: [
59
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: MidFormError }) }),
60
+ watchProps && values.map((value, idx) => /* @__PURE__ */ jsx(
61
+ DeletableRow,
62
+ {
63
+ alignItems,
64
+ onClick: () => {
65
+ const shouldRemove = deleteCallback ? deleteCallback(idx) : true;
66
+ if (shouldRemove) {
67
+ remove(idx);
68
+ }
69
+ },
70
+ deletionMark: getDeletionMark?.(idx),
71
+ disabledDeletion: disabledDeletion?.(idx),
72
+ children: /* @__PURE__ */ jsx(Field, { name, index: idx, ...fieldProps })
58
73
  },
59
- deletionMark: getDeletionMark?.(idx),
60
- disabledDeletion: disabledDeletion?.(idx),
61
- children: /* @__PURE__ */ jsx(Field, { name, index: idx, ...fieldProps })
62
- },
63
- value.id
64
- )),
65
- /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
66
- Button,
67
- {
68
- disabled,
69
- fullWidth: true,
70
- sx: mergeSx(styles.button, styles.paddingButton),
71
- startIcon: /* @__PURE__ */ jsx(ControlPoint, {}),
72
- onClick: () => append(initialValue),
73
- children: addButtonLabel && /* @__PURE__ */ jsx(FormattedMessage, { id: addButtonLabel })
74
- }
75
- ) })
76
- ] });
77
- }
74
+ value.id
75
+ )),
76
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
77
+ Button,
78
+ {
79
+ disabled,
80
+ fullWidth: true,
81
+ sx: mergeSx(styles.button, styles.paddingButton),
82
+ startIcon: /* @__PURE__ */ jsx(ControlPoint, {}),
83
+ onClick: () => append(initialValue),
84
+ children: addButtonLabel && /* @__PURE__ */ jsx(FormattedMessage, { id: addButtonLabel })
85
+ }
86
+ ) })
87
+ ] });
88
+ }
89
+ );
78
90
  export {
79
91
  ExpandableInput
80
92
  };
@@ -29,6 +29,7 @@ import { CountriesInput } from "./selectInputs/CountriesInput.js";
29
29
  import { InputWithPopupConfirmation } from "./selectInputs/InputWithPopupConfirmation.js";
30
30
  import { MuiSelectInput } from "./selectInputs/MuiSelectInput.js";
31
31
  import { SelectInput } from "./selectInputs/SelectInput.js";
32
+ import { SelectWithConfirmationInput } from "./selectInputs/SelectWithConfirmationInput.js";
32
33
  import { EnumInput } from "./selectInputs/EnumInput.js";
33
34
  import { TableNumericalInput } from "./tableInputs/table-numerical-input.js";
34
35
  import { TableTextInput } from "./tableInputs/table-text-input.js";
@@ -90,6 +91,7 @@ export {
90
91
  RawReadOnlyInput,
91
92
  ReadOnlyInput,
92
93
  SelectInput,
94
+ SelectWithConfirmationInput,
93
95
  SliderInput,
94
96
  SubmitButton,
95
97
  SwitchInput,
@@ -0,0 +1,9 @@
1
+ interface SelectWithConfirmationInputProps {
2
+ name: string;
3
+ options: string[];
4
+ onValidate: () => void;
5
+ getOptionLabel?: (option: string) => string;
6
+ label: string;
7
+ }
8
+ export declare function SelectWithConfirmationInput({ name, options, onValidate, getOptionLabel, label, }: Readonly<SelectWithConfirmationInputProps>): import("react/jsx-runtime").JSX.Element;
9
+ export {};