@gridsuite/commons-ui 0.139.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/csvDownloader/csv-export.d.ts +1 -1
- package/dist/components/csvDownloader/csv-export.js +5 -14
- package/dist/components/csvDownloader/csv-export.type.d.ts +1 -1
- package/dist/components/csvDownloader/use-csv-export.d.ts +1 -1
- package/dist/components/csvDownloader/use-csv-export.js +11 -11
- 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/filter/FilterCreationDialog.js +2 -1
- package/dist/components/filter/FilterForm.d.ts +16 -2
- package/dist/components/filter/FilterForm.js +5 -10
- package/dist/components/filter/HeaderFilterForm.d.ts +7 -11
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +8 -1
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.d.ts +3 -1
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +9 -2
- 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 +25 -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/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/navigator-clipboard.d.ts +7 -0
- package/dist/utils/navigator-clipboard.js +16 -0
- package/package.json +2 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CsvExportProps } from './csv-export.type';
|
|
2
|
-
export declare function CsvExport({ columns, tableNamePrefix, tableName, disabled, skipColumnHeaders, skipPinnedBottom, language,
|
|
2
|
+
export declare function CsvExport({ columns, tableNamePrefix, tableName, disabled, skipColumnHeaders, skipPinnedBottom, language, getData, }: CsvExportProps): JSX.Element;
|
|
@@ -10,29 +10,20 @@ function CsvExport({
|
|
|
10
10
|
skipColumnHeaders = false,
|
|
11
11
|
skipPinnedBottom = false,
|
|
12
12
|
language,
|
|
13
|
-
|
|
13
|
+
getData
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
15
|
+
const csvExport = useCsvExport();
|
|
16
16
|
const download = useCallback(() => {
|
|
17
|
-
|
|
17
|
+
csvExport.getData({
|
|
18
18
|
columns,
|
|
19
19
|
tableName,
|
|
20
20
|
tableNamePrefix,
|
|
21
21
|
skipColumnHeaders,
|
|
22
22
|
skipPinnedBottom,
|
|
23
23
|
language,
|
|
24
|
-
|
|
24
|
+
getData
|
|
25
25
|
});
|
|
26
|
-
}, [
|
|
27
|
-
downloadCSVData,
|
|
28
|
-
columns,
|
|
29
|
-
tableName,
|
|
30
|
-
tableNamePrefix,
|
|
31
|
-
skipColumnHeaders,
|
|
32
|
-
skipPinnedBottom,
|
|
33
|
-
language,
|
|
34
|
-
exportDataAsCsv
|
|
35
|
-
]);
|
|
26
|
+
}, [columns, csvExport, tableName, tableNamePrefix, skipColumnHeaders, skipPinnedBottom, language, getData]);
|
|
36
27
|
return /* @__PURE__ */ jsx(ExportCsvButton, { disabled, onClick: download });
|
|
37
28
|
}
|
|
38
29
|
export {
|
|
@@ -7,7 +7,7 @@ export type CsvDownloadProps = {
|
|
|
7
7
|
skipColumnHeaders?: boolean;
|
|
8
8
|
skipPinnedBottom?: boolean;
|
|
9
9
|
language: GsLang;
|
|
10
|
-
|
|
10
|
+
getData: (params?: CsvExportParams) => string | undefined | void;
|
|
11
11
|
};
|
|
12
12
|
export type CsvExportProps = CsvDownloadProps & {
|
|
13
13
|
disabled: boolean;
|
|
@@ -7,30 +7,30 @@ import "@mui/icons-material";
|
|
|
7
7
|
import "../../utils/types/equipmentType.js";
|
|
8
8
|
import "../../utils/yupConfig.js";
|
|
9
9
|
const NA_VALUE = "N/A";
|
|
10
|
-
const formatNAValue = (value, intl) => {
|
|
11
|
-
return value === NA_VALUE ? intl.formatMessage({ id: "export/undefined" }) : value;
|
|
12
|
-
};
|
|
13
10
|
const useCsvExport = () => {
|
|
14
11
|
const intl = useIntl();
|
|
15
|
-
const
|
|
16
|
-
return tableName.trim().replace(/[\\/:"*?<>|\s]/g, "-").substring(0, 27);
|
|
17
|
-
}, []);
|
|
18
|
-
const downloadCSVData = useCallback(
|
|
12
|
+
const getData = useCallback(
|
|
19
13
|
(props) => {
|
|
14
|
+
const formatNAValue = (value) => {
|
|
15
|
+
return value === NA_VALUE ? intl.formatMessage({ id: "export/undefined" }) : value;
|
|
16
|
+
};
|
|
20
17
|
const hasColId = (colId) => {
|
|
21
18
|
return colId !== void 0;
|
|
22
19
|
};
|
|
23
20
|
const processCell = (params) => {
|
|
24
21
|
if (params.column.getColId() === "limitName") {
|
|
25
|
-
return formatNAValue(params.value
|
|
22
|
+
return formatNAValue(params.value);
|
|
26
23
|
}
|
|
27
24
|
if (props.language === LANG_FRENCH && typeof params.value === "number") {
|
|
28
25
|
return params.value.toString().replace(".", ",");
|
|
29
26
|
}
|
|
30
27
|
return params.value;
|
|
31
28
|
};
|
|
29
|
+
const getCSVFilename = (tableName) => {
|
|
30
|
+
return tableName.trim().replace(/[\\/:"*?<>|\s]/g, "-").substring(0, 27);
|
|
31
|
+
};
|
|
32
32
|
const prefix = props.tableNamePrefix ?? "";
|
|
33
|
-
props.
|
|
33
|
+
return props.getData({
|
|
34
34
|
suppressQuotes: false,
|
|
35
35
|
skipPinnedBottom: props.skipPinnedBottom,
|
|
36
36
|
columnSeparator: props.language === LANG_FRENCH ? ";" : ",",
|
|
@@ -41,9 +41,9 @@ const useCsvExport = () => {
|
|
|
41
41
|
processCellCallback: processCell
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
|
-
[
|
|
44
|
+
[intl]
|
|
45
45
|
);
|
|
46
|
-
return {
|
|
46
|
+
return { getData };
|
|
47
47
|
};
|
|
48
48
|
export {
|
|
49
49
|
useCsvExport
|
|
@@ -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") {
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { GsLang } from '../../utils';
|
|
3
|
+
export interface FilterFormProps {
|
|
4
|
+
creation?: boolean;
|
|
5
|
+
activeDirectory?: UUID;
|
|
6
|
+
filterType?: {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
10
|
+
sourceFilterForExplicitNamingConversion?: {
|
|
11
|
+
id: UUID;
|
|
12
|
+
equipmentType: string;
|
|
13
|
+
};
|
|
14
|
+
language?: GsLang;
|
|
15
|
+
}
|
|
16
|
+
export declare function FilterForm({ sourceFilterForExplicitNamingConversion, creation, activeDirectory, filterType, language, }: Readonly<FilterFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,21 +20,16 @@ function FilterForm({
|
|
|
20
20
|
sourceFilterForExplicitNamingConversion,
|
|
21
21
|
creation,
|
|
22
22
|
activeDirectory,
|
|
23
|
-
filterType
|
|
23
|
+
filterType,
|
|
24
|
+
language
|
|
24
25
|
}) {
|
|
25
26
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx(Box, { sx: unscrollableDialogStyles.unscrollableHeader, children: /* @__PURE__ */ jsx(
|
|
27
|
-
HeaderFilterForm,
|
|
28
|
-
{
|
|
29
|
-
creation,
|
|
30
|
-
activeDirectory,
|
|
31
|
-
sourceFilterForExplicitNamingConversion
|
|
32
|
-
}
|
|
33
|
-
) }),
|
|
27
|
+
/* @__PURE__ */ jsx(Box, { sx: unscrollableDialogStyles.unscrollableHeader, children: /* @__PURE__ */ jsx(HeaderFilterForm, { creation, activeDirectory }) }),
|
|
34
28
|
filterType?.id === FilterType.EXPLICIT_NAMING.id && /* @__PURE__ */ jsx(
|
|
35
29
|
ExplicitNamingFilterForm,
|
|
36
30
|
{
|
|
37
|
-
sourceFilterForExplicitNamingConversion
|
|
31
|
+
sourceFilterForExplicitNamingConversion,
|
|
32
|
+
language
|
|
38
33
|
}
|
|
39
34
|
),
|
|
40
35
|
filterType?.id === FilterType.EXPERT.id && /* @__PURE__ */ jsx(ExpertFilterForm, {})
|
|
@@ -10,21 +10,17 @@ export declare const filterStyles: {
|
|
|
10
10
|
readonly width: "50%";
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export declare const HeaderFilterSchema: {
|
|
14
|
+
name: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
15
|
+
equipmentType: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
16
|
+
description: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
17
|
+
};
|
|
18
|
+
export interface HeaderFilterFormProps {
|
|
14
19
|
creation?: boolean;
|
|
15
20
|
activeDirectory?: UUID;
|
|
16
|
-
filterType?: {
|
|
17
|
-
id: string;
|
|
18
|
-
label: string;
|
|
19
|
-
};
|
|
20
21
|
sourceFilterForExplicitNamingConversion?: {
|
|
21
22
|
id: UUID;
|
|
22
23
|
equipmentType: string;
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
export declare
|
|
26
|
-
name: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
27
|
-
equipmentType: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
28
|
-
description: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
29
|
-
};
|
|
30
|
-
export declare function HeaderFilterForm({ creation, activeDirectory }: Readonly<FilterFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function HeaderFilterForm({ creation, activeDirectory }: Readonly<HeaderFilterFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -102,7 +102,14 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
102
102
|
isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
|
|
103
103
|
language,
|
|
104
104
|
unscrollableFullHeight: true,
|
|
105
|
-
children: isDataReady && /* @__PURE__ */ jsx(
|
|
105
|
+
children: isDataReady && /* @__PURE__ */ jsx(
|
|
106
|
+
FilterForm,
|
|
107
|
+
{
|
|
108
|
+
activeDirectory,
|
|
109
|
+
filterType: FilterType.EXPLICIT_NAMING,
|
|
110
|
+
language
|
|
111
|
+
}
|
|
112
|
+
)
|
|
106
113
|
}
|
|
107
114
|
);
|
|
108
115
|
}
|
|
@@ -2,6 +2,7 @@ import { UUID } from 'node:crypto';
|
|
|
2
2
|
import { FieldConstants } from '../../../utils/constants/fieldConstants';
|
|
3
3
|
import { default as yup } from '../../../utils/yupConfig';
|
|
4
4
|
import { DISTRIBUTION_KEY } from '../constants/FilterConstants';
|
|
5
|
+
import { GsLang } from '../../../utils';
|
|
5
6
|
export declare const explicitNamingFilterSchema: {
|
|
6
7
|
filterEquipmentsAttributes: yup.ArraySchema<{
|
|
7
8
|
equipmentID?: string | null | undefined;
|
|
@@ -22,6 +23,7 @@ export interface FilterForExplicitConversionProps {
|
|
|
22
23
|
}
|
|
23
24
|
interface ExplicitNamingFilterFormProps {
|
|
24
25
|
sourceFilterForExplicitNamingConversion?: FilterForExplicitConversionProps;
|
|
26
|
+
language?: GsLang;
|
|
25
27
|
}
|
|
26
|
-
export declare function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }: ExplicitNamingFilterFormProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion, language, }: Readonly<ExplicitNamingFilterFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export {};
|
|
@@ -23,7 +23,10 @@ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialo
|
|
|
23
23
|
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
24
24
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterConstants.js";
|
|
25
25
|
import { filterStyles } from "../HeaderFilterForm.js";
|
|
26
|
+
import "../../../utils/conversionUtils.js";
|
|
26
27
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
28
|
+
import "@mui/icons-material";
|
|
29
|
+
import "../../../utils/types/equipmentType.js";
|
|
27
30
|
import * as yup from "yup";
|
|
28
31
|
function isGeneratorOrLoad(equipmentType) {
|
|
29
32
|
return equipmentType === Generator.type || equipmentType === Load.type;
|
|
@@ -58,7 +61,10 @@ function getExplicitNamingFilterEmptyFormData() {
|
|
|
58
61
|
[FILTER_EQUIPMENTS_ATTRIBUTES]: makeDefaultTableRows()
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
|
-
function ExplicitNamingFilterForm({
|
|
64
|
+
function ExplicitNamingFilterForm({
|
|
65
|
+
sourceFilterForExplicitNamingConversion,
|
|
66
|
+
language
|
|
67
|
+
}) {
|
|
62
68
|
const intl = useIntl();
|
|
63
69
|
const { snackError } = useSnackMessage();
|
|
64
70
|
const { getValues, setValue } = useFormContext();
|
|
@@ -203,7 +209,8 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
203
209
|
id: "filterCsvFileName"
|
|
204
210
|
}),
|
|
205
211
|
fileHeaders: csvFileHeaders,
|
|
206
|
-
getDataFromCsv: getDataFromCsvFile
|
|
212
|
+
getDataFromCsv: getDataFromCsvFile,
|
|
213
|
+
language
|
|
207
214
|
},
|
|
208
215
|
cssProps: {
|
|
209
216
|
padding: 1,
|