@gridsuite/commons-ui 0.229.0 → 0.231.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/customAGGrid/customAggrid.js +5 -3
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -1
- package/dist/features/index.js +2 -1
- package/dist/features/network-modification-table/index.js +2 -1
- package/dist/features/network-modification-table/network-modifications-table.js +27 -14
- package/dist/features/network-modification-table/renderers/name-cell.js +54 -9
- package/dist/features/network-modification-table/use-modifications-selection.js +18 -1
- package/dist/features/network-modification-table/utils.d.ts +1 -0
- package/dist/features/network-modification-table/utils.js +6 -0
- package/dist/index.js +2 -1
- package/package.json +6 -6
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
|
-
import { AgGridReact } from "ag-grid-react";
|
|
3
|
+
import { AgGridProvider, AgGridReact } from "ag-grid-react";
|
|
4
4
|
import "ag-grid-community/styles/ag-grid.css";
|
|
5
5
|
import "ag-grid-community/styles/ag-theme-alpine.css";
|
|
6
|
+
import { AllCommunityModule } from "ag-grid-community";
|
|
6
7
|
import { AG_GRID_LOCALE_EN, AG_GRID_LOCALE_FR } from "@ag-grid-community/locale";
|
|
7
8
|
import { useIntl } from "react-intl";
|
|
8
9
|
import { useTheme, Box } from "@mui/material";
|
|
9
10
|
import { mergeSx } from "../../../utils/styles.js";
|
|
10
11
|
import { CUSTOM_AGGRID_THEME, styles } from "./customAggrid.style.js";
|
|
11
12
|
import { LANG_ENGLISH, LANG_FRENCH } from "../../../utils/langs.js";
|
|
13
|
+
const modules = [AllCommunityModule];
|
|
12
14
|
function useAgGridLocale(overrideLocales) {
|
|
13
15
|
const intl = useIntl();
|
|
14
16
|
return useMemo(() => {
|
|
@@ -43,7 +45,7 @@ const CustomAGGrid = forwardRef(
|
|
|
43
45
|
component: "div",
|
|
44
46
|
sx: mergeSx(styles.grid, sx),
|
|
45
47
|
className: `${theme.aggrid.theme} ${CUSTOM_AGGRID_THEME}`,
|
|
46
|
-
children: /* @__PURE__ */ jsx(
|
|
48
|
+
children: /* @__PURE__ */ jsx(AgGridProvider, { modules, children: /* @__PURE__ */ jsx(
|
|
47
49
|
AgGridReact,
|
|
48
50
|
{
|
|
49
51
|
ref,
|
|
@@ -53,7 +55,7 @@ const CustomAGGrid = forwardRef(
|
|
|
53
55
|
theme: "legacy",
|
|
54
56
|
...agGridReactProps
|
|
55
57
|
}
|
|
56
|
-
)
|
|
58
|
+
) })
|
|
57
59
|
}
|
|
58
60
|
);
|
|
59
61
|
}
|
|
@@ -118,7 +118,7 @@ function ElementSaveDialog({
|
|
|
118
118
|
onClose();
|
|
119
119
|
}, [onClose, reset, initialOperation]);
|
|
120
120
|
useEffect(() => {
|
|
121
|
-
if (!isCreateMode) {
|
|
121
|
+
if (!isCreateMode || !defaultName && !prefixIdForGeneratedName) {
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
const name = defaultName ?? `${intl.formatMessage({ id: prefixIdForGeneratedName })}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
package/dist/features/index.js
CHANGED
|
@@ -197,7 +197,7 @@ import { SelectHeaderCell } from "./network-modification-table/renderers/select-
|
|
|
197
197
|
import { SwitchCell } from "./network-modification-table/renderers/switch-cell.js";
|
|
198
198
|
import { DragCloneRow } from "./network-modification-table/row/drag-row-clone.js";
|
|
199
199
|
import { ModificationRow } from "./network-modification-table/row/modification-row.js";
|
|
200
|
-
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, mergeSubModificationsIntoTree, moveSubModificationInTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./network-modification-table/utils.js";
|
|
200
|
+
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, mergeSubModificationsIntoTree, moveSubModificationInTree, removeUuidsFromTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./network-modification-table/utils.js";
|
|
201
201
|
import { AnnouncementBanner } from "./announcement/AnnouncementBanner.js";
|
|
202
202
|
import { AnnouncementNotification } from "./announcement/AnnouncementNotification.js";
|
|
203
203
|
import { useGlobalAnnouncement } from "./announcement/useGlobalAnnouncement.js";
|
|
@@ -654,6 +654,7 @@ export {
|
|
|
654
654
|
networkModificationTableStyles,
|
|
655
655
|
newEquipmentDeletionDto,
|
|
656
656
|
onlyStartedGeneratorsOptions,
|
|
657
|
+
removeUuidsFromTree,
|
|
657
658
|
sanitizePercentageValue,
|
|
658
659
|
setCurrentReactiveCapabilityCurveTable,
|
|
659
660
|
setSelectedReactiveLimits,
|
|
@@ -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, mergeSubModificationsIntoTree, moveSubModificationInTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./utils.js";
|
|
17
|
+
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, mergeSubModificationsIntoTree, moveSubModificationInTree, removeUuidsFromTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./utils.js";
|
|
18
18
|
export {
|
|
19
19
|
AUTO_EXTENSIBLE_COLUMNS,
|
|
20
20
|
BASE_MODIFICATION_TABLE_COLUMNS,
|
|
@@ -67,6 +67,7 @@ export {
|
|
|
67
67
|
mergeSubModificationsIntoTree,
|
|
68
68
|
moveSubModificationInTree,
|
|
69
69
|
networkModificationTableStyles,
|
|
70
|
+
removeUuidsFromTree,
|
|
70
71
|
updateModificationFieldInTree,
|
|
71
72
|
updateSubModificationsOfACompositeInTree,
|
|
72
73
|
useModificationsDragAndDrop
|
|
@@ -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, findAllLoadedCompositeModifications, fetchSubModificationsForExpandedRows, isCompositeModification } from "./utils.js";
|
|
11
|
+
import { formatToComposedModification, findDepth, MAX_COMPOSITE_NESTING_DEPTH, mergeSubModificationsIntoTree, removeUuidsFromTree, findAllLoadedCompositeModifications, fetchSubModificationsForExpandedRows, isCompositeModification } from "./utils.js";
|
|
12
12
|
import "@mui/icons-material";
|
|
13
13
|
import "react-intl";
|
|
14
14
|
import "../../utils/conversionUtils.js";
|
|
@@ -51,6 +51,14 @@ function NetworkModificationsTable({
|
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
composedModificationsRef.current = composedModifications;
|
|
53
53
|
}, [composedModifications]);
|
|
54
|
+
const modificationToEditLabelRef = useRef(modificationToEditLabel);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
modificationToEditLabelRef.current = modificationToEditLabel;
|
|
57
|
+
}, [modificationToEditLabel]);
|
|
58
|
+
const highlightedModificationUuidRef = useRef(highlightedModificationUuid);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
highlightedModificationUuidRef.current = highlightedModificationUuid;
|
|
61
|
+
}, [highlightedModificationUuid]);
|
|
54
62
|
const isAssemblyDepthExceeded = useCallback((rows2) => {
|
|
55
63
|
if (rows2.length === 0) return false;
|
|
56
64
|
const firstSelectedRowDepth = findDepth(composedModificationsRef.current, rows2[0].uuid);
|
|
@@ -67,18 +75,22 @@ function NetworkModificationsTable({
|
|
|
67
75
|
onRowSelected: handleRowSelected
|
|
68
76
|
});
|
|
69
77
|
useEffect(() => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
const prevMods = composedModificationsRef.current;
|
|
79
|
+
const newTopLevelUuids = new Set(modifications.map((m) => m.uuid));
|
|
80
|
+
const nextMods = mergeSubModificationsIntoTree(formatToComposedModification(modifications), prevMods).map(
|
|
81
|
+
(mod) => mod.subModifications.length > 0 ? { ...mod, subModifications: removeUuidsFromTree(mod.subModifications, newTopLevelUuids) } : mod
|
|
82
|
+
);
|
|
83
|
+
setComposedModifications(nextMods);
|
|
84
|
+
const loadedComposites = [];
|
|
85
|
+
findAllLoadedCompositeModifications(prevMods, loadedComposites);
|
|
86
|
+
if (loadedComposites.length > 0) {
|
|
74
87
|
fetchSubModificationsForExpandedRows(
|
|
75
|
-
|
|
88
|
+
loadedComposites.map((m) => m.uuid),
|
|
76
89
|
nextMods,
|
|
77
90
|
setComposedModifications,
|
|
78
91
|
true
|
|
79
92
|
);
|
|
80
|
-
|
|
81
|
-
});
|
|
93
|
+
}
|
|
82
94
|
}, [modifications]);
|
|
83
95
|
const handleExpandRow = useCallback((updater) => {
|
|
84
96
|
setExpanded((prevExpanded) => {
|
|
@@ -110,7 +122,7 @@ function NetworkModificationsTable({
|
|
|
110
122
|
lastClickedRowId,
|
|
111
123
|
onRowSelected: handleRowSelected,
|
|
112
124
|
isRowDragDisabled,
|
|
113
|
-
modificationToEditLabel
|
|
125
|
+
modificationToEditLabel: modificationToEditLabelRef
|
|
114
126
|
},
|
|
115
127
|
status: {
|
|
116
128
|
isImpactedByNotification,
|
|
@@ -130,7 +142,7 @@ function NetworkModificationsTable({
|
|
|
130
142
|
setModificationsToExclude,
|
|
131
143
|
lastClickedRowId,
|
|
132
144
|
handleRowSelected,
|
|
133
|
-
|
|
145
|
+
modificationToEditLabelRef,
|
|
134
146
|
isRowDragDisabled,
|
|
135
147
|
isImpactedByNotification,
|
|
136
148
|
notificationMessageId,
|
|
@@ -210,13 +222,14 @@ function NetworkModificationsTable({
|
|
|
210
222
|
lastClickedRowId.current = null;
|
|
211
223
|
}, [lastClickedRowId, table, currentNodeId]);
|
|
212
224
|
useEffect(() => {
|
|
213
|
-
if (
|
|
214
|
-
const rowIndex = rows.findIndex((row) => row.original.uuid ===
|
|
225
|
+
if (highlightedModificationUuidRef.current && containerRef.current) {
|
|
226
|
+
const rowIndex = rows.findIndex((row) => row.original.uuid === highlightedModificationUuidRef.current);
|
|
215
227
|
if (rowIndex !== -1) {
|
|
216
|
-
virtualizer.scrollToIndex(rowIndex, { align: "
|
|
228
|
+
virtualizer.scrollToIndex(rowIndex, { align: "center", behavior: "auto" });
|
|
229
|
+
highlightedModificationUuidRef.current = null;
|
|
217
230
|
}
|
|
218
231
|
}
|
|
219
|
-
}, [
|
|
232
|
+
}, [highlightedModificationUuidRef, rows, virtualizer]);
|
|
220
233
|
return /* @__PURE__ */ jsx(DragDropContext, { onDragEnd: handleDragEnd, onDragStart: onRowDragStart, onDragUpdate: handleDragUpdate, children: /* @__PURE__ */ jsx(Box, { sx: networkModificationTableStyles.tableWrapper, children: /* @__PURE__ */ jsx(Droppable, { droppableId: "modifications-table", mode: "virtual", renderClone, children: (provided) => /* @__PURE__ */ jsx(Box, { ref: containerRef, sx: networkModificationTableStyles.container, children: /* @__PURE__ */ jsxs(Table, { sx: networkModificationTableStyles.table, children: [
|
|
221
234
|
/* @__PURE__ */ jsx(TableHead, { sx: networkModificationTableStyles.thead, children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { sx: networkModificationTableStyles.tableRow, children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(
|
|
222
235
|
TableCell,
|
|
@@ -3,19 +3,59 @@ import { useCallback, useMemo, useState, useEffect, useRef } from "react";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { useTheme, Box, IconButton, InputBase } from "@mui/material";
|
|
5
5
|
import { KeyboardArrowDown, KeyboardArrowRight } from "@mui/icons-material";
|
|
6
|
-
import
|
|
7
|
-
import { networkModificationTableStyles, createNameCellLabelBoxSx, createModificationNameCellStyle, createNameCellRootStyle } from "../network-modification-table-styles.js";
|
|
8
|
-
import { DepthBox } from "./depth-box.js";
|
|
9
|
-
import { isCompositeModification } from "../utils.js";
|
|
10
|
-
import { useModificationLabelComputer } from "../../../hooks/useModificationLabelComputer.js";
|
|
6
|
+
import "../../../components/ui/overflowableText/OverflowableText.js";
|
|
11
7
|
import "../../../utils/conversionUtils.js";
|
|
12
8
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
13
9
|
import "../../../utils/types/equipmentType.js";
|
|
14
10
|
import { mergeSx } from "../../../utils/styles.js";
|
|
11
|
+
import "react-hook-form";
|
|
12
|
+
import { useModificationLabelComputer } from "../../../hooks/useModificationLabelComputer.js";
|
|
15
13
|
import "localized-countries";
|
|
16
14
|
import "localized-countries/data/fr";
|
|
17
15
|
import "localized-countries/data/en";
|
|
18
16
|
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
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.svg?react";
|
|
27
|
+
import "../../../components/ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
28
|
+
import "../../../components/ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
29
|
+
import "@hello-pangea/dnd";
|
|
30
|
+
import "../../../components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
31
|
+
import "../../../components/ui/snackbarProvider/SnackbarProvider.js";
|
|
32
|
+
import "mui-nested-menu";
|
|
33
|
+
import "react-resizable-panels";
|
|
34
|
+
import "react-papaparse";
|
|
35
|
+
import "react-dom";
|
|
36
|
+
import "autosuggest-highlight/match";
|
|
37
|
+
import "autosuggest-highlight/parse";
|
|
38
|
+
import "clsx";
|
|
39
|
+
import "../../../components/composite/filter/FilterCreationDialog.js";
|
|
40
|
+
import "../../../components/composite/filter/HeaderFilterForm.js";
|
|
41
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
42
|
+
import "../../../components/composite/filter/expert/ExpertFilterForm.js";
|
|
43
|
+
import "../../../components/composite/filter/expert/ExpertFilterEditionDialog.js";
|
|
44
|
+
import "../../../components/composite/filter/expert/expertFilterConstants.js";
|
|
45
|
+
import "react-querybuilder";
|
|
46
|
+
import "uuid";
|
|
47
|
+
import "../../../components/composite/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
48
|
+
import "../../../components/composite/filter/utils/filterFormUtils.js";
|
|
49
|
+
import "@react-querybuilder/material";
|
|
50
|
+
import "../../../components/composite/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
51
|
+
import "../../../components/composite/reactQueryBuilder/PropertyValueEditor.js";
|
|
52
|
+
import "../../../components/composite/agGridTable/BottomTableButtons.js";
|
|
53
|
+
import "../../../components/composite/agGridTable/CustomAgGridTable.js";
|
|
54
|
+
import "ag-grid-community";
|
|
55
|
+
import "../../../components/composite/customAGGrid/customAggrid.js";
|
|
56
|
+
import { networkModificationTableStyles, createNameCellLabelBoxSx, createModificationNameCellStyle, createNameCellRootStyle } from "../network-modification-table-styles.js";
|
|
57
|
+
import { DepthBox } from "./depth-box.js";
|
|
58
|
+
import { isCompositeModification } from "../utils.js";
|
|
19
59
|
const MIN_CHAR_WIDTH = 30;
|
|
20
60
|
function measureTextPx(text, font) {
|
|
21
61
|
const ctx = document.createElement("canvas").getContext("2d");
|
|
@@ -26,13 +66,13 @@ function measureTextPx(text, font) {
|
|
|
26
66
|
return text.length * 8;
|
|
27
67
|
}
|
|
28
68
|
function NameCell({ row, table, onChange }) {
|
|
69
|
+
const { meta } = table.options;
|
|
29
70
|
const intl = useIntl();
|
|
30
71
|
const theme = useTheme();
|
|
31
72
|
const { computeLabel } = useModificationLabelComputer();
|
|
32
73
|
const { snackError } = useSnackMessage();
|
|
33
74
|
const { depth } = row;
|
|
34
75
|
const isComposite = isCompositeModification(row.original);
|
|
35
|
-
const modificationToEditLabel = table.options.meta?.interaction.modificationToEditLabel;
|
|
36
76
|
const getModificationLabel = useCallback(
|
|
37
77
|
(modification, formatBold = true) => {
|
|
38
78
|
return intl.formatMessage(
|
|
@@ -106,11 +146,16 @@ function NameCell({ row, table, onChange }) {
|
|
|
106
146
|
inputRef.current?.select();
|
|
107
147
|
});
|
|
108
148
|
}, []);
|
|
149
|
+
const defaultCompositeName = useMemo(() => intl.formatMessage({ id: "CompositeModification" }), [intl]);
|
|
109
150
|
useEffect(() => {
|
|
110
|
-
|
|
111
|
-
|
|
151
|
+
const modificationToEditLabel = meta?.interaction.modificationToEditLabel.current;
|
|
152
|
+
if (isComposite && !isEditingRef.current && modificationToEditLabel === row.original.uuid) {
|
|
153
|
+
beginEditingName(defaultCompositeName);
|
|
154
|
+
if (meta) {
|
|
155
|
+
meta.interaction.modificationToEditLabel.current = null;
|
|
156
|
+
}
|
|
112
157
|
}
|
|
113
|
-
}, [
|
|
158
|
+
}, [meta, defaultCompositeName, isComposite, row.original.uuid, beginEditingName]);
|
|
114
159
|
const handleLabelClick = useCallback(
|
|
115
160
|
(e) => {
|
|
116
161
|
e.stopPropagation();
|
|
@@ -49,6 +49,19 @@ function propagateSelectionToLoadedDescendants(selection, roots) {
|
|
|
49
49
|
roots.forEach((root) => visit(root, false));
|
|
50
50
|
return mutated ? next : selection;
|
|
51
51
|
}
|
|
52
|
+
function collectAllUuids(mods) {
|
|
53
|
+
const uuids = /* @__PURE__ */ new Set();
|
|
54
|
+
const visit = (nodes) => nodes.forEach((m) => {
|
|
55
|
+
uuids.add(m.uuid);
|
|
56
|
+
visit(m.subModifications);
|
|
57
|
+
});
|
|
58
|
+
visit(mods);
|
|
59
|
+
return uuids;
|
|
60
|
+
}
|
|
61
|
+
function pruneStaleSelection(selection, allUuids) {
|
|
62
|
+
const pruned = Object.fromEntries(Object.entries(selection).filter(([uuid]) => allUuids.has(uuid)));
|
|
63
|
+
return Object.keys(pruned).length === Object.keys(selection).length ? selection : pruned;
|
|
64
|
+
}
|
|
52
65
|
function useModificationsSelection({
|
|
53
66
|
modifications,
|
|
54
67
|
onRowSelected
|
|
@@ -71,7 +84,11 @@ function useModificationsSelection({
|
|
|
71
84
|
[onRowSelected]
|
|
72
85
|
);
|
|
73
86
|
useEffect(() => {
|
|
74
|
-
setRowSelection((prev) =>
|
|
87
|
+
setRowSelection((prev) => {
|
|
88
|
+
const propagated = propagateSelectionToLoadedDescendants(prev, modifications);
|
|
89
|
+
const allUuids = collectAllUuids(modifications);
|
|
90
|
+
return pruneStaleSelection(propagated, allUuids);
|
|
91
|
+
});
|
|
75
92
|
}, [modifications]);
|
|
76
93
|
return { rowSelection, onRowSelectionChange, lastClickedRowId, emitSelection };
|
|
77
94
|
}
|
|
@@ -5,6 +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 findDepth(mods: ComposedModificationMetadata[], uuid: UUID, currentDepth?: number): number;
|
|
8
|
+
export declare function removeUuidsFromTree(mods: ComposedModificationMetadata[], uuidsToRemove: Set<string>): ComposedModificationMetadata[];
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
10
11
|
* @param modifications source where the composite modifications are looked for
|
|
@@ -21,6 +21,11 @@ function findDepth(mods, uuid, currentDepth = 0) {
|
|
|
21
21
|
}
|
|
22
22
|
return -1;
|
|
23
23
|
}
|
|
24
|
+
function removeUuidsFromTree(mods, uuidsToRemove) {
|
|
25
|
+
return mods.filter((m) => !uuidsToRemove.has(m.uuid)).map(
|
|
26
|
+
(m) => m.subModifications.length > 0 ? { ...m, subModifications: removeUuidsFromTree(m.subModifications, uuidsToRemove) } : m
|
|
27
|
+
);
|
|
28
|
+
}
|
|
24
29
|
function findAllLoadedCompositeModifications(modifications, composites) {
|
|
25
30
|
modifications.forEach((modification) => {
|
|
26
31
|
if (isCompositeModification(modification) && modification.subModifications.length > 0) {
|
|
@@ -171,6 +176,7 @@ export {
|
|
|
171
176
|
isCompositeModification,
|
|
172
177
|
mergeSubModificationsIntoTree,
|
|
173
178
|
moveSubModificationInTree,
|
|
179
|
+
removeUuidsFromTree,
|
|
174
180
|
updateModificationFieldInTree,
|
|
175
181
|
updateSubModificationsOfACompositeInTree
|
|
176
182
|
};
|
package/dist/index.js
CHANGED
|
@@ -354,7 +354,7 @@ import { SelectHeaderCell } from "./features/network-modification-table/renderer
|
|
|
354
354
|
import { SwitchCell } from "./features/network-modification-table/renderers/switch-cell.js";
|
|
355
355
|
import { DragCloneRow } from "./features/network-modification-table/row/drag-row-clone.js";
|
|
356
356
|
import { ModificationRow } from "./features/network-modification-table/row/modification-row.js";
|
|
357
|
-
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, mergeSubModificationsIntoTree, moveSubModificationInTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./features/network-modification-table/utils.js";
|
|
357
|
+
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, mergeSubModificationsIntoTree, moveSubModificationInTree, removeUuidsFromTree, updateModificationFieldInTree, updateSubModificationsOfACompositeInTree } from "./features/network-modification-table/utils.js";
|
|
358
358
|
import { AnnouncementBanner } from "./features/announcement/AnnouncementBanner.js";
|
|
359
359
|
import { AnnouncementNotification } from "./features/announcement/AnnouncementNotification.js";
|
|
360
360
|
import { useGlobalAnnouncement } from "./features/announcement/useGlobalAnnouncement.js";
|
|
@@ -1340,6 +1340,7 @@ export {
|
|
|
1340
1340
|
queryValidator,
|
|
1341
1341
|
recursiveRemove,
|
|
1342
1342
|
removeNullFields,
|
|
1343
|
+
removeUuidsFromTree,
|
|
1343
1344
|
reportViewerEn,
|
|
1344
1345
|
reportViewerFr,
|
|
1345
1346
|
resetAuthenticationRouterError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridsuite/commons-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.231.0",
|
|
4
4
|
"description": "common react components for gridsuite applications",
|
|
5
5
|
"author": "gridsuite team",
|
|
6
6
|
"homepage": "https://github.com/gridsuite",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"licenses-check": "license-checker --summary --excludePrivatePackages --production --onlyAllow \"$( jq -r .onlyAllow[] license-checker-config.json | tr '\n' ';')\" --excludePackages \"$( jq -r .excludePackages[] license-checker-config.json | tr '\n' ';')\""
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@ag-grid-community/locale": "^
|
|
49
|
+
"@ag-grid-community/locale": "^35.3.1",
|
|
50
50
|
"@hello-pangea/dnd": "^18.0.1",
|
|
51
51
|
"@material-symbols/svg-400": "^0.31.9",
|
|
52
52
|
"@react-querybuilder/dnd": "^8.11.0",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"@mui/lab": "6.0.1-beta.36",
|
|
78
78
|
"@mui/material": "^6.5.0",
|
|
79
79
|
"@mui/x-tree-view": "^8.21.0",
|
|
80
|
-
"ag-grid-community": "^
|
|
81
|
-
"ag-grid-react": "^
|
|
80
|
+
"ag-grid-community": "^35.3.1",
|
|
81
|
+
"ag-grid-react": "^35.3.1",
|
|
82
82
|
"notistack": "^3.0.2",
|
|
83
83
|
"react": "^19.2.0",
|
|
84
84
|
"react-dom": "^19.2.0",
|
|
@@ -120,8 +120,8 @@
|
|
|
120
120
|
"@types/react-resizable": "^3.0.8",
|
|
121
121
|
"@types/react-window": "^1.8.8",
|
|
122
122
|
"@vitejs/plugin-react": "^5.0.4",
|
|
123
|
-
"ag-grid-community": "^
|
|
124
|
-
"ag-grid-react": "^
|
|
123
|
+
"ag-grid-community": "^35.3.1",
|
|
124
|
+
"ag-grid-react": "^35.3.1",
|
|
125
125
|
"babel-eslint": "^10.1.0",
|
|
126
126
|
"babel-preset-airbnb": "^5.0.0",
|
|
127
127
|
"babel-preset-vite": "^1.1.3",
|