@gridsuite/commons-ui 0.277.0 → 0.279.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.d.ts +1 -0
- package/dist/features/index.js +8 -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/side-bar/AppSideBar.d.ts +27 -0
- package/dist/features/side-bar/AppSideBar.js +102 -0
- package/dist/features/side-bar/AppSideBarHeader.d.ts +11 -0
- package/dist/features/side-bar/AppSideBarHeader.js +54 -0
- package/dist/features/side-bar/dialogs/AppSideBarDialogProvider.d.ts +14 -0
- package/dist/features/side-bar/dialogs/AppSideBarDialogProvider.js +36 -0
- package/dist/features/side-bar/dialogs/AppSideBarDialogs.d.ts +14 -0
- package/dist/features/side-bar/dialogs/AppSideBarDialogs.js +56 -0
- package/dist/features/side-bar/footer/AppSideBarFooter.d.ts +15 -0
- package/dist/features/side-bar/footer/AppSideBarFooter.js +60 -0
- package/dist/features/side-bar/footer/applications/ApplicationMenu.d.ts +5 -0
- package/dist/features/side-bar/footer/applications/ApplicationMenu.js +83 -0
- package/dist/features/side-bar/footer/applications/OtherAppRedirection.d.ts +6 -0
- package/dist/features/side-bar/footer/applications/OtherAppRedirection.js +105 -0
- package/dist/features/side-bar/footer/common/MinimizedSubMenuHeader.d.ts +9 -0
- package/dist/features/side-bar/footer/common/MinimizedSubMenuHeader.js +22 -0
- package/dist/features/side-bar/footer/common/SideBarMenuItem.d.ts +10 -0
- package/dist/features/side-bar/footer/common/SideBarMenuItem.js +76 -0
- package/dist/features/side-bar/footer/common/submenu-footer.style.d.ts +23 -0
- package/dist/features/side-bar/footer/common/submenu-footer.style.js +20 -0
- package/dist/features/side-bar/footer/profile/ProfileInfos.d.ts +4 -0
- package/dist/features/side-bar/footer/profile/ProfileInfos.js +32 -0
- package/dist/features/side-bar/footer/profile/ProfileMenu.d.ts +7 -0
- package/dist/features/side-bar/footer/profile/ProfileMenu.js +95 -0
- package/dist/features/side-bar/footer/profile/UserIcon.d.ts +9 -0
- package/dist/features/side-bar/footer/profile/UserIcon.js +33 -0
- package/dist/features/side-bar/footer/settings/DarkModeToggle.d.ts +7 -0
- package/dist/features/side-bar/footer/settings/DarkModeToggle.js +74 -0
- package/dist/features/side-bar/footer/settings/LanguageSelection.d.ts +8 -0
- package/dist/features/side-bar/footer/settings/LanguageSelection.js +75 -0
- package/dist/features/side-bar/footer/settings/SettingsMenu.d.ts +10 -0
- package/dist/features/side-bar/footer/settings/SettingsMenu.js +112 -0
- package/dist/features/side-bar/index.d.ts +7 -0
- package/dist/features/side-bar/index.js +4 -0
- package/dist/features/topBar/index.d.ts +2 -0
- package/dist/features/topBar/index.js +5 -1
- package/dist/index.js +8 -2
- package/dist/translations/en/topBarEn.d.ts +7 -0
- package/dist/translations/en/topBarEn.js +7 -0
- package/dist/translations/fr/topBarFr.d.ts +7 -0
- package/dist/translations/fr/topBarFr.js +7 -0
- package/package.json +1 -1
package/dist/features/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './authentication';
|
|
|
8
8
|
export * from './cardErrorBoundary';
|
|
9
9
|
export * from './notifications';
|
|
10
10
|
export * from './topBar';
|
|
11
|
+
export * from './side-bar';
|
|
11
12
|
export * from './parameters';
|
|
12
13
|
export * from './network-modifications';
|
|
13
14
|
export * from './node';
|
package/dist/features/index.js
CHANGED
|
@@ -18,6 +18,9 @@ import { AboutDialog } from "./topBar/AboutDialog.js";
|
|
|
18
18
|
import { GridLogo, LogoText } from "./topBar/GridLogo.js";
|
|
19
19
|
import { DevModeBanner } from "./topBar/DevModeBanner.js";
|
|
20
20
|
import { TopBar } from "./topBar/TopBar.js";
|
|
21
|
+
import { default as default3 } from "./topBar/UserInformationDialog.js";
|
|
22
|
+
import { default as default4 } from "./topBar/UserSettingsDialog.js";
|
|
23
|
+
import { AppSideBar } from "./side-bar/AppSideBar.js";
|
|
21
24
|
import { ParameterLayout } from "./parameters/common/parameter-layout/parameter-layout.js";
|
|
22
25
|
import { ParameterLayoutProvider, useParameterLayoutContext } from "./parameters/common/parameter-layout/parameter-layout-provider.js";
|
|
23
26
|
import { formatComputingTypeLabel, isValidComputingType } from "./parameters/common/computing-type.js";
|
|
@@ -270,7 +273,7 @@ import { SelectHeaderCell } from "./network-modification-table/renderers/select-
|
|
|
270
273
|
import { SwitchCell } from "./network-modification-table/renderers/switch-cell.js";
|
|
271
274
|
import { DragCloneRow } from "./network-modification-table/row/drag-row-clone.js";
|
|
272
275
|
import { ModificationRow } from "./network-modification-table/row/modification-row.js";
|
|
273
|
-
import { MAX_COMPOSITE_NESTING_DEPTH, fetchSubModificationsForExpandedRows, findAllLoadedCompositeModifications, findDepth, findModificationInTree, formatToComposedModification, isCompositeModification, isReferenceModification,
|
|
276
|
+
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
277
|
import { AnnouncementBanner } from "./announcement/AnnouncementBanner.js";
|
|
275
278
|
import { AnnouncementNotification } from "./announcement/AnnouncementNotification.js";
|
|
276
279
|
import { useGlobalAnnouncement } from "./announcement/useGlobalAnnouncement.js";
|
|
@@ -315,6 +318,7 @@ export {
|
|
|
315
318
|
ActivePowerControlForm,
|
|
316
319
|
AnnouncementBanner,
|
|
317
320
|
AnnouncementNotification,
|
|
321
|
+
AppSideBar,
|
|
318
322
|
DataType as AssignmentDataType,
|
|
319
323
|
AuthenticationRouter,
|
|
320
324
|
default2 as AuthenticationRouterErrorDisplay,
|
|
@@ -671,7 +675,9 @@ export {
|
|
|
671
675
|
UPDATE_BUS_VOLTAGE,
|
|
672
676
|
USE_REACTIVE_LIMITS,
|
|
673
677
|
UnauthorizedAccessAlert,
|
|
678
|
+
default3 as UserInformationDialog,
|
|
674
679
|
UserManagerMock,
|
|
680
|
+
default4 as UserSettingsDialog,
|
|
675
681
|
VARIABLE_Q_GENERATORS,
|
|
676
682
|
VARIABLE_SHUNT_COMPENSATORS,
|
|
677
683
|
VARIABLE_TRANSFORMERS,
|
|
@@ -719,6 +725,7 @@ export {
|
|
|
719
725
|
computeRatioTapChangerRegulationMode,
|
|
720
726
|
computeSwitchedOnValue,
|
|
721
727
|
computeTagMinSize,
|
|
728
|
+
containsReferenceModification,
|
|
722
729
|
convertFilterValues,
|
|
723
730
|
convertLimitsToOperationalLimitsGroupFormSchema,
|
|
724
731
|
convertToLineSegmentInfos,
|
|
@@ -924,7 +931,6 @@ export {
|
|
|
924
931
|
isEditingGlobalFilter,
|
|
925
932
|
isProcessType,
|
|
926
933
|
isReferenceModification,
|
|
927
|
-
isTargetChildOfReference,
|
|
928
934
|
isValidComputingType,
|
|
929
935
|
isValidContingencyRow,
|
|
930
936
|
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,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Breakpoint, Theme } from '@mui/material';
|
|
2
|
+
import { UserProfile } from 'oidc-client-ts';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { GridSuiteModule } from '../topBar';
|
|
5
|
+
import { GsLang, GsTheme, Metadata } from '../../utils';
|
|
6
|
+
type SideBarProps = {
|
|
7
|
+
sideBarTheme: Theme;
|
|
8
|
+
isDeveloperMode: boolean;
|
|
9
|
+
smallScreenBreakpoint: number | Breakpoint;
|
|
10
|
+
handleChangeDeveloperMode: (newValue: boolean) => void;
|
|
11
|
+
currentTheme: GsTheme;
|
|
12
|
+
setTheme: (newTheme: GsTheme) => void;
|
|
13
|
+
selectedLanguage: GsLang;
|
|
14
|
+
setSelectedLanguage: (newSelectedLanguage: GsLang) => void;
|
|
15
|
+
userProfile?: UserProfile;
|
|
16
|
+
appsAndUrls: Metadata[];
|
|
17
|
+
onLogoutClick?: () => void;
|
|
18
|
+
appName: string;
|
|
19
|
+
appNameColor: string;
|
|
20
|
+
appLogo: ReactNode;
|
|
21
|
+
appLicense?: string;
|
|
22
|
+
appVersion?: string;
|
|
23
|
+
globalVersionPromise: () => Promise<string>;
|
|
24
|
+
additionalModulesPromise: () => Promise<GridSuiteModule[]>;
|
|
25
|
+
};
|
|
26
|
+
export declare function AppSideBar({ sideBarTheme, isDeveloperMode, smallScreenBreakpoint, handleChangeDeveloperMode, currentTheme, setTheme, selectedLanguage, setSelectedLanguage, userProfile, appsAndUrls, appName, appNameColor, appLogo, appLicense, appVersion, globalVersionPromise, additionalModulesPromise, onLogoutClick, }: Readonly<SideBarProps>): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMediaQuery, ThemeProvider, ScopedCssBaseline, Stack, Box } from "@mui/material";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { AppSideBarHeader } from "./AppSideBarHeader.js";
|
|
5
|
+
import { AppSideBarFooter } from "./footer/AppSideBarFooter.js";
|
|
6
|
+
import { AppSideBarDialogProvider } from "./dialogs/AppSideBarDialogProvider.js";
|
|
7
|
+
import { AppSideBarDialogs } from "./dialogs/AppSideBarDialogs.js";
|
|
8
|
+
function AppSideBar({
|
|
9
|
+
sideBarTheme,
|
|
10
|
+
isDeveloperMode,
|
|
11
|
+
smallScreenBreakpoint,
|
|
12
|
+
handleChangeDeveloperMode,
|
|
13
|
+
currentTheme,
|
|
14
|
+
setTheme,
|
|
15
|
+
selectedLanguage,
|
|
16
|
+
setSelectedLanguage,
|
|
17
|
+
userProfile,
|
|
18
|
+
appsAndUrls,
|
|
19
|
+
appName,
|
|
20
|
+
appNameColor,
|
|
21
|
+
appLogo,
|
|
22
|
+
appLicense,
|
|
23
|
+
appVersion,
|
|
24
|
+
globalVersionPromise,
|
|
25
|
+
additionalModulesPromise,
|
|
26
|
+
onLogoutClick
|
|
27
|
+
}) {
|
|
28
|
+
const [isMinimized, setIsMinimized] = useState(true);
|
|
29
|
+
const toggleSideBarMinimized = () => {
|
|
30
|
+
setIsMinimized((previousIsSideBarMinimized) => !previousIsSideBarMinimized);
|
|
31
|
+
};
|
|
32
|
+
const isSmallScreen = useMediaQuery((theme) => theme.breakpoints.down(smallScreenBreakpoint));
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (isSmallScreen) {
|
|
35
|
+
setIsMinimized(true);
|
|
36
|
+
}
|
|
37
|
+
}, [isSmallScreen]);
|
|
38
|
+
return /* @__PURE__ */ jsxs(AppSideBarDialogProvider, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
AppSideBarDialogs,
|
|
41
|
+
{
|
|
42
|
+
appLicense,
|
|
43
|
+
appVersion,
|
|
44
|
+
additionalModulesPromise,
|
|
45
|
+
globalVersionPromise,
|
|
46
|
+
appName,
|
|
47
|
+
userProfile,
|
|
48
|
+
isDeveloperMode,
|
|
49
|
+
handleChangeDeveloperMode
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ jsx(ThemeProvider, { theme: sideBarTheme, children: /* @__PURE__ */ jsx(ScopedCssBaseline, { children: /* @__PURE__ */ jsxs(
|
|
53
|
+
Stack,
|
|
54
|
+
{
|
|
55
|
+
component: "aside",
|
|
56
|
+
sx: {
|
|
57
|
+
width: isMinimized ? 64 : 224,
|
|
58
|
+
height: "100%"
|
|
59
|
+
},
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
AppSideBarHeader,
|
|
63
|
+
{
|
|
64
|
+
isMinimized,
|
|
65
|
+
isLoggedIn: !!userProfile,
|
|
66
|
+
appName,
|
|
67
|
+
appNameColor,
|
|
68
|
+
appLogo,
|
|
69
|
+
appVersion
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Box,
|
|
74
|
+
{
|
|
75
|
+
sx: {
|
|
76
|
+
flex: 1
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
AppSideBarFooter,
|
|
82
|
+
{
|
|
83
|
+
isMinimized,
|
|
84
|
+
isSmallScreen,
|
|
85
|
+
toggleSideBarMinimized,
|
|
86
|
+
currentTheme,
|
|
87
|
+
setTheme,
|
|
88
|
+
selectedLanguage,
|
|
89
|
+
setSelectedLanguage,
|
|
90
|
+
userProfile,
|
|
91
|
+
appsAndUrls,
|
|
92
|
+
onLogoutClick
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
) }) })
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
AppSideBar
|
|
102
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface AppSideBarHeaderProps {
|
|
3
|
+
isMinimized: boolean;
|
|
4
|
+
isLoggedIn: boolean;
|
|
5
|
+
appName: string;
|
|
6
|
+
appNameColor: string;
|
|
7
|
+
appLogo: ReactNode;
|
|
8
|
+
appVersion?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function AppSideBarHeader({ isMinimized, isLoggedIn, appName, appNameColor, appLogo, appVersion, }: Readonly<AppSideBarHeaderProps>): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Stack, Typography, Box, Tooltip, IconButton, Divider } from "@mui/material";
|
|
3
|
+
import { Info } from "@mui/icons-material";
|
|
4
|
+
import { useAppSideBarDialogs, SideBarDialogType } from "./dialogs/AppSideBarDialogProvider.js";
|
|
5
|
+
function AppSideBarHeader({
|
|
6
|
+
isMinimized,
|
|
7
|
+
isLoggedIn,
|
|
8
|
+
appName,
|
|
9
|
+
appNameColor,
|
|
10
|
+
appLogo,
|
|
11
|
+
appVersion
|
|
12
|
+
}) {
|
|
13
|
+
const { setOpenDialog } = useAppSideBarDialogs();
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
Stack,
|
|
16
|
+
{
|
|
17
|
+
sx: {
|
|
18
|
+
px: 1.5,
|
|
19
|
+
pt: 3
|
|
20
|
+
},
|
|
21
|
+
spacing: 1,
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: isMinimized ? "center" : "flex-start", children: [
|
|
24
|
+
appLogo,
|
|
25
|
+
!isMinimized && /* @__PURE__ */ jsxs(Typography, { variant: "h6", children: [
|
|
26
|
+
"Grid",
|
|
27
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { color: appNameColor }, children: appName })
|
|
28
|
+
] })
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
Stack,
|
|
32
|
+
{
|
|
33
|
+
direction: "row",
|
|
34
|
+
visibility: isLoggedIn ? "inherit" : "hidden",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
justifyContent: isMinimized ? "center" : "end",
|
|
37
|
+
spacing: 1,
|
|
38
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
!isMinimized && /* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
|
|
40
|
+
"V",
|
|
41
|
+
appVersion
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsx(Tooltip, { title: `V${appVersion}`, disableHoverListener: !isMinimized, children: /* @__PURE__ */ jsx(IconButton, { sx: { padding: 0 }, onClick: () => setOpenDialog(SideBarDialogType.ABOUT), children: /* @__PURE__ */ jsx(Info, { fontSize: "small", color: "disabled" }) }) })
|
|
44
|
+
] })
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsx(Divider, {})
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
AppSideBarHeader
|
|
54
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export declare enum SideBarDialogType {
|
|
3
|
+
ABOUT = "ABOUT",
|
|
4
|
+
PROFILE = "PROFILE",
|
|
5
|
+
PROFILE_SETTINGS = "PROFILE_SETTINGS"
|
|
6
|
+
}
|
|
7
|
+
type AppSideBarDialogContextValue = {
|
|
8
|
+
openDialog: SideBarDialogType | null;
|
|
9
|
+
setOpenDialog: (dialog: SideBarDialogType) => void;
|
|
10
|
+
closeDialog: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function AppSideBarDialogProvider({ children }: Readonly<PropsWithChildren>): import("react").JSX.Element;
|
|
13
|
+
export declare function useAppSideBarDialogs(): AppSideBarDialogContextValue;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useState, useCallback, useMemo, useContext } from "react";
|
|
3
|
+
var SideBarDialogType = /* @__PURE__ */ ((SideBarDialogType2) => {
|
|
4
|
+
SideBarDialogType2["ABOUT"] = "ABOUT";
|
|
5
|
+
SideBarDialogType2["PROFILE"] = "PROFILE";
|
|
6
|
+
SideBarDialogType2["PROFILE_SETTINGS"] = "PROFILE_SETTINGS";
|
|
7
|
+
return SideBarDialogType2;
|
|
8
|
+
})(SideBarDialogType || {});
|
|
9
|
+
const AppSideBarDialogContext = createContext(void 0);
|
|
10
|
+
function AppSideBarDialogProvider({ children }) {
|
|
11
|
+
const [openDialog, setOpenDialog] = useState(null);
|
|
12
|
+
const closeDialog = useCallback(() => {
|
|
13
|
+
setOpenDialog(null);
|
|
14
|
+
}, []);
|
|
15
|
+
const contextValue = useMemo(
|
|
16
|
+
() => ({
|
|
17
|
+
openDialog,
|
|
18
|
+
setOpenDialog,
|
|
19
|
+
closeDialog
|
|
20
|
+
}),
|
|
21
|
+
[closeDialog, openDialog]
|
|
22
|
+
);
|
|
23
|
+
return /* @__PURE__ */ jsx(AppSideBarDialogContext.Provider, { value: contextValue, children });
|
|
24
|
+
}
|
|
25
|
+
function useAppSideBarDialogs() {
|
|
26
|
+
const dialogs = useContext(AppSideBarDialogContext);
|
|
27
|
+
if (!dialogs) {
|
|
28
|
+
throw new Error("useAppSideBarDialogs must be used within an AppSideBarDialogProvider");
|
|
29
|
+
}
|
|
30
|
+
return dialogs;
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
AppSideBarDialogProvider,
|
|
34
|
+
SideBarDialogType,
|
|
35
|
+
useAppSideBarDialogs
|
|
36
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UserProfile } from 'oidc-client-ts';
|
|
2
|
+
import { GridSuiteModule } from '../../topBar';
|
|
3
|
+
type AppSideBarDialogsProps = {
|
|
4
|
+
isDeveloperMode: boolean;
|
|
5
|
+
handleChangeDeveloperMode: (newValue: boolean) => void;
|
|
6
|
+
userProfile?: UserProfile;
|
|
7
|
+
appName: string;
|
|
8
|
+
appLicense?: string;
|
|
9
|
+
appVersion?: string;
|
|
10
|
+
globalVersionPromise: () => Promise<string>;
|
|
11
|
+
additionalModulesPromise: () => Promise<GridSuiteModule[]>;
|
|
12
|
+
};
|
|
13
|
+
export declare function AppSideBarDialogs({ appLicense, appVersion, additionalModulesPromise, globalVersionPromise, appName, userProfile, isDeveloperMode, handleChangeDeveloperMode, }: Readonly<AppSideBarDialogsProps>): import("react").JSX.Element;
|
|
14
|
+
export {};
|