@gridsuite/commons-ui 0.109.1 → 0.111.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 +2 -0
- package/dist/components/csvDownloader/csv-export.js +23 -0
- package/dist/components/csvDownloader/csv-export.type.d.ts +16 -0
- package/dist/components/csvDownloader/csv-export.type.js +1 -0
- package/dist/components/csvDownloader/export-csv-button.d.ts +7 -0
- package/dist/components/csvDownloader/export-csv-button.js +33 -0
- package/dist/components/csvDownloader/index.d.ts +10 -0
- package/dist/components/csvDownloader/index.js +8 -0
- package/dist/components/csvDownloader/use-csv-export.d.ts +4 -0
- package/dist/components/csvDownloader/use-csv-export.js +52 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +15 -2
- package/dist/components/inputs/index.js +3 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +0 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -5
- package/dist/components/inputs/reactHookForm/constants.d.ts +8 -0
- package/dist/components/inputs/reactHookForm/constants.js +6 -0
- package/dist/components/inputs/reactHookForm/index.d.ts +1 -0
- package/dist/components/inputs/reactHookForm/index.js +3 -2
- package/dist/components/parameters/common/index.js +2 -0
- package/dist/components/parameters/common/limitreductions/columns-definitions.d.ts +1 -1
- package/dist/components/parameters/common/limitreductions/columns-definitions.js +3 -1
- package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +4 -3
- package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +4 -0
- package/dist/components/parameters/common/parameters-edition-dialog-props.js +14 -1
- package/dist/components/parameters/index.d.ts +1 -0
- package/dist/components/parameters/index.js +6 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +34 -4
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +4 -2
- package/dist/components/parameters/network-visualizations/map-parameters.js +1 -1
- package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +1 -1
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +4 -3
- package/dist/components/parameters/security-analysis/index.d.ts +8 -0
- package/dist/components/parameters/security-analysis/index.js +6 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.d.ts +2 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +107 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.d.ts +8 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +139 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.d.ts +10 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +197 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.d.ts +7 -0
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +84 -0
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.d.ts +7 -0
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +138 -0
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +24 -0
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +162 -0
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +5 -4
- package/dist/components/parameters/voltage-init/general-parameters.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -3
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +2 -1
- package/dist/hooks/use-parameters-backend.d.ts +1 -1
- package/dist/index.js +26 -2
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +11 -0
- package/dist/services/security-analysis.d.ts +11 -0
- package/dist/services/security-analysis.js +91 -0
- package/dist/translations/en/parameters.d.ts +8 -0
- package/dist/translations/en/parameters.js +9 -1
- package/dist/translations/en/tableEn.d.ts +1 -0
- package/dist/translations/en/tableEn.js +2 -1
- package/dist/translations/fr/parameters.d.ts +8 -0
- package/dist/translations/fr/parameters.js +9 -1
- package/dist/translations/fr/tableFr.d.ts +1 -0
- package/dist/translations/fr/tableFr.js +2 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { useState, useCallback, useMemo, useEffect } from "react";
|
|
|
4
4
|
import { TabValues, getDefaultSpecificParamsValues, getSpecificLoadFlowParametersFormSchema, getCommonLoadFlowParametersFormSchema, mapLimitReductions, setSpecificParameters, setLimitReductions } from "./load-flow-parameters-utils.js";
|
|
5
5
|
import { ParameterType } from "../../../utils/types/parameters.type.js";
|
|
6
6
|
import { PROVIDER } from "../common/constant.js";
|
|
7
|
+
import { getDialogParametersFormSchema } from "../common/parameters-edition-dialog-props.js";
|
|
7
8
|
import "react/jsx-runtime";
|
|
8
9
|
import "@mui/material";
|
|
9
10
|
import "react-intl";
|
|
@@ -21,7 +22,7 @@ import { ElementType } from "../../../utils/types/elementType.js";
|
|
|
21
22
|
import "../../treeViewFinder/TreeViewFinder.js";
|
|
22
23
|
import * as yup from "yup";
|
|
23
24
|
import "../../overflowableText/OverflowableText.js";
|
|
24
|
-
import {
|
|
25
|
+
import { DESCRIPTION, NAME } from "../../inputs/reactHookForm/constants.js";
|
|
25
26
|
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
26
27
|
import "../../customAGGrid/customAggrid.js";
|
|
27
28
|
import "ag-grid-community";
|
|
@@ -80,6 +81,7 @@ const useLoadFlowParametersForm = (parametersBackend, enableDeveloperMode, param
|
|
|
80
81
|
const formSchema = useMemo(() => {
|
|
81
82
|
var _a;
|
|
82
83
|
return yup.object({
|
|
84
|
+
...getDialogParametersFormSchema(name),
|
|
83
85
|
[PROVIDER]: yup.string().required(),
|
|
84
86
|
[PARAM_LIMIT_REDUCTION]: yup.number().nullable(),
|
|
85
87
|
...getCommonLoadFlowParametersFormSchema().fields,
|
|
@@ -220,7 +222,7 @@ const useLoadFlowParametersForm = (parametersBackend, enableDeveloperMode, param
|
|
|
220
222
|
formatNewParams(formData),
|
|
221
223
|
formData[NAME],
|
|
222
224
|
ElementType.LOADFLOW_PARAMETERS,
|
|
223
|
-
formData[
|
|
225
|
+
formData[DESCRIPTION] ?? ""
|
|
224
226
|
);
|
|
225
227
|
}
|
|
226
228
|
},
|
|
@@ -2,6 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Grid } from "@mui/material";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import { MAP_BASE_MAP, NetworkVisualizationTabValues, PARAM_MAP_BASEMAP, INTL_MAP_BASE_MAP_OPTIONS, PARAM_LINE_FULL_PATH, PARAM_LINE_PARALLEL_PATH, INTL_LINE_FLOW_MODE_OPTIONS, LINE_FLOW_MODE, PARAM_LINE_FLOW_MODE, MAP_MANUAL_REFRESH, PARAM_MAP_MANUAL_REFRESH } from "./constants.js";
|
|
5
|
+
import "../../../utils/yupConfig.js";
|
|
5
6
|
import { LineSeparator } from "../common/line-separator.js";
|
|
6
7
|
import { parametersStyles } from "../parameters-style.js";
|
|
7
8
|
import "react";
|
|
@@ -27,7 +28,6 @@ import { SwitchInput } from "../../inputs/reactHookForm/booleans/SwitchInput.js"
|
|
|
27
28
|
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
28
29
|
import { MuiSelectInput } from "../../inputs/reactHookForm/selectInputs/MuiSelectInput.js";
|
|
29
30
|
import "../../../utils/conversionUtils.js";
|
|
30
|
-
import "../../../utils/yupConfig.js";
|
|
31
31
|
import "@react-querybuilder/material";
|
|
32
32
|
import "../../filter/expert/expertFilterConstants.js";
|
|
33
33
|
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
@@ -2,6 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Grid } from "@mui/material";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import "../../../utils/yupConfig.js";
|
|
5
6
|
import { LineSeparator } from "../common/line-separator.js";
|
|
6
7
|
import { parametersStyles } from "../parameters-style.js";
|
|
7
8
|
import "../../../utils/types/equipmentType.js";
|
|
@@ -26,7 +27,6 @@ import { SwitchInput } from "../../inputs/reactHookForm/booleans/SwitchInput.js"
|
|
|
26
27
|
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
27
28
|
import { MuiSelectInput } from "../../inputs/reactHookForm/selectInputs/MuiSelectInput.js";
|
|
28
29
|
import "../../../utils/conversionUtils.js";
|
|
29
|
-
import "../../../utils/yupConfig.js";
|
|
30
30
|
import "@react-querybuilder/material";
|
|
31
31
|
import "../../filter/expert/expertFilterConstants.js";
|
|
32
32
|
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
@@ -17,7 +17,9 @@ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
|
17
17
|
import "@mui/icons-material";
|
|
18
18
|
import * as yup from "yup";
|
|
19
19
|
import "../../overflowableText/OverflowableText.js";
|
|
20
|
-
import {
|
|
20
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
21
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
22
|
+
import { DESCRIPTION, NAME } from "../../inputs/reactHookForm/constants.js";
|
|
21
23
|
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
22
24
|
import "../../customAGGrid/customAggrid.js";
|
|
23
25
|
import "ag-grid-community";
|
|
@@ -25,7 +27,6 @@ import "react-papaparse";
|
|
|
25
27
|
import "react-csv-downloader";
|
|
26
28
|
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
27
29
|
import "../../../utils/conversionUtils.js";
|
|
28
|
-
import { ElementType } from "../../../utils/types/elementType.js";
|
|
29
30
|
import "@react-querybuilder/material";
|
|
30
31
|
import "../../filter/expert/expertFilterConstants.js";
|
|
31
32
|
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
@@ -112,7 +113,7 @@ const useNetworkVisualizationParametersForm = ({
|
|
|
112
113
|
formData,
|
|
113
114
|
formData[NAME],
|
|
114
115
|
ElementType.NETWORK_VISUALIZATIONS_PARAMETERS,
|
|
115
|
-
formData[
|
|
116
|
+
formData[DESCRIPTION] ?? ""
|
|
116
117
|
).catch((error) => {
|
|
117
118
|
snackError({
|
|
118
119
|
messageTxt: error.message,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './security-analysis-parameters-inline';
|
|
8
|
+
export * from './security-analysis-parameters-dialog';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SecurityAnalysisParametersInline } from "./security-analysis-parameters-inline.js";
|
|
2
|
+
import { SecurityAnalysisParametersDialog } from "./security-analysis-parameters-dialog.js";
|
|
3
|
+
export {
|
|
4
|
+
SecurityAnalysisParametersDialog,
|
|
5
|
+
SecurityAnalysisParametersInline
|
|
6
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ParametersEditionDialogProps } from '../common';
|
|
2
|
+
export declare function SecurityAnalysisParametersDialog({ id, open, onClose, titleId, name, description, activeDirectory, language, user, enableDeveloperMode, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-intl";
|
|
4
|
+
import "../../../utils/types/equipmentType.js";
|
|
5
|
+
import { getSecurityAnalysisDefaultLimitReductions, updateSecurityAnalysisParameters, fetchSecurityAnalysisParameters, fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisProviders } from "../../../services/security-analysis.js";
|
|
6
|
+
import "@mui/material";
|
|
7
|
+
import "localized-countries";
|
|
8
|
+
import "localized-countries/data/fr";
|
|
9
|
+
import "localized-countries/data/en";
|
|
10
|
+
import "notistack";
|
|
11
|
+
import { useParametersBackend, OptionalServicesStatus } from "../../../hooks/use-parameters-backend.js";
|
|
12
|
+
import { useSecurityAnalysisParametersForm } from "./use-security-analysis-parameters-form.js";
|
|
13
|
+
import { ComputingType } from "../common/computing-type.js";
|
|
14
|
+
import "../../../utils/yupConfig.js";
|
|
15
|
+
import { CustomMuiDialog } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
16
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
17
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
18
|
+
import "react-hook-form";
|
|
19
|
+
import "@mui/icons-material";
|
|
20
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
21
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
22
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
23
|
+
import "yup";
|
|
24
|
+
import "../../overflowableText/OverflowableText.js";
|
|
25
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
26
|
+
import "../../customAGGrid/customAggrid.js";
|
|
27
|
+
import "ag-grid-community";
|
|
28
|
+
import "react-papaparse";
|
|
29
|
+
import "react-csv-downloader";
|
|
30
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
31
|
+
import "../../../utils/conversionUtils.js";
|
|
32
|
+
import "@react-querybuilder/material";
|
|
33
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
34
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
35
|
+
import "uuid";
|
|
36
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
37
|
+
import "react-querybuilder";
|
|
38
|
+
import "../common/widget/parameter-line-slider.js";
|
|
39
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
40
|
+
import { SecurityAnalysisParametersForm } from "./security-analysis-parameters-form.js";
|
|
41
|
+
import { NameElementEditorForm } from "../common/name-element-editor/name-element-editor-form.js";
|
|
42
|
+
function SecurityAnalysisParametersDialog({
|
|
43
|
+
id,
|
|
44
|
+
open,
|
|
45
|
+
onClose,
|
|
46
|
+
titleId,
|
|
47
|
+
name,
|
|
48
|
+
description,
|
|
49
|
+
activeDirectory,
|
|
50
|
+
language,
|
|
51
|
+
user,
|
|
52
|
+
enableDeveloperMode = false
|
|
53
|
+
}) {
|
|
54
|
+
const parametersBackend = useParametersBackend(
|
|
55
|
+
user,
|
|
56
|
+
id,
|
|
57
|
+
ComputingType.SECURITY_ANALYSIS,
|
|
58
|
+
OptionalServicesStatus.Up,
|
|
59
|
+
fetchSecurityAnalysisProviders,
|
|
60
|
+
null,
|
|
61
|
+
fetchDefaultSecurityAnalysisProvider,
|
|
62
|
+
null,
|
|
63
|
+
fetchSecurityAnalysisParameters,
|
|
64
|
+
updateSecurityAnalysisParameters,
|
|
65
|
+
void 0,
|
|
66
|
+
getSecurityAnalysisDefaultLimitReductions
|
|
67
|
+
);
|
|
68
|
+
const securityAnalysisMethods = useSecurityAnalysisParametersForm(parametersBackend, id, name, description);
|
|
69
|
+
const {
|
|
70
|
+
formState: { errors, dirtyFields }
|
|
71
|
+
} = securityAnalysisMethods.formMethods;
|
|
72
|
+
const disableSave = Object.keys(errors).length > 0 || Object.keys(dirtyFields).length === 0;
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
74
|
+
CustomMuiDialog,
|
|
75
|
+
{
|
|
76
|
+
open,
|
|
77
|
+
onClose,
|
|
78
|
+
onSave: securityAnalysisMethods.onSaveDialog,
|
|
79
|
+
formSchema: securityAnalysisMethods.formSchema,
|
|
80
|
+
formMethods: securityAnalysisMethods.formMethods,
|
|
81
|
+
titleId,
|
|
82
|
+
removeOptional: true,
|
|
83
|
+
language,
|
|
84
|
+
disabledSave: disableSave,
|
|
85
|
+
children: /* @__PURE__ */ jsx(
|
|
86
|
+
SecurityAnalysisParametersForm,
|
|
87
|
+
{
|
|
88
|
+
securityAnalysisMethods,
|
|
89
|
+
enableDeveloperMode,
|
|
90
|
+
renderTitleFields: () => {
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
NameElementEditorForm,
|
|
93
|
+
{
|
|
94
|
+
initialElementName: name,
|
|
95
|
+
activeDirectory,
|
|
96
|
+
elementType: ElementType.LOADFLOW_PARAMETERS
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
SecurityAnalysisParametersDialog
|
|
107
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UseSecurityAnalysisParametersFormReturn } from './use-security-analysis-parameters-form';
|
|
3
|
+
export declare function SecurityAnalysisParametersForm({ securityAnalysisMethods, renderTitleFields, renderActions, enableDeveloperMode, }: Readonly<{
|
|
4
|
+
securityAnalysisMethods: UseSecurityAnalysisParametersFormReturn;
|
|
5
|
+
renderTitleFields?: () => ReactNode;
|
|
6
|
+
renderActions?: () => ReactNode;
|
|
7
|
+
enableDeveloperMode: boolean;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { FormattedMessage } from "react-intl";
|
|
3
|
+
import { Grid, Box, LinearProgress } from "@mui/material";
|
|
4
|
+
import "react";
|
|
5
|
+
import "react-hook-form";
|
|
6
|
+
import "../../../utils/types/equipmentType.js";
|
|
7
|
+
import "localized-countries";
|
|
8
|
+
import "localized-countries/data/fr";
|
|
9
|
+
import "localized-countries/data/en";
|
|
10
|
+
import "notistack";
|
|
11
|
+
import { CustomFormProvider } from "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
12
|
+
import "@mui/icons-material";
|
|
13
|
+
import "yup";
|
|
14
|
+
import "../../overflowableText/OverflowableText.js";
|
|
15
|
+
import { mergeSx } from "../../../utils/styles.js";
|
|
16
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
17
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
18
|
+
import "../../customAGGrid/customAggrid.js";
|
|
19
|
+
import "ag-grid-community";
|
|
20
|
+
import "react-papaparse";
|
|
21
|
+
import "react-csv-downloader";
|
|
22
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
23
|
+
import { MuiSelectInput } from "../../inputs/reactHookForm/selectInputs/MuiSelectInput.js";
|
|
24
|
+
import "../../../utils/conversionUtils.js";
|
|
25
|
+
import "../../../utils/yupConfig.js";
|
|
26
|
+
import "@react-querybuilder/material";
|
|
27
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
28
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
29
|
+
import "uuid";
|
|
30
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
31
|
+
import "react-querybuilder";
|
|
32
|
+
import { parametersStyles } from "../parameters-style.js";
|
|
33
|
+
import { PARAM_SA_PROVIDER } from "../common/constant.js";
|
|
34
|
+
import { LineSeparator } from "../common/line-separator.js";
|
|
35
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
36
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
37
|
+
import "../common/widget/parameter-line-slider.js";
|
|
38
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
39
|
+
import { SecurityAnalysisParametersSelector } from "./security-analysis-parameters-selector.js";
|
|
40
|
+
const styles = {
|
|
41
|
+
securityAnalysisParameters: {
|
|
42
|
+
flexGrow: 1,
|
|
43
|
+
paddingLeft: 1,
|
|
44
|
+
overflow: "auto",
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexDirection: "column"
|
|
47
|
+
},
|
|
48
|
+
actions: {
|
|
49
|
+
flexGrow: 0
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function SecurityAnalysisParametersForm({
|
|
53
|
+
securityAnalysisMethods,
|
|
54
|
+
renderTitleFields,
|
|
55
|
+
renderActions,
|
|
56
|
+
enableDeveloperMode
|
|
57
|
+
}) {
|
|
58
|
+
var _a;
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
CustomFormProvider,
|
|
61
|
+
{
|
|
62
|
+
validationSchema: securityAnalysisMethods.formSchema,
|
|
63
|
+
...securityAnalysisMethods.formMethods,
|
|
64
|
+
children: /* @__PURE__ */ jsx(Grid, { item: true, sx: { height: "100%" }, xl: 9, lg: 11, md: 12, children: /* @__PURE__ */ jsx(
|
|
65
|
+
Box,
|
|
66
|
+
{
|
|
67
|
+
sx: {
|
|
68
|
+
height: "100%",
|
|
69
|
+
display: "flex",
|
|
70
|
+
position: "relative",
|
|
71
|
+
flexDirection: "column"
|
|
72
|
+
},
|
|
73
|
+
children: /* @__PURE__ */ jsxs(Box, { sx: styles.securityAnalysisParameters, children: [
|
|
74
|
+
renderTitleFields == null ? void 0 : renderTitleFields(),
|
|
75
|
+
securityAnalysisMethods.paramsLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ jsxs(
|
|
77
|
+
Grid,
|
|
78
|
+
{
|
|
79
|
+
container: true,
|
|
80
|
+
spacing: 1,
|
|
81
|
+
sx: {
|
|
82
|
+
padding: 0,
|
|
83
|
+
paddingBottom: 2,
|
|
84
|
+
height: "fit-content"
|
|
85
|
+
},
|
|
86
|
+
justifyContent: "space-between",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: "auto", sx: parametersStyles.parameterName, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "Provider" }) }),
|
|
89
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: "auto", sx: parametersStyles.controlItem, children: /* @__PURE__ */ jsx(
|
|
90
|
+
MuiSelectInput,
|
|
91
|
+
{
|
|
92
|
+
name: PARAM_SA_PROVIDER,
|
|
93
|
+
size: "small",
|
|
94
|
+
options: Object.values(securityAnalysisMethods.formattedProviders)
|
|
95
|
+
}
|
|
96
|
+
) }),
|
|
97
|
+
/* @__PURE__ */ jsx(LineSeparator, {})
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
Box,
|
|
103
|
+
{
|
|
104
|
+
sx: {
|
|
105
|
+
flexGrow: 1,
|
|
106
|
+
overflow: "auto",
|
|
107
|
+
paddingLeft: 1
|
|
108
|
+
},
|
|
109
|
+
children: /* @__PURE__ */ jsx(
|
|
110
|
+
Grid,
|
|
111
|
+
{
|
|
112
|
+
container: true,
|
|
113
|
+
sx: mergeSx(parametersStyles.scrollableGrid, {
|
|
114
|
+
maxHeight: "100%"
|
|
115
|
+
}),
|
|
116
|
+
children: /* @__PURE__ */ jsx(
|
|
117
|
+
SecurityAnalysisParametersSelector,
|
|
118
|
+
{
|
|
119
|
+
params: securityAnalysisMethods.params,
|
|
120
|
+
currentProvider: (_a = securityAnalysisMethods.currentProvider) == null ? void 0 : _a.trim(),
|
|
121
|
+
enableDeveloperMode,
|
|
122
|
+
defaultLimitReductions: securityAnalysisMethods.defaultLimitReductions
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }) : /* @__PURE__ */ jsx(LinearProgress, {}),
|
|
130
|
+
renderActions && /* @__PURE__ */ jsx(Box, { sx: styles.actions, children: renderActions() })
|
|
131
|
+
] })
|
|
132
|
+
}
|
|
133
|
+
) })
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
SecurityAnalysisParametersForm
|
|
139
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { UUID } from 'crypto';
|
|
3
|
+
import { UseParametersBackendReturnProps } from '../../../utils';
|
|
4
|
+
import { ComputingType } from '../common';
|
|
5
|
+
export declare function SecurityAnalysisParametersInline({ studyUuid, parametersBackend, setHaveDirtyFields, enableDeveloperMode, }: Readonly<{
|
|
6
|
+
studyUuid: UUID | null;
|
|
7
|
+
parametersBackend: UseParametersBackendReturnProps<ComputingType.SECURITY_ANALYSIS>;
|
|
8
|
+
setHaveDirtyFields: Dispatch<SetStateAction<boolean>>;
|
|
9
|
+
enableDeveloperMode: boolean;
|
|
10
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useEffect } from "react";
|
|
3
|
+
import { Box, Grid } from "@mui/material";
|
|
4
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
|
+
import "../../../utils/conversionUtils.js";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
8
|
+
import { mergeSx } from "../../../utils/styles.js";
|
|
9
|
+
import "../../../utils/types/equipmentType.js";
|
|
10
|
+
import "../../../utils/yupConfig.js";
|
|
11
|
+
import { LineSeparator } from "../common/line-separator.js";
|
|
12
|
+
import { LabelledButton } from "../common/parameters.js";
|
|
13
|
+
import { CreateParameterDialog } from "../common/parameters-creation-dialog.js";
|
|
14
|
+
import { parametersStyles } from "../parameters-style.js";
|
|
15
|
+
import "react-hook-form";
|
|
16
|
+
import { fetchSecurityAnalysisParameters } from "../../../services/security-analysis.js";
|
|
17
|
+
import "localized-countries";
|
|
18
|
+
import "localized-countries/data/fr";
|
|
19
|
+
import "localized-countries/data/en";
|
|
20
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
21
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
22
|
+
import { SubmitButton } from "../../inputs/reactHookForm/utils/SubmitButton.js";
|
|
23
|
+
import "yup";
|
|
24
|
+
import "../../overflowableText/OverflowableText.js";
|
|
25
|
+
import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
|
|
26
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
27
|
+
import "../../customAGGrid/customAggrid.js";
|
|
28
|
+
import "ag-grid-community";
|
|
29
|
+
import "react-papaparse";
|
|
30
|
+
import "react-csv-downloader";
|
|
31
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
32
|
+
import { PopupConfirmationDialog } from "../../dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
|
|
33
|
+
import "@react-querybuilder/material";
|
|
34
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
35
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
36
|
+
import "uuid";
|
|
37
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
38
|
+
import "react-querybuilder";
|
|
39
|
+
import "../common/widget/parameter-line-slider.js";
|
|
40
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
41
|
+
import { toFormValueSaParameters } from "../common/limitreductions/limit-reductions-form-util.js";
|
|
42
|
+
import { useSecurityAnalysisParametersForm } from "./use-security-analysis-parameters-form.js";
|
|
43
|
+
import { SecurityAnalysisParametersForm } from "./security-analysis-parameters-form.js";
|
|
44
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
45
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
46
|
+
function SecurityAnalysisParametersInline({
|
|
47
|
+
studyUuid,
|
|
48
|
+
parametersBackend,
|
|
49
|
+
setHaveDirtyFields,
|
|
50
|
+
enableDeveloperMode
|
|
51
|
+
}) {
|
|
52
|
+
const securityAnalysisMethods = useSecurityAnalysisParametersForm(parametersBackend, null, null, null);
|
|
53
|
+
const [, , , , resetProvider, , , , resetParameters, , ,] = parametersBackend;
|
|
54
|
+
const intl = useIntl();
|
|
55
|
+
const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
|
|
56
|
+
const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
|
|
57
|
+
const [openResetConfirmation, setOpenResetConfirmation] = useState(false);
|
|
58
|
+
const [pendingResetAction, setPendingResetAction] = useState(null);
|
|
59
|
+
const { snackError } = useSnackMessage();
|
|
60
|
+
const { handleSubmit, formState, reset, getValues } = securityAnalysisMethods.formMethods;
|
|
61
|
+
const executeResetAction = useCallback(() => {
|
|
62
|
+
if (pendingResetAction === "all") {
|
|
63
|
+
resetParameters();
|
|
64
|
+
resetProvider();
|
|
65
|
+
} else if (pendingResetAction === "parameters") {
|
|
66
|
+
resetParameters();
|
|
67
|
+
}
|
|
68
|
+
setOpenResetConfirmation(false);
|
|
69
|
+
setPendingResetAction(null);
|
|
70
|
+
}, [pendingResetAction, resetParameters, resetProvider]);
|
|
71
|
+
const handleResetAllClick = useCallback(() => {
|
|
72
|
+
setPendingResetAction("all");
|
|
73
|
+
setOpenResetConfirmation(true);
|
|
74
|
+
}, []);
|
|
75
|
+
const handleResetParametersClick = useCallback(() => {
|
|
76
|
+
setPendingResetAction("parameters");
|
|
77
|
+
setOpenResetConfirmation(true);
|
|
78
|
+
}, []);
|
|
79
|
+
const handleCancelReset = useCallback(() => {
|
|
80
|
+
setOpenResetConfirmation(false);
|
|
81
|
+
setPendingResetAction(null);
|
|
82
|
+
}, []);
|
|
83
|
+
const handleLoadParameter = useCallback(
|
|
84
|
+
(newParams) => {
|
|
85
|
+
if (newParams && newParams.length > 0) {
|
|
86
|
+
setOpenSelectParameterDialog(false);
|
|
87
|
+
fetchSecurityAnalysisParameters(newParams[0].id).then((parameters) => {
|
|
88
|
+
console.info(`loading the following security analysis parameters : ${parameters.uuid}`);
|
|
89
|
+
reset(toFormValueSaParameters(parameters), {
|
|
90
|
+
keepDefaultValues: true
|
|
91
|
+
});
|
|
92
|
+
}).catch((error) => {
|
|
93
|
+
console.error(error);
|
|
94
|
+
snackError({
|
|
95
|
+
messageTxt: error.message,
|
|
96
|
+
headerId: "paramsRetrievingError"
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
setOpenSelectParameterDialog(false);
|
|
101
|
+
},
|
|
102
|
+
[reset, snackError]
|
|
103
|
+
);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
setHaveDirtyFields(!!Object.keys(formState.dirtyFields).length);
|
|
106
|
+
}, [formState, setHaveDirtyFields]);
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
SecurityAnalysisParametersForm,
|
|
109
|
+
{
|
|
110
|
+
securityAnalysisMethods,
|
|
111
|
+
enableDeveloperMode,
|
|
112
|
+
renderActions: () => {
|
|
113
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexGrow: 0 }, children: [
|
|
115
|
+
/* @__PURE__ */ jsx(LineSeparator, {}),
|
|
116
|
+
/* @__PURE__ */ jsxs(
|
|
117
|
+
Grid,
|
|
118
|
+
{
|
|
119
|
+
container: true,
|
|
120
|
+
item: true,
|
|
121
|
+
sx: mergeSx(parametersStyles.controlParametersItem, parametersStyles.marginTopButton, {
|
|
122
|
+
paddingBottom: 0
|
|
123
|
+
}),
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
LabelledButton,
|
|
127
|
+
{
|
|
128
|
+
callback: () => setOpenSelectParameterDialog(true),
|
|
129
|
+
label: "settings.button.chooseSettings"
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ jsx(LabelledButton, { callback: () => setOpenCreateParameterDialog(true), label: "save" }),
|
|
133
|
+
/* @__PURE__ */ jsx(LabelledButton, { callback: handleResetAllClick, label: "resetToDefault" }),
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
LabelledButton,
|
|
136
|
+
{
|
|
137
|
+
label: "resetProviderValuesToDefault",
|
|
138
|
+
callback: handleResetParametersClick
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
SubmitButton,
|
|
143
|
+
{
|
|
144
|
+
onClick: handleSubmit(securityAnalysisMethods.onSaveInline),
|
|
145
|
+
variant: "outlined",
|
|
146
|
+
children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" })
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }),
|
|
153
|
+
openCreateParameterDialog && /* @__PURE__ */ jsx(
|
|
154
|
+
CreateParameterDialog,
|
|
155
|
+
{
|
|
156
|
+
studyUuid,
|
|
157
|
+
open: openCreateParameterDialog,
|
|
158
|
+
onClose: () => setOpenCreateParameterDialog(false),
|
|
159
|
+
parameterValues: () => securityAnalysisMethods.formatNewParams(getValues()),
|
|
160
|
+
parameterFormatter: (newParams) => newParams,
|
|
161
|
+
parameterType: ElementType.SECURITY_ANALYSIS_PARAMETERS
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
openSelectParameterDialog && /* @__PURE__ */ jsx(
|
|
165
|
+
DirectoryItemSelector,
|
|
166
|
+
{
|
|
167
|
+
open: openSelectParameterDialog,
|
|
168
|
+
onClose: handleLoadParameter,
|
|
169
|
+
types: [ElementType.SECURITY_ANALYSIS_PARAMETERS],
|
|
170
|
+
title: intl.formatMessage({
|
|
171
|
+
id: "showSelectParameterDialog"
|
|
172
|
+
}),
|
|
173
|
+
onlyLeaves: true,
|
|
174
|
+
multiSelect: false,
|
|
175
|
+
validationButtonText: intl.formatMessage({
|
|
176
|
+
id: "validate"
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
openResetConfirmation && /* @__PURE__ */ jsx(
|
|
181
|
+
PopupConfirmationDialog,
|
|
182
|
+
{
|
|
183
|
+
message: "resetParamsConfirmation",
|
|
184
|
+
validateButtonLabel: "validate",
|
|
185
|
+
openConfirmationPopup: openResetConfirmation,
|
|
186
|
+
setOpenConfirmationPopup: handleCancelReset,
|
|
187
|
+
handlePopupConfirmation: executeResetAction
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
SecurityAnalysisParametersInline
|
|
197
|
+
};
|
package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ILimitReductionsByVoltageLevel, ISAParameters } from '../common';
|
|
2
|
+
export declare function SecurityAnalysisParametersSelector({ params, currentProvider, enableDeveloperMode, defaultLimitReductions, }: Readonly<{
|
|
3
|
+
params: ISAParameters | null;
|
|
4
|
+
currentProvider?: string;
|
|
5
|
+
enableDeveloperMode: boolean;
|
|
6
|
+
defaultLimitReductions: ILimitReductionsByVoltageLevel[];
|
|
7
|
+
}>): import("react/jsx-runtime").JSX.Element;
|