@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
|
@@ -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
|
+
};
|
package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts
ADDED
|
@@ -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;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { useForm } from "react-hook-form";
|
|
2
|
+
import { useState, useMemo, useCallback, useEffect } from "react";
|
|
3
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
|
+
import "../../../utils/conversionUtils.js";
|
|
5
|
+
import "react/jsx-runtime";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
8
|
+
import "../../../utils/types/equipmentType.js";
|
|
9
|
+
import "../../../utils/yupConfig.js";
|
|
10
|
+
import { PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER } from "../common/constant.js";
|
|
11
|
+
import { DESCRIPTION, NAME } from "../../inputs/reactHookForm/constants.js";
|
|
12
|
+
import "@mui/material";
|
|
13
|
+
import "react-intl";
|
|
14
|
+
import { updateParameter } from "../../../services/explore.js";
|
|
15
|
+
import "localized-countries";
|
|
16
|
+
import "localized-countries/data/fr";
|
|
17
|
+
import "localized-countries/data/en";
|
|
18
|
+
import "notistack";
|
|
19
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
20
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
21
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
22
|
+
import "../../treeViewFinder/TreeViewFinder.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 "@react-querybuilder/material";
|
|
32
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
33
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
34
|
+
import "uuid";
|
|
35
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
36
|
+
import "react-querybuilder";
|
|
37
|
+
import "../common/widget/parameter-line-slider.js";
|
|
38
|
+
import { getSAParametersFromSchema, LIMIT_REDUCTIONS_FORM, IST_FORM, LIMIT_DURATION_FORM } from "../common/limitreductions/columns-definitions.js";
|
|
39
|
+
import { toFormValuesLimitReductions, toFormValueSaParameters } from "../common/limitreductions/limit-reductions-form-util.js";
|
|
40
|
+
import "../../filter/HeaderFilterForm.js";
|
|
41
|
+
import { getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
42
|
+
const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, name, description) => {
|
|
43
|
+
const [providers, provider, , , , params, , updateParameters, , , defaultLimitReductions] = parametersBackend;
|
|
44
|
+
const [currentProvider, setCurrentProvider] = useState(params == null ? void 0 : params.provider);
|
|
45
|
+
const formattedProviders = useMemo(() => {
|
|
46
|
+
return Object.entries(providers).filter(([key]) => !key.includes("DynaFlow")).map(([key, value]) => ({
|
|
47
|
+
id: key,
|
|
48
|
+
label: value
|
|
49
|
+
}));
|
|
50
|
+
}, [providers]);
|
|
51
|
+
const paramsLoaded = useMemo(() => !!params && !!currentProvider, [currentProvider, params]);
|
|
52
|
+
const formSchema = useMemo(() => {
|
|
53
|
+
return getSAParametersFromSchema(name, params == null ? void 0 : params.limitReductions);
|
|
54
|
+
}, [name, params == null ? void 0 : params.limitReductions]);
|
|
55
|
+
const formMethods = useForm({
|
|
56
|
+
defaultValues: {
|
|
57
|
+
...getNameElementEditorEmptyFormData(name, description),
|
|
58
|
+
[PARAM_SA_PROVIDER]: provider,
|
|
59
|
+
[LIMIT_REDUCTIONS_FORM]: [],
|
|
60
|
+
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: null,
|
|
61
|
+
[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: null,
|
|
62
|
+
[PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: null,
|
|
63
|
+
[PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: null,
|
|
64
|
+
[PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: null
|
|
65
|
+
},
|
|
66
|
+
resolver: yupResolver(formSchema)
|
|
67
|
+
});
|
|
68
|
+
const { reset, watch } = formMethods;
|
|
69
|
+
const watchProvider = watch("provider");
|
|
70
|
+
const toLimitReductions = useCallback(
|
|
71
|
+
(formLimits) => {
|
|
72
|
+
if (!(params == null ? void 0 : params.limitReductions)) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
return params.limitReductions.map((vlLimits, indexVl) => {
|
|
76
|
+
const vlLNewLimits = {
|
|
77
|
+
...vlLimits,
|
|
78
|
+
permanentLimitReduction: formLimits[indexVl][IST_FORM]
|
|
79
|
+
};
|
|
80
|
+
vlLimits.temporaryLimitReductions.forEach((temporaryLimit, index) => {
|
|
81
|
+
vlLNewLimits.temporaryLimitReductions[index] = {
|
|
82
|
+
...temporaryLimit,
|
|
83
|
+
reduction: formLimits[indexVl][LIMIT_DURATION_FORM + index]
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
return vlLNewLimits;
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
[params == null ? void 0 : params.limitReductions]
|
|
90
|
+
);
|
|
91
|
+
const formatNewParams = useCallback(
|
|
92
|
+
(formData) => {
|
|
93
|
+
return {
|
|
94
|
+
[PARAM_SA_PROVIDER]: formData[PARAM_SA_PROVIDER],
|
|
95
|
+
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: formData[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD] / 100,
|
|
96
|
+
[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: formData[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD] / 100,
|
|
97
|
+
[PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: formData[PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD],
|
|
98
|
+
[PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: formData[PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD] / 100,
|
|
99
|
+
[PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: formData[PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD],
|
|
100
|
+
limitReductions: toLimitReductions(formData[LIMIT_REDUCTIONS_FORM])
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
[toLimitReductions]
|
|
104
|
+
);
|
|
105
|
+
const onSaveInline = useCallback(
|
|
106
|
+
(formData) => {
|
|
107
|
+
updateParameters(formatNewParams(formData));
|
|
108
|
+
},
|
|
109
|
+
[updateParameters, formatNewParams]
|
|
110
|
+
);
|
|
111
|
+
const onSaveDialog = useCallback(
|
|
112
|
+
(formData) => {
|
|
113
|
+
if (parametersUuid) {
|
|
114
|
+
updateParameter(
|
|
115
|
+
parametersUuid,
|
|
116
|
+
formatNewParams(formData),
|
|
117
|
+
formData[NAME],
|
|
118
|
+
ElementType.SECURITY_ANALYSIS_PARAMETERS,
|
|
119
|
+
formData[DESCRIPTION] ?? ""
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
[parametersUuid, formatNewParams]
|
|
124
|
+
);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (watchProvider !== currentProvider) {
|
|
127
|
+
setCurrentProvider(watchProvider);
|
|
128
|
+
if (watchProvider !== void 0 && currentProvider !== void 0) {
|
|
129
|
+
if (params !== null) {
|
|
130
|
+
params.limitReductions = defaultLimitReductions;
|
|
131
|
+
}
|
|
132
|
+
formMethods.setValue(
|
|
133
|
+
LIMIT_REDUCTIONS_FORM,
|
|
134
|
+
toFormValuesLimitReductions(defaultLimitReductions)[LIMIT_REDUCTIONS_FORM]
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}, [watchProvider, currentProvider, formMethods, setCurrentProvider, defaultLimitReductions, params]);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (!params) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
reset(toFormValueSaParameters(params));
|
|
144
|
+
}, [paramsLoaded, params, reset]);
|
|
145
|
+
return {
|
|
146
|
+
formMethods,
|
|
147
|
+
formSchema,
|
|
148
|
+
formattedProviders,
|
|
149
|
+
defaultLimitReductions,
|
|
150
|
+
toFormValueSaParameters,
|
|
151
|
+
formatNewParams,
|
|
152
|
+
params,
|
|
153
|
+
currentProvider,
|
|
154
|
+
setCurrentProvider,
|
|
155
|
+
paramsLoaded,
|
|
156
|
+
onSaveInline,
|
|
157
|
+
onSaveDialog
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export {
|
|
161
|
+
useSecurityAnalysisParametersForm
|
|
162
|
+
};
|
|
@@ -16,7 +16,9 @@ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
|
16
16
|
import "@mui/icons-material";
|
|
17
17
|
import * as yup from "yup";
|
|
18
18
|
import "../../overflowableText/OverflowableText.js";
|
|
19
|
-
import {
|
|
19
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
20
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
21
|
+
import { DESCRIPTION, NAME } from "../../inputs/reactHookForm/constants.js";
|
|
20
22
|
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
21
23
|
import "../../customAGGrid/customAggrid.js";
|
|
22
24
|
import "ag-grid-community";
|
|
@@ -24,7 +26,6 @@ import "react-papaparse";
|
|
|
24
26
|
import "react-csv-downloader";
|
|
25
27
|
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
26
28
|
import "../../../utils/conversionUtils.js";
|
|
27
|
-
import { ElementType } from "../../../utils/types/elementType.js";
|
|
28
29
|
import "@react-querybuilder/material";
|
|
29
30
|
import "../../filter/expert/expertFilterConstants.js";
|
|
30
31
|
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
@@ -96,7 +97,7 @@ const useShortCircuitParametersForm = ({
|
|
|
96
97
|
const {
|
|
97
98
|
predefinedParameters: omit,
|
|
98
99
|
[NAME]: omit2,
|
|
99
|
-
[
|
|
100
|
+
[DESCRIPTION]: omit3,
|
|
100
101
|
...newParametersWithoutPredefinedParameters
|
|
101
102
|
} = newParameters;
|
|
102
103
|
let parameters = {
|
|
@@ -168,7 +169,7 @@ const useShortCircuitParametersForm = ({
|
|
|
168
169
|
prepareDataToSend(shortCircuitParameters, formData),
|
|
169
170
|
formData[NAME],
|
|
170
171
|
ElementType.SHORT_CIRCUIT_PARAMETERS,
|
|
171
|
-
formData[
|
|
172
|
+
formData[DESCRIPTION] ?? ""
|
|
172
173
|
).catch((error) => {
|
|
173
174
|
snackError({
|
|
174
175
|
messageTxt: error.message,
|
|
@@ -5,6 +5,7 @@ import { FormattedMessage } from "react-intl";
|
|
|
5
5
|
import { Grid, Alert, Box } from "@mui/material";
|
|
6
6
|
import { GENERAL, GENERAL_APPLY_MODIFICATIONS, UPDATE_BUS_VOLTAGE, REACTIVE_SLACKS_THRESHOLD, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD } from "./constants.js";
|
|
7
7
|
import { ReactivePowerAdornment } from "../common/constant.js";
|
|
8
|
+
import "../../../utils/yupConfig.js";
|
|
8
9
|
import { LineSeparator } from "../common/line-separator.js";
|
|
9
10
|
import { parametersStyles } from "../parameters-style.js";
|
|
10
11
|
import "../../../utils/types/equipmentType.js";
|
|
@@ -26,7 +27,6 @@ import "react-papaparse";
|
|
|
26
27
|
import "react-csv-downloader";
|
|
27
28
|
import "../../inputs/reactHookForm/numbers/RangeInput.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 { NAME, DESCRIPTION } 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 { isBlankOrEmpty } from "../../../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";
|
|
@@ -167,7 +168,7 @@ const useVoltageInitParametersForm = ({
|
|
|
167
168
|
fromVoltageInitParametersFormToParamValues(formData).computationParameters,
|
|
168
169
|
formData[NAME],
|
|
169
170
|
ElementType.VOLTAGE_INIT_PARAMETERS,
|
|
170
|
-
formData[
|
|
171
|
+
formData[DESCRIPTION] ?? ""
|
|
171
172
|
).catch((error) => {
|
|
172
173
|
snackError({
|
|
173
174
|
messageTxt: error.message,
|
|
@@ -14,7 +14,8 @@ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
|
14
14
|
import "@mui/icons-material";
|
|
15
15
|
import "yup";
|
|
16
16
|
import "../../overflowableText/OverflowableText.js";
|
|
17
|
-
import
|
|
17
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
18
|
+
import { NAME } from "../../inputs/reactHookForm/constants.js";
|
|
18
19
|
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
19
20
|
import "../../customAGGrid/customAggrid.js";
|
|
20
21
|
import "ag-grid-community";
|
|
@@ -8,4 +8,4 @@ export declare enum OptionalServicesStatus {
|
|
|
8
8
|
Down = "DOWN",
|
|
9
9
|
Pending = "PENDING"
|
|
10
10
|
}
|
|
11
|
-
export declare const useParametersBackend: <T extends ComputingType>(user: User | null, studyUuid: UUID | null, type: T, optionalServiceStatus: OptionalServicesStatus | undefined, backendFetchProviders: () => Promise<string[]>, backendFetchProvider: ((studyUuid: UUID) => Promise<string>) | null, backendFetchDefaultProvider: () => Promise<string>, backendUpdateProvider: ((studyUuid: UUID, newProvider: string) => Promise<
|
|
11
|
+
export declare const useParametersBackend: <T extends ComputingType>(user: User | null, studyUuid: UUID | null, type: T, optionalServiceStatus: OptionalServicesStatus | undefined, backendFetchProviders: () => Promise<string[]>, backendFetchProvider: ((studyUuid: UUID) => Promise<string>) | null, backendFetchDefaultProvider: () => Promise<string>, backendUpdateProvider: ((studyUuid: UUID, newProvider: string) => Promise<any>) | null, backendFetchParameters: (studyUuid: UUID) => Promise<ParametersInfos<T>>, backendUpdateParameters?: (studyUuid: UUID, newParam: ParametersInfos<T> | null) => Promise<any>, backendFetchSpecificParametersDescription?: () => Promise<SpecificParametersInfos>, backendFetchDefaultLimitReductions?: () => Promise<ILimitReductionsByVoltageLevel[]>) => UseParametersBackendReturnProps<T>;
|