@gridsuite/commons-ui 0.189.0 → 0.190.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 (57) hide show
  1. package/dist/components/customAGGrid/cell-renderers.js +28 -26
  2. package/dist/components/dnd-table/dnd-table.js +71 -34
  3. package/dist/components/index.js +16 -6
  4. package/dist/components/inputs/index.js +2 -0
  5. package/dist/components/inputs/reactHookForm/index.js +2 -0
  6. package/dist/components/inputs/reactHookForm/selectInputs/SelectWithConfirmationInput.d.ts +9 -0
  7. package/dist/components/inputs/reactHookForm/selectInputs/SelectWithConfirmationInput.js +64 -0
  8. package/dist/components/inputs/reactHookForm/selectInputs/index.d.ts +1 -0
  9. package/dist/components/inputs/reactHookForm/selectInputs/index.js +3 -1
  10. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-constants.d.ts +16 -0
  11. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-constants.js +402 -0
  12. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-form.d.ts +12 -0
  13. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-form.js +217 -0
  14. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.d.ts +21 -0
  15. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment-utils.js +89 -0
  16. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment.type.d.ts +28 -0
  17. package/dist/components/network-modifications/by-filter/assignment/assignment/assignment.type.js +12 -0
  18. package/dist/components/network-modifications/by-filter/assignment/index.d.ts +10 -0
  19. package/dist/components/network-modifications/by-filter/assignment/index.js +11 -0
  20. package/dist/components/network-modifications/by-filter/assignment/modification-by-assignment-form.d.ts +7 -0
  21. package/dist/components/network-modifications/by-filter/assignment/modification-by-assignment-form.js +89 -0
  22. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.types.d.ts +7 -0
  23. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.types.js +1 -0
  24. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.utils.d.ts +22 -0
  25. package/dist/components/network-modifications/by-filter/assignment/modificationByAssignment.utils.js +55 -0
  26. package/dist/components/network-modifications/by-filter/index.d.ts +1 -0
  27. package/dist/components/network-modifications/by-filter/index.js +10 -1
  28. package/dist/components/network-modifications/hooks/index.d.ts +7 -0
  29. package/dist/components/network-modifications/hooks/index.js +4 -0
  30. package/dist/components/network-modifications/hooks/useTabsWithError.d.ts +15 -0
  31. package/dist/components/network-modifications/hooks/useTabsWithError.js +28 -0
  32. package/dist/components/network-modifications/index.d.ts +1 -0
  33. package/dist/components/network-modifications/index.js +14 -6
  34. package/dist/components/network-modifications/load/common/LoadForm.d.ts +1 -1
  35. package/dist/components/network-modifications/load/common/LoadForm.js +7 -27
  36. package/dist/components/network-modifications/load/common/index.js +2 -1
  37. package/dist/components/network-modifications/load/common/load.utils.d.ts +7 -11
  38. package/dist/components/network-modifications/load/common/load.utils.js +30 -4
  39. package/dist/components/network-modifications/load/index.js +2 -1
  40. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +9 -29
  41. package/dist/components/network-modifications/voltageLevel/creation/index.js +1 -5
  42. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.d.ts +8 -12
  43. package/dist/components/network-modifications/voltageLevel/creation/voltageLevel.constants.js +53 -5
  44. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.d.ts +0 -4
  45. package/dist/components/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +0 -16
  46. package/dist/components/network-modifications/voltageLevel/index.js +1 -5
  47. package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -0
  48. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -0
  49. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +1 -0
  50. package/dist/index.js +16 -6
  51. package/dist/translations/en/networkModificationsEn.d.ts +51 -0
  52. package/dist/translations/en/networkModificationsEn.js +51 -0
  53. package/dist/translations/fr/networkModificationsFr.d.ts +51 -0
  54. package/dist/translations/fr/networkModificationsFr.js +51 -0
  55. package/dist/utils/constants/fieldConstants.d.ts +2 -0
  56. package/dist/utils/constants/fieldConstants.js +2 -0
  57. 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
@@ -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";
@@ -88,18 +90,19 @@ function MultiCheckbox({
88
90
  }
89
91
  );
