@gridsuite/commons-ui 0.140.0 → 0.141.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/customAGGrid/cell-renderers.d.ts +26 -0
- package/dist/components/customAGGrid/cell-renderers.js +199 -0
- package/dist/components/customAGGrid/index.d.ts +1 -0
- package/dist/components/customAGGrid/index.js +9 -0
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.d.ts +1 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +3 -0
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +5 -2
- package/dist/components/directoryItemSelector/utils.js +2 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +15 -0
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +2 -1
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -55
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +1 -0
- package/dist/components/inputs/reactQueryBuilder/ElementValueEditor.js +1 -1
- package/dist/components/muiTable/OverflowableTableCell.d.ts +3 -0
- package/dist/components/muiTable/OverflowableTableCell.js +10 -0
- package/dist/components/muiTable/OverflowableTableCellWithCheckbox.d.ts +6 -0
- package/dist/components/muiTable/OverflowableTableCellWithCheckbox.js +16 -0
- package/dist/components/muiTable/index.d.ts +8 -0
- package/dist/components/muiTable/index.js +6 -0
- package/dist/components/parameters/common/parameters-creation-dialog.js +1 -1
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/resizablePanels/ResizeHandle.d.ts +8 -0
- package/dist/components/resizablePanels/ResizeHandle.js +32 -0
- package/dist/components/resizablePanels/index.d.ts +7 -0
- package/dist/components/resizablePanels/index.js +4 -0
- package/dist/components/topBar/GridLogo.d.ts +4 -2
- package/dist/components/topBar/GridLogo.js +39 -21
- package/dist/components/topBar/TopBar.d.ts +2 -1
- package/dist/components/topBar/TopBar.js +81 -65
- package/dist/index.js +23 -5
- package/dist/services/config.d.ts +10 -0
- package/dist/services/config.js +34 -0
- package/dist/services/directory.d.ts +6 -4
- package/dist/services/directory.js +17 -32
- package/dist/services/index.d.ts +5 -4
- package/dist/services/index.js +8 -5
- package/package.json +2 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ICellRendererParams } from 'ag-grid-community';
|
|
3
|
+
import { CustomCellRendererProps } from 'ag-grid-react';
|
|
4
|
+
export declare function BooleanCellRenderer({ value }: Readonly<any>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function BooleanNullableCellRenderer({ value }: Readonly<any>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface NumericCellRendererProps extends CustomCellRendererProps {
|
|
7
|
+
fractionDigits?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function NumericCellRenderer({ value, fractionDigits }: Readonly<NumericCellRendererProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function ErrorCellRenderer({ value }: Readonly<CustomCellRendererProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function DefaultCellRenderer(props: Readonly<CustomCellRendererProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function NetworkModificationNameCellRenderer({ value }: Readonly<CustomCellRendererProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function MessageLogCellRenderer({ param, highlightColor, currentHighlightColor, searchTerm, currentResultIndex, searchResults, }: Readonly<{
|
|
14
|
+
param: ICellRendererParams;
|
|
15
|
+
highlightColor?: string;
|
|
16
|
+
currentHighlightColor?: string;
|
|
17
|
+
searchTerm?: string;
|
|
18
|
+
currentResultIndex?: number;
|
|
19
|
+
searchResults?: number[];
|
|
20
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function ContingencyCellRenderer({ value, }: Readonly<{
|
|
22
|
+
value: {
|
|
23
|
+
cellValue: ReactNode;
|
|
24
|
+
tooltipValue: ReactNode;
|
|
25
|
+
};
|
|
26
|
+
}>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox, Box, Tooltip } from "@mui/material";
|
|
3
|
+
import { useRef, useState, useEffect } from "react";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { isBlankOrEmpty } from "../../utils/conversionUtils.js";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { mergeSx } from "../../utils/styles.js";
|
|
8
|
+
import "../../utils/types/equipmentType.js";
|
|
9
|
+
import "../../utils/yupConfig.js";
|
|
10
|
+
const styles = {
|
|
11
|
+
tableCell: (theme) => ({
|
|
12
|
+
fontSize: "small",
|
|
13
|
+
cursor: "inherit",
|
|
14
|
+
display: "flex",
|
|
15
|
+
"&:before": {
|
|
16
|
+
content: '""',
|
|
17
|
+
position: "absolute",
|
|
18
|
+
left: theme.spacing(0.5),
|
|
19
|
+
right: theme.spacing(0.5),
|
|
20
|
+
bottom: 0
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
overflow: {
|
|
24
|
+
whiteSpace: "pre",
|
|
25
|
+
textOverflow: "ellipsis",
|
|
26
|
+
overflow: "hidden"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const FORMULA_ERROR_KEY = "spreadsheet/formula/error";
|
|
30
|
+
function BooleanCellRenderer({ value }) {
|
|
31
|
+
const isChecked = value;
|
|
32
|
+
return /* @__PURE__ */ jsx("div", { children: value !== void 0 && /* @__PURE__ */ jsx(Checkbox, { style: { padding: 0 }, color: "default", checked: isChecked, disableRipple: true }) });
|
|
33
|
+
}
|
|
34
|
+
function BooleanNullableCellRenderer({ value }) {
|
|
35
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
36
|
+
Checkbox,
|
|
37
|
+
{
|
|
38
|
+
style: { padding: 0 },
|
|
39
|
+
color: "default",
|
|
40
|
+
checked: value === true,
|
|
41
|
+
indeterminate: isBlankOrEmpty(value),
|
|
42
|
+
disableRipple: true
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
}
|
|
46
|
+
const formatNumericCell = (value, fractionDigits) => {
|
|
47
|
+
if (value === null || Number.isNaN(value)) {
|
|
48
|
+
return { value: null };
|
|
49
|
+
}
|
|
50
|
+
return { value: value.toFixed(fractionDigits ?? 2), tooltip: value?.toString() };
|
|
51
|
+
};
|
|
52
|
+
const formatCell = (props) => {
|
|
53
|
+
let value = props?.valueFormatted || props.value;
|
|
54
|
+
let tooltipValue;
|
|
55
|
+
if (!value && props.colDef.valueGetter) {
|
|
56
|
+
props.colDef.valueGetter(props);
|
|
57
|
+
}
|
|
58
|
+
if (value != null && props.colDef.context?.numeric && props.colDef.context?.fractionDigits) {
|
|
59
|
+
tooltipValue = value;
|
|
60
|
+
value = Number.parseFloat(value).toFixed(props.colDef.context.fractionDigits);
|
|
61
|
+
}
|
|
62
|
+
if (props.colDef.context?.numeric && Number.isNaN(value)) {
|
|
63
|
+
value = null;
|
|
64
|
+
}
|
|
65
|
+
return { value, tooltip: tooltipValue };
|
|
66
|
+
};
|
|
67
|
+
function NumericCellRenderer({ value, fractionDigits }) {
|
|
68
|
+
const numericalValue = typeof value === "number" ? value : Number.parseFloat(value);
|
|
69
|
+
const cellValue = formatNumericCell(numericalValue, fractionDigits);
|
|
70
|
+
return /* @__PURE__ */ jsx(Box, { sx: mergeSx(styles.tableCell), children: /* @__PURE__ */ jsx(
|
|
71
|
+
Tooltip,
|
|
72
|
+
{
|
|
73
|
+
disableFocusListener: true,
|
|
74
|
+
disableTouchListener: true,
|
|
75
|
+
title: cellValue.tooltip ? cellValue.tooltip : cellValue.value?.toString(),
|
|
76
|
+
children: /* @__PURE__ */ jsx(Box, { sx: styles.overflow, children: cellValue.value })
|
|
77
|
+
}
|
|
78
|
+
) });
|
|
79
|
+
}
|
|
80
|
+
function BaseCellRenderer({ value, tooltip }) {
|
|
81
|
+
return /* @__PURE__ */ jsx(Box, { sx: mergeSx(styles.tableCell), children: /* @__PURE__ */ jsx(Tooltip, { disableFocusListener: true, disableTouchListener: true, title: tooltip || value || "", children: /* @__PURE__ */ jsx(Box, { sx: styles.overflow, children: value }) }) });
|
|
82
|
+
}
|
|
83
|
+
function ErrorCellRenderer({ value }) {
|
|
84
|
+
const intl = useIntl();
|
|
85
|
+
const errorMessage = intl.formatMessage({ id: value?.error });
|
|
86
|
+
const errorValue = intl.formatMessage({ id: FORMULA_ERROR_KEY });
|
|
87
|
+
return /* @__PURE__ */ jsx(BaseCellRenderer, { value: errorValue, tooltip: errorMessage });
|
|
88
|
+
}
|
|
89
|
+
function DefaultCellRenderer(props) {
|
|
90
|
+
const cellValue = formatCell(props).value?.toString();
|
|
91
|
+
return /* @__PURE__ */ jsx(BaseCellRenderer, { value: cellValue });
|
|
92
|
+
}
|
|
93
|
+
function NetworkModificationNameCellRenderer({ value }) {
|
|
94
|
+
return /* @__PURE__ */ jsx(Box, { sx: mergeSx(styles.tableCell), children: /* @__PURE__ */ jsx(
|
|
95
|
+
Tooltip,
|
|
96
|
+
{
|
|
97
|
+
disableFocusListener: true,
|
|
98
|
+
disableTouchListener: true,
|
|
99
|
+
title: value,
|
|
100
|
+
componentsProps: {
|
|
101
|
+
tooltip: {
|
|
102
|
+
sx: {
|
|
103
|
+
maxWidth: "none"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
children: /* @__PURE__ */ jsx(Box, { sx: styles.overflow, children: value })
|
|
108
|
+
}
|
|
109
|
+
) });
|
|
110
|
+
}
|
|
111
|
+
function MessageLogCellRenderer({
|
|
112
|
+
param,
|
|
113
|
+
highlightColor,
|
|
114
|
+
currentHighlightColor,
|
|
115
|
+
searchTerm,
|
|
116
|
+
currentResultIndex,
|
|
117
|
+
searchResults
|
|
118
|
+
}) {
|
|
119
|
+
const marginLeft = (param.data?.depth ?? 0) * 2;
|
|
120
|
+
const textRef = useRef(null);
|
|
121
|
+
const [isEllipsisActive, setIsEllipsisActive] = useState(false);
|
|
122
|
+
const checkEllipsis = () => {
|
|
123
|
+
if (textRef.current) {
|
|
124
|
+
const zoomLevel = window.devicePixelRatio;
|
|
125
|
+
const adjustedScrollWidth = textRef.current.scrollWidth / zoomLevel;
|
|
126
|
+
const adjustedClientWidth = textRef.current.clientWidth / zoomLevel;
|
|
127
|
+
setIsEllipsisActive(adjustedScrollWidth > adjustedClientWidth);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
checkEllipsis();
|
|
132
|
+
const resizeObserver = new ResizeObserver(() => checkEllipsis());
|
|
133
|
+
if (textRef.current) {
|
|
134
|
+
resizeObserver.observe(textRef.current);
|
|
135
|
+
}
|
|
136
|
+
return () => {
|
|
137
|
+
resizeObserver.disconnect();
|
|
138
|
+
};
|
|
139
|
+
}, [param.value]);
|
|
140
|
+
const escapeRegExp = (string) => {
|
|
141
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
142
|
+
};
|
|
143
|
+
const renderHighlightedText = (value) => {
|
|
144
|
+
if (!searchTerm || searchTerm === "") {
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
const escapedSearchTerm = escapeRegExp(searchTerm);
|
|
148
|
+
const parts = value.split(new RegExp(`(${escapedSearchTerm})`, "gi"));
|
|
149
|
+
let count = 0;
|
|
150
|
+
return /* @__PURE__ */ jsx("span", { children: parts.map((part) => {
|
|
151
|
+
count += 1;
|
|
152
|
+
const key = `${param.node.rowIndex}-${count}`;
|
|
153
|
+
const isMatch = part.toLowerCase() === searchTerm.toLowerCase();
|
|
154
|
+
if (isMatch) {
|
|
155
|
+
return /* @__PURE__ */ jsx(
|
|
156
|
+
"span",
|
|
157
|
+
{
|
|
158
|
+
style: {
|
|
159
|
+
backgroundColor: searchResults && currentResultIndex !== void 0 && searchResults[currentResultIndex] === param.node.rowIndex ? currentHighlightColor : highlightColor
|
|
160
|
+
},
|
|
161
|
+
children: part
|
|
162
|
+
},
|
|
163
|
+
key
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return /* @__PURE__ */ jsx("span", { children: part }, key);
|
|
167
|
+
}) });
|
|
168
|
+
};
|
|
169
|
+
return /* @__PURE__ */ jsx(Box, { sx: mergeSx(styles.tableCell), children: /* @__PURE__ */ jsx(Tooltip, { disableFocusListener: true, disableTouchListener: true, title: isEllipsisActive ? param.value : "", children: /* @__PURE__ */ jsx(
|
|
170
|
+
Box,
|
|
171
|
+
{
|
|
172
|
+
ref: textRef,
|
|
173
|
+
sx: {
|
|
174
|
+
...styles.overflow,
|
|
175
|
+
marginLeft
|
|
176
|
+
},
|
|
177
|
+
children: renderHighlightedText(param.value)
|
|
178
|
+
}
|
|
179
|
+
) }) });
|
|
180
|
+
}
|
|
181
|
+
function ContingencyCellRenderer({
|
|
182
|
+
value
|
|
183
|
+
}) {
|
|
184
|
+
const { cellValue, tooltipValue } = value ?? {};
|
|
185
|
+
if (cellValue == null || tooltipValue == null) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
return /* @__PURE__ */ jsx(Box, { sx: mergeSx(styles.tableCell), children: /* @__PURE__ */ jsx(Tooltip, { title: /* @__PURE__ */ jsx("div", { style: { whiteSpace: "pre-line" }, children: tooltipValue }), children: /* @__PURE__ */ jsx(Box, { sx: styles.overflow, children: cellValue }) }) });
|
|
189
|
+
}
|
|
190
|
+
export {
|
|
191
|
+
BooleanCellRenderer,
|
|
192
|
+
BooleanNullableCellRenderer,
|
|
193
|
+
ContingencyCellRenderer,
|
|
194
|
+
DefaultCellRenderer,
|
|
195
|
+
ErrorCellRenderer,
|
|
196
|
+
MessageLogCellRenderer,
|
|
197
|
+
NetworkModificationNameCellRenderer,
|
|
198
|
+
NumericCellRenderer
|
|
199
|
+
};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { CUSTOM_AGGRID_THEME, styles } from "./customAggrid.style.js";
|
|
2
2
|
import { CustomAGGrid } from "./customAggrid.js";
|
|
3
3
|
import { SeparatorCellRenderer } from "./separatorCellRenderer.js";
|
|
4
|
+
import { BooleanCellRenderer, BooleanNullableCellRenderer, ContingencyCellRenderer, DefaultCellRenderer, ErrorCellRenderer, MessageLogCellRenderer, NetworkModificationNameCellRenderer, NumericCellRenderer } from "./cell-renderers.js";
|
|
4
5
|
export {
|
|
6
|
+
BooleanCellRenderer,
|
|
7
|
+
BooleanNullableCellRenderer,
|
|
5
8
|
CUSTOM_AGGRID_THEME,
|
|
9
|
+
ContingencyCellRenderer,
|
|
6
10
|
CustomAGGrid,
|
|
11
|
+
DefaultCellRenderer,
|
|
12
|
+
ErrorCellRenderer,
|
|
13
|
+
MessageLogCellRenderer,
|
|
14
|
+
NetworkModificationNameCellRenderer,
|
|
15
|
+
NumericCellRenderer,
|
|
7
16
|
SeparatorCellRenderer,
|
|
8
17
|
styles
|
|
9
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
|
-
import { Dialog, LinearProgress, DialogTitle,
|
|
4
|
+
import { Dialog, LinearProgress, DialogTitle, DialogContent, DialogActions } from "@mui/material";
|
|
5
5
|
import { SubmitButton } from "../../inputs/reactHookForm/utils/SubmitButton.js";
|
|
6
6
|
import { CancelButton } from "../../inputs/reactHookForm/utils/CancelButton.js";
|
|
7
7
|
import { CustomFormProvider } from "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
@@ -120,7 +120,7 @@ function CustomMuiDialog({
|
|
|
120
120
|
...dialogProps,
|
|
121
121
|
children: [
|
|
122
122
|
isDataFetching && /* @__PURE__ */ jsx(LinearProgress, {}),
|
|
123
|
-
/* @__PURE__ */ jsx(DialogTitle, { "data-testid": "DialogTitle", children: /* @__PURE__ */ jsx(
|
|
123
|
+
/* @__PURE__ */ jsx(DialogTitle, { "data-testid": "DialogTitle", children: /* @__PURE__ */ jsx(FormattedMessage, { id: titleId }) }),
|
|
124
124
|
/* @__PURE__ */ jsx(DialogContent, { sx: unscrollableFullHeight ? unscrollableDialogStyles.unscrollableContainer : null, children }),
|
|
125
125
|
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
126
126
|
/* @__PURE__ */ jsx(CancelButton, { onClick: handleCancel, "data-testid": "CancelButton" }),
|
package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export interface DescriptionModificationDialogProps {
|
|
|
4
4
|
description: string;
|
|
5
5
|
open: boolean;
|
|
6
6
|
onClose: () => void;
|
|
7
|
-
updateElement: (uuid: UUID, data: Record<string, string>) => Promise<
|
|
7
|
+
updateElement: (uuid: UUID, data: Record<string, string>) => Promise<Response>;
|
|
8
8
|
}
|
|
9
9
|
export declare function DescriptionModificationDialog({ elementUuid, description, open, onClose, updateElement, }: Readonly<DescriptionModificationDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,9 @@ import { FolderOutlined } from "@mui/icons-material";
|
|
|
7
7
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
8
8
|
import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
|
|
9
9
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
10
|
+
import "../../../utils/conversionUtils.js";
|
|
11
|
+
import "../../../utils/types/equipmentType.js";
|
|
12
|
+
import "../../../utils/yupConfig.js";
|
|
10
13
|
import { fetchDirectoryElementPath } from "../../../services/directory.js";
|
|
11
14
|
function ModifyElementSelection(props) {
|
|
12
15
|
const intl = useIntl();
|
|
@@ -4,10 +4,13 @@ import { getFileIcon } from "../../utils/mapper/getFileIcon.js";
|
|
|
4
4
|
import { ElementType } from "../../utils/types/elementType.js";
|
|
5
5
|
import { TreeViewFinder } from "../treeViewFinder/TreeViewFinder.js";
|
|
6
6
|
import { useSnackMessage } from "../../hooks/useSnackMessage.js";
|
|
7
|
-
import
|
|
7
|
+
import "../../utils/conversionUtils.js";
|
|
8
|
+
import { snackWithFallback } from "../../utils/error.js";
|
|
9
|
+
import "../../utils/types/equipmentType.js";
|
|
10
|
+
import "../../utils/yupConfig.js";
|
|
8
11
|
import { fetchRootFolders, fetchDirectoryContent } from "../../services/directory.js";
|
|
12
|
+
import { fetchElementsInfos } from "../../services/explore.js";
|
|
9
13
|
import { getExpansionPathsForSelected, fetchChildrenForExpandedNodes, initializeFromLastSelected, saveLastSelectedDirectoryFromNode } from "./utils.js";
|
|
10
|
-
import { snackWithFallback } from "../../utils/error.js";
|
|
11
14
|
const styles = {
|
|
12
15
|
icon: (theme) => ({
|
|
13
16
|
marginRight: theme.spacing(1),
|
|
@@ -5,7 +5,8 @@ import "@mui/icons-material";
|
|
|
5
5
|
import { ElementType } from "../../utils/types/elementType.js";
|
|
6
6
|
import "../../utils/types/equipmentType.js";
|
|
7
7
|
import "../../utils/yupConfig.js";
|
|
8
|
-
import { updateConfigParameter
|
|
8
|
+
import { updateConfigParameter } from "../../services/config.js";
|
|
9
|
+
import { fetchDirectoryElementPath } from "../../services/directory.js";
|
|
9
10
|
function getLastSelectedDirectoryId() {
|
|
10
11
|
const lastSelectedDirId = localStorage.getItem(LAST_SELECTED_DIRECTORY);
|
|
11
12
|
if (!lastSelectedDirId || lastSelectedDirId === "null") {
|
package/dist/components/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { useCsvExport } from "./csvDownloader/use-csv-export.js";
|
|
|
20
20
|
import { CUSTOM_AGGRID_THEME, styles } from "./customAGGrid/customAggrid.style.js";
|
|
21
21
|
import { CustomAGGrid } from "./customAGGrid/customAggrid.js";
|
|
22
22
|
import { SeparatorCellRenderer } from "./customAGGrid/separatorCellRenderer.js";
|
|
23
|
+
import { BooleanCellRenderer, BooleanNullableCellRenderer, ContingencyCellRenderer, DefaultCellRenderer, ErrorCellRenderer, MessageLogCellRenderer, NetworkModificationNameCellRenderer, NumericCellRenderer } from "./customAGGrid/cell-renderers.js";
|
|
23
24
|
import { CustomMuiDialog, unscrollableDialogStyles } from "./dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
24
25
|
import { DescriptionModificationDialog } from "./dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
25
26
|
import { ElementSaveDialog } from "./dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
@@ -172,6 +173,9 @@ import { SensitivityAnalysisParametersDialog } from "./parameters/sensi/sensitiv
|
|
|
172
173
|
import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiHvdcs, SensiInjection, SensiInjectionsSet, SensiNodes, SensiPsts, SensiTabValues } from "./parameters/sensi/columns-definitions.js";
|
|
173
174
|
import { SensitivityTable } from "./parameters/sensi/sensitivity-table.js";
|
|
174
175
|
import { CustomMenuItem, CustomNestedMenuItem } from "./menus/custom-nested-menu.js";
|
|
176
|
+
import { OverflowableTableCell } from "./muiTable/OverflowableTableCell.js";
|
|
177
|
+
import { OverflowableTableCellWithCheckbox } from "./muiTable/OverflowableTableCellWithCheckbox.js";
|
|
178
|
+
import { ResizeHandle } from "./resizablePanels/ResizeHandle.js";
|
|
175
179
|
export {
|
|
176
180
|
AboutDialog,
|
|
177
181
|
ActivableChip,
|
|
@@ -184,7 +188,9 @@ export {
|
|
|
184
188
|
AutocompleteInput,
|
|
185
189
|
AutocompleteWithFavorites,
|
|
186
190
|
BALANCE_TYPE,
|
|
191
|
+
BooleanCellRenderer,
|
|
187
192
|
BooleanInput,
|
|
193
|
+
BooleanNullableCellRenderer,
|
|
188
194
|
BottomRightButtons,
|
|
189
195
|
CENTER_LABEL,
|
|
190
196
|
COLUMNS_DEFINITIONS_HVDCS,
|
|
@@ -209,6 +215,7 @@ export {
|
|
|
209
215
|
CombinatorSelector,
|
|
210
216
|
CombinatorType,
|
|
211
217
|
ComputingType,
|
|
218
|
+
ContingencyCellRenderer,
|
|
212
219
|
CountriesInput,
|
|
213
220
|
CountryValueEditor,
|
|
214
221
|
CreateParameterDialog,
|
|
@@ -239,6 +246,7 @@ export {
|
|
|
239
246
|
DISTRIBUTED_SLACK,
|
|
240
247
|
DISTRIBUTION_KEY,
|
|
241
248
|
DataType,
|
|
249
|
+
DefaultCellRenderer,
|
|
242
250
|
DescriptionField,
|
|
243
251
|
DescriptionModificationDialog,
|
|
244
252
|
DevModeBanner,
|
|
@@ -261,6 +269,7 @@ export {
|
|
|
261
269
|
ElementValueEditor,
|
|
262
270
|
EquipmentItem,
|
|
263
271
|
EquipmentsSelectionType,
|
|
272
|
+
ErrorCellRenderer,
|
|
264
273
|
ErrorInLogoutAlert,
|
|
265
274
|
ErrorInUserValidationAlert,
|
|
266
275
|
ErrorInput,
|
|
@@ -328,6 +337,7 @@ export {
|
|
|
328
337
|
MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION,
|
|
329
338
|
MONITORED_BRANCHES_EQUIPMENT_TYPES,
|
|
330
339
|
MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES,
|
|
340
|
+
MessageLogCellRenderer,
|
|
331
341
|
MidFormError,
|
|
332
342
|
ModifyElementSelection,
|
|
333
343
|
MuiSelectInput,
|
|
@@ -338,16 +348,20 @@ export {
|
|
|
338
348
|
NAME,
|
|
339
349
|
NO_ITEM_SELECTION_FOR_COPY,
|
|
340
350
|
NadPositionsGenerationMode,
|
|
351
|
+
NetworkModificationNameCellRenderer,
|
|
341
352
|
NetworkVisualizationParametersInline,
|
|
342
353
|
NetworkVisualizationTabValues,
|
|
343
354
|
NetworkVisualizationsParametersEditionDialog,
|
|
344
355
|
NotificationsContext,
|
|
345
356
|
NotificationsProvider,
|
|
357
|
+
NumericCellRenderer,
|
|
346
358
|
NumericEditor,
|
|
347
359
|
OPERATOR_OPTIONS,
|
|
348
360
|
OperatorType,
|
|
349
361
|
OverflowableChip,
|
|
350
362
|
OverflowableChipWithHelperText,
|
|
363
|
+
OverflowableTableCell,
|
|
364
|
+
OverflowableTableCellWithCheckbox,
|
|
351
365
|
OverflowableText,
|
|
352
366
|
PARAM_CENTER_LABEL,
|
|
353
367
|
PARAM_COMPONENT_LIBRARY,
|
|
@@ -396,6 +410,7 @@ export {
|
|
|
396
410
|
RawReadOnlyInput,
|
|
397
411
|
ReactivePowerAdornment,
|
|
398
412
|
RemoveButton,
|
|
413
|
+
ResizeHandle,
|
|
399
414
|
RuleValueEditor,
|
|
400
415
|
SELECTED,
|
|
401
416
|
SELECTION_TYPE,
|
|
@@ -16,9 +16,10 @@ export interface DirectoryItemsInputProps<CP extends OverflowableChipProps = Ove
|
|
|
16
16
|
labelRequiredFromContext?: boolean;
|
|
17
17
|
ChipComponent?: ComponentType<CP>;
|
|
18
18
|
chipProps?: Partial<CP>;
|
|
19
|
+
fullHeight?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare function DirectoryItemsInput<CP extends OverflowableChipProps = OverflowableChipProps>({ label, name, elementType, // Used to specify type of element (Filter, Contingency list, ...)
|
|
21
22
|
equipmentTypes, // Mostly used for filters, it allows the user to get elements of specific equipment only
|
|
22
23
|
itemFilter, // Used to further filter the results displayed according to specific requirement
|
|
23
24
|
titleId, // title of directory item selector dialogue
|
|
24
|
-
hideErrorMessage, onRowChanged, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, }: Readonly<DirectoryItemsInputProps<CP>>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
hideErrorMessage, onRowChanged, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, fullHeight, }: Readonly<DirectoryItemsInputProps<CP>>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl,
|
|
2
|
+
import { FormControl, Tooltip, IconButton } from "@mui/material";
|
|
3
3
|
import { Folder } from "@mui/icons-material";
|
|
4
4
|
import { useState, useMemo, useCallback, useEffect } from "react";
|
|
5
5
|
import { useFieldArray, useWatch, useController } from "react-hook-form";
|
|
@@ -11,46 +11,35 @@ import { useCustomFormContext } from "./provider/useCustomFormContext.js";
|
|
|
11
11
|
import { ErrorInput } from "./errorManagement/ErrorInput.js";
|
|
12
12
|
import { MidFormError } from "./errorManagement/MidFormError.js";
|
|
13
13
|
import "../../../utils/types/equipmentType.js";
|
|
14
|
+
import "../../../utils/conversionUtils.js";
|
|
15
|
+
import { mergeSx } from "../../../utils/styles.js";
|
|
16
|
+
import { ArrayAction } from "../../../utils/types/types.js";
|
|
17
|
+
import { getEquipmentTypeShortLabel } from "../../../utils/labelUtils.js";
|
|
18
|
+
import "../../../utils/yupConfig.js";
|
|
14
19
|
import { fetchDirectoryElementPath } from "../../../services/directory.js";
|
|
15
20
|
import "localized-countries";
|
|
16
21
|
import "localized-countries/data/fr";
|
|
17
22
|
import "localized-countries/data/en";
|
|
18
23
|
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
19
24
|
import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
|
|
20
|
-
import "../../../utils/conversionUtils.js";
|
|
21
|
-
import { mergeSx } from "../../../utils/styles.js";
|
|
22
|
-
import { ArrayAction } from "../../../utils/types/types.js";
|
|
23
|
-
import { getEquipmentTypeShortLabel } from "../../../utils/labelUtils.js";
|
|
24
|
-
import "../../../utils/yupConfig.js";
|
|
25
25
|
import { NAME } from "./constants.js";
|
|
26
26
|
import { OverflowableChip } from "./OverflowableChip.js";
|
|
27
|
-
import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
|
|
28
27
|
const styles = {
|
|
29
|
-
|
|
28
|
+
formDirectoryElements: {
|
|
30
29
|
display: "flex",
|
|
31
30
|
gap: "8px",
|
|
32
31
|
flexWrap: "wrap",
|
|
33
32
|
flexDirection: "row",
|
|
33
|
+
alignContent: "flex-start",
|
|
34
|
+
alignItems: "center",
|
|
34
35
|
border: "2px solid lightgray",
|
|
35
|
-
padding: "
|
|
36
|
+
padding: "2px 8px",
|
|
36
37
|
borderRadius: "4px",
|
|
37
38
|
overflow: "hidden"
|
|
38
39
|
},
|
|
39
40
|
formDirectoryElementsError: (theme) => ({
|
|
40
41
|
borderColor: theme.palette.error.main
|
|
41
|
-
})
|
|
42
|
-
formDirectoryElements2: {
|
|
43
|
-
display: "flex",
|
|
44
|
-
gap: "8px",
|
|
45
|
-
flexWrap: "wrap",
|
|
46
|
-
flexDirection: "row",
|
|
47
|
-
marginTop: 0,
|
|
48
|
-
padding: "4px",
|
|
49
|
-
overflow: "hidden"
|
|
50
|
-
},
|
|
51
|
-
addDirectoryElements: {
|
|
52
|
-
marginTop: "-5px"
|
|
53
|
-
}
|
|
42
|
+
})
|
|
54
43
|
};
|
|
55
44
|
function DirectoryItemsInput({
|
|
56
45
|
label,
|
|
@@ -70,7 +59,8 @@ function DirectoryItemsInput({
|
|
|
70
59
|
allowMultiSelect = true,
|
|
71
60
|
labelRequiredFromContext = true,
|
|
72
61
|
ChipComponent = OverflowableChip,
|
|
73
|
-
chipProps
|
|
62
|
+
chipProps,
|
|
63
|
+
fullHeight
|
|
74
64
|
}) {
|
|
75
65
|
const { snackError } = useSnackMessage();
|
|
76
66
|
const intl = useIntl();
|
|
@@ -124,10 +114,11 @@ function DirectoryItemsInput({
|
|
|
124
114
|
);
|
|
125
115
|
const removeElements = useCallback(
|
|
126
116
|
(index) => {
|
|
127
|
-
const
|
|
117
|
+
const elemToRemove = getValues(name)[index];
|
|
128
118
|
remove(index);
|
|
119
|
+
const newElems = getValues(name);
|
|
129
120
|
onRowChanged?.(true);
|
|
130
|
-
onChange?.(
|
|
121
|
+
onChange?.(newElems, ArrayAction.REMOVE, elemToRemove);
|
|
131
122
|
},
|
|
132
123
|
[onRowChanged, remove, getValues, name, onChange]
|
|
133
124
|
);
|
|
@@ -173,31 +164,41 @@ function DirectoryItemsInput({
|
|
|
173
164
|
FormControl,
|
|
174
165
|
{
|
|
175
166
|
sx: mergeSx(
|
|
176
|
-
styles.
|
|
167
|
+
styles.formDirectoryElements,
|
|
177
168
|
// @ts-expect-error
|
|
178
|
-
error?.message && styles.formDirectoryElementsError
|
|
169
|
+
error?.message && styles.formDirectoryElementsError,
|
|
170
|
+
fullHeight && { height: "100%" }
|
|
179
171
|
),
|
|
180
172
|
error: !!error?.message,
|
|
181
173
|
children: [
|
|
182
|
-
|
|
183
|
-
|
|
174
|
+
/* @__PURE__ */ jsx(Tooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
175
|
+
IconButton,
|
|
184
176
|
{
|
|
185
|
-
|
|
186
|
-
|
|
177
|
+
size: "small",
|
|
178
|
+
disabled: disable,
|
|
179
|
+
onClick: () => {
|
|
180
|
+
if (shouldReplaceElement) {
|
|
181
|
+
handleChipClick(0);
|
|
182
|
+
} else {
|
|
183
|
+
setDirectoryItemSelectorOpen(true);
|
|
184
|
+
if (allowMultiSelect) {
|
|
185
|
+
setMultiSelect(true);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
children: /* @__PURE__ */ jsx(Folder, {})
|
|
187
190
|
}
|
|
188
|
-
),
|
|
189
|
-
elements?.
|
|
191
|
+
) }) }),
|
|
192
|
+
elements?.map((item, index) => {
|
|
190
193
|
const elementName = watchedElements?.[index]?.[NAME] ?? getValues(`${name}.${index}.${NAME}`) ?? item?.[NAME];
|
|
191
|
-
const equipmentTypeShortLabel = getEquipmentTypeShortLabel(
|
|
192
|
-
item?.specificMetadata?.equipmentType
|
|
193
|
-
);
|
|
194
|
+
const equipmentTypeShortLabel = getEquipmentTypeShortLabel(item?.specificMetadata?.equipmentType);
|
|
194
195
|
const { sx: chipSx, ...otherChipProps } = chipProps ?? {};
|
|
195
196
|
return /* @__PURE__ */ jsx(
|
|
196
197
|
ChipComponent,
|
|
197
198
|
{
|
|
198
199
|
onDelete: () => removeElements(index),
|
|
199
200
|
onClick: () => handleChipClick(index),
|
|
200
|
-
label: elementName
|
|
201
|
+
label: elementName || intl.formatMessage({ id: "elementNotFound" }),
|
|
201
202
|
...equipmentTypeShortLabel && {
|
|
202
203
|
helperText: intl.formatMessage({
|
|
203
204
|
id: equipmentTypeShortLabel
|
|
@@ -215,26 +216,14 @@ function DirectoryItemsInput({
|
|
|
215
216
|
},
|
|
216
217
|
item.id
|
|
217
218
|
);
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
}),
|
|
220
|
+
elements?.length === 0 && label && /* @__PURE__ */ jsx(
|
|
221
|
+
FieldLabel,
|
|
221
222
|
{
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
disabled: disable,
|
|
225
|
-
onClick: () => {
|
|
226
|
-
if (shouldReplaceElement) {
|
|
227
|
-
handleChipClick(0);
|
|
228
|
-
} else {
|
|
229
|
-
setDirectoryItemSelectorOpen(true);
|
|
230
|
-
if (allowMultiSelect) {
|
|
231
|
-
setMultiSelect(true);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
children: /* @__PURE__ */ jsx(Folder, {})
|
|
223
|
+
label,
|
|
224
|
+
optional: labelRequiredFromContext && !isFieldRequired(name, validationSchema, getValues())
|
|
236
225
|
}
|
|
237
|
-
)
|
|
226
|
+
)
|
|
238
227
|
]
|
|
239
228
|
}
|
|
240
229
|
),
|
|
@@ -9,6 +9,7 @@ import "../../../../utils/conversionUtils.js";
|
|
|
9
9
|
import "@mui/icons-material";
|
|
10
10
|
import "../../../../utils/types/equipmentType.js";
|
|
11
11
|
import "../../../../utils/yupConfig.js";
|
|
12
|
+
import "react-intl";
|
|
12
13
|
const style = (customProps) => ({
|
|
13
14
|
grid: (theme) => ({
|
|
14
15
|
width: "auto",
|
|
@@ -2,11 +2,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { validate } from "uuid";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
4
|
import { useCustomFormContext } from "../reactHookForm/provider/useCustomFormContext.js";
|
|
5
|
-
import { fetchElementsInfos } from "../../../services/explore.js";
|
|
6
5
|
import "../../../utils/conversionUtils.js";
|
|
7
6
|
import "@mui/icons-material";
|
|
8
7
|
import "../../../utils/types/equipmentType.js";
|
|
9
8
|
import "../../../utils/yupConfig.js";
|
|
9
|
+
import { fetchElementsInfos } from "../../../services/explore.js";
|
|
10
10
|
import { DirectoryItemsInput } from "../reactHookForm/DirectoryItemsInput.js";
|
|
11
11
|
function ElementValueEditor(props) {
|
|
12
12
|
const { defaultValue, name, elementType, equipmentTypes, titleId, hideErrorMessage, itemFilter, onChange } = props;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell } from "@mui/material";
|
|
3
|
+
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
4
|
+
function OverflowableTableCell(overflowableTextProps) {
|
|
5
|
+
return /* @__PURE__ */ jsx(TableCell, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(OverflowableText, { sx: { flex: "1 1 0", width: 0, display: "block" }, ...overflowableTextProps }) });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
OverflowableTableCell,
|
|
9
|
+
OverflowableTableCell as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OverflowableTextProps } from '../overflowableText';
|
|
2
|
+
export interface OverflowableTableCellProps extends OverflowableTextProps {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function OverflowableTableCellWithCheckbox({ checked, ...overflowableTextProps }: Readonly<OverflowableTableCellProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default OverflowableTableCellWithCheckbox;
|