@gridsuite/commons-ui 0.109.1 → 0.110.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.
Files changed (53) hide show
  1. package/dist/components/index.js +9 -2
  2. package/dist/components/inputs/index.js +3 -2
  3. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +0 -2
  4. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -5
  5. package/dist/components/inputs/reactHookForm/constants.d.ts +8 -0
  6. package/dist/components/inputs/reactHookForm/constants.js +6 -0
  7. package/dist/components/inputs/reactHookForm/index.d.ts +1 -0
  8. package/dist/components/inputs/reactHookForm/index.js +3 -2
  9. package/dist/components/parameters/common/index.js +2 -0
  10. package/dist/components/parameters/common/limitreductions/columns-definitions.d.ts +1 -1
  11. package/dist/components/parameters/common/limitreductions/columns-definitions.js +3 -1
  12. package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +4 -3
  13. package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +4 -0
  14. package/dist/components/parameters/common/parameters-edition-dialog-props.js +14 -1
  15. package/dist/components/parameters/index.d.ts +1 -0
  16. package/dist/components/parameters/index.js +6 -0
  17. package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -1
  18. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +1 -1
  19. package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -1
  20. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +34 -4
  21. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +4 -2
  22. package/dist/components/parameters/network-visualizations/map-parameters.js +1 -1
  23. package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +1 -1
  24. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +4 -3
  25. package/dist/components/parameters/security-analysis/index.d.ts +8 -0
  26. package/dist/components/parameters/security-analysis/index.js +6 -0
  27. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.d.ts +2 -0
  28. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +107 -0
  29. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.d.ts +8 -0
  30. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +139 -0
  31. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.d.ts +10 -0
  32. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +197 -0
  33. package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.d.ts +7 -0
  34. package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +84 -0
  35. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.d.ts +7 -0
  36. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +138 -0
  37. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +24 -0
  38. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +162 -0
  39. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +5 -4
  40. package/dist/components/parameters/voltage-init/general-parameters.js +1 -1
  41. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -3
  42. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +2 -1
  43. package/dist/hooks/use-parameters-backend.d.ts +1 -1
  44. package/dist/index.js +20 -2
  45. package/dist/services/index.d.ts +1 -0
  46. package/dist/services/index.js +11 -0
  47. package/dist/services/security-analysis.d.ts +11 -0
  48. package/dist/services/security-analysis.js +91 -0
  49. package/dist/translations/en/parameters.d.ts +8 -0
  50. package/dist/translations/en/parameters.js +9 -1
  51. package/dist/translations/fr/parameters.d.ts +8 -0
  52. package/dist/translations/fr/parameters.js +9 -1
  53. package/package.json +1 -1
