@gridsuite/commons-ui 0.265.0 → 0.266.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.
- package/dist/components/composite/dnd-table/dnd-table-add-rows-dialog.js +1 -1
- package/dist/components/composite/dnd-table/dnd-table-row.js +1 -1
- package/dist/components/composite/dnd-table/dnd-table.js +1 -1
- package/dist/components/composite/filter/FilterForm.js +1 -1
- package/dist/components/composite/filter/HeaderFilterForm.js +1 -1
- package/dist/components/composite/filter/expert/ExpertFilterForm.js +1 -1
- package/dist/components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js +1 -1
- package/dist/components/composite/report/report-viewer/log-table/log-table.js +1 -1
- package/dist/components/ui/csvPicker/csv-picker-confirmation-dialog.js +1 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -1
- package/dist/components/ui/dialogs/name-element-editor/name-element-editor-utils.js +1 -1
- package/dist/components/ui/icons/DatasetLinkedIcon.d.ts +2 -0
- package/dist/components/ui/icons/DatasetLinkedIcon.js +9 -0
- package/dist/components/ui/icons/EditNoteIcon.js +1 -1
- package/dist/features/global-filter/ui/global-filter-dropdown-panel.js +1 -1
- package/dist/features/global-filter/ui/global-filter-panel.js +1 -1
- package/dist/features/global-filter/ui/selected-global-filters.js +1 -1
- package/dist/features/index.js +6 -4
- package/dist/features/network-modification-table/columns-definition.d.ts +4 -0
- package/dist/features/network-modification-table/columns-definition.js +4 -0
- package/dist/features/network-modification-table/index.js +5 -3
- package/dist/features/network-modification-table/network-modification-table-styles.js +2 -2
- package/dist/features/network-modification-table/network-modifications-table.d.ts +1 -1
- package/dist/features/network-modification-table/network-modifications-table.js +15 -12
- package/dist/features/network-modification-table/renderers/cell-renderers.d.ts +1 -0
- package/dist/features/network-modification-table/renderers/cell-renderers.js +10 -0
- package/dist/features/network-modification-table/renderers/index.js +2 -1
- package/dist/features/network-modification-table/renderers/name-cell.js +3 -3
- package/dist/features/network-modification-table/renderers/reference-link-cell.d.ts +7 -0
- package/dist/features/network-modification-table/renderers/reference-link-cell.js +128 -0
- package/dist/features/network-modification-table/renderers/root-network-chip-cell.js +3 -1
- package/dist/features/network-modification-table/row/modification-row.js +76 -68
- package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +40 -22
- package/dist/features/network-modification-table/use-modifications-selection.js +14 -14
- package/dist/features/network-modification-table/utils.d.ts +20 -12
- package/dist/features/network-modification-table/utils.js +102 -48
- package/dist/features/network-modifications/battery/creation/BatteryCreationForm.js +1 -1
- package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +1 -1
- package/dist/features/network-modifications/battery/modification/BatteryDialogHeader.js +1 -1
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabsContent.js +1 -1
- package/dist/features/network-modifications/battery/modification/batteryModification.utils.js +1 -1
- package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-form.js +1 -1
- package/dist/features/network-modifications/by-filter/assignment/modification-by-assignment-form.js +1 -1
- package/dist/features/network-modifications/by-filter/deletion/ByFilterDeletionForm.js +1 -1
- package/dist/features/network-modifications/by-filter/formula/formula/formula-form.js +1 -1
- package/dist/features/network-modifications/by-filter/formula/formula/reference-autocomplete-input.js +1 -1
- package/dist/features/network-modifications/by-filter/formula/modification-by-formula-form.js +1 -1
- package/dist/features/network-modifications/common/activePowerControl/ActivePowerControlForm.js +1 -1
- package/dist/features/network-modifications/common/connectivity/ConnectivityForm.js +1 -1
- package/dist/features/network-modifications/common/connectivity/PositionForm.js +1 -1
- package/dist/features/network-modifications/common/connectivity/VoltageLevelConnectivityForm.js +1 -1
- package/dist/features/network-modifications/common/currentLimits/LimitsPane.js +1 -1
- package/dist/features/network-modifications/common/currentLimits/SelectedOperationalLimitGroup.js +1 -1
- package/dist/features/network-modifications/common/currentLimits/limitsEditor/LimitsEditor.js +1 -1
- package/dist/features/network-modifications/common/currentLimits/limitsEditor/LimitsPropertiesSideStack.js +1 -1
- package/dist/features/network-modifications/common/currentLimits/limitsEditor/TemporaryLimitsTable.js +1 -1
- package/dist/features/network-modifications/common/currentLimits/limitsPane.utils.js +1 -1
- package/dist/features/network-modifications/common/measurements/BusbarSectionVoltageMeasurementsForm.js +1 -1
- package/dist/features/network-modifications/common/measurements/PowerWithValidityForm.js +1 -1
- package/dist/features/network-modifications/common/properties/PropertiesForm.js +1 -1
- package/dist/features/network-modifications/common/properties/PropertyForm.js +1 -1
- package/dist/features/network-modifications/common/reactiveLimits/ReactiveLimitsForm.js +1 -1
- package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js +1 -1
- package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js +1 -1
- package/dist/features/network-modifications/common/regulatingTerminal/RegulatingTerminalForm.js +1 -1
- package/dist/features/network-modifications/common/setpoints/SetPointsForm.js +1 -1
- package/dist/features/network-modifications/common/shortCircuit/ShortCircuitForm.js +1 -1
- package/dist/features/network-modifications/common/voltageRegulation/VoltageRegulationForm.js +1 -1
- package/dist/features/network-modifications/equipmentDeletion/EquipmentDeletionForm.js +1 -1
- package/dist/features/network-modifications/equipmentDeletion/equipmentDeletion.utils.js +1 -1
- package/dist/features/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js +1 -1
- package/dist/features/network-modifications/generator/creation/GeneratorCreationForm.js +1 -1
- package/dist/features/network-modifications/generator/creation/generatorCreation.utils.js +1 -1
- package/dist/features/network-modifications/generator/modification/GeneratorDialogHeader.js +1 -1
- package/dist/features/network-modifications/generator/modification/GeneratorDialogTabsContent.js +1 -1
- package/dist/features/network-modifications/generator/modification/generatorModification.utils.js +1 -1
- package/dist/features/network-modifications/index.js +1 -1
- package/dist/features/network-modifications/line/characteristics/LineCharacteristicsPane.js +1 -1
- package/dist/features/network-modifications/line/common/LineDialogHeader.js +1 -1
- package/dist/features/network-modifications/line/common/LineDialogTabsContent.js +1 -1
- package/dist/features/network-modifications/line/creation/lineCreation.utils.js +1 -1
- package/dist/features/network-modifications/line/modification/lineModification.utils.js +1 -1
- package/dist/features/network-modifications/load/common/LoadDialogHeader.js +1 -1
- package/dist/features/network-modifications/load/creation/loadCreation.utils.js +1 -1
- package/dist/features/network-modifications/load/modification/loadModification.utils.js +1 -1
- package/dist/features/network-modifications/shunt-compensator/common/CharacteristicsForm.js +1 -1
- package/dist/features/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +1 -1
- package/dist/features/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +1 -1
- package/dist/features/network-modifications/shunt-compensator/modification/ShuntCompensatorModificationForm.js +1 -1
- package/dist/features/network-modifications/shunt-compensator/modification/shuntCompensatorModification.utils.js +1 -1
- package/dist/features/network-modifications/substation/creation/SubstationCreationForm.js +1 -1
- package/dist/features/network-modifications/substation/modification/SubstationModificationForm.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/index.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/tabs/characteristicsTab/CharacteristicsTab.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/couplingOmnibus/CouplingOmnibusForm.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationCreationSection.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationTab.js +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +1 -1
- package/dist/features/network-modifications/voltageLevel/index.js +1 -1
- package/dist/features/network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js +1 -1
- package/dist/features/parameters/common/contingency-table/columns-definitions.js +1 -1
- package/dist/features/parameters/common/limitreductions/limit-reduction-table-cell.js +1 -1
- package/dist/features/parameters/common/limitreductions/limit-reductions-table-form.js +1 -1
- package/dist/features/parameters/common/parameter-field.js +1 -1
- package/dist/features/parameters/common/parameter-layout/parameter-layout.js +1 -1
- package/dist/features/parameters/common/parameter-table-field/parameter-table-field.js +1 -1
- package/dist/features/parameters/common/parameters-creation-dialog.js +1 -1
- package/dist/features/parameters/common/provider-param.js +1 -1
- package/dist/features/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +1 -1
- package/dist/features/parameters/common/widget/parameter-float.js +1 -1
- package/dist/features/parameters/common/widget/parameter-line-directory-items-input.js +1 -1
- package/dist/features/parameters/common/widget/parameter-line-slider.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +1 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-simulation/mapping/mapping-parameters-utils.js +1 -1
- package/dist/features/parameters/dynamic-simulation/mapping/mapping-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-advanced-parameters.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-general-parameters.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-content.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-dialog.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-header.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-provider-specific-parameters.js +1 -1
- package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
- package/dist/features/parameters/network-visualizations/map-parameters.js +1 -1
- package/dist/features/parameters/network-visualizations/network-area-diagram-parameters.js +1 -1
- package/dist/features/parameters/network-visualizations/network-visualizations-form.js +1 -1
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js +1 -1
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -1
- package/dist/features/parameters/network-visualizations/single-line-diagram-parameters.js +1 -1
- package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
- package/dist/features/parameters/pcc-min/pcc-min-form-utils.js +1 -1
- package/dist/features/parameters/pcc-min/pcc-min-parameters-dialog.js +1 -1
- package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +1 -1
- package/dist/features/parameters/pcc-min/use-pcc-min-parameters-form.js +1 -1
- package/dist/features/parameters/security-analysis/columns-definitions.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-form.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-utils.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-violations-hiding.js +1 -1
- package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +1 -1
- package/dist/features/parameters/sensi/columns-definitions.js +1 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +1 -1
- package/dist/features/parameters/sensi/sensitivity-parameters-fields.js +1 -1
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +1 -1
- package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
- package/dist/features/parameters/sensi/utils.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-general-tab-panel.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-icc-material-table-cell.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-content.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +1 -1
- package/dist/features/parameters/short-circuit/short-circuit-study-area-tab-panel.js +1 -1
- package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
- package/dist/features/parameters/voltage-init/equipment-selection-parameters.js +1 -1
- package/dist/features/parameters/voltage-init/general-parameters.js +1 -1
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/features/parameters/voltage-init/voltage-init-form-utils.js +1 -1
- package/dist/features/parameters/voltage-init/voltage-init-parameters-dialog.js +1 -1
- package/dist/features/parameters/voltage-init/voltage-init-parameters-form.js +1 -1
- package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
- package/dist/features/parameters/voltage-init/voltage-limits-parameters.js +1 -1
- package/dist/features/process-configs/common/process-config-modifications-edition.js +1 -1
- package/dist/features/process-configs/lf-process-config-edition-dialog.js +1 -1
- package/dist/features/process-configs/loadflow/lf-process-config-edition.js +1 -1
- package/dist/features/process-configs/loadflow/lf-process-config-edition.utils.js +1 -1
- package/dist/features/process-configs/process-config.utils.js +1 -1
- package/dist/features/process-configs/sa-process-config-edition-dialog.js +1 -1
- package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +1 -1
- package/dist/features/process-configs/security-analysis/sa-process-config-edition.utils.js +1 -1
- package/dist/features/results/securityanalysis/security-analysis-result-nmk.js +1 -1
- package/dist/features/results/securityanalysis/security-analysis-table.js +1 -1
- package/dist/index.js +5 -3
- package/dist/translations/en/networkModificationsEn.d.ts +3 -0
- package/dist/translations/en/networkModificationsEn.js +4 -1
- package/dist/translations/fr/networkModificationsFr.d.ts +3 -0
- package/dist/translations/fr/networkModificationsFr.js +4 -1
- package/dist/utils/types/network-modification-metadata.d.ts +13 -1
- package/package.json +1 -1
|
@@ -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(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
|
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
|
-
|
|
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(
|
|
35
|
-
return
|
|
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.
|
|
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?.
|
|
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
|
|
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
|
|
119
|
-
const
|
|
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(
|
|
135
|
+
const targetSiblings = getTargetSiblings(targetComposite.rowKey, rows);
|
|
136
|
+
let landingSibling;
|
|
125
137
|
if (droppingIntoExpandedComposite) {
|
|
126
|
-
|
|
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
|
-
|
|
142
|
+
landingSibling = targetSiblings[beforeSiblingIndex];
|
|
133
143
|
}
|
|
144
|
+
const beforeRowKey = landingSibling?.id ?? null;
|
|
145
|
+
beforeUuid = landingSibling?.original.uuid ?? null;
|
|
134
146
|
setComposedModifications(
|
|
135
|
-
(prev) => moveSubModificationInTree(
|
|
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.
|
|
139
|
-
const newPosition = composedModifications.findIndex((m) => m.
|
|
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
|
}
|
|
@@ -4,13 +4,13 @@ function normalizeCompositeSelection(rawSelection, roots) {
|
|
|
4
4
|
const visit = (node) => {
|
|
5
5
|
const children = node.subModifications;
|
|
6
6
|
if (!children || children.length === 0) {
|
|
7
|
-
return next[node.
|
|
7
|
+
return next[node.rowKey];
|
|
8
8
|
}
|
|
9
9
|
const everyChildSelected = children.map((child) => visit(child)).every(Boolean);
|
|
10
10
|
if (everyChildSelected) {
|
|
11
|
-
next[node.
|
|
11
|
+
next[node.rowKey] = true;
|
|
12
12
|
} else {
|
|
13
|
-
delete next[node.
|
|
13
|
+
delete next[node.rowKey];
|
|
14
14
|
}
|
|
15
15
|
return everyChildSelected;
|
|
16
16
|
};
|
|
@@ -36,30 +36,30 @@ function propagateSelectionToLoadedDescendants(selection, roots) {
|
|
|
36
36
|
let next = selection;
|
|
37
37
|
let mutated = false;
|
|
38
38
|
const visit = (node, ancestorSelected) => {
|
|
39
|
-
const effectiveSelected = ancestorSelected || next[node.
|
|
40
|
-
if (effectiveSelected && !next[node.
|
|
39
|
+
const effectiveSelected = ancestorSelected || next[node.rowKey];
|
|
40
|
+
if (effectiveSelected && !next[node.rowKey]) {
|
|
41
41
|
if (!mutated) {
|
|
42
42
|
next = { ...selection };
|
|
43
43
|
mutated = true;
|
|
44
44
|
}
|
|
45
|
-
next[node.
|
|
45
|
+
next[node.rowKey] = true;
|
|
46
46
|
}
|
|
47
47
|
node.subModifications?.forEach((child) => visit(child, effectiveSelected));
|
|
48
48
|
};
|
|
49
49
|
roots.forEach((root) => visit(root, false));
|
|
50
50
|
return mutated ? next : selection;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
52
|
+
function collectAllRowKeys(mods) {
|
|
53
|
+
const rowKeys = /* @__PURE__ */ new Set();
|
|
54
54
|
const visit = (nodes) => nodes.forEach((m) => {
|
|
55
|
-
|
|
55
|
+
rowKeys.add(m.rowKey);
|
|
56
56
|
visit(m.subModifications);
|
|
57
57
|
});
|
|
58
58
|
visit(mods);
|
|
59
|
-
return
|
|
59
|
+
return rowKeys;
|
|
60
60
|
}
|
|
61
|
-
function pruneStaleSelection(selection,
|
|
62
|
-
const pruned = Object.fromEntries(Object.entries(selection).filter(([
|
|
61
|
+
function pruneStaleSelection(selection, allRowKeys) {
|
|
62
|
+
const pruned = Object.fromEntries(Object.entries(selection).filter(([rowKey]) => allRowKeys.has(rowKey)));
|
|
63
63
|
return Object.keys(pruned).length === Object.keys(selection).length ? selection : pruned;
|
|
64
64
|
}
|
|
65
65
|
function useModificationsSelection({
|
|
@@ -86,8 +86,8 @@ function useModificationsSelection({
|
|
|
86
86
|
useEffect(() => {
|
|
87
87
|
setRowSelection((prev) => {
|
|
88
88
|
const propagated = propagateSelectionToLoadedDescendants(prev, modifications);
|
|
89
|
-
const
|
|
90
|
-
return pruneStaleSelection(propagated,
|
|
89
|
+
const allRowKeys = collectAllRowKeys(modifications);
|
|
90
|
+
return pruneStaleSelection(propagated, allRowKeys);
|
|
91
91
|
});
|
|
92
92
|
}, [modifications]);
|
|
93
93
|
return { rowSelection, onRowSelectionChange, lastClickedRowId, emitSelection };
|
|
@@ -4,7 +4,10 @@ import { ComposedModificationMetadata, NetworkModificationMetadata } from '../..
|
|
|
4
4
|
export declare const MAX_COMPOSITE_NESTING_DEPTH = 5;
|
|
5
5
|
export declare const formatToComposedModification: (modifications: NetworkModificationMetadata[]) => ComposedModificationMetadata[];
|
|
6
6
|
export declare function isCompositeModification(modification: ComposedModificationMetadata | undefined): boolean;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function isReferenceModification(modification: ComposedModificationMetadata | undefined): boolean;
|
|
8
|
+
export declare function isTargetChildOfReference(targetRow: {
|
|
9
|
+
original: ComposedModificationMetadata;
|
|
10
|
+
}): boolean;
|
|
8
11
|
export declare function findDepth(mods: ComposedModificationMetadata[], uuid: UUID, currentDepth?: number): number;
|
|
9
12
|
export declare function removeUuidsFromTree(mods: ComposedModificationMetadata[], uuidsToRemove: Set<string>): ComposedModificationMetadata[];
|
|
10
13
|
/**
|
|
@@ -13,14 +16,14 @@ export declare function removeUuidsFromTree(mods: ComposedModificationMetadata[]
|
|
|
13
16
|
* @param composites result : all the composite modifications found
|
|
14
17
|
*/
|
|
15
18
|
export declare function findAllLoadedCompositeModifications(modifications: ComposedModificationMetadata[], composites: ComposedModificationMetadata[]): void;
|
|
16
|
-
export declare function findModificationInTree(
|
|
19
|
+
export declare function findModificationInTree(rowKey: UUID, mods: ComposedModificationMetadata[]): ComposedModificationMetadata | undefined;
|
|
17
20
|
/**
|
|
18
|
-
* in the tree, replaces the sub-modifications of '
|
|
19
|
-
* @param
|
|
20
|
-
* @param subModifications new subModifications of
|
|
21
|
+
* in the tree, replaces the sub-modifications of 'parentRowKey' with 'subModifications' and returns the result
|
|
22
|
+
* @param parentRowKey
|
|
23
|
+
* @param subModifications new subModifications of parentRowKey
|
|
21
24
|
* @param tree all the modifications of the tree
|
|
22
25
|
*/
|
|
23
|
-
export declare function updateSubModificationsOfACompositeInTree(
|
|
26
|
+
export declare function updateSubModificationsOfACompositeInTree(parentRowKey: UUID, subModifications: ComposedModificationMetadata[], tree: ComposedModificationMetadata[]): ComposedModificationMetadata[];
|
|
24
27
|
/**
|
|
25
28
|
* Recursively merges already-loaded subModifications from the previous tree into a freshly
|
|
26
29
|
* formatted tree (where all subModifications start as []). This ensures that when `modifications`
|
|
@@ -33,12 +36,17 @@ export declare function mergeSubModificationsIntoTree(nextMods: ComposedModifica
|
|
|
33
36
|
*/
|
|
34
37
|
export declare function updateModificationFieldInTree(uuid: string, fields: Partial<ComposedModificationMetadata>, mods: ComposedModificationMetadata[]): ComposedModificationMetadata[];
|
|
35
38
|
/**
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
39
|
+
* @param movingRowKey moved submodification's internal row key
|
|
40
|
+
* @param sourceParentRowKey composite from which movingRowKey comes from. null if movingRowKey is at the root level
|
|
41
|
+
* @param targetParentRowKey composite where movingRowKey is moved. null if movingRowKey is moved to the root level
|
|
42
|
+
* @param beforeRowKey movingRowKey is moved just before beforeRowKey. If null, movingRowKey is moved to the end.
|
|
40
43
|
* @param mods all the network modifications of the tree
|
|
41
44
|
* @return mods updated according to the moved submodification
|
|
42
45
|
*/
|
|
43
|
-
export declare function moveSubModificationInTree(
|
|
44
|
-
|
|
46
|
+
export declare function moveSubModificationInTree(movingRowKey: UUID, sourceParentRowKey: UUID | null, targetParentRowKey: UUID | null, beforeRowKey: UUID | null, mods: ComposedModificationMetadata[]): ComposedModificationMetadata[];
|
|
47
|
+
/**
|
|
48
|
+
* @param expandedRowKeys rowKeys of the rows that were just expanded — this is exactly what
|
|
49
|
+
* ExpandedState is keyed by now, since getRowId returns row.rowKey, so no translation is needed
|
|
50
|
+
* at the call site (unlike the previous resolveUuidFromRowId path-parsing scheme, now removed).
|
|
51
|
+
*/
|
|
52
|
+
export declare function fetchSubModificationsForExpandedRows(expandedRowKeys: UUID[], mods: ComposedModificationMetadata[], setMods: Dispatch<SetStateAction<ComposedModificationMetadata[]>>, force?: boolean): Promise<void>;
|