@gridsuite/commons-ui 0.178.0 → 0.179.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/index.js +6 -0
- package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.js +3 -0
- package/dist/components/parameters/common/utils.d.ts +25 -2
- package/dist/components/parameters/common/utils.js +40 -1
- package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.d.ts +2 -18
- package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +2 -38
- package/dist/components/parameters/dynamic-security-analysis/constants.d.ts +9 -0
- package/dist/components/parameters/dynamic-security-analysis/constants.js +8 -0
- package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.d.ts +10 -0
- package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.js +65 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.d.ts +10 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +130 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +9 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +103 -0
- package/dist/components/parameters/dynamic-security-analysis/index.d.ts +8 -0
- package/dist/components/parameters/dynamic-security-analysis/index.js +8 -0
- package/dist/components/parameters/dynamic-security-analysis/scenario-parameters.d.ts +10 -0
- package/dist/components/parameters/dynamic-security-analysis/scenario-parameters.js +16 -0
- package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.d.ts +51 -0
- package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +181 -0
- package/dist/components/parameters/index.d.ts +1 -0
- package/dist/components/parameters/index.js +6 -0
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +24 -4
- package/dist/components/parameters/util/make-component-utils.d.ts +17 -0
- package/dist/components/parameters/util/make-component-utils.js +96 -0
- package/dist/components/parameters/util/styles.d.ts +38 -0
- package/dist/components/parameters/util/styles.js +41 -0
- package/dist/index.js +12 -1
- package/dist/services/dynamic-security-analysis.d.ts +4 -0
- package/dist/services/dynamic-security-analysis.js +29 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +6 -1
- package/dist/services/sensitivity-analysis.d.ts +1 -1
- package/dist/services/sensitivity-analysis.js +3 -2
- package/dist/services/utils.d.ts +2 -0
- package/dist/services/utils.js +3 -0
- package/dist/utils/types/elementType.d.ts +1 -0
- package/dist/utils/types/elementType.js +1 -0
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -179,6 +179,8 @@ import { SensitivityAnalysisParametersDialog } from "./parameters/sensi/sensitiv
|
|
|
179
179
|
import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiHvdcs, SensiInjection, SensiInjectionsSet, SensiNodes, SensiPsts, SensiTabValues } from "./parameters/sensi/columns-definitions.js";
|
|
180
180
|
import { ACCURACY, ACTIVE, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./parameters/dynamic-margin-calculation/constants.js";
|
|
181
181
|
import { DynamicMarginCalculationInline } from "./parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js";
|
|
182
|
+
import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./parameters/dynamic-security-analysis/constants.js";
|
|
183
|
+
import { DynamicSecurityAnalysisInline } from "./parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js";
|
|
182
184
|
import { CustomMenuItem, CustomNestedMenuItem } from "./menus/custom-nested-menu.js";
|
|
183
185
|
import { OverflowableTableCell } from "./muiTable/OverflowableTableCell.js";
|
|
184
186
|
import { OverflowableTableCellWithCheckbox } from "./muiTable/OverflowableTableCellWithCheckbox.js";
|
|
@@ -230,6 +232,8 @@ export {
|
|
|
230
232
|
COMPONENT_LIBRARY,
|
|
231
233
|
CONNECTED_MODE,
|
|
232
234
|
CONTINGENCIES,
|
|
235
|
+
CONTINGENCIES_LIST_INFOS,
|
|
236
|
+
CONTINGENCIES_START_TIME,
|
|
233
237
|
CONTINGENCY_LISTS,
|
|
234
238
|
CONTINGENCY_LISTS_INFOS,
|
|
235
239
|
CONTINGENCY_LIST_EQUIPMENTS,
|
|
@@ -293,6 +297,7 @@ export {
|
|
|
293
297
|
DndTableBottomLeftButtons,
|
|
294
298
|
DndTableBottomRightButtons,
|
|
295
299
|
DynamicMarginCalculationInline,
|
|
300
|
+
DynamicSecurityAnalysisInline,
|
|
296
301
|
ENERGY_SOURCE_OPTIONS,
|
|
297
302
|
EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES,
|
|
298
303
|
EXPERT_FILTER_EQUIPMENTS,
|
|
@@ -459,6 +464,7 @@ export {
|
|
|
459
464
|
RemoveButton,
|
|
460
465
|
ResizeHandle,
|
|
461
466
|
RuleValueEditor,
|
|
467
|
+
SCENARIO_DURATION,
|
|
462
468
|
SELECTED,
|
|
463
469
|
SELECTION_TYPE,
|
|
464
470
|
SENSITIVITY_TYPES,
|
|
@@ -50,6 +50,9 @@ import "../../../../parameters/sensi/columns-definitions.js";
|
|
|
50
50
|
import "../../../../parameters/dynamic-margin-calculation/time-delay-parameters.js";
|
|
51
51
|
import "../../../../parameters/dynamic-margin-calculation/loads-variations-parameters.js";
|
|
52
52
|
import "../../../../parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js";
|
|
53
|
+
import "../../../../parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js";
|
|
54
|
+
import "../../../../parameters/dynamic-security-analysis/scenario-parameters.js";
|
|
55
|
+
import "../../../../parameters/dynamic-security-analysis/contingency-parameters.js";
|
|
53
56
|
function SubstationAutocompleteAddButton({ children, ...rest }) {
|
|
54
57
|
const { setValue, getValues } = useFormContext();
|
|
55
58
|
const intl = useIntl();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ObjectSchema } from 'yup';
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
3
|
+
import { FieldErrors, UseFormReturn } from 'react-hook-form';
|
|
2
4
|
import { SpecificParameterInfos, SpecificParametersDescription, SpecificParametersValues } from '../../../utils';
|
|
3
5
|
import { default as yup } from '../../../utils/yupConfig';
|
|
4
|
-
export declare const getSpecificParametersFormSchema: (specificParameters: SpecificParameterInfos[] | undefined) =>
|
|
6
|
+
export declare const getSpecificParametersFormSchema: (specificParameters: SpecificParameterInfos[] | undefined) => ObjectSchema<{
|
|
5
7
|
specificParametersPerProvider: {};
|
|
6
8
|
}, yup.AnyObject, {
|
|
7
9
|
specificParametersPerProvider: {
|
|
@@ -12,3 +14,24 @@ export declare const getDefaultSpecificParamsValues: (specificParametersDescript
|
|
|
12
14
|
export declare const formatSpecificParameters: (specificParametersDescriptionForProvider: SpecificParameterInfos[], specificParamsList: SpecificParametersValues) => SpecificParametersValues;
|
|
13
15
|
export declare const getAllSpecificParametersValues: (formData: Record<string, any>, _specificParametersValues: SpecificParametersValues) => SpecificParametersValues;
|
|
14
16
|
export declare const setSpecificParameters: (provider: string, specificParamsDescriptions: SpecificParametersDescription | null, formMethods: UseFormReturn) => void;
|
|
17
|
+
type UseTabsReturn<TTabValue extends string> = {
|
|
18
|
+
selectedTab: TTabValue;
|
|
19
|
+
tabsWithError: TTabValue[];
|
|
20
|
+
onTabChange: (event: SyntheticEvent, newValue: TTabValue) => void;
|
|
21
|
+
onError: (errors: FieldErrors) => void;
|
|
22
|
+
};
|
|
23
|
+
export type UseComputationParametersFormReturn<TTabValue extends string> = UseTabsReturn<TTabValue> & {
|
|
24
|
+
formMethods: UseFormReturn;
|
|
25
|
+
formSchema: ObjectSchema<any>;
|
|
26
|
+
paramsLoaded: boolean;
|
|
27
|
+
formattedProviders: {
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
type UseTabsProps<TTabValue extends string> = {
|
|
33
|
+
defaultTab: TTabValue;
|
|
34
|
+
tabEnum: Record<string, TTabValue>;
|
|
35
|
+
};
|
|
36
|
+
export declare function useTabs<TTabValue extends string>({ defaultTab, tabEnum, }: Readonly<UseTabsProps<TTabValue>>): UseTabsReturn<TTabValue>;
|
|
37
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
1
2
|
import "../../../utils/conversionUtils.js";
|
|
2
3
|
import "../../../utils/types/equipmentType.js";
|
|
3
4
|
import { ParameterType } from "../../../utils/types/parameters.type.js";
|
|
5
|
+
import { isObjectEmpty } from "../../../utils/functions.js";
|
|
4
6
|
import "react/jsx-runtime";
|
|
5
7
|
import "@mui/icons-material";
|
|
6
8
|
import "../../../utils/yupConfig.js";
|
|
@@ -80,10 +82,47 @@ const setSpecificParameters = (provider, specificParamsDescriptions, formMethods
|
|
|
80
82
|
const specificParamsValues = getDefaultSpecificParamsValues(specificParams);
|
|
81
83
|
formMethods.setValue(SPECIFIC_PARAMETERS, specificParamsValues);
|
|
82
84
|
};
|
|
85
|
+
function useTabs({
|
|
86
|
+
defaultTab,
|
|
87
|
+
tabEnum
|
|
88
|
+
}) {
|
|
89
|
+
const [tabValue, setTabValue] = useState(defaultTab);
|
|
90
|
+
const [tabValuesWithError, setTabValuesWithError] = useState([]);
|
|
91
|
+
const handleTabChange = useCallback((event, newValue) => {
|
|
92
|
+
setTabValue(newValue);
|
|
93
|
+
}, []);
|
|
94
|
+
const onError = useCallback(
|
|
95
|
+
(errors) => {
|
|
96
|
+
if (!errors || isObjectEmpty(errors)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const tabsInError = [];
|
|
100
|
+
Object.values(tabEnum).forEach((tab) => {
|
|
101
|
+
if (errors?.[tab] && tab !== tabValue) {
|
|
102
|
+
tabsInError.push(tab);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
if (tabsInError.includes(tabValue)) {
|
|
106
|
+
setTabValuesWithError(tabsInError.filter((errorTab) => errorTab !== tabValue));
|
|
107
|
+
} else if (tabsInError.length > 0) {
|
|
108
|
+
setTabValue(tabsInError[0]);
|
|
109
|
+
setTabValuesWithError(tabsInError.filter((errorTab, index, arr) => errorTab !== arr[0]));
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
[tabValue, tabEnum]
|
|
113
|
+
);
|
|
114
|
+
return {
|
|
115
|
+
selectedTab: tabValue,
|
|
116
|
+
tabsWithError: tabValuesWithError,
|
|
117
|
+
onTabChange: handleTabChange,
|
|
118
|
+
onError
|
|
119
|
+
};
|
|
120
|
+
}
|
|
83
121
|
export {
|
|
84
122
|
formatSpecificParameters,
|
|
85
123
|
getAllSpecificParametersValues,
|
|
86
124
|
getDefaultSpecificParamsValues,
|
|
87
125
|
getSpecificParametersFormSchema,
|
|
88
|
-
setSpecificParameters
|
|
126
|
+
setSpecificParameters,
|
|
127
|
+
useTabs
|
|
89
128
|
};
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ObjectSchema } from 'yup';
|
|
3
|
-
import { SyntheticEvent } from 'react';
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
2
|
import { DynamicMarginCalculationParametersInfos } from '../../../utils/types/dynamic-margin-calculation.type';
|
|
5
3
|
import { TabValues } from './dynamic-margin-calculation.type';
|
|
4
|
+
import { UseComputationParametersFormReturn } from '../common/utils';
|
|
6
5
|
export declare const toFormValues: (_params: DynamicMarginCalculationParametersInfos) => FieldValues;
|
|
7
6
|
export declare const toParamsInfos: (_formData: FieldValues) => DynamicMarginCalculationParametersInfos;
|
|
8
|
-
export type UseTabsReturn<TTabValue extends string> = {
|
|
9
|
-
selectedTab: TTabValue;
|
|
10
|
-
tabsWithError: TTabValue[];
|
|
11
|
-
onTabChange: (event: SyntheticEvent, newValue: TTabValue) => void;
|
|
12
|
-
onError: (errors: FieldErrors) => void;
|
|
13
|
-
};
|
|
14
|
-
export type UseComputationParametersFormReturn<TTabValue extends string> = UseTabsReturn<TTabValue> & {
|
|
15
|
-
formMethods: UseFormReturn;
|
|
16
|
-
formSchema: ObjectSchema<any>;
|
|
17
|
-
paramsLoaded: boolean;
|
|
18
|
-
formattedProviders: {
|
|
19
|
-
id: string;
|
|
20
|
-
label: string;
|
|
21
|
-
}[];
|
|
22
|
-
};
|
|
23
7
|
export type UseDynamicMarginCalculationParametersFormReturn = UseComputationParametersFormReturn<TabValues>;
|
|
24
8
|
export type UseParametersFormProps = {
|
|
25
9
|
providers: Record<string, string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useForm } from "react-hook-form";
|
|
2
|
-
import { useMemo, useEffect
|
|
2
|
+
import { useMemo, useEffect } from "react";
|
|
3
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
4
|
import "../../../utils/yupConfig.js";
|
|
5
5
|
import { formSchema as formSchema$2, emptyFormData as emptyFormData$2 } from "./time-delay-parameters.js";
|
|
@@ -7,7 +7,6 @@ import { formSchema as formSchema$1, emptyFormData as emptyFormData$1 } from "./
|
|
|
7
7
|
import { ID } from "../../../utils/constants/filterConstant.js";
|
|
8
8
|
import "../../../utils/conversionUtils.js";
|
|
9
9
|
import "../../../utils/types/equipmentType.js";
|
|
10
|
-
import { isObjectEmpty } from "../../../utils/functions.js";
|
|
11
10
|
import "react/jsx-runtime";
|
|
12
11
|
import "@mui/icons-material";
|
|
13
12
|
import { PROVIDER } from "../common/constants.js";
|
|
@@ -46,6 +45,7 @@ import "../../filter/HeaderFilterForm.js";
|
|
|
46
45
|
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
47
46
|
import { LOADS_VARIATIONS, LOAD_MODELS_RULE, ACCURACY, CALCULATION_TYPE, LOAD_INCREASE_STOP_TIME, LOAD_INCREASE_START_TIME, MARGIN_CALCULATION_START_TIME, STOP_TIME, START_TIME } from "./constants.js";
|
|
48
47
|
import { TabValues } from "./dynamic-margin-calculation.type.js";
|
|
48
|
+
import { useTabs } from "../common/utils.js";
|
|
49
49
|
const formSchema = yup.object().shape({
|
|
50
50
|
[PROVIDER]: yup.string().required(),
|
|
51
51
|
[TabValues.TAB_TIME_DELAY]: formSchema$2,
|
|
@@ -87,42 +87,6 @@ const toParamsInfos = (_formData) => ({
|
|
|
87
87
|
loadModelsRule: _formData[TabValues.TAB_LOADS_VARIATIONS][LOAD_MODELS_RULE],
|
|
88
88
|
loadsVariations: _formData[TabValues.TAB_LOADS_VARIATIONS][LOADS_VARIATIONS]
|
|
89
89
|
});
|
|
90
|
-
function useTabs({
|
|
91
|
-
defaultTab,
|
|
92
|
-
tabEnum
|
|
93
|
-
}) {
|
|
94
|
-
const [tabValue, setTabValue] = useState(defaultTab);
|
|
95
|
-
const [tabValuesWithError, setTabValuesWithError] = useState([]);
|
|
96
|
-
const handleTabChange = useCallback((event, newValue) => {
|
|
97
|
-
setTabValue(newValue);
|
|
98
|
-
}, []);
|
|
99
|
-
const onError = useCallback(
|
|
100
|
-
(errors) => {
|
|
101
|
-
if (!errors || isObjectEmpty(errors)) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const tabsInError = [];
|
|
105
|
-
Object.values(tabEnum).forEach((tab) => {
|
|
106
|
-
if (errors?.[tab] && tab !== tabValue) {
|
|
107
|
-
tabsInError.push(tab);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
if (tabsInError.includes(tabValue)) {
|
|
111
|
-
setTabValuesWithError(tabsInError.filter((errorTab) => errorTab !== tabValue));
|
|
112
|
-
} else if (tabsInError.length > 0) {
|
|
113
|
-
setTabValue(tabsInError[0]);
|
|
114
|
-
setTabValuesWithError(tabsInError.filter((errorTab, index, arr) => errorTab !== arr[0]));
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
[tabValue, tabEnum]
|
|
118
|
-
);
|
|
119
|
-
return {
|
|
120
|
-
selectedTab: tabValue,
|
|
121
|
-
tabsWithError: tabValuesWithError,
|
|
122
|
-
onTabChange: handleTabChange,
|
|
123
|
-
onError
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
90
|
function useDynamicMarginCalculationParametersForm({
|
|
127
91
|
providers,
|
|
128
92
|
params,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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 const CONTINGENCIES_START_TIME = "contingenciesStartTime";
|
|
8
|
+
export declare const CONTINGENCIES_LIST_INFOS = "contingencyListInfos";
|
|
9
|
+
export declare const SCENARIO_DURATION = "scenarioDuration";
|
|
@@ -0,0 +1,10 @@
|
|
|
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 http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
declare function ContingencyParameters({ path }: Readonly<{
|
|
8
|
+
path: string;
|
|
9
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default ContingencyParameters;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid } from "@mui/material";
|
|
3
|
+
import "react-intl";
|
|
4
|
+
import "react";
|
|
5
|
+
import "../../../utils/conversionUtils.js";
|
|
6
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
7
|
+
import "../../../utils/types/equipmentType.js";
|
|
8
|
+
import "@mui/icons-material";
|
|
9
|
+
import "../../../utils/yupConfig.js";
|
|
10
|
+
import "localized-countries";
|
|
11
|
+
import "localized-countries/data/fr";
|
|
12
|
+
import "localized-countries/data/en";
|
|
13
|
+
import "notistack";
|
|
14
|
+
import "react-hook-form";
|
|
15
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
16
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
17
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
18
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
19
|
+
import "../../overflowableText/OverflowableText.js";
|
|
20
|
+
import "yup";
|
|
21
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
22
|
+
import "../../customAGGrid/customAggrid.js";
|
|
23
|
+
import "ag-grid-community";
|
|
24
|
+
import "react-papaparse";
|
|
25
|
+
import "react-csv-downloader";
|
|
26
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
29
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
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 { ParameterLineDirectoryItemsInput } from "../common/widget/parameter-line-directory-items-input.js";
|
|
38
|
+
import "../common/widget/parameter-line-slider.js";
|
|
39
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
40
|
+
import "../common/contingency-table/columns-definitions.js";
|
|
41
|
+
import { TYPES, makeComponents } from "../util/make-component-utils.js";
|
|
42
|
+
import { CONTINGENCIES_START_TIME, CONTINGENCIES_LIST_INFOS } from "./constants.js";
|
|
43
|
+
const defParams = {
|
|
44
|
+
[CONTINGENCIES_START_TIME]: {
|
|
45
|
+
type: TYPES.FLOAT,
|
|
46
|
+
label: "DynamicSecurityAnalysisContingenciesStartTime"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function ContingencyParameters({ path }) {
|
|
50
|
+
return /* @__PURE__ */ jsxs(Grid, { xl: 8, container: true, children: [
|
|
51
|
+
makeComponents(defParams, path),
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
ParameterLineDirectoryItemsInput,
|
|
54
|
+
{
|
|
55
|
+
name: `${path}.${CONTINGENCIES_LIST_INFOS}`,
|
|
56
|
+
elementType: ElementType.CONTINGENCY_LIST,
|
|
57
|
+
label: "ContingencyListsSelection",
|
|
58
|
+
hideErrorMessage: true
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
ContingencyParameters as default
|
|
65
|
+
};
|
package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { UseParametersBackendReturnProps } from '../../../utils/types/parameters.type';
|
|
3
|
+
import { ComputingType } from '../common/computing-type';
|
|
4
|
+
type DynamicSecurityAnalysisInlineProps = {
|
|
5
|
+
studyUuid: UUID | null;
|
|
6
|
+
parametersBackend: UseParametersBackendReturnProps<ComputingType.DYNAMIC_SECURITY_ANALYSIS>;
|
|
7
|
+
setHaveDirtyFields: (isDirty: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function DynamicSecurityAnalysisInline({ studyUuid, parametersBackend, setHaveDirtyFields, }: Readonly<DynamicSecurityAnalysisInlineProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Grid } from "@mui/material";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { useState, useCallback, useEffect } from "react";
|
|
5
|
+
import "../../../utils/conversionUtils.js";
|
|
6
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
7
|
+
import "../../../utils/types/equipmentType.js";
|
|
8
|
+
import "@mui/icons-material";
|
|
9
|
+
import { mergeSx } from "../../../utils/styles.js";
|
|
10
|
+
import "../../../utils/yupConfig.js";
|
|
11
|
+
import { useDynamicSecurityAnalysisParametersForm, toParamsInfos } from "./use-dynamic-security-analysis-parameters-form.js";
|
|
12
|
+
import { LabelledButton } from "../common/parameters.js";
|
|
13
|
+
import { SubmitButton } from "../../inputs/reactHookForm/utils/SubmitButton.js";
|
|
14
|
+
import { PopupConfirmationDialog } from "../../dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
|
|
15
|
+
import { parametersStyles } from "../parameters-style.js";
|
|
16
|
+
import { CreateParameterDialog } from "../common/parameters-creation-dialog.js";
|
|
17
|
+
import "../../overflowableText/OverflowableText.js";
|
|
18
|
+
import "react-hook-form";
|
|
19
|
+
import "localized-countries";
|
|
20
|
+
import "localized-countries/data/fr";
|
|
21
|
+
import "localized-countries/data/en";
|
|
22
|
+
import "notistack";
|
|
23
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
24
|
+
import "yup";
|
|
25
|
+
import "../../treeViewFinder/TreeViewFinder.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 "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
34
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
35
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
36
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
37
|
+
import "@react-querybuilder/material";
|
|
38
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
39
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
40
|
+
import "uuid";
|
|
41
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
42
|
+
import "react-querybuilder";
|
|
43
|
+
import "../common/widget/parameter-line-slider.js";
|
|
44
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
45
|
+
import "../common/contingency-table/columns-definitions.js";
|
|
46
|
+
import { DynamicSecurityAnalysisParametersForm } from "./dynamic-security-analysis-parameters-form.js";
|
|
47
|
+
function DynamicSecurityAnalysisInline({
|
|
48
|
+
studyUuid,
|
|
49
|
+
parametersBackend,
|
|
50
|
+
setHaveDirtyFields
|
|
51
|
+
}) {
|
|
52
|
+
const { providers, params, updateParameters, resetParameters } = parametersBackend;
|
|
53
|
+
const dynamicSecurityAnalysisMethods = useDynamicSecurityAnalysisParametersForm({
|
|
54
|
+
providers,
|
|
55
|
+
params,
|
|
56
|
+
name: null,
|
|
57
|
+
description: null
|
|
58
|
+
});
|
|
59
|
+
const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
|
|
60
|
+
const [openResetConfirmation, setOpenResetConfirmation] = useState(false);
|
|
61
|
+
const { formMethods, onError } = dynamicSecurityAnalysisMethods;
|
|
62
|
+
const { handleSubmit, getValues, formState } = formMethods;
|
|
63
|
+
const handleResetClick = useCallback(() => {
|
|
64
|
+
setOpenResetConfirmation(true);
|
|
65
|
+
}, []);
|
|
66
|
+
const handleCancelReset = useCallback(() => {
|
|
67
|
+
setOpenResetConfirmation(false);
|
|
68
|
+
}, []);
|
|
69
|
+
const handleReset = useCallback(() => {
|
|
70
|
+
resetParameters();
|
|
71
|
+
setOpenResetConfirmation(false);
|
|
72
|
+
}, [resetParameters]);
|
|
73
|
+
const onSubmit = useCallback(
|
|
74
|
+
(formData) => {
|
|
75
|
+
updateParameters(toParamsInfos(formData));
|
|
76
|
+
},
|
|
77
|
+
[updateParameters]
|
|
78
|
+
);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setHaveDirtyFields(!!Object.keys(formState.dirtyFields).length);
|
|
81
|
+
}, [formState, setHaveDirtyFields]);
|
|
82
|
+
const renderActions = () => {
|
|
83
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx(Grid, { container: true, item: true, children: /* @__PURE__ */ jsxs(
|
|
85
|
+
Grid,
|
|
86
|
+
{
|
|
87
|
+
sx: mergeSx(parametersStyles.controlParametersItem, {
|
|
88
|
+
paddingBottom: 2,
|
|
89
|
+
paddingLeft: 0
|
|
90
|
+
}),
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx(LabelledButton, { callback: handleResetClick, label: "resetToDefault" }),
|
|
93
|
+
/* @__PURE__ */ jsx(SubmitButton, { variant: "outlined", onClick: handleSubmit(onSubmit, onError), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) })
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
) }),
|
|
97
|
+
openCreateParameterDialog && /* @__PURE__ */ jsx(
|
|
98
|
+
CreateParameterDialog,
|
|
99
|
+
{
|
|
100
|
+
studyUuid,
|
|
101
|
+
open: openCreateParameterDialog,
|
|
102
|
+
onClose: () => setOpenCreateParameterDialog(false),
|
|
103
|
+
parameterValues: getValues,
|
|
104
|
+
parameterFormatter: toParamsInfos,
|
|
105
|
+
parameterType: ElementType.DYNAMIC_SECURITY_ANALYSIS_PARAMETERS
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
openResetConfirmation && /* @__PURE__ */ jsx(
|
|
109
|
+
PopupConfirmationDialog,
|
|
110
|
+
{
|
|
111
|
+
message: "resetParamsConfirmation",
|
|
112
|
+
validateButtonLabel: "validate",
|
|
113
|
+
openConfirmationPopup: openResetConfirmation,
|
|
114
|
+
setOpenConfirmationPopup: handleCancelReset,
|
|
115
|
+
handlePopupConfirmation: handleReset
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
return /* @__PURE__ */ jsx(
|
|
121
|
+
DynamicSecurityAnalysisParametersForm,
|
|
122
|
+
{
|
|
123
|
+
dynamicSecurityAnalysisMethods,
|
|
124
|
+
renderActions
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
DynamicSecurityAnalysisInline
|
|
130
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UseDynamicSecurityAnalysisParametersFormReturn } from './use-dynamic-security-analysis-parameters-form';
|
|
3
|
+
type DynamicSecurityAnalysisParametersFormProps = {
|
|
4
|
+
dynamicSecurityAnalysisMethods: UseDynamicSecurityAnalysisParametersFormReturn;
|
|
5
|
+
renderTitleFields?: () => ReactNode;
|
|
6
|
+
renderActions?: () => ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare function DynamicSecurityAnalysisParametersForm({ dynamicSecurityAnalysisMethods, renderTitleFields, renderActions, }: Readonly<DynamicSecurityAnalysisParametersFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid, Tabs, Tab, LinearProgress } from "@mui/material";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import ScenarioParameters from "./scenario-parameters.js";
|
|
5
|
+
import ContingencyParameters from "./contingency-parameters.js";
|
|
6
|
+
import { parametersStyles } from "../util/styles.js";
|
|
7
|
+
import { TabPanel } from "../common/parameters.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import "../../../utils/conversionUtils.js";
|
|
10
|
+
import "../../../utils/types/equipmentType.js";
|
|
11
|
+
import "@mui/icons-material";
|
|
12
|
+
import { mergeSx } from "../../../utils/styles.js";
|
|
13
|
+
import "../../../utils/yupConfig.js";
|
|
14
|
+
import "localized-countries";
|
|
15
|
+
import "localized-countries/data/fr";
|
|
16
|
+
import "localized-countries/data/en";
|
|
17
|
+
import "notistack";
|
|
18
|
+
import "react-hook-form";
|
|
19
|
+
import { CustomFormProvider } from "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
20
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
21
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
22
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
23
|
+
import { ProviderParam } from "../common/ProviderParam.js";
|
|
24
|
+
import "../../overflowableText/OverflowableText.js";
|
|
25
|
+
import "yup";
|
|
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 "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
34
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
35
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
36
|
+
import "@react-querybuilder/material";
|
|
37
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
38
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
39
|
+
import "uuid";
|
|
40
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
41
|
+
import "react-querybuilder";
|
|
42
|
+
import { getTabStyle } from "../parameters-style.js";
|
|
43
|
+
import "../common/widget/parameter-line-slider.js";
|
|
44
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
45
|
+
import "../common/contingency-table/columns-definitions.js";
|
|
46
|
+
import { TabValues } from "./use-dynamic-security-analysis-parameters-form.js";
|
|
47
|
+
function DynamicSecurityAnalysisParametersForm({
|
|
48
|
+
dynamicSecurityAnalysisMethods,
|
|
49
|
+
renderTitleFields,
|
|
50
|
+
renderActions
|
|
51
|
+
}) {
|
|
52
|
+
const { formMethods, formSchema, paramsLoaded, formattedProviders, selectedTab, onTabChange, tabsWithError } = dynamicSecurityAnalysisMethods;
|
|
53
|
+
return /* @__PURE__ */ jsxs(CustomFormProvider, { validationSchema: formSchema, ...formMethods, children: [
|
|
54
|
+
renderTitleFields?.(),
|
|
55
|
+
paramsLoaded ? /* @__PURE__ */ jsxs(Grid, { sx: { height: "100%" }, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Grid, { container: true, children: /* @__PURE__ */ jsx(ProviderParam, { options: formattedProviders }) }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Grid,
|
|
59
|
+
{
|
|
60
|
+
sx: mergeSx(parametersStyles.scrollableGrid, {
|
|
61
|
+
height: "100%",
|
|
62
|
+
paddingTop: 0
|
|
63
|
+
}),
|
|
64
|
+
children: /* @__PURE__ */ jsxs(Grid, { item: true, width: "100%", children: [
|
|
65
|
+
/* @__PURE__ */ jsxs(
|
|
66
|
+
Tabs,
|
|
67
|
+
{
|
|
68
|
+
value: selectedTab,
|
|
69
|
+
variant: "scrollable",
|
|
70
|
+
onChange: onTabChange,
|
|
71
|
+
"aria-label": "parameters",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
Tab,
|
|
75
|
+
{
|
|
76
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: "DynamicSecurityAnalysisScenario" }),
|
|
77
|
+
value: TabValues.SCENARIO,
|
|
78
|
+
sx: getTabStyle(tabsWithError, TabValues.SCENARIO)
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
Tab,
|
|
83
|
+
{
|
|
84
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: "DynamicSecurityAnalysisContingency" }),
|
|
85
|
+
value: TabValues.CONTINGENCY
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
/* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: TabValues.SCENARIO, children: /* @__PURE__ */ jsx(ScenarioParameters, { path: TabValues.SCENARIO }) }),
|
|
92
|
+
/* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: TabValues.CONTINGENCY, children: /* @__PURE__ */ jsx(ContingencyParameters, { path: TabValues.CONTINGENCY }) })
|
|
93
|
+
] })
|
|
94
|
+
},
|
|
95
|
+
"dsaParameters"
|
|
96
|
+
),
|
|
97
|
+
renderActions?.()
|
|
98
|
+
] }) : /* @__PURE__ */ jsx(LinearProgress, {})
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
DynamicSecurityAnalysisParametersForm
|
|
103
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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 * from './constants';
|
|
8
|
+
export * from './dynamic-security-analysis-inline';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./constants.js";
|
|
2
|
+
import { DynamicSecurityAnalysisInline } from "./dynamic-security-analysis-inline.js";
|
|
3
|
+
export {
|
|
4
|
+
CONTINGENCIES_LIST_INFOS,
|
|
5
|
+
CONTINGENCIES_START_TIME,
|
|
6
|
+
DynamicSecurityAnalysisInline,
|
|
7
|
+
SCENARIO_DURATION
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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 http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
declare function ScenarioParameters({ path }: Readonly<{
|
|
8
|
+
path: string;
|
|
9
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default ScenarioParameters;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid } from "@mui/material";
|
|
3
|
+
import { TYPES, makeComponents } from "../util/make-component-utils.js";
|
|
4
|
+
import { SCENARIO_DURATION } from "./constants.js";
|
|
5
|
+
const defParams = {
|
|
6
|
+
[SCENARIO_DURATION]: {
|
|
7
|
+
type: TYPES.FLOAT,
|
|
8
|
+
label: "DynamicSecurityAnalysisScenarioDuration"
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
function ScenarioParameters({ path }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Grid, { xl: 8, container: true, children: makeComponents(defParams, path) });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
ScenarioParameters as default
|
|
16
|
+
};
|