@gridsuite/commons-ui 0.265.0 → 0.267.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/dist/components/composite/dnd-table/dnd-table-add-rows-dialog.js +1 -1
  2. package/dist/components/composite/dnd-table/dnd-table-row.js +1 -1
  3. package/dist/components/composite/dnd-table/dnd-table.js +1 -1
  4. package/dist/components/composite/filter/FilterForm.js +1 -1
  5. package/dist/components/composite/filter/HeaderFilterForm.js +1 -1
  6. package/dist/components/composite/filter/expert/ExpertFilterForm.js +1 -1
  7. package/dist/components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js +1 -1
  8. package/dist/components/composite/report/report-viewer/log-table/log-table.js +1 -1
  9. package/dist/components/ui/csvPicker/csv-picker-confirmation-dialog.js +1 -1
  10. package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -1
  11. package/dist/components/ui/dialogs/name-element-editor/name-element-editor-utils.js +1 -1
  12. package/dist/components/ui/icons/DatasetLinkedIcon.d.ts +2 -0
  13. package/dist/components/ui/icons/DatasetLinkedIcon.js +9 -0
  14. package/dist/components/ui/icons/EditNoteIcon.js +1 -1
  15. package/dist/components/ui/inputs/checkbox-autocomplete/checkbox-autocomplete.js +2 -1
  16. package/dist/components/ui/reactHookForm/CheckboxNullableInput.js +4 -2
  17. package/dist/components/ui/reactHookForm/autocompleteInputs/MultipleAutocompleteInput.js +3 -2
  18. package/dist/components/ui/reactHookForm/booleans/BooleanInput.d.ts +1 -1
  19. package/dist/components/ui/reactHookForm/booleans/BooleanInput.js +4 -6
  20. package/dist/components/ui/reactHookForm/tableInputs/table-numerical-input.js +4 -2
  21. package/dist/components/ui/reactHookForm/tableInputs/table-text-input.d.ts +1 -1
  22. package/dist/components/ui/reactHookForm/tableInputs/table-text-input.js +2 -3
  23. package/dist/components/ui/reactHookForm/text/ExpandingTextField.js +15 -13
  24. package/dist/components/ui/reactHookForm/text/TextInput.js +4 -2
  25. package/dist/components/ui/reactHookForm/text/UniqueNameInput.js +4 -2
  26. package/dist/components/ui/reactHookForm/utils/TextFieldWithAdornment.js +2 -1
  27. package/dist/features/global-filter/ui/global-filter-dropdown-panel.js +1 -1
  28. package/dist/features/global-filter/ui/global-filter-panel.js +1 -1
  29. package/dist/features/global-filter/ui/selected-global-filters.js +1 -1
  30. package/dist/features/index.js +13 -4
  31. package/dist/features/network-modification-table/columns-definition.d.ts +4 -0
  32. package/dist/features/network-modification-table/columns-definition.js +4 -0
  33. package/dist/features/network-modification-table/index.js +5 -3
  34. package/dist/features/network-modification-table/network-modification-table-styles.js +2 -2
  35. package/dist/features/network-modification-table/network-modifications-table.d.ts +1 -1
  36. package/dist/features/network-modification-table/network-modifications-table.js +15 -12
  37. package/dist/features/network-modification-table/renderers/cell-renderers.d.ts +1 -0
  38. package/dist/features/network-modification-table/renderers/cell-renderers.js +10 -0
  39. package/dist/features/network-modification-table/renderers/index.js +2 -1
  40. package/dist/features/network-modification-table/renderers/name-cell.js +3 -3
  41. package/dist/features/network-modification-table/renderers/reference-link-cell.d.ts +7 -0
  42. package/dist/features/network-modification-table/renderers/reference-link-cell.js +128 -0
  43. package/dist/features/network-modification-table/renderers/root-network-chip-cell.js +3 -1
  44. package/dist/features/network-modification-table/row/modification-row.js +76 -68
  45. package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +40 -22
  46. package/dist/features/network-modification-table/use-modifications-selection.js +14 -14
  47. package/dist/features/network-modification-table/utils.d.ts +20 -12
  48. package/dist/features/network-modification-table/utils.js +102 -48
  49. package/dist/features/network-modifications/battery/creation/BatteryCreationForm.js +1 -1
  50. package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +1 -1
  51. package/dist/features/network-modifications/battery/modification/BatteryDialogHeader.js +1 -1
  52. package/dist/features/network-modifications/battery/modification/BatteryDialogTabsContent.js +1 -1
  53. package/dist/features/network-modifications/battery/modification/batteryModification.utils.js +1 -1
  54. package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-form.js +1 -1
  55. package/dist/features/network-modifications/by-filter/assignment/modification-by-assignment-form.js +1 -1
  56. package/dist/features/network-modifications/by-filter/deletion/ByFilterDeletionForm.js +1 -1
  57. package/dist/features/network-modifications/by-filter/formula/formula/formula-form.js +1 -1
  58. package/dist/features/network-modifications/by-filter/formula/formula/reference-autocomplete-input.js +1 -1
  59. package/dist/features/network-modifications/by-filter/formula/modification-by-formula-form.js +1 -1
  60. package/dist/features/network-modifications/common/activePowerControl/ActivePowerControlForm.js +1 -1
  61. package/dist/features/network-modifications/common/connectivity/ConnectivityForm.js +1 -1
  62. package/dist/features/network-modifications/common/connectivity/PositionForm.js +1 -1
  63. package/dist/features/network-modifications/common/connectivity/VoltageLevelConnectivityForm.js +1 -1
  64. package/dist/features/network-modifications/common/connectivity/connectivity.type.d.ts +1 -1
  65. package/dist/features/network-modifications/common/currentLimits/LimitsPane.js +1 -1
  66. package/dist/features/network-modifications/common/currentLimits/SelectedOperationalLimitGroup.js +1 -1
  67. package/dist/features/network-modifications/common/currentLimits/limitsEditor/LimitsEditor.js +1 -1
  68. package/dist/features/network-modifications/common/currentLimits/limitsEditor/LimitsPropertiesSideStack.js +1 -1
  69. package/dist/features/network-modifications/common/currentLimits/limitsEditor/TemporaryLimitsTable.js +1 -1
  70. package/dist/features/network-modifications/common/currentLimits/limitsPane.utils.js +1 -1
  71. package/dist/features/network-modifications/common/measurements/BusbarSectionVoltageMeasurementsForm.js +1 -1
  72. package/dist/features/network-modifications/common/measurements/PowerWithValidityForm.js +1 -1
  73. package/dist/features/network-modifications/common/properties/PropertiesForm.js +1 -1
  74. package/dist/features/network-modifications/common/properties/PropertyForm.js +1 -1
  75. package/dist/features/network-modifications/common/reactiveLimits/ReactiveLimitsForm.js +1 -1
  76. package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js +1 -1
  77. package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js +1 -1
  78. package/dist/features/network-modifications/common/regulatingTerminal/RegulatingTerminalForm.js +1 -1
  79. package/dist/features/network-modifications/common/setpoints/SetPointsForm.js +1 -1
  80. package/dist/features/network-modifications/common/shortCircuit/ShortCircuitForm.js +1 -1
  81. package/dist/features/network-modifications/common/voltageRegulation/VoltageRegulationForm.js +1 -1
  82. package/dist/features/network-modifications/equipmentDeletion/EquipmentDeletionForm.js +1 -1
  83. package/dist/features/network-modifications/equipmentDeletion/equipmentDeletion.utils.js +1 -1
  84. package/dist/features/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js +1 -1
  85. package/dist/features/network-modifications/generator/creation/GeneratorCreationForm.js +1 -1
  86. package/dist/features/network-modifications/generator/creation/generatorCreation.utils.js +1 -1
  87. package/dist/features/network-modifications/generator/modification/GeneratorDialogHeader.js +1 -1
  88. package/dist/features/network-modifications/generator/modification/GeneratorDialogTabsContent.js +1 -1
  89. package/dist/features/network-modifications/generator/modification/generatorModification.utils.js +1 -1
  90. package/dist/features/network-modifications/index.js +8 -1
  91. package/dist/features/network-modifications/line/characteristics/LineCharacteristicsPane.js +1 -1
  92. package/dist/features/network-modifications/line/common/LineDialogHeader.js +1 -1
  93. package/dist/features/network-modifications/line/common/LineDialogTabsContent.js +1 -1
  94. package/dist/features/network-modifications/line/creation/lineCreation.utils.js +1 -1
  95. package/dist/features/network-modifications/line/modification/lineModification.utils.js +1 -1
  96. package/dist/features/network-modifications/load/common/LoadDialogHeader.js +1 -1
  97. package/dist/features/network-modifications/load/creation/loadCreation.utils.js +1 -1
  98. package/dist/features/network-modifications/load/modification/loadModification.utils.js +1 -1
  99. package/dist/features/network-modifications/shunt-compensator/common/CharacteristicsForm.js +1 -1
  100. package/dist/features/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +1 -1
  101. package/dist/features/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +1 -1
  102. package/dist/features/network-modifications/shunt-compensator/modification/ShuntCompensatorModificationForm.js +1 -1
  103. package/dist/features/network-modifications/shunt-compensator/modification/shuntCompensatorModification.utils.js +1 -1
  104. package/dist/features/network-modifications/substation/creation/SubstationCreationForm.js +1 -1
  105. package/dist/features/network-modifications/substation/modification/SubstationModificationForm.js +1 -1
  106. package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
  107. package/dist/features/network-modifications/voltageLevel/creation/index.js +1 -1
  108. package/dist/features/network-modifications/voltageLevel/creation/tabs/characteristicsTab/CharacteristicsTab.js +1 -1
  109. package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +1 -1
  110. package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/couplingOmnibus/CouplingOmnibusForm.js +1 -1
  111. package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +1 -1
  112. package/dist/features/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationCreationSection.js +1 -1
  113. package/dist/features/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationTab.js +1 -1
  114. package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +1 -1
  115. package/dist/features/network-modifications/voltageLevel/index.d.ts +1 -0
  116. package/dist/features/network-modifications/voltageLevel/index.js +8 -1
  117. package/dist/features/network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js +1 -1
  118. package/dist/features/network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.d.ts +6 -0
  119. package/dist/features/network-modifications/voltageLevel/topology/CreateVoltageLevelTopologyForm.js +135 -0
  120. package/dist/features/network-modifications/voltageLevel/topology/index.d.ts +9 -0
  121. package/dist/features/network-modifications/voltageLevel/topology/index.js +9 -0
  122. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.types.d.ts +8 -0
  123. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.types.js +1 -0
  124. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.d.ts +25 -0
  125. package/dist/features/network-modifications/voltageLevel/topology/voltageLevelTopologyCreation.utils.js +48 -0
  126. package/dist/features/parameters/common/contingency-table/columns-definitions.js +1 -1
  127. package/dist/features/parameters/common/limitreductions/limit-reduction-table-cell.js +1 -1
  128. package/dist/features/parameters/common/limitreductions/limit-reductions-table-form.js +1 -1
  129. package/dist/features/parameters/common/parameter-field.js +1 -1
  130. package/dist/features/parameters/common/parameter-layout/parameter-layout.js +1 -1
  131. package/dist/features/parameters/common/parameter-table-field/parameter-table-field.js +1 -1
  132. package/dist/features/parameters/common/parameters-creation-dialog.js +1 -1
  133. package/dist/features/parameters/common/provider-param.js +1 -1
  134. package/dist/features/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +1 -1
  135. package/dist/features/parameters/common/widget/parameter-float.js +1 -1
  136. package/dist/features/parameters/common/widget/parameter-line-directory-items-input.js +1 -1
  137. package/dist/features/parameters/common/widget/parameter-line-slider.js +1 -1
  138. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -1
  139. package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +1 -1
  140. package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -1
  141. package/dist/features/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +1 -1
  142. package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +1 -1
  143. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +1 -1
  144. package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -1
  145. package/dist/features/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +1 -1
  146. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +1 -1
  147. package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +1 -1
  148. package/dist/features/parameters/dynamic-simulation/mapping/mapping-parameters-utils.js +1 -1
  149. package/dist/features/parameters/dynamic-simulation/mapping/mapping-parameters.js +1 -1
  150. package/dist/features/parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js +1 -1
  151. package/dist/features/parameters/loadflow/load-flow-advanced-parameters.js +1 -1
  152. package/dist/features/parameters/loadflow/load-flow-general-parameters.js +1 -1
  153. package/dist/features/parameters/loadflow/load-flow-parameters-content.js +1 -1
  154. package/dist/features/parameters/loadflow/load-flow-parameters-dialog.js +1 -1
  155. package/dist/features/parameters/loadflow/load-flow-parameters-header.js +1 -1
  156. package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +1 -1
  157. package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +1 -1
  158. package/dist/features/parameters/loadflow/load-flow-provider-specific-parameters.js +1 -1
  159. package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
  160. package/dist/features/parameters/network-visualizations/map-parameters.js +1 -1
  161. package/dist/features/parameters/network-visualizations/network-area-diagram-parameters.js +1 -1
  162. package/dist/features/parameters/network-visualizations/network-visualizations-form.js +1 -1
  163. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js +1 -1
  164. package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -1
  165. package/dist/features/parameters/network-visualizations/single-line-diagram-parameters.js +1 -1
  166. package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
  167. package/dist/features/parameters/pcc-min/pcc-min-form-utils.js +1 -1
  168. package/dist/features/parameters/pcc-min/pcc-min-parameters-dialog.js +1 -1
  169. package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +1 -1
  170. package/dist/features/parameters/pcc-min/use-pcc-min-parameters-form.js +1 -1
  171. package/dist/features/parameters/security-analysis/columns-definitions.js +1 -1
  172. package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +1 -1
  173. package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -1
  174. package/dist/features/parameters/security-analysis/security-analysis-parameters-form.js +1 -1
  175. package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +1 -1
  176. package/dist/features/parameters/security-analysis/security-analysis-parameters-utils.js +1 -1
  177. package/dist/features/parameters/security-analysis/security-analysis-violations-hiding.js +1 -1
  178. package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +1 -1
  179. package/dist/features/parameters/sensi/columns-definitions.js +1 -1
  180. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -1
  181. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -1
  182. package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +1 -1
  183. package/dist/features/parameters/sensi/sensitivity-parameters-fields.js +1 -1
  184. package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +1 -1
  185. package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
  186. package/dist/features/parameters/sensi/utils.js +1 -1
  187. package/dist/features/parameters/short-circuit/short-circuit-general-tab-panel.js +1 -1
  188. package/dist/features/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -1
  189. package/dist/features/parameters/short-circuit/short-circuit-icc-material-table-cell.js +1 -1
  190. package/dist/features/parameters/short-circuit/short-circuit-parameters-content.js +1 -1
  191. package/dist/features/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -1
  192. package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
  193. package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +1 -1
  194. package/dist/features/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +1 -1
  195. package/dist/features/parameters/short-circuit/short-circuit-study-area-tab-panel.js +1 -1
  196. package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
  197. package/dist/features/parameters/voltage-init/equipment-selection-parameters.js +1 -1
  198. package/dist/features/parameters/voltage-init/general-parameters.js +1 -1
  199. package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
  200. package/dist/features/parameters/voltage-init/voltage-init-form-utils.js +1 -1
  201. package/dist/features/parameters/voltage-init/voltage-init-parameters-dialog.js +1 -1
  202. package/dist/features/parameters/voltage-init/voltage-init-parameters-form.js +1 -1
  203. package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
  204. package/dist/features/parameters/voltage-init/voltage-limits-parameters.js +1 -1
  205. package/dist/features/process-configs/common/process-config-modifications-edition.js +1 -1
  206. package/dist/features/process-configs/lf-process-config-edition-dialog.js +1 -1
  207. package/dist/features/process-configs/loadflow/lf-process-config-edition.js +1 -1
  208. package/dist/features/process-configs/loadflow/lf-process-config-edition.utils.js +1 -1
  209. package/dist/features/process-configs/process-config.utils.js +1 -1
  210. package/dist/features/process-configs/sa-process-config-edition-dialog.js +1 -1
  211. package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +1 -1
  212. package/dist/features/process-configs/security-analysis/sa-process-config-edition.utils.js +1 -1
  213. package/dist/features/results/securityanalysis/security-analysis-result-nmk.js +1 -1
  214. package/dist/features/results/securityanalysis/security-analysis-table.js +1 -1
  215. package/dist/index.js +12 -3
  216. package/dist/translations/en/networkModificationsEn.d.ts +10 -0
  217. package/dist/translations/en/networkModificationsEn.js +12 -1
  218. package/dist/translations/fr/networkModificationsFr.d.ts +10 -0
  219. package/dist/translations/fr/networkModificationsFr.js +12 -1
  220. package/dist/utils/constants/fieldConstants.d.ts +9 -0
  221. package/dist/utils/constants/fieldConstants.js +9 -0
  222. package/dist/utils/types/network-modification-metadata.d.ts +13 -1
  223. package/package.json +1 -1
