@gridsuite/commons-ui 0.276.0 → 0.278.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/features/index.js +2 -2
- package/dist/features/network-modification-table/index.js +2 -2
- package/dist/features/network-modification-table/row/modification-row.js +68 -76
- package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +23 -14
- package/dist/features/network-modification-table/utils.d.ts +1 -3
- package/dist/features/network-modification-table/utils.js +9 -7
- package/dist/features/network-modifications/common/properties/properties.type.d.ts +3 -0
- package/dist/features/network-modifications/common/properties/propertyUtils.d.ts +3 -3
- package/dist/features/network-modifications/common/properties/propertyUtils.js +2 -2
- package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.d.ts +1 -25
- package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +8 -3
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/features/index.js
CHANGED
|
@@ -270,7 +270,7 @@ import { SelectHeaderCell } from "./network-modification-table/renderers/select-
|
|
|
270
270
|
import { SwitchCell } from "./network-modification-table/renderers/switch-cell.js";
|
|
271
271
|
import { DragCloneRow } from "./network-modification-table/row/drag-row-clone.js";
|
|
272
272
|
import { ModificationRow } from "./network-modification-table/row/modification-row.js";
|
|
273
|
-
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, isReferenceModification,
|
|
273
|
+
import { MAX_COMPOSITE_NESTING_DEPTH, containsReferenceModification, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, isReferenceModification, mergeSubModificationsIntoTree, moveSubModificationInTree, removeUuidsFromTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./network-modification-table/utils.js";
|
|
274
274
|
import { AnnouncementBanner } from "./announcement/AnnouncementBanner.js";
|
|
275
275
|
import { AnnouncementNotification } from "./announcement/AnnouncementNotification.js";
|
|
276
276
|
import { useGlobalAnnouncement } from "./announcement/useGlobalAnnouncement.js";
|
|
@@ -719,6 +719,7 @@ export {
|
|
|
719
719
|
computeRatioTapChangerRegulationMode,
|
|
720
720
|
computeSwitchedOnValue,
|
|
721
721
|
computeTagMinSize,
|
|
722
|
+
containsReferenceModification,
|
|
722
723
|
convertFilterValues,
|
|
723
724
|
convertLimitsToOperationalLimitsGroupFormSchema,
|
|
724
725
|
convertToLineSegmentInfos,
|
|
@@ -924,7 +925,6 @@ export {
|
|
|
924
925
|
isEditingGlobalFilter,
|
|
925
926
|
isProcessType,
|
|
926
927
|
isReferenceModification,
|
|
927
|
-
isTargetChildOfReference,
|
|
928
928
|
isValidComputingType,
|
|
929
929
|
isValidContingencyRow,
|
|
930
930
|
italicFontTextField,
|
|
@@ -14,7 +14,7 @@ import { SelectHeaderCell } from "./renderers/select-header-cell.js";
|
|
|
14
14
|
import { SwitchCell } from "./renderers/switch-cell.js";
|
|
15
15
|
import { DragCloneRow } from "./row/drag-row-clone.js";
|
|
16
16
|
import { ModificationRow } from "./row/modification-row.js";
|
|
17
|
-
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, isReferenceModification,
|
|
17
|
+
import { MAX_COMPOSITE_NESTING_DEPTH, containsReferenceModification, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, isReferenceModification, mergeSubModificationsIntoTree, moveSubModificationInTree, removeUuidsFromTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./utils.js";
|
|
18
18
|
export {
|
|
19
19
|
AUTO_EXTENSIBLE_COLUMNS,
|
|
20
20
|
BASE_MODIFICATION_TABLE_COLUMNS,
|
|
@@ -49,6 +49,7 @@ export {
|
|
|
49
49
|
SwitchCell,
|
|
50
50
|
SwitchCellRenderer,
|
|
51
51
|
computeTagMinSize,
|
|
52
|
+
containsReferenceModification,
|
|
52
53
|
createCellBorderColor,
|
|
53
54
|
createCellContentWrapperSx,
|
|
54
55
|
createCellStyle,
|
|
@@ -66,7 +67,6 @@ export {
|
|
|
66
67
|
formatToComposedModification,
|
|
67
68
|
isCompositeModification,
|
|
68
69
|
isReferenceModification,
|
|
69
|
-
isTargetChildOfReference,
|
|
70
70
|
mergeSubModificationsIntoTree,
|
|
71
71
|
moveSubModificationInTree,
|
|
72
72
|
networkModificationTableStyles,
|
|
@@ -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, isReferenceModification
|
|
9
|
+
import { isCompositeModification, isReferenceModification } from "../utils.js";
|
|
10
10
|
import "../../../utils/conversionUtils.js";
|
|
11
11
|
import "../../../utils/types/equipmentType.js";
|
|
12
12
|
import "@mui/icons-material";
|
|
@@ -30,84 +30,76 @@ 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
|
-
|
|
65
|
-
return /* @__PURE__ */ jsx(
|
|
66
|
-
TableCell,
|
|
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.id,
|
|
41
|
+
sx: mergeSx(
|
|
42
|
+
networkModificationTableStyles.tableRow,
|
|
43
|
+
createRowSx(
|
|
44
|
+
theme,
|
|
45
|
+
isHighlighted,
|
|
46
|
+
snapshot.isDragging,
|
|
47
|
+
virtualRow,
|
|
48
|
+
row.depth,
|
|
49
|
+
isCompositeModification(row.original) || isReferenceModification(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,
|
|
67
65
|
{
|
|
68
|
-
sx:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
})
|
|
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
|
+
);
|
|
106
86
|
}
|
|
107
|
-
|
|
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
|
+
})
|
|
108
100
|
}
|
|
109
|
-
|
|
110
|
-
);
|
|
101
|
+
);
|
|
102
|
+
} });
|
|
111
103
|
}
|
|
112
104
|
export {
|
|
113
105
|
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, isReferenceModification,
|
|
10
|
+
import { isCompositeModification, isReferenceModification, MAX_COMPOSITE_NESTING_DEPTH, findModificationInTree, containsReferenceModification, 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";
|
|
@@ -55,7 +55,7 @@ const useModificationsDragAndDrop = ({
|
|
|
55
55
|
}) => {
|
|
56
56
|
const { snackError } = useSnackMessage();
|
|
57
57
|
const { rows } = table.getRowModel();
|
|
58
|
-
const
|
|
58
|
+
const computeIsDraggingDown = useCallback(
|
|
59
59
|
(sourceRow, targetRow) => {
|
|
60
60
|
const sourceRowIndex = table.getRowModel().flatRows.findIndex((row) => {
|
|
61
61
|
return row.id === sourceRow.id;
|
|
@@ -63,26 +63,35 @@ const useModificationsDragAndDrop = ({
|
|
|
63
63
|
const targetRowIndex = table.getRowModel().flatRows.findIndex((row) => {
|
|
64
64
|
return row.id === targetRow.id;
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
return isCompositeModification(targetRow.original) && targetRow.getIsExpanded() && isDraggingDown ? targetRow.depth + 1 : targetRow.depth;
|
|
66
|
+
return sourceRowIndex < targetRowIndex;
|
|
68
67
|
},
|
|
69
68
|
[table]
|
|
70
69
|
);
|
|
70
|
+
const computeTargetDepth = useCallback(
|
|
71
|
+
(sourceRow, targetRow) => {
|
|
72
|
+
const isDraggingDown = computeIsDraggingDown(sourceRow, targetRow);
|
|
73
|
+
return isCompositeModification(targetRow.original) && targetRow.getIsExpanded() && isDraggingDown ? targetRow.depth + 1 : targetRow.depth;
|
|
74
|
+
},
|
|
75
|
+
[computeIsDraggingDown]
|
|
76
|
+
);
|
|
71
77
|
const isDropForbidden = useCallback(
|
|
72
78
|
(sourceRow, targetRow) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
79
|
+
const sourceIsCompositeOrReference = isCompositeModification(sourceRow.original) || isReferenceModification(sourceRow.original);
|
|
80
|
+
if (sourceIsCompositeOrReference) {
|
|
77
81
|
const targetDepth = computeTargetDepth(sourceRow, targetRow);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const exceedsNestingLimit = (sourceRow.original.maxDepth ?? 0) + targetDepth > MAX_COMPOSITE_NESTING_DEPTH;
|
|
83
|
+
const isSelfDrop = !!findModificationInTree(targetRow.id, [sourceRow.original]);
|
|
84
|
+
const isDraggingDown = computeIsDraggingDown(sourceRow, targetRow);
|
|
85
|
+
const entersTargetRowItself = (isCompositeModification(targetRow.original) || isReferenceModification(targetRow.original)) && targetRow.getIsExpanded() && isDraggingDown;
|
|
86
|
+
const enteringParent = entersTargetRowItself ? targetRow.original : targetRow.getParentRow()?.original;
|
|
87
|
+
const sourceCarriesReference = isReferenceModification(sourceRow.original) || containsReferenceModification(sourceRow.original);
|
|
88
|
+
const enteringSharedSubtree = isReferenceModification(enteringParent) || enteringParent?.childFromShared === true;
|
|
89
|
+
const isReferenceIntoReference = sourceCarriesReference && enteringSharedSubtree;
|
|
90
|
+
return exceedsNestingLimit || isSelfDrop || isReferenceIntoReference;
|
|
82
91
|
}
|
|
83
92
|
return false;
|
|
84
93
|
},
|
|
85
|
-
[computeTargetDepth]
|
|
94
|
+
[computeTargetDepth, computeIsDraggingDown]
|
|
86
95
|
);
|
|
87
96
|
const handleDragUpdate = useCallback(
|
|
88
97
|
(update) => {
|
|
@@ -125,7 +134,7 @@ const useModificationsDragAndDrop = ({
|
|
|
125
134
|
const sourceCompositeRowKey = sourceParent?.id ?? null;
|
|
126
135
|
const sourceContainerId = sourceParent?.original.uuid ?? null;
|
|
127
136
|
const isDraggingDown = destination.index > source.index;
|
|
128
|
-
const droppingIntoExpandedComposite = isDraggingDown && targetRow.getIsExpanded();
|
|
137
|
+
const droppingIntoExpandedComposite = isDraggingDown && isCompositeModification(targetRow.original) && targetRow.getIsExpanded();
|
|
129
138
|
const isSubRowInvolved = sourceRow.depth > 0 || targetRow.depth > 0;
|
|
130
139
|
const targetComposite = resolveTargetComposite(droppingIntoExpandedComposite, targetRow);
|
|
131
140
|
const targetContainerId = targetComposite.uuid;
|
|
@@ -5,9 +5,7 @@ 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
7
|
export declare function isReferenceModification(modification: ComposedModificationMetadata | undefined): boolean;
|
|
8
|
-
export declare function
|
|
9
|
-
original: ComposedModificationMetadata;
|
|
10
|
-
}): boolean;
|
|
8
|
+
export declare function containsReferenceModification(modification: ComposedModificationMetadata | undefined): boolean;
|
|
11
9
|
export declare function findDepth(mods: ComposedModificationMetadata[], uuid: UUID, currentDepth?: number): number;
|
|
12
10
|
export declare function removeUuidsFromTree(mods: ComposedModificationMetadata[], uuidsToRemove: Set<string>): ComposedModificationMetadata[];
|
|
13
11
|
/**
|
|
@@ -18,6 +18,14 @@ function isCompositeModification(modification) {
|
|
|
18
18
|
function isReferenceModification(modification) {
|
|
19
19
|
return modification?.type === MODIFICATION_TYPES.MODIFICATION_REFERENCE.type;
|
|
20
20
|
}
|
|
21
|
+
function containsReferenceModification(modification) {
|
|
22
|
+
if (!modification) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return modification.subModifications.some(
|
|
26
|
+
(sub) => isReferenceModification(sub) || containsReferenceModification(sub)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
21
29
|
function normalizeReferenceChild(child) {
|
|
22
30
|
return {
|
|
23
31
|
...child,
|
|
@@ -25,12 +33,6 @@ function normalizeReferenceChild(child) {
|
|
|
25
33
|
messageValues: child.messageValues ?? "{}"
|
|
26
34
|
};
|
|
27
35
|
}
|
|
28
|
-
function isTargetChildOfReference(targetRow) {
|
|
29
|
-
if (targetRow.original.childFromShared === true) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
36
|
function extractReferenceChildren(detail) {
|
|
35
37
|
const referenceInfos = detail?.referenceInfos;
|
|
36
38
|
if (!referenceInfos) {
|
|
@@ -224,6 +226,7 @@ async function fetchSubModificationsForExpandedRows(expandedRowKeys, mods, setMo
|
|
|
224
226
|
}
|
|
225
227
|
export {
|
|
226
228
|
MAX_COMPOSITE_NESTING_DEPTH,
|
|
229
|
+
containsReferenceModification,
|
|
227
230
|
fetchSubModificationsForExpandedRows,
|
|
228
231
|
findAllLoadedCompositeModifications,
|
|
229
232
|
findDepth,
|
|
@@ -231,7 +234,6 @@ export {
|
|
|
231
234
|
formatToComposedModification,
|
|
232
235
|
isCompositeModification,
|
|
233
236
|
isReferenceModification,
|
|
234
|
-
isTargetChildOfReference,
|
|
235
237
|
mergeSubModificationsIntoTree,
|
|
236
238
|
moveSubModificationInTree,
|
|
237
239
|
removeUuidsFromTree,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PredefinedProperties } from '../../../../utils';
|
|
2
|
-
import { FilledProperty, Properties, Property } from './properties.type';
|
|
2
|
+
import { FilledProperties, FilledProperty, Properties, Property } from './properties.type';
|
|
3
3
|
export type EquipmentWithProperties = {
|
|
4
4
|
properties?: Record<string, string>;
|
|
5
5
|
};
|
|
@@ -7,9 +7,9 @@ export declare const fetchPredefinedProperties: (networkElementType: string) =>
|
|
|
7
7
|
export declare const emptyProperties: Properties;
|
|
8
8
|
export declare const createPropertyModification: (name: string, value: string | null) => Property;
|
|
9
9
|
export declare const initializedProperty: () => Property;
|
|
10
|
-
export declare const getFilledPropertiesFromModification: (properties: Property[] | undefined | null) => FilledProperty[];
|
|
10
|
+
export declare const getFilledPropertiesFromModification: (properties: Property[] | undefined | null, includePreviousValue?: boolean) => FilledProperty[];
|
|
11
11
|
export declare const getPropertiesFromModification: (properties: Property[] | undefined | null, includePreviousValue?: boolean) => Properties;
|
|
12
|
-
export declare const copyEquipmentPropertiesForCreation: (equipmentInfos: EquipmentWithProperties) =>
|
|
12
|
+
export declare const copyEquipmentPropertiesForCreation: (equipmentInfos: EquipmentWithProperties) => FilledProperties;
|
|
13
13
|
export declare const mergeModificationAndEquipmentProperties: (modificationProperties: Property[], equipment: EquipmentWithProperties) => Property[];
|
|
14
14
|
export declare function getConcatenatedProperties(equipment: EquipmentWithProperties, getValues: (name: string) => any, id?: string): any;
|
|
15
15
|
export declare const toModificationProperties: (properties: Properties) => Property[] | null;
|
|
@@ -29,12 +29,12 @@ const initializedProperty = () => {
|
|
|
29
29
|
const isFilledProperty = (property) => {
|
|
30
30
|
return property.value != null;
|
|
31
31
|
};
|
|
32
|
-
const getFilledPropertiesFromModification = (properties) => {
|
|
32
|
+
const getFilledPropertiesFromModification = (properties, includePreviousValue = true) => {
|
|
33
33
|
return properties?.filter(isFilledProperty).map((p) => {
|
|
34
34
|
return {
|
|
35
35
|
[FieldConstants.NAME]: p[FieldConstants.NAME],
|
|
36
36
|
[FieldConstants.VALUE]: p[FieldConstants.VALUE],
|
|
37
|
-
[FieldConstants.PREVIOUS_VALUE]: p[FieldConstants.PREVIOUS_VALUE],
|
|
37
|
+
[FieldConstants.PREVIOUS_VALUE]: includePreviousValue ? p[FieldConstants.PREVIOUS_VALUE] : void 0,
|
|
38
38
|
[FieldConstants.ADDED]: p[FieldConstants.ADDED],
|
|
39
39
|
[FieldConstants.DELETION_MARK]: p[FieldConstants.DELETION_MARK]
|
|
40
40
|
};
|
package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.d.ts
CHANGED
|
@@ -118,28 +118,4 @@ export declare const voltageLevelCreationEmptyFormData: {
|
|
|
118
118
|
};
|
|
119
119
|
export declare const voltageLevelCreationFormToDto: (voltageLevelForm: VoltageLevelCreationFormData) => VoltageLevelCreationDto;
|
|
120
120
|
export declare const translateSwitchKinds: (switchKinds: SwitchKind[] | null, intl?: IntlShape) => string;
|
|
121
|
-
export declare const voltageLevelCreationDtoToForm: (voltageLevelDto: VoltageLevelCreationDto, intl?: IntlShape, includePreviousValue?: boolean) =>
|
|
122
|
-
AdditionalProperties?: import('../..').Property[];
|
|
123
|
-
equipmentID: string;
|
|
124
|
-
equipmentName: string;
|
|
125
|
-
substationId: string | null;
|
|
126
|
-
nominalV: number | null;
|
|
127
|
-
lowVoltageLimit: number | null;
|
|
128
|
-
highVoltageLimit: number | null;
|
|
129
|
-
lowShortCircuitCurrentLimit: any;
|
|
130
|
-
highShortCircuitCurrentLimit: any;
|
|
131
|
-
busbarCount: number;
|
|
132
|
-
sectionCount: number;
|
|
133
|
-
switchesBetweenSections: string;
|
|
134
|
-
couplingOmnibus: import('./voltageLevelCreation.types').CouplingDevice[];
|
|
135
|
-
switchKinds: {
|
|
136
|
-
switchKind: SwitchKind;
|
|
137
|
-
}[];
|
|
138
|
-
addSubstationCreationId: boolean;
|
|
139
|
-
substationCreationId: string | null;
|
|
140
|
-
substationName: string | null;
|
|
141
|
-
country: string | null;
|
|
142
|
-
substationCreation: import('../..').Properties;
|
|
143
|
-
hideNominalVoltage: boolean;
|
|
144
|
-
hideBusBarSection: boolean;
|
|
145
|
-
};
|
|
121
|
+
export declare const voltageLevelCreationDtoToForm: (voltageLevelDto: VoltageLevelCreationDto, intl?: IntlShape, includePreviousValue?: boolean) => VoltageLevelCreationFormData;
|
package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { object, array, string, ref, number, boolean } from "yup";
|
|
2
|
-
import { creationPropertiesSchema,
|
|
2
|
+
import { creationPropertiesSchema, getFilledPropertiesFromModification, toModificationProperties } from "../../common/properties/propertyUtils.js";
|
|
3
3
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
4
4
|
import { SHORT_CIRCUIT_CURRENT_LIMIT_MUST_BE_GREATER_OR_EQUAL_TO_ZERO, MUST_BE_GREATER_OR_EQUAL_TO_ZERO, CREATE_SUBSTATION_IN_VOLTAGE_LEVEL_IDENTICAL_ID } from "../../../../utils/constants/translationKeys.js";
|
|
5
5
|
import { convertInputValue, convertOutputValue } from "../../../../utils/conversionUtils.js";
|
|
@@ -234,7 +234,9 @@ const voltageLevelCreationFormToDto = (voltageLevelForm) => {
|
|
|
234
234
|
const translateSwitchKinds = (switchKinds, intl) => switchKinds?.map((kind) => intl ? intl.formatMessage({ id: kind }) : kind).join(" / ") ?? "";
|
|
235
235
|
const voltageLevelCreationDtoToForm = (voltageLevelDto, intl, includePreviousValue = true) => {
|
|
236
236
|
const isSubstationCreation = voltageLevelDto.substationCreation?.equipmentId != null;
|
|
237
|
-
const substationProperties =
|
|
237
|
+
const substationProperties = {
|
|
238
|
+
[FieldConstants.ADDITIONAL_PROPERTIES]: isSubstationCreation ? getFilledPropertiesFromModification(voltageLevelDto.substationCreation?.properties, includePreviousValue) : []
|
|
239
|
+
};
|
|
238
240
|
return {
|
|
239
241
|
[FieldConstants.EQUIPMENT_ID]: voltageLevelDto.equipmentId,
|
|
240
242
|
[FieldConstants.EQUIPMENT_NAME]: voltageLevelDto.equipmentName ?? "",
|
|
@@ -264,7 +266,10 @@ const voltageLevelCreationDtoToForm = (voltageLevelDto, intl, includePreviousVal
|
|
|
264
266
|
[FieldConstants.SUBSTATION_CREATION]: substationProperties,
|
|
265
267
|
[FieldConstants.HIDE_NOMINAL_VOLTAGE]: false,
|
|
266
268
|
[FieldConstants.HIDE_BUS_BAR_SECTION]: false,
|
|
267
|
-
|
|
269
|
+
[FieldConstants.ADDITIONAL_PROPERTIES]: getFilledPropertiesFromModification(
|
|
270
|
+
voltageLevelDto.properties,
|
|
271
|
+
includePreviousValue
|
|
272
|
+
)
|
|
268
273
|
};
|
|
269
274
|
};
|
|
270
275
|
export {
|
package/dist/index.js
CHANGED
|
@@ -466,7 +466,7 @@ import { SelectHeaderCell } from "./features/network-modification-table/renderer
|
|
|
466
466
|
import { SwitchCell } from "./features/network-modification-table/renderers/switch-cell.js";
|
|
467
467
|
import { DragCloneRow } from "./features/network-modification-table/row/drag-row-clone.js";
|
|
468
468
|
import { ModificationRow } from "./features/network-modification-table/row/modification-row.js";
|
|
469
|
-
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, isReferenceModification,
|
|
469
|
+
import { MAX_COMPOSITE_NESTING_DEPTH, containsReferenceModification, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, isReferenceModification, mergeSubModificationsIntoTree, moveSubModificationInTree, removeUuidsFromTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./features/network-modification-table/utils.js";
|
|
470
470
|
import { AnnouncementBanner } from "./features/announcement/AnnouncementBanner.js";
|
|
471
471
|
import { AnnouncementNotification } from "./features/announcement/AnnouncementNotification.js";
|
|
472
472
|
import { useGlobalAnnouncement } from "./features/announcement/useGlobalAnnouncement.js";
|
|
@@ -1348,6 +1348,7 @@ export {
|
|
|
1348
1348
|
computeSwitchedOnValue,
|
|
1349
1349
|
computeTagMinSize,
|
|
1350
1350
|
computeTolerance,
|
|
1351
|
+
containsReferenceModification,
|
|
1351
1352
|
convertFilterValues,
|
|
1352
1353
|
convertInputValue,
|
|
1353
1354
|
convertLimitsToOperationalLimitsGroupFormSchema,
|
|
@@ -1712,7 +1713,6 @@ export {
|
|
|
1712
1713
|
isProcessType,
|
|
1713
1714
|
isReferenceModification,
|
|
1714
1715
|
isStudyMetadata,
|
|
1715
|
-
isTargetChildOfReference,
|
|
1716
1716
|
isValidComputingType,
|
|
1717
1717
|
isValidContingencyRow,
|
|
1718
1718
|
italicFontTextField,
|