90
92
  }
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);
93
+ function DefaultTableCell({ arrayFormName, rowIndex, column, width, ...props }) {
94
+ return /* @__PURE__ */ jsx(TableCell, { sx: mergeSx({ padding: 1 }, width), children: /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${arrayFormName}[${rowIndex}].${column.dataKey}`, ...props }) }, column.dataKey);
93
95
  }
94
96
  function EditableTableCell({
95
97
  arrayFormName,
96
98
  rowIndex,
97
99
  column,
100
+ width,
98
101
  previousValue,
99
102
  valueModified,
100
103
  ...props
101
104
  }) {
102
- return /* @__PURE__ */ jsxs(TableCell, { sx: { padding: 0.5, maxWidth: column.maxWidth }, children: [
105
+ return /* @__PURE__ */ jsxs(TableCell, { sx: mergeSx({ padding: 0.5, maxWidth: column.maxWidth }, width), children: [
103
106
  column.type === DndColumnType.NUMERIC && /* @__PURE__ */ jsx(
104
107
  TableNumericalInput,
105
108
  {
@@ -185,7 +188,7 @@ function DndTable(props) {
185
188
  remove
186
189
  } = useFieldArrayOutput;
187
190
  const [openAddRowsDialog, setOpenAddRowsDialog] = useState(false);
188
- function renderTableCell(rowId, rowIndex, column) {
191
+ function renderTableCell(rowId, rowIndex, column, width) {
189
192
  const CustomTableCell = column.editable ? EditableTableCell : DefaultTableCell;
190
193
  return /* @__PURE__ */ jsx(
191
194
  CustomTableCell,
@@ -195,7 +198,8 @@ function DndTable(props) {
195
198
  column,
196
199
  disabled: disableTableCell ? disableTableCell(rowIndex, column, arrayFormName, previousValues) : disabled,
197
200
  previousValue: getPreviousValue ? getPreviousValue(rowIndex, column, arrayFormName, previousValues) : void 0,
198
- valueModified: isValueModified ? isValueModified(rowIndex, arrayFormName) : false
201
+ valueModified: isValueModified ? isValueModified(rowIndex, arrayFormName) : false,
202
+ width
199
203
  },
200
204
  rowId + column.dataKey
201
205
  );
@@ -277,7 +281,25 @@ function DndTable(props) {
277
281
  }
278
282
  }
279
283
  };
284
+ const dragCellWidthsRef = useRef([]);
285
+ const cellIdxRef = useRef(0);
286
+ const onBeforeDragStart = useCallback((start) => {
287
+ const row = document.querySelector(`[data-rfd-draggable-id="${start.draggableId}"]`);
288
+ if (row) {
289
+ dragCellWidthsRef.current = Array.from(row.cells, (cell) => cell.offsetWidth);
290
+ }
291
+ }, []);
292
+ const nextLockedWidthSx = useCallback((isDragging) => {
293
+ const cellWidths = dragCellWidthsRef.current;
294
+ const cellIdx = cellIdxRef.current;
295
+ if (!isDragging || cellWidths[cellIdx] == null) {
296
+ return void 0;
297
+ }
298
+ cellIdxRef.current += 1;
299
+ return { width: cellWidths[cellIdx], boxSizing: "border-box" };
300
+ }, []);
280
301
  const onDragEnd = (result) => {
302
+ dragCellWidthsRef.current = [];
281
303
  if (!result.destination) {
282
304
  return;
283
305
  }
@@ -309,33 +331,48 @@ function DndTable(props) {
309
331
  draggableId: row.id.toString(),
310
332
  index,
311
333
  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
- ] })
334
+ children: (provided, snapshot) => {
335
+ cellIdxRef.current = 0;
336
+ const tableRow = /* @__PURE__ */ jsxs(TableRow, { ref: provided.innerRef, ...provided.draggableProps, children: [
337
+ !disableDragAndDrop && /* @__PURE__ */ jsx(
338
+ Tooltip,
339
+ {
340
+ title: intl.formatMessage({
341
+ id: "DragAndDrop"
342
+ }),
343
+ placement: "right",
344
+ children: /* @__PURE__ */ jsx(
345
+ TableCell,
346
+ {
347
+ sx: mergeSx(
348
+ { textAlign: "center" },
349
+ nextLockedWidthSx(snapshot.isDragging)
350
+ ),
351
+ ...disabled ? {} : { ...provided.dragHandleProps },
352
+ children: /* @__PURE__ */ jsx(DragIndicator, {})
353
+ }
354
+ )
355
+ }
356
+ ),
357
+ /* @__PURE__ */ jsx(
358
+ TableCell,
359
+ {
360
+ sx: mergeSx({ textAlign: "center" }, nextLockedWidthSx(snapshot.isDragging)),
361
+ children: /* @__PURE__ */ jsx(
362
+ CheckboxInput,
363
+ {
364
+ name: `${arrayFormName}[${index}].${SELECTED}`,
365
+ formProps: { disabled }
366
+ }
367
+ )
368
+ }
369
+ ),
370
+ columnsDefinition.map(
371
+ (column) => renderTableCell(row.id, index, column, nextLockedWidthSx(snapshot.isDragging))
372
+ )
373
+ ] });
374
+ return snapshot.isDragging ? createPortal(tableRow, document.body) : tableRow;
375
+ }
339
376
  },
340
377
  row.id
341
378
  )),
@@ -344,7 +381,7 @@ function DndTable(props) {
344
381
  }
345
382
  return /* @__PURE__ */ jsxs(Grid, { item: true, container: true, spacing: 1, children: [
346
383
  /* @__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(
384
+ /* @__PURE__ */ jsx(DragDropContext, { onBeforeDragStart, onDragEnd, children: /* @__PURE__ */ jsx(Droppable, { droppableId: "tapTable", isDropDisabled: disabled, children: (provided) => /* @__PURE__ */ jsx(
348
385
  TableContainer,
349
386
  {
350
387
  ref: provided.innerRef,
@@ -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,
@@ -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 {};
@@ -0,0 +1,64 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { useController } from "react-hook-form";
4
+ import { FormControl, InputLabel, Select, MenuItem } from "@mui/material";
5
+ import { useIntl, FormattedMessage } from "react-intl";
6
+ import { PopupConfirmationDialog } from "../../../dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
7
+ function SelectWithConfirmationInput({
8
+ name,
9
+ options,
10
+ onValidate,
11
+ getOptionLabel,
12
+ label
13
+ }) {
14
+ const intl = useIntl();
15
+ const [openConfirmationDialog, setOpenConfirmationDialog] = useState(false);
16
+ const [newValue, setNewValue] = useState("");
17
+ const {
18
+ field: { value, onChange }
19
+ } = useController({
20
+ name
21
+ });
22
+ const handleChange = (event) => {
23
+ if (value) {
24
+ setOpenConfirmationDialog(true);
25
+ setNewValue(event.target.value);
26
+ } else {
27
+ onChange(event.target.value);
28
+ }
29
+ };
30
+ const handleValidate = () => {
31
+ onValidate?.();
32
+ onChange(newValue);
33
+ setOpenConfirmationDialog(false);
34
+ };
35
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
36
+ /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, children: [
37
+ /* @__PURE__ */ jsx(InputLabel, { size: "small", children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
38
+ /* @__PURE__ */ jsx(
39
+ Select,
40
+ {
41
+ value: value ?? "",
42
+ size: "small",
43
+ fullWidth: true,
44
+ onChange: handleChange,
45
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: label }),
46
+ children: options.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option, children: getOptionLabel ? getOptionLabel(option) : intl.formatMessage({ id: option }) }, option))
47
+ }
48
+ )
49
+ ] }),
50
+ /* @__PURE__ */ jsx(
51
+ PopupConfirmationDialog,
52
+ {
53
+ message: "changeTypeConfirmation",
54
+ openConfirmationPopup: openConfirmationDialog,
55
+ setOpenConfirmationPopup: setOpenConfirmationDialog,
56
+ handlePopupConfirmation: handleValidate,
57
+ validateButtonLabel: "button.changeType"
58
+ }
59
+ )
60
+ ] });
61
+ }
62
+ export {
63
+ SelectWithConfirmationInput
64
+ };
@@ -8,4 +8,5 @@ export * from './CountriesInput';
8
8
  export * from './InputWithPopupConfirmation';
9
9
  export * from './MuiSelectInput';
10
10
  export * from './SelectInput';
11
+ export * from './SelectWithConfirmationInput';
11
12
  export * from './EnumInput';
@@ -2,11 +2,13 @@ import { CountriesInput } from "./CountriesInput.js";
2
2
  import { InputWithPopupConfirmation } from "./InputWithPopupConfirmation.js";
3
3
  import { MuiSelectInput } from "./MuiSelectInput.js";
4
4
  import { SelectInput } from "./SelectInput.js";
5
+ import { SelectWithConfirmationInput } from "./SelectWithConfirmationInput.js";
5
6
  import { EnumInput } from "./EnumInput.js";
6
7
  export {
7
8
  CountriesInput,
8
9
  EnumInput,
9
10
  InputWithPopupConfirmation,
10
11
  MuiSelectInput,
11
- SelectInput
12
+ SelectInput,
13
+ SelectWithConfirmationInput
12
14
  };
@@ -0,0 +1,16 @@
1
+ import { FieldOptionType } from './assignment.type';
2
+ export declare const FIELD_OPTIONS: Record<string, FieldOptionType>;
3
+ export declare const EQUIPMENTS_FIELDS: {
4
+ readonly SUBSTATION: readonly [FieldOptionType];
5
+ readonly VOLTAGE_LEVEL: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
6
+ readonly LINE: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
7
+ readonly TWO_WINDINGS_TRANSFORMER: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
8
+ readonly THREE_WINDINGS_TRANSFORMER: readonly [FieldOptionType];
9
+ readonly GENERATOR: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
10
+ readonly BATTERY: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
11
+ readonly LOAD: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
12
+ readonly SHUNT_COMPENSATOR: readonly [FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType, FieldOptionType];
13
+ readonly STATIC_VAR_COMPENSATOR: readonly [FieldOptionType];
14
+ readonly HVDC_LINE: readonly [FieldOptionType];
15
+ };
16
+ export type EquipmentTypeOptionType = keyof typeof EQUIPMENTS_FIELDS;