@@ -8,7 +8,7 @@ import { MODIFICATION_ROW_HEIGHT, networkModificationTableStyles, createHeaderCe
8
8
  import { AUTO_EXTENSIBLE_COLUMNS } from "./columns-definition.js";
9
9
  import { useModificationsDragAndDrop } from "./use-modifications-drag-and-drop.js";
10
10
  import { useModificationsSelection } from "./use-modifications-selection.js";
11
- import { formatToComposedModification, findDepth, MAX_COMPOSITE_NESTING_DEPTH, mergeSubModificationsIntoTree, removeUuidsFromTree, findAllLoadedCompositeModifications, fetchSubModificationsForExpandedRows, isCompositeModification } from "./utils.js";
11
+ import { formatToComposedModification, findDepth, MAX_COMPOSITE_NESTING_DEPTH, mergeSubModificationsIntoTree, removeUuidsFromTree, findAllLoadedCompositeModifications, fetchSubModificationsForExpandedRows, isCompositeModification, isReferenceModification } from "./utils.js";
12
12
  import "@mui/icons-material";
13
13
  import "react-intl";
14
14
  import "../../utils/conversionUtils.js";
@@ -85,7 +85,7 @@ function NetworkModificationsTable({
85
85
  findAllLoadedCompositeModifications(prevMods, loadedComposites);
86
86
  if (loadedComposites.length > 0) {
87
87
  fetchSubModificationsForExpandedRows(
88
- loadedComposites.map((m) => m.uuid),
88
+ loadedComposites.map((m) => m.rowKey),
89
89
  nextMods,
90
90
  setComposedModifications,
91
91
  true
@@ -97,9 +97,11 @@ function NetworkModificationsTable({
97
97
  const nextExpanded = typeof updater === "function" ? updater(prevExpanded) : updater;
98
98
  const prevRecord = prevExpanded === true ? {} : prevExpanded;
99
99
  const nextRecord = nextExpanded === true ? {} : nextExpanded;
100
- const newlyExpandedIds = Object.keys(nextRecord).filter((id) => nextRecord[id] && !prevRecord[id]);
100
+ const newlyExpandedRowKeys = Object.keys(nextRecord).filter(
101
+ (id) => nextRecord[id] && !prevRecord[id]
102
+ );
101
103
  setComposedModifications((prevMods) => {
102
- fetchSubModificationsForExpandedRows(newlyExpandedIds, prevMods, setComposedModifications);
104
+ fetchSubModificationsForExpandedRows(newlyExpandedRowKeys, prevMods, setComposedModifications);
103
105
  return [...prevMods];
104
106
  });
105
107
  return nextExpanded;
@@ -157,9 +159,9 @@ function NetworkModificationsTable({
157
159
  state: { expanded, rowSelection },
158
160
  getCoreRowModel: getCoreRowModel(),
159
161
  getExpandedRowModel: getExpandedRowModel(),
160
- getSubRows: (row) => row.subModifications,
161
- getRowId: (row) => row.uuid,
162
- getRowCanExpand: (row) => isCompositeModification(row.original),
162
+ getSubRows: (originalRow) => originalRow.subModifications,
163
+ getRowId: (originalRow) => originalRow.rowKey,
164
+ getRowCanExpand: (row) => isCompositeModification(row.original) || isReferenceModification(row.original),
163
165
  enableRowSelection: true,
164
166
  enableSubRowSelection: true,
165
167
  enableExpanding: true,
@@ -192,15 +194,16 @@ function NetworkModificationsTable({
192
194
  return;
193
195
  }
194
196
  table.resetRowSelection();
195
- const uuidsToReset = new Set(modificationUuidsToReset);
197
+ const targetUuids = new Set(modificationUuidsToReset);
198
+ const rowKeysToUnexpanded = /* @__PURE__ */ new Set();
196
199
  const collectAll = (mod) => {
197
- uuidsToReset.add(mod.uuid);
200
+ rowKeysToUnexpanded.add(mod.rowKey);
198
201
  mod.subModifications?.forEach(collectAll);
199
202
  };
200
203
  const collectDescendants = (mods) => {
201
204
  mods.forEach((mod) => {
202
- if (uuidsToReset.has(mod.uuid)) {
203
- mod.subModifications?.forEach(collectAll);
205
+ if (targetUuids.has(mod.uuid)) {
206
+ collectAll(mod);
204
207
  } else {
205
208
  collectDescendants(mod.subModifications ?? []);
206
209
  }
@@ -212,7 +215,7 @@ function NetworkModificationsTable({
212
215
  return prev;
213
216
  }
214
217
  const next = { ...prev };
215
- uuidsToReset.forEach((uuid) => delete next[uuid]);
218
+ rowKeysToUnexpanded.forEach((rowKey) => delete next[rowKey]);
216
219
  return next;
217
220
  });
218
221
  }, [modificationUuidsToReset, table]);
@@ -17,6 +17,7 @@ export declare function SelectCellRenderer({ row, table }: CCtx): import("react"
17
17
  export declare function NameHeaderRenderer({ table }: HCtx): import("react").JSX.Element;
18
18
  export declare function NameCellRenderer({ row, table, column }: CCtx): import("react").JSX.Element;
19
19
  export declare function DescriptionCellRenderer({ row, table }: CCtx): import("react").JSX.Element;
20
+ export declare function ReferenceCellRenderer({ row, table }: CCtx): import("react").JSX.Element | null;
20
21
  export declare function SwitchCellRenderer({ row, table }: CCtx): import("react").JSX.Element;
21
22
  export declare function RootNetworkHeaderRenderer({ column, table }: HCtx): import("react").JSX.Element | null;
22
23
  export declare function RootNetworkCellRenderer({ row, column, table }: CCtx): import("react").JSX.Element | null;
@@ -11,6 +11,8 @@ import { DescriptionCell } from "./description-cell.js";
11
11
  import { SwitchCell } from "./switch-cell.js";
12
12
  import { RootNetworkChipCell } from "./root-network-chip-cell.js";
13
13
  import { createRootNetworkChipCellSx, networkModificationTableStyles } from "../network-modification-table-styles.js";
14
+ import { isReferenceModification } from "../utils.js";
15
+ import { ReferenceLinkCell } from "./reference-link-cell.js";
14
16
  function DragHandleRenderer({ table }) {
15
17
  return /* @__PURE__ */ jsx(DragHandleCell, { isRowDragDisabled: table.options.meta?.interaction.isRowDragDisabled ?? false });
16
18
  }
@@ -48,6 +50,13 @@ function DescriptionCellRenderer({ row, table }) {
48
50
  }
49
51
  );
50
52
  }
53
+ function ReferenceCellRenderer({ row, table }) {
54
+ const { meta } = table.options;
55
+ if (isReferenceModification(row.original)) {
56
+ return /* @__PURE__ */ jsx(ReferenceLinkCell, { data: row.original, disabled: meta?.status.isDisabled });
57
+ }
58
+ return null;
59
+ }
51
60
  function SwitchCellRenderer({ row, table }) {
52
61
  const { meta } = table.options;
53
62
  return /* @__PURE__ */ jsx(
@@ -95,6 +104,7 @@ export {
95
104
  DragHandleRenderer,
96
105
  NameCellRenderer,
97
106
  NameHeaderRenderer,
107
+ ReferenceCellRenderer,
98
108
  RootNetworkCellRenderer,
99
109
  RootNetworkHeaderRenderer,
100
110
  SelectCellRenderer,
@@ -1,4 +1,4 @@
1
- import { DescriptionCellRenderer, DragHandleRenderer, NameCellRenderer, NameHeaderRenderer, RootNetworkCellRenderer, RootNetworkHeaderRenderer, SelectCellRenderer, SelectHeaderRenderer, SwitchCellRenderer } from "./cell-renderers.js";
1
+ import { DescriptionCellRenderer, DragHandleRenderer, NameCellRenderer, NameHeaderRenderer, ReferenceCellRenderer, RootNetworkCellRenderer, RootNetworkHeaderRenderer, SelectCellRenderer, SelectHeaderRenderer, SwitchCellRenderer } from "./cell-renderers.js";
2
2
  import { DepthBox } from "./depth-box.js";
3
3
  import { DescriptionCell } from "./description-cell.js";
4
4
  import { DragHandleCell } from "./drag-handle-cell.js";
@@ -18,6 +18,7 @@ export {
18
18
  NameCellRenderer,
19
19
  NameHeaderRenderer,
20
20
  NetworkModificationEditorNameHeader,
21
+ ReferenceCellRenderer,
21
22
  RootNetworkCellRenderer,
22
23
  RootNetworkChipCell,
23
24
  RootNetworkHeaderRenderer,
@@ -23,7 +23,7 @@ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
23
23
  import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
24
24
  import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
25
25
  import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
26
- import "@material-symbols/svg-400/outlined/add_notes.svg?react";
26
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
27
27
  import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
28
28
  import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
29
29
  import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
@@ -211,7 +211,7 @@ function NameCell({ row, table, onChange }) {
211
211
  children: [
212
212
  renderDepthBox(),
213
213
  /* @__PURE__ */ jsxs(Box, { sx: networkModificationTableStyles.nameCellInnerRow, children: [
214
- isComposite && /* @__PURE__ */ jsx(Box, { sx: networkModificationTableStyles.nameCellTogglerBox, children: /* @__PURE__ */ jsx(
214
+ row.getCanExpand() && /* @__PURE__ */ jsx(Box, { sx: networkModificationTableStyles.nameCellTogglerBox, children: /* @__PURE__ */ jsx(
215
215
  IconButton,
216
216
  {
217
217
  size: "small",
@@ -224,7 +224,7 @@ function NameCell({ row, table, onChange }) {
224
224
  children: row.getIsExpanded() ? /* @__PURE__ */ jsx(KeyboardArrowDown, { fontSize: "small" }) : /* @__PURE__ */ jsx(KeyboardArrowRight, { fontSize: "small" })
225
225
  }
226
226
  ) }),
227
- /* @__PURE__ */ jsx(Box, { sx: createNameCellLabelBoxSx(row.getIsExpanded(), depth), children: isComposite && isEditing ? /* @__PURE__ */ jsx(
227
+ /* @__PURE__ */ jsx(Box, { sx: createNameCellLabelBoxSx(row.getIsExpanded(), depth), children: isEditing ? /* @__PURE__ */ jsx(
228
228
  Box,
229
229
  {
230
230
  sx: mergeSx(networkModificationTableStyles.modificationLabel, {
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { ComposedModificationMetadata } from '../../../utils';
3
+ export interface ReferenceLinkCellProps {
4
+ data: ComposedModificationMetadata;
5
+ disabled?: boolean;
6
+ }
7
+ export declare function ReferenceLinkCell({ data, disabled }: Readonly<ReferenceLinkCellProps>): React.JSX.Element;
@@ -0,0 +1,128 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useState, useCallback } from "react";
3
+ import { IconButton, Menu, ListItemIcon, ListItemText } from "@mui/material";
4
+ import { useIntl, FormattedMessage } from "react-intl";
5
+ import { LinkRounded } from "@mui/icons-material";
6
+ import "../../../utils/conversionUtils.js";
7
+ import { snackWithFallback } from "../../../utils/error.js";
8
+ import "../../../utils/types/equipmentType.js";
9
+ import { fetchAppsMetadata, isExploreMetadata } from "../../../services/appsMetadata.js";
10
+ import { fetchNetworkModification } from "../../../services/networkModification.js";
11
+ import "localized-countries";
12
+ import "localized-countries/data/fr";
13
+ import "localized-countries/data/en";
14
+ import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
15
+ import "../../../components/ui/overflowableText/OverflowableText.js";
16
+ import "react-hook-form";
17
+ import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
18
+ import "yup";
19
+ import { CustomTooltip } from "../../../components/ui/tooltip/CustomTooltip.js";
20
+ import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
21
+ import "../../../components/ui/reactHookForm/numbers/RangeInput.js";
22
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
23
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
24
+ import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
25
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
26
+ import "@material-symbols/svg-400/outlined/add_notes-fill.svg?react";
27
+ import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
28
+ import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
29
+ import "../../../components/ui/reactHookForm/directory-item-input/directory-item-utils.js";
30
+ import "@hello-pangea/dnd";
31
+ import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
32
+ import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
33
+ import { CustomMenuItem } from "../../../components/ui/menus/custom-nested-menu.js";
34
+ import "react-resizable-panels";
35
+ import "react-papaparse";
36
+ import "react-dom";
37
+ import "autosuggest-highlight/match";
38
+ import "autosuggest-highlight/parse";
39
+ import "clsx";
40
+ import "../../../components/composite/filter/FilterCreationDialog.js";
41
+ import "../../../components/composite/filter/HeaderFilterForm.js";
42
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
43
+ import "../../../components/composite/filter/expert/ExpertFilterForm.js";
44
+ import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
45
+ import "../../../components/composite/filter/expert/expertFilterConstants.js";
46
+ import "react-querybuilder";
47
+ import "uuid";
48
+ import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
49
+ import "../../../components/composite/filter/utils/filterFormUtils.js";
50
+ import "@react-querybuilder/material";
51
+ import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
52
+ import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
53
+ import "../../../components/composite/agGridTable/BottomTableButtons.js";
54
+ import "../../../components/composite/agGridTable/CustomAgGridTable.js";
55
+ import "ag-grid-community";
56
+ import "../../../components/composite/customAGGrid/customAggrid.js";
57
+ import "../../../components/composite/customAGGrid/context/custom-aggrid-context.js";
58
+ import "mathjs";
59
+ import "../../../components/composite/report/report-viewer/log-table/log-table.js";
60
+ import "react-window";
61
+ import "../../../components/composite/report/report-treeview/treeview-item.js";
62
+ import "../../../components/composite/report/report-viewer/context/report-viewer-context.js";
63
+ import { DatasetLinkedIcon } from "../../../components/ui/icons/DatasetLinkedIcon.js";
64
+ function ReferenceLinkCell({ data, disabled = false }) {
65
+ const intl = useIntl();
66
+ const { snackInfo, snackError } = useSnackMessage();
67
+ const [anchorEl, setAnchorEl] = useState(null);
68
+ const [isLoading, setIsLoading] = useState(false);
69
+ const open = Boolean(anchorEl);
70
+ const handleOpen = useCallback((event) => {
71
+ event.stopPropagation();
72
+ setAnchorEl(event.currentTarget);
73
+ }, []);
74
+ const handleMenuClose = useCallback(() => {
75
+ setAnchorEl(null);
76
+ }, []);
77
+ const handleCopyLink = useCallback(
78
+ (event) => {
79
+ event.stopPropagation();
80
+ setAnchorEl(null);
81
+ setIsLoading(true);
82
+ Promise.all([
83
+ fetchNetworkModification(data.uuid).then((res) => res.json()),
84
+ fetchAppsMetadata()
85
+ ]).then(([referenceInfos, metadata]) => {
86
+ const referenceId = referenceInfos?.referenceId;
87
+ const exploreUrl = metadata?.find(isExploreMetadata)?.url;
88
+ if (!referenceId || !exploreUrl) {
89
+ throw new Error(
90
+ `Cannot build reference link: ${!referenceId ? "referenceId" : "exploreUrl"} is missing`
91
+ );
92
+ }
93
+ const link = `${exploreUrl}/elements/${referenceId}`;
94
+ return navigator.clipboard.writeText(link).then(() => snackInfo({ headerId: "linkCopied" }));
95
+ }).catch((error) => snackWithFallback(snackError, error, { headerId: "linkCopyError" })).finally(() => setIsLoading(false));
96
+ },
97
+ [data.uuid, snackInfo, snackError]
98
+ );
99
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
100
+ /* @__PURE__ */ jsx(CustomTooltip, { title: /* @__PURE__ */ jsx(FormattedMessage, { id: "importComposites.shared" }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { disabled: disabled || isLoading, onClick: handleOpen, children: /* @__PURE__ */ jsx(DatasetLinkedIcon, {}) }) }) }),
101
+ /* @__PURE__ */ jsx(
102
+ Menu,
103
+ {
104
+ anchorEl,
105
+ open,
106
+ onClose: handleMenuClose,
107
+ slotProps: {
108
+ paper: {
109
+ sx: {
110
+ maxWidth: 220
111
+ }
112
+ },
113
+ list: {
114
+ dense: true,
115
+ sx: { py: 0.25 }
116
+ }
117
+ },
118
+ children: /* @__PURE__ */ jsxs(CustomMenuItem, { onClick: handleCopyLink, sx: { minHeight: 0, py: 0.25, px: 1 }, children: [
119
+ /* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 24 }, children: /* @__PURE__ */ jsx(LinkRounded, { sx: { fontSize: 18, transform: "rotate(-50deg)" } }) }),
120
+ /* @__PURE__ */ jsx(ListItemText, { primary: intl.formatMessage({ id: "copyLink" }) })
121
+ ] })
122
+ }
123
+ )
124
+ ] });
125
+ }
126
+ export {
127
+ ReferenceLinkCell
128
+ };
@@ -6,6 +6,7 @@ import { ActivableChip } from "../../../components/ui/inputs/ActivableChip.js";
6
6
  import "../../../utils/conversionUtils.js";
7
7
  import { snackWithFallback } from "../../../utils/error.js";
8
8
  import "../../../utils/types/equipmentType.js";
9
+ import { ModificationType } from "../../../utils/types/modificationType.js";
9
10
  import "@mui/icons-material";
10
11
  import { updateModificationStatusByRootNetwork } from "../../../services/networkModification.js";
11
12
  import "localized-countries";
@@ -54,6 +55,7 @@ function RootNetworkChipCell(props) {
54
55
  const [isLoading, setIsLoading] = useState(false);
55
56
  const { snackError } = useSnackMessage();
56
57
  const modificationUuid = data.uuid;
58
+ const isReferenceModificationOrInsideOne = data.type === ModificationType.MODIFICATION_REFERENCE || data.childFromShared;
57
59
  const isModificationActivated = useMemo(() => {
58
60
  if (rootNetwork.isCreating) {
59
61
  return true;
@@ -103,7 +105,7 @@ function RootNetworkChipCell(props) {
103
105
  label: rootNetwork.tag,
104
106
  tooltipMessage: rootNetwork.name,
105
107
  isActivated: isModificationActivated,
106
- isDisabled: isLoading || isDisabled,
108
+ isDisabled: isLoading || isDisabled || isReferenceModificationOrInsideOne,
107
109
  onClick: handleModificationActivationByRootNetwork
108
110
  }
109
111
  );
@@ -6,7 +6,7 @@ import { Draggable } from "@hello-pangea/dnd";
6
6
  import { useIntl } from "react-intl";
7
7
  import { BASE_MODIFICATION_TABLE_COLUMNS, AUTO_EXTENSIBLE_COLUMNS } from "../columns-definition.js";
8
8
  import { COLUMNS_WITHOUT_BORDER, createCellContentWrapperSx, createCellStyle, createRowSx, networkModificationTableStyles } from "../network-modification-table-styles.js";
9
- import { isCompositeModification } from "../utils.js";
9
+ import { isCompositeModification, isReferenceModification, isTargetChildOfReference } from "../utils.js";
10
10
  import "../../../utils/conversionUtils.js";
11
11
  import "../../../utils/types/equipmentType.js";
12
12
  import "@mui/icons-material";
@@ -30,76 +30,84 @@ function ModificationRow({
30
30
  },
31
31
  [handleCellClick, row.original]
32
32
  );
33
- return /* @__PURE__ */ jsx(Draggable, { draggableId: row.id, index: virtualRow.index, isDragDisabled: isRowDragDisabled, children: (provided, snapshot) => {
34
- const { style, ...draggablePropsWithoutStyle } = provided.draggableProps;
35
- return /* @__PURE__ */ jsx(
36
- TableRow,
37
- {
38
- ref: provided.innerRef,
39
- ...draggablePropsWithoutStyle,
40
- "data-row-id": row.original.uuid,
41
- sx: mergeSx(
42
- networkModificationTableStyles.tableRow,
43
- createRowSx(
44
- theme,
45
- isHighlighted,
46
- snapshot.isDragging,
47
- virtualRow,
48
- row.depth,
49
- isCompositeModification(row.original)
50
- )
51
- ),
52
- children: row.getVisibleCells().map((cell) => {
53
- const isNameColumn = cell.column.id === BASE_MODIFICATION_TABLE_COLUMNS.NAME.id;
54
- const isDragHandle = cell.column.id === BASE_MODIFICATION_TABLE_COLUMNS.DRAG_HANDLE.id;
55
- const isCheckboxColumn = cell.column.id === BASE_MODIFICATION_TABLE_COLUMNS.SELECT.id;
56
- const cellContent = flexRender(cell.column.columnDef.cell, cell.getContext());
57
- const cellWithoutBorders = (isExpanded || row.depth > 0) && COLUMNS_WITHOUT_BORDER.has(cell.column.columnDef.id ?? "");
58
- if (isDragHandle) {
59
- return /* @__PURE__ */ jsx(
60
- TableCell,
61
- {
62
- sx: createCellStyle(cell, AUTO_EXTENSIBLE_COLUMNS.includes(cell.column.id)),
63
- children: /* @__PURE__ */ jsx(
64
- Box,
33
+ return /* @__PURE__ */ jsx(
34
+ Draggable,
35
+ {
36
+ draggableId: row.id,
37
+ index: virtualRow.index,
38
+ isDragDisabled: isRowDragDisabled || isTargetChildOfReference(row),
39
+ children: (provided, snapshot) => {
40
+ const { style, ...draggablePropsWithoutStyle } = provided.draggableProps;
41
+ return /* @__PURE__ */ jsx(
42
+ TableRow,
43
+ {
44
+ ref: provided.innerRef,
45
+ ...draggablePropsWithoutStyle,
46
+ "data-row-id": row.id,
47
+ sx: mergeSx(
48
+ networkModificationTableStyles.tableRow,
49
+ createRowSx(
50
+ theme,
51
+ isHighlighted,
52
+ snapshot.isDragging,
53
+ virtualRow,
54
+ row.depth,
55
+ isCompositeModification(row.original) || isReferenceModification(row.original)
56
+ )
57
+ ),
58
+ children: row.getVisibleCells().map((cell) => {
59
+ const isNameColumn = cell.column.id === BASE_MODIFICATION_TABLE_COLUMNS.NAME.id;
60
+ const isDragHandle = cell.column.id === BASE_MODIFICATION_TABLE_COLUMNS.DRAG_HANDLE.id;
61
+ const isCheckboxColumn = cell.column.id === BASE_MODIFICATION_TABLE_COLUMNS.SELECT.id;
62
+ const cellContent = flexRender(cell.column.columnDef.cell, cell.getContext());
63
+ const cellWithoutBorders = (isExpanded || row.depth > 0) && COLUMNS_WITHOUT_BORDER.has(cell.column.columnDef.id ?? "");
64
+ if (isDragHandle) {
65
+ return /* @__PURE__ */ jsx(
66
+ TableCell,
65
67
  {
66
- sx: createCellContentWrapperSx(theme, cellWithoutBorders),
67
- ...provided.dragHandleProps,
68
- "aria-label": intl.formatMessage({ id: "moveModification" }),
69
- children: cellContent
70
- }
71
- )
72
- },
73
- cell.id
74
- );
75
- }
76
- if (isCheckboxColumn) {
77
- return /* @__PURE__ */ jsx(
78
- TableCell,
79
- {
80
- sx: createCellStyle(cell, AUTO_EXTENSIBLE_COLUMNS.includes(cell.column.id)),
81
- onClick: () => handleCellClickCallback(cell.column.id),
82
- children: /* @__PURE__ */ jsx(Box, { sx: createCellContentWrapperSx(theme, cellWithoutBorders), children: cellContent })
83
- },
84
- cell.id
85
- );
68
+ sx: createCellStyle(cell, AUTO_EXTENSIBLE_COLUMNS.includes(cell.column.id)),
69
+ children: /* @__PURE__ */ jsx(
70
+ Box,
71
+ {
72
+ sx: createCellContentWrapperSx(theme, cellWithoutBorders),
73
+ ...provided.dragHandleProps,
74
+ "aria-label": intl.formatMessage({ id: "moveModification" }),
75
+ children: cellContent
76
+ }
77
+ )
78
+ },
79
+ cell.id
80
+ );
81
+ }
82
+ if (isCheckboxColumn) {
83
+ return /* @__PURE__ */ jsx(
84
+ TableCell,
85
+ {
86
+ sx: createCellStyle(cell, AUTO_EXTENSIBLE_COLUMNS.includes(cell.column.id)),
87
+ onClick: () => handleCellClickCallback(cell.column.id),
88
+ children: /* @__PURE__ */ jsx(Box, { sx: createCellContentWrapperSx(theme, cellWithoutBorders), children: cellContent })
89
+ },
90
+ cell.id
91
+ );
92
+ }
93
+ return /* @__PURE__ */ jsx(
94
+ TableCell,
95
+ {
96
+ sx: createCellStyle(cell, AUTO_EXTENSIBLE_COLUMNS.includes(cell.column.id)),
97
+ onClick: () => handleCellClickCallback(cell.column.id),
98
+ children: isNameColumn ? (
99
+ // NameCell owns its own borders entirely
100
+ flexRender(cell.column.columnDef.cell, cell.getContext())
101
+ ) : /* @__PURE__ */ jsx(Box, { sx: createCellContentWrapperSx(theme, cellWithoutBorders), children: cellContent })
102
+ },
103
+ cell.id
104
+ );
105
+ })
86
106
  }
87
- return /* @__PURE__ */ jsx(
88
- TableCell,
89
- {
90
- sx: createCellStyle(cell, AUTO_EXTENSIBLE_COLUMNS.includes(cell.column.id)),
91
- onClick: () => handleCellClickCallback(cell.column.id),
92
- children: isNameColumn ? (
93
- // NameCell owns its own borders entirely
94
- flexRender(cell.column.columnDef.cell, cell.getContext())
95
- ) : /* @__PURE__ */ jsx(Box, { sx: createCellContentWrapperSx(theme, cellWithoutBorders), children: cellContent })
96
- },
97
- cell.id
98
- );
99
- })
107
+ );
100
108
  }
101
- );
102
- } });
109
+ }
110
+ );
103
111
  }
104
112
  export {
105
113
  ModificationRow
@@ -7,7 +7,7 @@ import "@hello-pangea/dnd";
7
7
  import "react-intl";
8
8
  import "./columns-definition.js";
9
9
  import { DROP_FORBIDDEN_INDICATOR_BOTTOM, DROP_FORBIDDEN_INDICATOR_TOP, DROP_INDICATOR_BOTTOM, DROP_INDICATOR_TOP } from "./network-modification-table-styles.js";
10
- import { isCompositeModification, MAX_COMPOSITE_NESTING_DEPTH, findModificationInTree, isSharedModification, moveSubModificationInTree } from "./utils.js";
10
+ import { isCompositeModification, isReferenceModification, isTargetChildOfReference, MAX_COMPOSITE_NESTING_DEPTH, findModificationInTree, moveSubModificationInTree } from "./utils.js";
11
11
  import "../../utils/conversionUtils.js";
12
12
  import { snackWithFallback } from "../../utils/error.js";
13
13
  import "../../utils/types/equipmentType.js";
@@ -25,14 +25,18 @@ const clearRowDragIndicators = (container) => {
25
25
  });
26
26
  container?.querySelectorAll(`[${CHIP_ATTR}]`).forEach((chip) => chip.remove());
27
27
  };
28
- function getTargetCompositeUuid(droppingIntoExpandedComposite, targetRow) {
28
+ function resolveTargetComposite(droppingIntoExpandedComposite, targetRow) {
29
29
  if (droppingIntoExpandedComposite) {
30
- return targetRow.original.uuid;
30
+ return { rowKey: targetRow.id, uuid: targetRow.original.uuid };
31
31
  }
32
- return targetRow.depth > 0 ? targetRow.getParentRow()?.original.uuid ?? null : null;
32
+ if (targetRow.depth > 0) {
33
+ const parent = targetRow.getParentRow();
34
+ return { rowKey: parent?.id ?? null, uuid: parent?.original.uuid ?? null };
35
+ }
36
+ return { rowKey: null, uuid: null };
33
37
  }
34
- function getTargetSiblings(targetCompositeUuid, rows) {
35
- return targetCompositeUuid ? rows.filter((r) => r.depth > 0 && r.getParentRow()?.original.uuid === targetCompositeUuid) : rows.filter((r) => r.depth === 0);
38
+ function getTargetSiblings(targetCompositeRowKey, rows) {
39
+ return targetCompositeRowKey ? rows.filter((r) => r.depth > 0 && r.getParentRow()?.id === targetCompositeRowKey) : rows.filter((r) => r.depth === 0);
36
40
  }
37
41
  function getContainerShadow(forbidden, isMovingDown) {
38
42
  if (forbidden) {
@@ -67,10 +71,15 @@ const useModificationsDragAndDrop = ({
67
71
  const isDropForbidden = useCallback(
68
72
  (sourceRow, targetRow) => {
69
73
  if (isCompositeModification(sourceRow.original)) {
74
+ if (isReferenceModification(targetRow.original) || isTargetChildOfReference(targetRow)) {
75
+ return true;
76
+ }
70
77
  const targetDepth = computeTargetDepth(sourceRow, targetRow);
71
- return (sourceRow.original.maxDepth ?? 0) + targetDepth > MAX_COMPOSITE_NESTING_DEPTH || !!(isCompositeModification(sourceRow.original) && findModificationInTree(targetRow.original.uuid, [sourceRow.original]));
78
+ return (sourceRow.original.maxDepth ?? 0) + targetDepth > MAX_COMPOSITE_NESTING_DEPTH || !!(isCompositeModification(sourceRow.original) && findModificationInTree(targetRow.id, [sourceRow.original]));
79
+ }
80
+ if (isReferenceModification(sourceRow.original) || isReferenceModification(targetRow.original) || isTargetChildOfReference(targetRow)) {
81
+ return true;
72
82
  }
73
- if (isSharedModification(sourceRow.original)) return true;
74
83
  return false;
75
84
  },
76
85
  [computeTargetDepth]
@@ -84,7 +93,7 @@ const useModificationsDragAndDrop = ({
84
93
  }
85
94
  const sourceRow = rows[source.index];
86
95
  const targetRow = rows[destination.index];
87
- const el = containerRef.current?.querySelector(`[data-row-id="${targetRow?.original.uuid}"]`);
96
+ const el = containerRef.current?.querySelector(`[data-row-id="${targetRow?.id}"]`);
88
97
  if (!el) {
89
98
  return;
90
99
  }
@@ -110,33 +119,42 @@ const useModificationsDragAndDrop = ({
110
119
  if (isDropForbidden(sourceRow, targetRow)) {
111
120
  return;
112
121
  }
122
+ const movingRowKey = sourceRow.id;
113
123
  const movingUuid = sourceRow.original.uuid;
114
- const sourceCompositeUuid = sourceRow.depth > 0 ? sourceRow.getParentRow()?.original.uuid ?? null : null;
124
+ const sourceParent = sourceRow.depth > 0 ? sourceRow.getParentRow() : void 0;
125
+ const sourceCompositeRowKey = sourceParent?.id ?? null;
126
+ const sourceContainerId = sourceParent?.original.uuid ?? null;
115
127
  const isDraggingDown = destination.index > source.index;
116
128
  const droppingIntoExpandedComposite = isDraggingDown && targetRow.getIsExpanded();
117
129
  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;
130
+ const targetComposite = resolveTargetComposite(droppingIntoExpandedComposite, targetRow);
131
+ const targetContainerId = targetComposite.uuid;
121
132
  const previousModifications = [...composedModifications];
122
133
  let beforeUuid;
123
134
  if (droppingIntoExpandedComposite || isSubRowInvolved) {
124
- const targetSiblings = getTargetSiblings(targetCompositeUuid, rows);
135
+ const targetSiblings = getTargetSiblings(targetComposite.rowKey, rows);
136
+ let landingSibling;
125
137
  if (droppingIntoExpandedComposite) {
126
- beforeUuid = targetSiblings[0]?.original.uuid ?? null;
138
+ [landingSibling] = targetSiblings;
127
139
  } else {
128
- const landingIndexInSiblings = targetSiblings.findIndex(
129
- (r) => r.original.uuid === targetRow.original.uuid
130
- );
140
+ const landingIndexInSiblings = targetSiblings.findIndex((r) => r.id === targetRow.id);
131
141
  const beforeSiblingIndex = isDraggingDown ? landingIndexInSiblings + 1 : landingIndexInSiblings;
132
- beforeUuid = targetSiblings[beforeSiblingIndex]?.original.uuid ?? null;
142
+ landingSibling = targetSiblings[beforeSiblingIndex];
133
143
  }
144
+ const beforeRowKey = landingSibling?.id ?? null;
145
+ beforeUuid = landingSibling?.original.uuid ?? null;
134
146
  setComposedModifications(
135
- (prev) => moveSubModificationInTree(movingUuid, sourceCompositeUuid, targetCompositeUuid, beforeUuid, prev)
147
+ (prev) => moveSubModificationInTree(
148
+ movingRowKey,
149
+ sourceCompositeRowKey,
150
+ targetComposite.rowKey,
151
+ beforeRowKey,
152
+ prev
153
+ )
136
154
  );
137
155
  } else {
138
- const oldPosition = composedModifications.findIndex((m) => m.uuid === sourceRow.original.uuid);
139
- const newPosition = composedModifications.findIndex((m) => m.uuid === targetRow.original.uuid);
156
+ const oldPosition = composedModifications.findIndex((m) => m.rowKey === sourceRow.id);
157
+ const newPosition = composedModifications.findIndex((m) => m.rowKey === targetRow.id);
140
158
  if (oldPosition === -1 || newPosition === -1 || oldPosition === newPosition || !currentNodeUuid) {
141
159
  return;
142
160
  }