@@ -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
+ };
@@ -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;
@@ -0,0 +1,84 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useCallback, useMemo, useEffect } from "react";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { Grid, Tabs, Tab } from "@mui/material";
5
+ import "../../../utils/yupConfig.js";
6
+ import { TabPanel } from "../common/parameters.js";
7
+ import "../../../utils/types/equipmentType.js";
8
+ import "localized-countries";
9
+ import "localized-countries/data/fr";
10
+ import "localized-countries/data/en";
11
+ import "notistack";
12
+ import "react-hook-form";
13
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
14
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
15
+ import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
16
+ import "@mui/icons-material";
17
+ import "../../treeViewFinder/TreeViewFinder.js";
18
+ import "yup";
19
+ import "../../overflowableText/OverflowableText.js";
20
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
21
+ import "../../customAGGrid/customAggrid.js";
22
+ import "ag-grid-community";
23
+ import "react-papaparse";
24
+ import "react-csv-downloader";
25
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
26
+ import "../../../utils/conversionUtils.js";
27
+ import "@react-querybuilder/material";
28
+ import "../../filter/expert/expertFilterConstants.js";
29
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
30
+ import "uuid";
31
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
32
+ import "react-querybuilder";
33
+ import "../common/widget/parameter-line-slider.js";
34
+ import { TabValues, TAB_INFO } from "../common/limitreductions/columns-definitions.js";
35
+ import { LimitReductionsTableForm } from "../common/limitreductions/limit-reductions-table-form.js";
36
+ import { PARAM_PROVIDER_OPENLOADFLOW } from "../loadflow/constants.js";
37
+ import "../loadflow/load-flow-parameters-context.js";
38
+ import "@hookform/resolvers/yup";
39
+ import "../../filter/HeaderFilterForm.js";
40
+ import "../loadflow/load-flow-parameters-content.js";
41
+ import { ViolationsHidingParameters } from "./security-analysis-violations-hiding.js";
42
+ function SecurityAnalysisParametersSelector({
43
+ params,
44
+ currentProvider,
45
+ enableDeveloperMode,
46
+ defaultLimitReductions
47
+ }) {
48
+ const [tabSelected, setTabSelected] = useState(TabValues.General);
49
+ const handleTabChange = useCallback((event, newValue) => {
50
+ setTabSelected(newValue);
51
+ }, []);
52
+ const tabValue = useMemo(() => {
53
+ return tabSelected === TabValues.LimitReductions && !(params == null ? void 0 : params.limitReductions) ? TabValues.General : tabSelected;
54
+ }, [params, tabSelected]);
55
+ useEffect(() => {
56
+ if (currentProvider !== PARAM_PROVIDER_OPENLOADFLOW) {
57
+ setTabSelected(TabValues.General);
58
+ }
59
+ }, [currentProvider]);
60
+ return /* @__PURE__ */ jsxs(Grid, { sx: { width: "100%" }, children: [
61
+ /* @__PURE__ */ jsx(Tabs, { value: tabValue, onChange: handleTabChange, children: TAB_INFO.filter((t) => enableDeveloperMode || !t.developerModeOnly).map(
62
+ (tab, index) => (tab.label !== TabValues[TabValues.LimitReductions] || currentProvider === PARAM_PROVIDER_OPENLOADFLOW && (params == null ? void 0 : params.limitReductions)) && /* @__PURE__ */ jsx(
63
+ Tab,
64
+ {
65
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: tab.label }),
66
+ value: index,
67
+ sx: {
68
+ fontSize: 17,
69
+ fontWeight: "bold",
70
+ textTransform: "capitalize"
71
+ }
72
+ },
73
+ tab.label
74
+ )
75
+ ) }),
76
+ TAB_INFO.filter((t) => enableDeveloperMode || !t.developerModeOnly).map((tab, index) => /* @__PURE__ */ jsxs(TabPanel, { value: tabValue, index, children: [
77
+ tabValue === TabValues.General && /* @__PURE__ */ jsx(ViolationsHidingParameters, {}),
78
+ tabValue === TabValues.LimitReductions && currentProvider === PARAM_PROVIDER_OPENLOADFLOW && (params == null ? void 0 : params.limitReductions) && /* @__PURE__ */ jsx(Grid, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx(LimitReductionsTableForm, { limits: (params == null ? void 0 : params.limitReductions) ?? defaultLimitReductions }) })
79
+ ] }, tab.label))
80
+ ] });
81
+ }
82
+ export {
83
+ SecurityAnalysisParametersSelector
84
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2024, 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 http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export declare function ViolationsHidingParameters(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,138 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { Grid, Typography, Tooltip } from "@mui/material";
3
+ import { useIntl } from "react-intl";
4
+ import { Info } from "@mui/icons-material";
5
+ import { parametersStyles } from "../parameters-style.js";
6
+ import "react";
7
+ import "react-hook-form";
8
+ import "../../../utils/types/equipmentType.js";
9
+ import "localized-countries";
10
+ import "localized-countries/data/fr";
11
+ import "localized-countries/data/en";
12
+ import "notistack";
13
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
14
+ import "yup";
15
+ import "../../overflowableText/OverflowableText.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 { FloatInput } from "../../inputs/reactHookForm/numbers/FloatInput.js";
23
+ import "../../inputs/reactHookForm/numbers/RangeInput.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 { PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD } from "../common/constant.js";
33
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
34
+ import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
35
+ import "../common/widget/parameter-line-slider.js";
36
+ import "../common/limitreductions/columns-definitions.js";
37
+ function SecurityAnalysisFields({
38
+ label,
39
+ firstField,
40
+ secondField,
41
+ tooltipInfoId,
42
+ isSingleField
43
+ }) {
44
+ const intl = useIntl();
45
+ return /* @__PURE__ */ jsxs(Grid, { sx: isSingleField ? parametersStyles.singleItem : parametersStyles.multipleItems, children: [
46
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, sx: parametersStyles.parameterName, children: /* @__PURE__ */ jsx(Typography, { children: intl.formatMessage({ id: label }) }) }),
47
+ /* @__PURE__ */ jsx(
48
+ Grid,
49
+ {
50
+ item: true,
51
+ container: true,
52
+ xs: isSingleField ? 8 : 4,
53
+ sx: isSingleField ? parametersStyles.singleTextField : parametersStyles.firstTextField,
54
+ children: /* @__PURE__ */ jsx(
55
+ FloatInput,
56
+ {
57
+ name: firstField.name,
58
+ adornment: {
59
+ position: "end",
60
+ text: firstField.label
61
+ }
62
+ }
63
+ )
64
+ }
65
+ ),
66
+ !isSingleField && secondField && /* @__PURE__ */ jsx(Grid, { item: true, container: true, xs: 4, sx: parametersStyles.secondTextField, children: /* @__PURE__ */ jsx(
67
+ FloatInput,
68
+ {
69
+ name: secondField.name,
70
+ adornment: {
71
+ position: "end",
72
+ text: secondField.label
73
+ }
74
+ }
75
+ ) }),
76
+ /* @__PURE__ */ jsx(Tooltip, { title: intl.formatMessage({ id: tooltipInfoId }), placement: "left-start", children: /* @__PURE__ */ jsx(Info, {}) })
77
+ ] });
78
+ }
79
+ const fieldsToShow = [
80
+ {
81
+ label: "securityAnalysis.current",
82
+ firstField: {
83
+ name: PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD,
84
+ label: "%"
85
+ },
86
+ tooltipInfoId: "securityAnalysis.toolTip.current",
87
+ isSingleField: true
88
+ },
89
+ {
90
+ label: "securityAnalysis.lowVoltage",
91
+ firstField: {
92
+ name: PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD,
93
+ label: "%"
94
+ },
95
+ secondField: {
96
+ label: "kV",
97
+ name: PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD
98
+ },
99
+ tooltipInfoId: "securityAnalysis.toolTip.lowVoltage"
100
+ },
101
+ {
102
+ label: "securityAnalysis.highVoltage",
103
+ firstField: {
104
+ name: PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD,
105
+ label: "%"
106
+ },
107
+ secondField: {
108
+ label: "kV",
109
+ name: PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD
110
+ },
111
+ tooltipInfoId: "securityAnalysis.toolTip.highVoltage"
112
+ }
113
+ ];
114
+ function ViolationsHidingParameters() {
115
+ const intl = useIntl();
116
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
117
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 1, paddingBottom: 1, children: /* @__PURE__ */ jsxs(Grid, { item: true, xs: 8, sx: parametersStyles.text, children: [
118
+ /* @__PURE__ */ jsx(Typography, { children: intl.formatMessage({
119
+ id: "securityAnalysis.violationsHiding"
120
+ }) }),
121
+ /* @__PURE__ */ jsx(
122
+ Tooltip,
123
+ {
124
+ sx: parametersStyles.tooltip,
125
+ title: intl.formatMessage({ id: "securityAnalysis.toolTip.violationsHiding" }),
126
+ placement: "left-start",
127
+ children: /* @__PURE__ */ jsx(Info, {})
128
+ }
129
+ )
130
+ ] }) }),
131
+ fieldsToShow == null ? void 0 : fieldsToShow.map((item) => {
132
+ return /* @__PURE__ */ jsx(Grid, { item: true, xs: 16, xl: 6.25, children: /* @__PURE__ */ jsx(SecurityAnalysisFields, { ...item }) }, item.label);
133
+ })
134
+ ] });
135
+ }
136
+ export {
137
+ ViolationsHidingParameters
138
+ };
@@ -0,0 +1,24 @@
1
+ import { UseFormReturn } from 'react-hook-form';
2
+ import { ObjectSchema } from 'yup';
3
+ import { Dispatch, SetStateAction } from 'react';
4
+ import { UUID } from 'crypto';
5
+ import { UseParametersBackendReturnProps } from '../../../utils';
6
+ import { ComputingType, ILimitReductionsByVoltageLevel, ISAParameters } from '../common';
7
+ export interface UseSecurityAnalysisParametersFormReturn {
8
+ formMethods: UseFormReturn;
9
+ formSchema: ObjectSchema<any>;
10
+ formattedProviders: {
11
+ id: string;
12
+ label: string;
13
+ }[];
14
+ defaultLimitReductions: ILimitReductionsByVoltageLevel[];
15
+ toFormValueSaParameters: (_params: ISAParameters) => any;
16
+ formatNewParams: (formData: Record<string, any>) => ISAParameters;
17
+ params: ISAParameters | null;
18
+ currentProvider: string | undefined;
19
+ setCurrentProvider: Dispatch<SetStateAction<string | undefined>>;
20
+ paramsLoaded: boolean;
21
+ onSaveInline: (formData: Record<string, any>) => void;
22
+ onSaveDialog: (formData: Record<string, any>) => void;
23
+ }
24
+ export declare const useSecurityAnalysisParametersForm: (parametersBackend: UseParametersBackendReturnProps<ComputingType.SECURITY_ANALYSIS>, parametersUuid: UUID | null, name: string | null, description: string | null) => UseSecurityAnalysisParametersFormReturn;