@gridsuite/commons-ui 0.138.0 → 0.140.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/cardErrorBoundary/CardErrorBoundary.d.ts +1 -1
- 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/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +2 -6
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +2 -4
- package/dist/components/elementSearch/hooks/useElementSearch.js +2 -4
- package/dist/components/filter/FilterCreationDialog.js +5 -17
- 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/expert/ExpertFilterEditionDialog.js +4 -23
- package/dist/components/filter/expert/expertFilterUtils.d.ts +0 -1
- package/dist/components/filter/expert/expertFilterUtils.js +0 -11
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +11 -8
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.d.ts +3 -1
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +11 -6
- package/dist/components/filter/index.js +1 -2
- package/dist/components/filter/utils/filterApi.js +1 -1
- package/dist/components/index.js +1 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +7 -4
- package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.js +1 -1
- package/dist/components/parameters/common/parameters-creation-dialog.js +4 -9
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +3 -6
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +3 -5
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +2 -5
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +4 -12
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -5
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -5
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +3 -9
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +4 -12
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +2 -5
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +5 -16
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -12
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +3 -8
- package/dist/hooks/use-parameters-backend.js +10 -20
- package/dist/hooks/usePredefinedProperties.js +2 -3
- package/dist/hooks/useSnackMessage.d.ts +1 -2
- package/dist/index.js +11 -4
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +1 -4
- package/dist/services/utils.d.ts +0 -1
- package/dist/services/utils.js +7 -10
- package/dist/translations/en/businessErrorsEn.d.ts +18 -0
- package/dist/translations/en/businessErrorsEn.js +19 -1
- package/dist/translations/en/equipmentShortEn.js +3 -3
- package/dist/translations/fr/businessErrorsFr.d.ts +18 -0
- package/dist/translations/fr/businessErrorsFr.js +19 -1
- package/dist/translations/fr/equipmentShortFr.js +3 -3
- package/dist/utils/error.d.ts +4 -0
- package/dist/utils/error.js +28 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/labelUtils.d.ts +8 -0
- package/dist/utils/labelUtils.js +17 -0
- package/dist/utils/navigator-clipboard.d.ts +7 -0
- package/dist/utils/navigator-clipboard.js +16 -0
- package/dist/{services/businessErrorCode.d.ts → utils/types/CustomError.d.ts} +3 -1
- package/dist/utils/types/CustomError.js +20 -0
- package/dist/utils/types/index.d.ts +1 -0
- package/dist/utils/types/index.js +3 -0
- package/package.json +1 -1
- package/dist/services/businessErrorCode.js +0 -10
|
@@ -22,6 +22,6 @@ export declare class CardErrorBoundary extends Component<PropsWithChildren<{}>,
|
|
|
22
22
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
23
23
|
private handleExpandClick;
|
|
24
24
|
private handleReloadClick;
|
|
25
|
-
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element |
|
|
25
|
+
render(): string | number | boolean | Iterable<import('react').ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -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
|
package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js
CHANGED
|
@@ -9,6 +9,7 @@ import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
|
9
9
|
import { CustomMuiDialog } from "../customMuiDialog/CustomMuiDialog.js";
|
|
10
10
|
import { ExpandingTextField } from "../../inputs/reactHookForm/text/ExpandingTextField.js";
|
|
11
11
|
import { MAX_CHAR_DESCRIPTION } from "../../../utils/constants/uiConstants.js";
|
|
12
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
12
13
|
import * as yup from "yup";
|
|
13
14
|
const schema = yup.object().shape({
|
|
14
15
|
[FieldConstants.DESCRIPTION]: yup.string().max(MAX_CHAR_DESCRIPTION, "descriptionLimitError")
|
|
@@ -40,12 +41,7 @@ function DescriptionModificationDialog({
|
|
|
40
41
|
updateElement(elementUuid, {
|
|
41
42
|
[FieldConstants.DESCRIPTION]: data[FieldConstants.DESCRIPTION]?.trim() ?? ""
|
|
42
43
|
}).catch((error) => {
|
|
43
|
-
|
|
44
|
-
snackError({
|
|
45
|
-
messageTxt: error.message,
|
|
46
|
-
headerId: "descriptionModificationError"
|
|
47
|
-
});
|
|
48
|
-
}
|
|
44
|
+
snackWithFallback(snackError, error, { headerId: "descriptionModificationError" });
|
|
49
45
|
});
|
|
50
46
|
},
|
|
51
47
|
[elementUuid, updateElement, snackError]
|
|
@@ -7,6 +7,7 @@ import { useSnackMessage } from "../../hooks/useSnackMessage.js";
|
|
|
7
7
|
import { fetchElementsInfos } from "../../services/explore.js";
|
|
8
8
|
import { fetchRootFolders, fetchDirectoryContent } from "../../services/directory.js";
|
|
9
9
|
import { getExpansionPathsForSelected, fetchChildrenForExpandedNodes, initializeFromLastSelected, saveLastSelectedDirectoryFromNode } from "./utils.js";
|
|
10
|
+
import { snackWithFallback } from "../../utils/error.js";
|
|
10
11
|
const styles = {
|
|
11
12
|
icon: (theme) => ({
|
|
12
13
|
marginRight: theme.spacing(1),
|
|
@@ -168,10 +169,7 @@ function DirectoryItemSelector({
|
|
|
168
169
|
nodeMap.current = mdr;
|
|
169
170
|
setData(convertRoots(nrs));
|
|
170
171
|
}).catch((error) => {
|
|
171
|
-
snackError
|
|
172
|
-
messageTxt: error.message,
|
|
173
|
-
headerId: "DirectoryItemSelector"
|
|
174
|
-
});
|
|
172
|
+
snackWithFallback(snackError, error, { headerId: "DirectoryItemSelector" });
|
|
175
173
|
}).finally(() => {
|
|
176
174
|
setIsRootsLoaded(true);
|
|
177
175
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState, useRef, useCallback } from "react";
|
|
2
2
|
import { useDebounce } from "../../../hooks/useDebounce.js";
|
|
3
3
|
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
4
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
4
5
|
const SEARCH_FETCH_TIMEOUT_MILLIS = 1e3;
|
|
5
6
|
const useElementSearch = (props) => {
|
|
6
7
|
const { fetchElements } = props;
|
|
@@ -32,10 +33,7 @@ const useElementSearch = (props) => {
|
|
|
32
33
|
setElementsFound([]);
|
|
33
34
|
setTotalElements(0);
|
|
34
35
|
setIsLoading(false);
|
|
35
|
-
snackError
|
|
36
|
-
messageTxt: error.message,
|
|
37
|
-
headerId: "equipmentsSearchingError"
|
|
38
|
-
});
|
|
36
|
+
snackWithFallback(snackError, error, { headerId: "equipmentsSearchingError" });
|
|
39
37
|
}
|
|
40
38
|
});
|
|
41
39
|
},
|
|
@@ -14,10 +14,7 @@ import { FilterType } from "./constants/FilterConstants.js";
|
|
|
14
14
|
import { MAX_CHAR_DESCRIPTION } from "../../utils/constants/uiConstants.js";
|
|
15
15
|
import { EXPERT_FILTER_QUERY } from "./expert/expertFilterConstants.js";
|
|
16
16
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./explicitNaming/ExplicitNamingFilterConstants.js";
|
|
17
|
-
import {
|
|
18
|
-
import "../../utils/conversionUtils.js";
|
|
19
|
-
import "@mui/icons-material";
|
|
20
|
-
import "../../utils/types/equipmentType.js";
|
|
17
|
+
import { snackWithFallback } from "../../utils/error.js";
|
|
21
18
|
import * as yup from "yup";
|
|
22
19
|
const emptyFormData = {
|
|
23
20
|
[FieldConstants.NAME]: "",
|
|
@@ -63,9 +60,7 @@ function FilterCreationDialog({
|
|
|
63
60
|
filterForm[FieldConstants.DESCRIPTION],
|
|
64
61
|
null,
|
|
65
62
|
(error) => {
|
|
66
|
-
snackError
|
|
67
|
-
messageTxt: error.message
|
|
68
|
-
});
|
|
63
|
+
snackWithFallback(snackError, error);
|
|
69
64
|
},
|
|
70
65
|
onClose,
|
|
71
66
|
activeDirectory
|
|
@@ -81,15 +76,7 @@ function FilterCreationDialog({
|
|
|
81
76
|
activeDirectory,
|
|
82
77
|
onClose,
|
|
83
78
|
(error) => {
|
|
84
|
-
|
|
85
|
-
snackError({
|
|
86
|
-
messageId: error.businessErrorCode
|
|
87
|
-
});
|
|
88
|
-
} else {
|
|
89
|
-
snackError({
|
|
90
|
-
messageTxt: error.message
|
|
91
|
-
});
|
|
92
|
-
}
|
|
79
|
+
snackWithFallback(snackError, error);
|
|
93
80
|
}
|
|
94
81
|
);
|
|
95
82
|
}
|
|
@@ -124,7 +111,8 @@ function FilterCreationDialog({
|
|
|
124
111
|
creation: true,
|
|
125
112
|
activeDirectory,
|
|
126
113
|
filterType,
|
|
127
|
-
sourceFilterForExplicitNamingConversion
|
|
114
|
+
sourceFilterForExplicitNamingConversion,
|
|
115
|
+
language
|
|
128
116
|
}
|
|
129
117
|
)
|
|
130
118
|
}
|
|
@@ -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;
|
|
@@ -13,12 +13,8 @@ import { saveExpertFilter } from "../utils/filterApi.js";
|
|
|
13
13
|
import { expertFilterSchema } from "./ExpertFilterForm.js";
|
|
14
14
|
import { importExpertRules } from "./expertFilterUtils.js";
|
|
15
15
|
import { HeaderFilterSchema } from "../HeaderFilterForm.js";
|
|
16
|
-
import { catchErrorHandler } from "../../../services/utils.js";
|
|
17
|
-
import "../../../utils/conversionUtils.js";
|
|
18
|
-
import "@mui/icons-material";
|
|
19
|
-
import "../../../utils/types/equipmentType.js";
|
|
20
|
-
import { CustomError } from "../../../services/businessErrorCode.js";
|
|
21
16
|
import { EXPERT_FILTER_QUERY } from "./expertFilterConstants.js";
|
|
17
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
22
18
|
import * as yup from "yup";
|
|
23
19
|
const formSchema = yup.object().shape({
|
|
24
20
|
...HeaderFilterSchema,
|
|
@@ -61,13 +57,8 @@ function ExpertFilterEditionDialog({
|
|
|
61
57
|
[EXPERT_FILTER_QUERY]: importExpertRules(response[EXPERT_FILTER_QUERY])
|
|
62
58
|
});
|
|
63
59
|
}).catch((error) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
snackError({
|
|
67
|
-
messageTxt: message,
|
|
68
|
-
headerId: "cannotRetrieveFilter"
|
|
69
|
-
});
|
|
70
|
-
});
|
|
60
|
+
setDataFetchStatus(FetchStatus.FETCH_ERROR);
|
|
61
|
+
snackWithFallback(snackError, error, { headerId: "cannotRetrieveFilter" });
|
|
71
62
|
});
|
|
72
63
|
}
|
|
73
64
|
}, [id, name, open, reset, snackError, getFilterById, description]);
|
|
@@ -83,17 +74,7 @@ function ExpertFilterEditionDialog({
|
|
|
83
74
|
null,
|
|
84
75
|
onClose,
|
|
85
76
|
(error) => {
|
|
86
|
-
|
|
87
|
-
snackError({
|
|
88
|
-
messageId: error.businessErrorCode,
|
|
89
|
-
headerId: "cannotSaveFilter"
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
snackError({
|
|
93
|
-
messageTxt: error.message,
|
|
94
|
-
headerId: "cannotSaveFilter"
|
|
95
|
-
});
|
|
96
|
-
}
|
|
77
|
+
snackWithFallback(snackError, error, { headerId: "cannotSaveFilter" });
|
|
97
78
|
}
|
|
98
79
|
);
|
|
99
80
|
if (itemSelectionForCopy.sourceItemUuid === id) {
|
|
@@ -12,4 +12,3 @@ export declare const queryValidator: QueryValidator;
|
|
|
12
12
|
export declare const testQuery: (check: string, query: RuleGroupTypeAny) => boolean;
|
|
13
13
|
export declare function getNumberOfSiblings(path: number[], query: RuleGroupTypeAny): number;
|
|
14
14
|
export declare function recursiveRemove(query: RuleGroupTypeAny, path: number[]): RuleGroupTypeAny;
|
|
15
|
-
export declare function getFilterEquipmentTypeLabel(equipmentType: string | undefined): string;
|
|
@@ -4,10 +4,6 @@ import { DataType } from "./expertFilter.type.js";
|
|
|
4
4
|
import { OPERATOR_OPTIONS, RULES, FIELDS_OPTIONS } from "./expertFilterConstants.js";
|
|
5
5
|
import { isBlankOrEmpty, convertOutputValue, convertInputValue } from "../../../utils/conversionUtils.js";
|
|
6
6
|
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
7
|
-
import "react/jsx-runtime";
|
|
8
|
-
import "@mui/icons-material";
|
|
9
|
-
import { ALL_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
|
|
10
|
-
import "../../../utils/yupConfig.js";
|
|
11
7
|
const searchTree = (tree, key, value) => {
|
|
12
8
|
const stack = Object.values(tree);
|
|
13
9
|
while (stack.length) {
|
|
@@ -361,16 +357,9 @@ function recursiveRemove(query, path) {
|
|
|
361
357
|
}
|
|
362
358
|
return remove(query, path);
|
|
363
359
|
}
|
|
364
|
-
function getFilterEquipmentTypeLabel(equipmentType) {
|
|
365
|
-
if (!equipmentType) {
|
|
366
|
-
return "";
|
|
367
|
-
}
|
|
368
|
-
return ALL_EQUIPMENTS[equipmentType]?.label ?? "";
|
|
369
|
-
}
|
|
370
360
|
export {
|
|
371
361
|
countRules,
|
|
372
362
|
exportExpertRules,
|
|
373
|
-
getFilterEquipmentTypeLabel,
|
|
374
363
|
getNumberOfSiblings,
|
|
375
364
|
getOperators,
|
|
376
365
|
importExpertRules,
|
|
@@ -2,7 +2,7 @@ import { ExpertFilterEditionDialog } from "./ExpertFilterEditionDialog.js";
|
|
|
2
2
|
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData } from "./ExpertFilterForm.js";
|
|
3
3
|
import { CombinatorType, DataType, OperatorType } from "./expertFilter.type.js";
|
|
4
4
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, EXPERT_FILTER_QUERY, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./expertFilterConstants.js";
|
|
5
|
-
import { countRules, exportExpertRules,
|
|
5
|
+
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./expertFilterUtils.js";
|
|
6
6
|
export {
|
|
7
7
|
COMBINATOR_OPTIONS,
|
|
8
8
|
CONVERTERS_MODE_OPTIONS,
|
|
@@ -28,7 +28,6 @@ export {
|
|
|
28
28
|
expertFilterSchema,
|
|
29
29
|
exportExpertRules,
|
|
30
30
|
getExpertFilterEmptyFormData,
|
|
31
|
-
getFilterEquipmentTypeLabel,
|
|
32
31
|
getNumberOfSiblings,
|
|
33
32
|
getOperators,
|
|
34
33
|
importExpertRules,
|
|
@@ -15,6 +15,7 @@ import { FilterForm } from "../FilterForm.js";
|
|
|
15
15
|
import { NO_ITEM_SELECTION_FOR_COPY, FilterType } from "../constants/FilterConstants.js";
|
|
16
16
|
import { HeaderFilterSchema } from "../HeaderFilterForm.js";
|
|
17
17
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterConstants.js";
|
|
18
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
18
19
|
import * as yup from "yup";
|
|
19
20
|
const formSchema = yup.object().shape({
|
|
20
21
|
...HeaderFilterSchema,
|
|
@@ -61,10 +62,7 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
61
62
|
});
|
|
62
63
|
}).catch((error) => {
|
|
63
64
|
setDataFetchStatus(FetchStatus.FETCH_ERROR);
|
|
64
|
-
snackError
|
|
65
|
-
messageTxt: error.message,
|
|
66
|
-
headerId: "cannotRetrieveFilter"
|
|
67
|
-
});
|
|
65
|
+
snackWithFallback(snackError, error, { headerId: "cannotRetrieveFilter" });
|
|
68
66
|
});
|
|
69
67
|
}
|
|
70
68
|
}, [id, name, open, reset, snackError, getFilterById, description]);
|
|
@@ -78,9 +76,7 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
78
76
|
filterForm[FieldConstants.DESCRIPTION] ?? "",
|
|
79
77
|
id,
|
|
80
78
|
(error) => {
|
|
81
|
-
snackError
|
|
82
|
-
messageTxt: error.message
|
|
83
|
-
});
|
|
79
|
+
snackWithFallback(snackError, error);
|
|
84
80
|
},
|
|
85
81
|
onClose
|
|
86
82
|
);
|
|
@@ -106,7 +102,14 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
106
102
|
isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
|
|
107
103
|
language,
|
|
108
104
|
unscrollableFullHeight: true,
|
|
109
|
-
children: isDataReady && /* @__PURE__ */ jsx(
|
|
105
|
+
children: isDataReady && /* @__PURE__ */ jsx(
|
|
106
|
+
FilterForm,
|
|
107
|
+
{
|
|
108
|
+
activeDirectory,
|
|
109
|
+
filterType: FilterType.EXPLICIT_NAMING,
|
|
110
|
+
language
|
|
111
|
+
}
|
|
112
|
+
)
|
|
110
113
|
}
|
|
111
114
|
);
|
|
112
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,6 +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";
|
|
27
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
28
|
+
import "@mui/icons-material";
|
|
29
|
+
import "../../../utils/types/equipmentType.js";
|
|
26
30
|
import * as yup from "yup";
|
|
27
31
|
function isGeneratorOrLoad(equipmentType) {
|
|
28
32
|
return equipmentType === Generator.type || equipmentType === Load.type;
|
|
@@ -57,7 +61,10 @@ function getExplicitNamingFilterEmptyFormData() {
|
|
|
57
61
|
[FILTER_EQUIPMENTS_ATTRIBUTES]: makeDefaultTableRows()
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
|
-
function ExplicitNamingFilterForm({
|
|
64
|
+
function ExplicitNamingFilterForm({
|
|
65
|
+
sourceFilterForExplicitNamingConversion,
|
|
66
|
+
language
|
|
67
|
+
}) {
|
|
61
68
|
const intl = useIntl();
|
|
62
69
|
const { snackError } = useSnackMessage();
|
|
63
70
|
const { getValues, setValue } = useFormContext();
|
|
@@ -147,10 +154,7 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
147
154
|
}))
|
|
148
155
|
);
|
|
149
156
|
}).catch(
|
|
150
|
-
(error) => snackError
|
|
151
|
-
messageTxt: error.message,
|
|
152
|
-
headerId: "convertIntoExplicitNamingFilterError"
|
|
153
|
-
})
|
|
157
|
+
(error) => snackWithFallback(snackError, error, { headerId: "convertIntoExplicitNamingFilterError" })
|
|
154
158
|
);
|
|
155
159
|
};
|
|
156
160
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -205,7 +209,8 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
205
209
|
id: "filterCsvFileName"
|
|
206
210
|
}),
|
|
207
211
|
fileHeaders: csvFileHeaders,
|
|
208
|
-
getDataFromCsv: getDataFromCsvFile
|
|
212
|
+
getDataFromCsv: getDataFromCsvFile,
|
|
213
|
+
language
|
|
209
214
|
},
|
|
210
215
|
cssProps: {
|
|
211
216
|
padding: 1,
|
|
@@ -5,7 +5,7 @@ import { ExpertFilterEditionDialog } from "./expert/ExpertFilterEditionDialog.js
|
|
|
5
5
|
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData } from "./expert/ExpertFilterForm.js";
|
|
6
6
|
import { CombinatorType, DataType, OperatorType } from "./expert/expertFilter.type.js";
|
|
7
7
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, EXPERT_FILTER_QUERY, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./expert/expertFilterConstants.js";
|
|
8
|
-
import { countRules, exportExpertRules,
|
|
8
|
+
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./expert/expertFilterUtils.js";
|
|
9
9
|
import { ExplicitNamingFilterEditionDialog } from "./explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
10
10
|
import { ExplicitNamingFilterForm, explicitNamingFilterSchema, getExplicitNamingFilterEmptyFormData } from "./explicitNaming/ExplicitNamingFilterForm.js";
|
|
11
11
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./explicitNaming/ExplicitNamingFilterConstants.js";
|
|
@@ -48,7 +48,6 @@ export {
|
|
|
48
48
|
exportExpertRules,
|
|
49
49
|
getExpertFilterEmptyFormData,
|
|
50
50
|
getExplicitNamingFilterEmptyFormData,
|
|
51
|
-
getFilterEquipmentTypeLabel,
|
|
52
51
|
getNumberOfSiblings,
|
|
53
52
|
getOperators,
|
|
54
53
|
importExpertRules,
|
|
@@ -3,8 +3,8 @@ import { Generator, Load } from "../../../utils/types/equipmentTypes.js";
|
|
|
3
3
|
import { exportExpertRules } from "../expert/expertFilterUtils.js";
|
|
4
4
|
import { DISTRIBUTION_KEY, FilterType } from "../constants/FilterConstants.js";
|
|
5
5
|
import { createFilter, saveFilter } from "../../../services/explore.js";
|
|
6
|
-
import { catchErrorHandler } from "../../../services/utils.js";
|
|
7
6
|
import "../../../utils/conversionUtils.js";
|
|
7
|
+
import { catchErrorHandler } from "../../../utils/error.js";
|
|
8
8
|
import "react/jsx-runtime";
|
|
9
9
|
import "@mui/icons-material";
|
|
10
10
|
import "../../../utils/types/equipmentType.js";
|
package/dist/components/index.js
CHANGED
|
@@ -43,7 +43,7 @@ import { ExpertFilterEditionDialog } from "./filter/expert/ExpertFilterEditionDi
|
|
|
43
43
|
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData } from "./filter/expert/ExpertFilterForm.js";
|
|
44
44
|
import { CombinatorType, DataType, OperatorType } from "./filter/expert/expertFilter.type.js";
|
|
45
45
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, EXPERT_FILTER_QUERY, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./filter/expert/expertFilterConstants.js";
|
|
46
|
-
import { countRules, exportExpertRules,
|
|
46
|
+
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./filter/expert/expertFilterUtils.js";
|
|
47
47
|
import { ExplicitNamingFilterEditionDialog } from "./filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
48
48
|
import { ExplicitNamingFilterForm, explicitNamingFilterSchema, getExplicitNamingFilterEmptyFormData } from "./filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
49
49
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./filter/explicitNaming/ExplicitNamingFilterConstants.js";
|
|
@@ -487,7 +487,6 @@ export {
|
|
|
487
487
|
generateTreeViewFinderClass,
|
|
488
488
|
getExpertFilterEmptyFormData,
|
|
489
489
|
getExplicitNamingFilterEmptyFormData,
|
|
490
|
-
getFilterEquipmentTypeLabel,
|
|
491
490
|
getLimitReductionsFormSchema,
|
|
492
491
|
getNumberOfSiblings,
|
|
493
492
|
getOperators,
|
|
@@ -10,7 +10,7 @@ import "./provider/CustomFormProvider.js";
|
|
|
10
10
|
import { useCustomFormContext } from "./provider/useCustomFormContext.js";
|
|
11
11
|
import { ErrorInput } from "./errorManagement/ErrorInput.js";
|
|
12
12
|
import { MidFormError } from "./errorManagement/MidFormError.js";
|
|
13
|
-
import
|
|
13
|
+
import "../../../utils/types/equipmentType.js";
|
|
14
14
|
import { fetchDirectoryElementPath } from "../../../services/directory.js";
|
|
15
15
|
import "localized-countries";
|
|
16
16
|
import "localized-countries/data/fr";
|
|
@@ -20,6 +20,7 @@ import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItem
|
|
|
20
20
|
import "../../../utils/conversionUtils.js";
|
|
21
21
|
import { mergeSx } from "../../../utils/styles.js";
|
|
22
22
|
import { ArrayAction } from "../../../utils/types/types.js";
|
|
23
|
+
import { getEquipmentTypeShortLabel } from "../../../utils/labelUtils.js";
|
|
23
24
|
import "../../../utils/yupConfig.js";
|
|
24
25
|
import { NAME } from "./constants.js";
|
|
25
26
|
import { OverflowableChip } from "./OverflowableChip.js";
|
|
@@ -187,7 +188,9 @@ function DirectoryItemsInput({
|
|
|
187
188
|
),
|
|
188
189
|
elements?.length > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.formDirectoryElements2, children: elements.map((item, index) => {
|
|
189
190
|
const elementName = watchedElements?.[index]?.[NAME] ?? getValues(`${name}.${index}.${NAME}`) ?? item?.[NAME];
|
|
190
|
-
const
|
|
191
|
+
const equipmentTypeShortLabel = getEquipmentTypeShortLabel(
|
|
192
|
+
item?.specificMetadata?.equipmentType
|
|
193
|
+
);
|
|
191
194
|
const { sx: chipSx, ...otherChipProps } = chipProps ?? {};
|
|
192
195
|
return /* @__PURE__ */ jsx(
|
|
193
196
|
ChipComponent,
|
|
@@ -195,9 +198,9 @@ function DirectoryItemsInput({
|
|
|
195
198
|
onDelete: () => removeElements(index),
|
|
196
199
|
onClick: () => handleChipClick(index),
|
|
197
200
|
label: elementName ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${name}.${index}.${NAME}` }) : intl.formatMessage({ id: "elementNotFound" }),
|
|
198
|
-
...
|
|
201
|
+
...equipmentTypeShortLabel && {
|
|
199
202
|
helperText: intl.formatMessage({
|
|
200
|
-
id:
|
|
203
|
+
id: equipmentTypeShortLabel
|
|
201
204
|
})
|
|
202
205
|
},
|
|
203
206
|
sx: mergeSx(
|
|
@@ -7,7 +7,7 @@ function OverflowableChipWithHelperText({
|
|
|
7
7
|
}) {
|
|
8
8
|
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "left", flexDirection: "column" }, children: [
|
|
9
9
|
/* @__PURE__ */ jsx(OverflowableChip, { ...otherProps }),
|
|
10
|
-
helperText && /* @__PURE__ */ jsx(FormHelperText, { sx: {
|
|
10
|
+
helperText && /* @__PURE__ */ jsx(FormHelperText, { sx: { fontSize: "x-small" }, children: helperText })
|
|
11
11
|
] });
|
|
12
12
|
}
|
|
13
13
|
export {
|