@gridsuite/commons-ui 0.178.0 → 0.180.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 +79 -1
- package/dist/components/inputs/index.js +2 -0
- package/dist/components/inputs/reactHookForm/CheckboxNullableInput.d.ts +15 -0
- package/dist/components/inputs/reactHookForm/CheckboxNullableInput.js +75 -0
- package/dist/components/inputs/reactHookForm/index.d.ts +1 -0
- package/dist/components/inputs/reactHookForm/index.js +2 -0
- package/dist/components/network-modifications/common/connectivity/BranchConnectivityForm.d.ts +7 -0
- package/dist/components/network-modifications/common/connectivity/BranchConnectivityForm.js +63 -0
- package/dist/components/network-modifications/common/connectivity/ConnectivityForm.d.ts +37 -0
- package/dist/components/network-modifications/common/connectivity/ConnectivityForm.js +267 -0
- package/dist/components/network-modifications/common/connectivity/connectivity.type.d.ts +34 -0
- package/dist/components/network-modifications/common/connectivity/connectivity.type.js +1 -0
- package/dist/components/network-modifications/common/connectivity/connectivityForm.utils.d.ts +241 -0
- package/dist/components/network-modifications/common/connectivity/connectivityForm.utils.js +196 -0
- package/dist/components/network-modifications/common/connectivity/index.d.ts +10 -0
- package/dist/components/network-modifications/common/connectivity/index.js +25 -0
- package/dist/components/network-modifications/common/index.d.ts +4 -1
- package/dist/components/network-modifications/common/index.js +56 -1
- package/dist/components/network-modifications/common/measurements/BranchActiveReactivePowerMeasurementsForm.d.ts +2 -0
- package/dist/components/network-modifications/common/measurements/BranchActiveReactivePowerMeasurementsForm.js +37 -0
- package/dist/components/network-modifications/common/measurements/PowerMeasurementsForm.d.ts +9 -0
- package/dist/components/network-modifications/common/measurements/PowerMeasurementsForm.js +52 -0
- package/dist/components/network-modifications/common/measurements/PowerWithValidityForm.d.ts +2 -0
- package/dist/components/network-modifications/common/measurements/PowerWithValidityForm.js +74 -0
- package/dist/components/network-modifications/common/measurements/branchActiveReactivePowerForm.utils.d.ts +56 -0
- package/dist/components/network-modifications/common/measurements/branchActiveReactivePowerForm.utils.js +69 -0
- package/dist/components/network-modifications/common/measurements/index.d.ts +13 -0
- package/dist/components/network-modifications/common/measurements/index.js +26 -0
- package/dist/components/network-modifications/common/measurements/injectionActiveReactivePowerForm.utils.d.ts +58 -0
- package/dist/components/network-modifications/common/measurements/injectionActiveReactivePowerForm.utils.js +55 -0
- package/dist/components/network-modifications/common/measurements/measurement.type.d.ts +13 -0
- package/dist/components/network-modifications/common/measurements/measurement.type.js +1 -0
- package/dist/components/network-modifications/common/measurements/powerWithValidity.utils.d.ts +22 -0
- package/dist/components/network-modifications/common/measurements/powerWithValidity.utils.js +36 -0
- package/dist/components/network-modifications/common/setpoints/SetPointsForm.d.ts +15 -0
- package/dist/components/network-modifications/common/setpoints/SetPointsForm.js +71 -0
- package/dist/components/network-modifications/common/setpoints/index.d.ts +8 -0
- package/dist/components/network-modifications/common/setpoints/index.js +10 -0
- package/dist/components/network-modifications/common/setpoints/setPoints.utils.d.ts +16 -0
- package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +62 -0
- package/dist/components/network-modifications/index.d.ts +1 -0
- package/dist/components/network-modifications/index.js +71 -1
- package/dist/components/network-modifications/load/common/LoadDialogHeader.d.ts +7 -0
- package/dist/components/network-modifications/load/common/LoadDialogHeader.js +103 -0
- package/dist/components/network-modifications/load/common/LoadDialogTabs.d.ts +14 -0
- package/dist/components/network-modifications/load/common/LoadDialogTabs.js +49 -0
- package/dist/components/network-modifications/load/common/LoadDialogTabsContent.d.ts +8 -0
- package/dist/components/network-modifications/load/common/LoadDialogTabsContent.js +61 -0
- package/dist/components/network-modifications/load/common/LoadForm.d.ts +5 -0
- package/dist/components/network-modifications/load/common/LoadForm.js +73 -0
- package/dist/components/network-modifications/load/common/index.d.ts +12 -0
- package/dist/components/network-modifications/load/common/index.js +12 -0
- package/dist/components/network-modifications/load/common/load.types.d.ts +16 -0
- package/dist/components/network-modifications/load/common/load.types.js +1 -0
- package/dist/components/network-modifications/load/common/load.utils.d.ts +11 -0
- package/dist/components/network-modifications/load/common/load.utils.js +8 -0
- package/dist/components/network-modifications/load/creation/index.d.ts +8 -0
- package/dist/components/network-modifications/load/creation/index.js +7 -0
- package/dist/components/network-modifications/load/creation/loadCreation.types.d.ts +16 -0
- package/dist/components/network-modifications/load/creation/loadCreation.types.js +1 -0
- package/dist/components/network-modifications/load/creation/loadCreation.utils.d.ts +53 -0
- package/dist/components/network-modifications/load/creation/loadCreation.utils.js +98 -0
- package/dist/components/network-modifications/load/index.d.ts +8 -0
- package/dist/components/network-modifications/load/index.js +17 -0
- package/dist/components/network-modifications/substation/creation/substationCreation.utils.js +2 -1
- package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.js +3 -0
- package/dist/components/network-modifications/voltage-level/index.d.ts +1 -0
- package/dist/components/network-modifications/voltage-level/voltage-level.type.d.ts +12 -0
- package/dist/components/network-modifications/voltage-level/voltage-level.type.js +1 -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 +95 -4
- 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/translations/en/networkModificationsEn.d.ts +17 -0
- package/dist/translations/en/networkModificationsEn.js +18 -1
- package/dist/translations/fr/networkModificationsFr.d.ts +17 -0
- package/dist/translations/fr/networkModificationsFr.js +18 -1
- package/dist/utils/constants/fieldConstants.d.ts +24 -1
- package/dist/utils/constants/fieldConstants.js +24 -1
- package/dist/utils/index.js +10 -2
- package/dist/utils/ts-utils.d.ts +5 -6
- package/dist/utils/ts-utils.js +11 -0
- package/dist/utils/types/elementType.d.ts +1 -0
- package/dist/utils/types/elementType.js +1 -0
- package/dist/utils/types/equipmentType.d.ts +18 -0
- package/dist/utils/types/equipmentType.js +27 -1
- package/dist/utils/types/index.js +8 -2
- package/package.json +1 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { useForm } from "react-hook-form";
|
|
2
|
+
import { useMemo, useEffect } from "react";
|
|
3
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
|
+
import "../../../utils/yupConfig.js";
|
|
5
|
+
import { ID } from "../../../utils/constants/filterConstant.js";
|
|
6
|
+
import "../../../utils/conversionUtils.js";
|
|
7
|
+
import "../../../utils/types/equipmentType.js";
|
|
8
|
+
import "react/jsx-runtime";
|
|
9
|
+
import "@mui/icons-material";
|
|
10
|
+
import { PROVIDER } from "../common/constants.js";
|
|
11
|
+
import "@mui/material";
|
|
12
|
+
import "react-intl";
|
|
13
|
+
import "localized-countries";
|
|
14
|
+
import "localized-countries/data/fr";
|
|
15
|
+
import "localized-countries/data/en";
|
|
16
|
+
import "notistack";
|
|
17
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
18
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
19
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
20
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
21
|
+
import "../../overflowableText/OverflowableText.js";
|
|
22
|
+
import * as yup from "yup";
|
|
23
|
+
import { NAME } from "../../inputs/reactHookForm/constants.js";
|
|
24
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
25
|
+
import "../../customAGGrid/customAggrid.js";
|
|
26
|
+
import "ag-grid-community";
|
|
27
|
+
import "react-papaparse";
|
|
28
|
+
import "react-csv-downloader";
|
|
29
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
32
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
34
|
+
import "@react-querybuilder/material";
|
|
35
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
36
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
37
|
+
import "uuid";
|
|
38
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
39
|
+
import "react-querybuilder";
|
|
40
|
+
import "../common/widget/parameter-line-slider.js";
|
|
41
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
42
|
+
import "../common/contingency-table/columns-definitions.js";
|
|
43
|
+
import "../../filter/HeaderFilterForm.js";
|
|
44
|
+
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
45
|
+
import { SCENARIO_DURATION, CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME } from "./constants.js";
|
|
46
|
+
import { useTabs } from "../common/utils.js";
|
|
47
|
+
var TabValues = /* @__PURE__ */ ((TabValues2) => {
|
|
48
|
+
TabValues2["SCENARIO"] = "scenario";
|
|
49
|
+
TabValues2["CONTINGENCY"] = "contingency";
|
|
50
|
+
return TabValues2;
|
|
51
|
+
})(TabValues || {});
|
|
52
|
+
const scenarioFormSchema = yup.object().shape({
|
|
53
|
+
[SCENARIO_DURATION]: yup.number().required()
|
|
54
|
+
}).required();
|
|
55
|
+
const contingencyFormSchema = yup.object().shape({
|
|
56
|
+
[CONTINGENCIES_START_TIME]: yup.number().required(),
|
|
57
|
+
[CONTINGENCIES_LIST_INFOS]: yup.array().of(
|
|
58
|
+
yup.object().shape({
|
|
59
|
+
[ID]: yup.string().required(),
|
|
60
|
+
[NAME]: yup.string().required()
|
|
61
|
+
})
|
|
62
|
+
).required()
|
|
63
|
+
});
|
|
64
|
+
const formSchema = yup.object().shape({
|
|
65
|
+
[PROVIDER]: yup.string().required(),
|
|
66
|
+
[
|
|
67
|
+
"scenario"
|
|
68
|
+
/* SCENARIO */
|
|
69
|
+
]: scenarioFormSchema,
|
|
70
|
+
[
|
|
71
|
+
"contingency"
|
|
72
|
+
/* CONTINGENCY */
|
|
73
|
+
]: contingencyFormSchema
|
|
74
|
+
});
|
|
75
|
+
const scenarioEmptyFormData = {
|
|
76
|
+
[SCENARIO_DURATION]: 0
|
|
77
|
+
};
|
|
78
|
+
const contingencyEmptyFormData = {
|
|
79
|
+
[CONTINGENCIES_START_TIME]: 0,
|
|
80
|
+
[CONTINGENCIES_LIST_INFOS]: []
|
|
81
|
+
};
|
|
82
|
+
const emptyFormData = {
|
|
83
|
+
[PROVIDER]: "",
|
|
84
|
+
[
|
|
85
|
+
"scenario"
|
|
86
|
+
/* SCENARIO */
|
|
87
|
+
]: { ...scenarioEmptyFormData },
|
|
88
|
+
[
|
|
89
|
+
"contingency"
|
|
90
|
+
/* CONTINGENCY */
|
|
91
|
+
]: { ...contingencyEmptyFormData }
|
|
92
|
+
};
|
|
93
|
+
const toFormValues = (_params) => ({
|
|
94
|
+
[PROVIDER]: _params.provider,
|
|
95
|
+
[
|
|
96
|
+
"scenario"
|
|
97
|
+
/* SCENARIO */
|
|
98
|
+
]: {
|
|
99
|
+
[SCENARIO_DURATION]: _params.scenarioDuration
|
|
100
|
+
},
|
|
101
|
+
[
|
|
102
|
+
"contingency"
|
|
103
|
+
/* CONTINGENCY */
|
|
104
|
+
]: {
|
|
105
|
+
[CONTINGENCIES_START_TIME]: _params.contingenciesStartTime,
|
|
106
|
+
[CONTINGENCIES_LIST_INFOS]: _params.contingencyListInfos
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const toParamsInfos = (_formData) => ({
|
|
110
|
+
provider: _formData[PROVIDER],
|
|
111
|
+
scenarioDuration: _formData[
|
|
112
|
+
"scenario"
|
|
113
|
+
/* SCENARIO */
|
|
114
|
+
][SCENARIO_DURATION],
|
|
115
|
+
contingenciesStartTime: _formData[
|
|
116
|
+
"contingency"
|
|
117
|
+
/* CONTINGENCY */
|
|
118
|
+
][CONTINGENCIES_START_TIME],
|
|
119
|
+
contingencyListInfos: _formData[
|
|
120
|
+
"contingency"
|
|
121
|
+
/* CONTINGENCY */
|
|
122
|
+
][CONTINGENCIES_LIST_INFOS]
|
|
123
|
+
});
|
|
124
|
+
function useDynamicSecurityAnalysisParametersForm({
|
|
125
|
+
providers,
|
|
126
|
+
params,
|
|
127
|
+
name: initialName,
|
|
128
|
+
description: initialDescription
|
|
129
|
+
}) {
|
|
130
|
+
const paramsLoaded = useMemo(() => !!params, [params]);
|
|
131
|
+
const formattedProviders = useMemo(
|
|
132
|
+
() => Object.entries(providers).map(([key, value]) => ({
|
|
133
|
+
id: key,
|
|
134
|
+
label: value
|
|
135
|
+
})),
|
|
136
|
+
[providers]
|
|
137
|
+
);
|
|
138
|
+
const returnFormSchema = useMemo(() => {
|
|
139
|
+
return initialName === null ? formSchema : formSchema.concat(getNameElementEditorSchema(initialName));
|
|
140
|
+
}, [initialName]);
|
|
141
|
+
const newEmptyFormData = useMemo(() => {
|
|
142
|
+
return {
|
|
143
|
+
...initialName === null ? {} : getNameElementEditorEmptyFormData(initialName, initialDescription),
|
|
144
|
+
...emptyFormData
|
|
145
|
+
};
|
|
146
|
+
}, [initialName, initialDescription]);
|
|
147
|
+
const returnFormMethods = useForm({
|
|
148
|
+
defaultValues: newEmptyFormData,
|
|
149
|
+
resolver: yupResolver(returnFormSchema)
|
|
150
|
+
});
|
|
151
|
+
const { reset } = returnFormMethods;
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (params) {
|
|
154
|
+
console.log("xxx Resetting form with params:", params);
|
|
155
|
+
reset(toFormValues(params));
|
|
156
|
+
}
|
|
157
|
+
}, [params, paramsLoaded, reset]);
|
|
158
|
+
const { selectedTab, tabsWithError, onTabChange, onError } = useTabs({
|
|
159
|
+
defaultTab: "scenario",
|
|
160
|
+
tabEnum: TabValues
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
formMethods: returnFormMethods,
|
|
164
|
+
formSchema: returnFormSchema,
|
|
165
|
+
paramsLoaded,
|
|
166
|
+
formattedProviders,
|
|
167
|
+
/* tab-related handling */
|
|
168
|
+
selectedTab,
|
|
169
|
+
tabsWithError,
|
|
170
|
+
onTabChange,
|
|
171
|
+
onError
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
TabValues,
|
|
176
|
+
emptyFormData,
|
|
177
|
+
formSchema,
|
|
178
|
+
toFormValues,
|
|
179
|
+
toParamsInfos,
|
|
180
|
+
useDynamicSecurityAnalysisParametersForm
|
|
181
|
+
};
|
|
@@ -41,6 +41,8 @@ import { SensitivityAnalysisParametersDialog } from "./sensi/sensitivity-analysi
|
|
|
41
41
|
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 "./sensi/columns-definitions.js";
|
|
42
42
|
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 "./dynamic-margin-calculation/constants.js";
|
|
43
43
|
import { DynamicMarginCalculationInline } from "./dynamic-margin-calculation/dynamic-margin-calculation-inline.js";
|
|
44
|
+
import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./dynamic-security-analysis/constants.js";
|
|
45
|
+
import { DynamicSecurityAnalysisInline } from "./dynamic-security-analysis/dynamic-security-analysis-inline.js";
|
|
44
46
|
export {
|
|
45
47
|
ACCURACY,
|
|
46
48
|
ACTIVE,
|
|
@@ -58,6 +60,8 @@ export {
|
|
|
58
60
|
COMPONENT_LIBRARY,
|
|
59
61
|
CONNECTED_MODE,
|
|
60
62
|
CONTINGENCIES,
|
|
63
|
+
CONTINGENCIES_LIST_INFOS,
|
|
64
|
+
CONTINGENCIES_START_TIME,
|
|
61
65
|
CONTINGENCY_LISTS,
|
|
62
66
|
CONTINGENCY_LISTS_INFOS,
|
|
63
67
|
COUNTRIES_TO_BALANCE,
|
|
@@ -78,6 +82,7 @@ export {
|
|
|
78
82
|
DIAGONAL_LABEL,
|
|
79
83
|
DISTRIBUTED_SLACK,
|
|
80
84
|
DynamicMarginCalculationInline,
|
|
85
|
+
DynamicSecurityAnalysisInline,
|
|
81
86
|
EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES,
|
|
82
87
|
EquipmentsSelectionType,
|
|
83
88
|
GENERAL,
|
|
@@ -165,6 +170,7 @@ export {
|
|
|
165
170
|
RATIO_TAP_CHANGER_TARGET_V,
|
|
166
171
|
REACTIVE_SLACKS_THRESHOLD,
|
|
167
172
|
READ_SLACK_BUS,
|
|
173
|
+
SCENARIO_DURATION,
|
|
168
174
|
SELECTION_TYPE,
|
|
169
175
|
SENSITIVITY_TYPES,
|
|
170
176
|
SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
|
|
@@ -12,6 +12,7 @@ import { ElementType } from "../../../utils/types/elementType.js";
|
|
|
12
12
|
import "../../../utils/types/equipmentType.js";
|
|
13
13
|
import "@mui/icons-material";
|
|
14
14
|
import "../../../utils/yupConfig.js";
|
|
15
|
+
import { DEFAULT_TIMEOUT_MS, IGNORE_SIGNAL } from "../../../services/utils.js";
|
|
15
16
|
import { updateParameter } from "../../../services/explore.js";
|
|
16
17
|
import "localized-countries";
|
|
17
18
|
import "localized-countries/data/fr";
|
|
@@ -63,6 +64,7 @@ const useSensitivityAnalysisParametersForm = ({
|
|
|
63
64
|
const [factorsCount, setFactorsCount] = useState(DEFAULT_FACTOR_COUNT);
|
|
64
65
|
const [isLoading, setIsLoading] = useState(false);
|
|
65
66
|
const [isSubmitAction, setIsSubmitAction] = useState(false);
|
|
67
|
+
const [factorCountParams, setFactorCountParams] = useState(null);
|
|
66
68
|
const emptyFormData = useMemo(() => {
|
|
67
69
|
return {
|
|
68
70
|
...getNameElementEditorEmptyFormData(name, description),
|
|
@@ -108,6 +110,7 @@ const useSensitivityAnalysisParametersForm = ({
|
|
|
108
110
|
const resetFactorsCount = useCallback(() => {
|
|
109
111
|
setIsLoading(false);
|
|
110
112
|
setFactorsCount(DEFAULT_FACTOR_COUNT);
|
|
113
|
+
setFactorCountParams(null);
|
|
111
114
|
}, []);
|
|
112
115
|
const updateFactorCount = useCallback(() => {
|
|
113
116
|
if (!currentNodeUuid || !currentRootNetworkUuid) {
|
|
@@ -132,23 +135,40 @@ const useSensitivityAnalysisParametersForm = ({
|
|
|
132
135
|
[PARAMETER_SENSI_PST]: filteredPst,
|
|
133
136
|
[PARAMETER_SENSI_NODES]: filteredNodes
|
|
134
137
|
};
|
|
138
|
+
setFactorCountParams(formatNewParams(filteredFormValues));
|
|
139
|
+
}, [currentNodeUuid, currentRootNetworkUuid, formatNewParams, getValues, resetFactorsCount]);
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (!factorCountParams || !currentNodeUuid || !currentRootNetworkUuid) {
|
|
142
|
+
return () => {
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
let loadingTimeoutId;
|
|
146
|
+
const controller = new AbortController();
|
|
147
|
+
const abortSignal = AbortSignal.any([controller.signal, AbortSignal.timeout(DEFAULT_TIMEOUT_MS)]);
|
|
135
148
|
setIsLoading(true);
|
|
136
149
|
getSensitivityAnalysisFactorsCount(
|
|
137
150
|
studyUuid,
|
|
138
151
|
currentNodeUuid,
|
|
139
152
|
currentRootNetworkUuid,
|
|
140
|
-
|
|
153
|
+
factorCountParams,
|
|
154
|
+
abortSignal
|
|
141
155
|
).then((factorsCountResponse) => {
|
|
142
156
|
setFactorsCount(factorsCountResponse);
|
|
143
|
-
|
|
157
|
+
loadingTimeoutId = setTimeout(() => {
|
|
144
158
|
setIsLoading(false);
|
|
145
159
|
}, 500);
|
|
146
|
-
return () => clearTimeout(timeoutId);
|
|
147
160
|
}).catch((error) => {
|
|
161
|
+
if (abortSignal.aborted && abortSignal.reason?.message === IGNORE_SIGNAL) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
148
164
|
setIsLoading(false);
|
|
149
165
|
snackWithFallback(snackError, error, { headerId: "getSensitivityAnalysisFactorsCountError" });
|
|
150
166
|
});
|
|
151
|
-
|
|
167
|
+
return () => {
|
|
168
|
+
controller?.abort(new Error(IGNORE_SIGNAL));
|
|
169
|
+
clearTimeout(loadingTimeoutId);
|
|
170
|
+
};
|
|
171
|
+
}, [snackError, studyUuid, currentRootNetworkUuid, currentNodeUuid, factorCountParams]);
|
|
152
172
|
const onFormChanged = useCallback(() => {
|
|
153
173
|
updateFactorCount();
|
|
154
174
|
}, [updateFactorCount]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { Option } from '../../../utils';
|
|
3
|
+
export declare enum TYPES {
|
|
4
|
+
ENUM = "ENUM",
|
|
5
|
+
BOOL = "BOOL",
|
|
6
|
+
INTEGER = "INTEGER",
|
|
7
|
+
FLOAT = "FLOAT",
|
|
8
|
+
STRING = "STRING"
|
|
9
|
+
}
|
|
10
|
+
export type DefParam = {
|
|
11
|
+
type: TYPES;
|
|
12
|
+
label: string;
|
|
13
|
+
options?: Option[];
|
|
14
|
+
render?: (defParam: DefParam, path: string, key: string) => ReactElement;
|
|
15
|
+
};
|
|
16
|
+
export declare const makeComponent: (defParam: DefParam, path: string, key: string) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const makeComponents: (defParams: Record<string, DefParam>, path: string) => import("react/jsx-runtime").JSX.Element[];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid } from "@mui/material";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { parametersStyles } from "./styles.js";
|
|
5
|
+
import { LineSeparator } from "../common/line-separator.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "../../../utils/conversionUtils.js";
|
|
8
|
+
import "../../../utils/types/equipmentType.js";
|
|
9
|
+
import "@mui/icons-material";
|
|
10
|
+
import "../../../utils/yupConfig.js";
|
|
11
|
+
import "localized-countries";
|
|
12
|
+
import "localized-countries/data/fr";
|
|
13
|
+
import "localized-countries/data/en";
|
|
14
|
+
import "notistack";
|
|
15
|
+
import "react-hook-form";
|
|
16
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
17
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
18
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
19
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
20
|
+
import "../../overflowableText/OverflowableText.js";
|
|
21
|
+
import "yup";
|
|
22
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
23
|
+
import "../../customAGGrid/customAggrid.js";
|
|
24
|
+
import "ag-grid-community";
|
|
25
|
+
import "react-papaparse";
|
|
26
|
+
import "react-csv-downloader";
|
|
27
|
+
import { SwitchInput } from "../../inputs/reactHookForm/booleans/SwitchInput.js";
|
|
28
|
+
import { FloatInput } from "../../inputs/reactHookForm/numbers/FloatInput.js";
|
|
29
|
+
import { IntegerInput } from "../../inputs/reactHookForm/numbers/IntegerInput.js";
|
|
30
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
31
|
+
import { SelectInput } from "../../inputs/reactHookForm/selectInputs/SelectInput.js";
|
|
32
|
+
import { TextInput } from "../../inputs/reactHookForm/text/TextInput.js";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
34
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
35
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
36
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
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
|
+
var TYPES = /* @__PURE__ */ ((TYPES2) => {
|
|
47
|
+
TYPES2["ENUM"] = "ENUM";
|
|
48
|
+
TYPES2["BOOL"] = "BOOL";
|
|
49
|
+
TYPES2["INTEGER"] = "INTEGER";
|
|
50
|
+
TYPES2["FLOAT"] = "FLOAT";
|
|
51
|
+
TYPES2["STRING"] = "STRING";
|
|
52
|
+
return TYPES2;
|
|
53
|
+
})(TYPES || {});
|
|
54
|
+
const defaultParamRender = (defParam, path, key) => {
|
|
55
|
+
switch (defParam.type) {
|
|
56
|
+
case "ENUM":
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
SelectInput,
|
|
59
|
+
{
|
|
60
|
+
name: `${path}.${key}`,
|
|
61
|
+
label: "",
|
|
62
|
+
options: defParam?.options ?? [],
|
|
63
|
+
fullWidth: true,
|
|
64
|
+
size: "small"
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
case "BOOL":
|
|
68
|
+
return /* @__PURE__ */ jsx(SwitchInput, { name: `${path}.${key}`, label: "" });
|
|
69
|
+
case "INTEGER":
|
|
70
|
+
return /* @__PURE__ */ jsx(IntegerInput, { name: `${path}.${key}`, label: "" });
|
|
71
|
+
case "FLOAT":
|
|
72
|
+
return /* @__PURE__ */ jsx(FloatInput, { name: `${path}.${key}`, label: "" });
|
|
73
|
+
case "STRING":
|
|
74
|
+
return /* @__PURE__ */ jsx(TextInput, { name: `${path}.${key}`, label: "" });
|
|
75
|
+
default:
|
|
76
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const makeComponent = (defParam, path, key) => {
|
|
80
|
+
const render = defParam?.render ?? defaultParamRender;
|
|
81
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 8, sx: parametersStyles.parameterName, children: /* @__PURE__ */ jsx(FormattedMessage, { id: defParam.label }) }),
|
|
83
|
+
/* @__PURE__ */ jsx(Grid, { item: true, container: true, xs: 4, sx: parametersStyles.controlItem, children: render(defParam, path, key) })
|
|
84
|
+
] });
|
|
85
|
+
};
|
|
86
|
+
const makeComponents = (defParams, path) => {
|
|
87
|
+
return Object.keys(defParams).map((key) => /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, paddingTop: 1, children: [
|
|
88
|
+
makeComponent(defParams[key], path, key),
|
|
89
|
+
/* @__PURE__ */ jsx(LineSeparator, {})
|
|
90
|
+
] }, key));
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
TYPES,
|
|
94
|
+
makeComponent,
|
|
95
|
+
makeComponents
|
|
96
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const parametersStyles: {
|
|
3
|
+
readonly parameterName: (theme: Theme) => {
|
|
4
|
+
fontWeight: string;
|
|
5
|
+
marginTop: string;
|
|
6
|
+
};
|
|
7
|
+
readonly scrollableGrid: (theme: Theme) => {
|
|
8
|
+
overflowY: "auto";
|
|
9
|
+
overflowX: "hidden";
|
|
10
|
+
maxHeight: string;
|
|
11
|
+
paddingRight: string;
|
|
12
|
+
paddingTop: string;
|
|
13
|
+
paddingBottom: string;
|
|
14
|
+
flexGrow: number;
|
|
15
|
+
};
|
|
16
|
+
readonly controlItem: {
|
|
17
|
+
readonly justifyContent: "flex-end";
|
|
18
|
+
readonly flexGrow: 1;
|
|
19
|
+
};
|
|
20
|
+
readonly controlParametersItem: {
|
|
21
|
+
readonly justifyContent: "flex-start";
|
|
22
|
+
readonly flexGrow: 1;
|
|
23
|
+
readonly height: "fit-content";
|
|
24
|
+
readonly paddingBottom: 4;
|
|
25
|
+
};
|
|
26
|
+
readonly marginTopButton: {
|
|
27
|
+
readonly marginTop: "10px";
|
|
28
|
+
readonly position: "sticky";
|
|
29
|
+
readonly bottom: 0;
|
|
30
|
+
};
|
|
31
|
+
readonly panel: (theme: Theme) => {
|
|
32
|
+
marginTop: string;
|
|
33
|
+
marginBottom: string;
|
|
34
|
+
};
|
|
35
|
+
readonly title: (theme: Theme) => {
|
|
36
|
+
padding: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const parametersStyles = {
|
|
2
|
+
parameterName: (theme) => ({
|
|
3
|
+
fontWeight: "bold",
|
|
4
|
+
marginTop: theme.spacing(1)
|
|
5
|
+
}),
|
|
6
|
+
scrollableGrid: (theme) => ({
|
|
7
|
+
overflowY: "auto",
|
|
8
|
+
overflowX: "hidden",
|
|
9
|
+
maxHeight: "85%",
|
|
10
|
+
// TODO This needs to be refactored
|
|
11
|
+
paddingRight: theme.spacing(2),
|
|
12
|
+
paddingTop: theme.spacing(2),
|
|
13
|
+
paddingBottom: theme.spacing(1),
|
|
14
|
+
flexGrow: 1
|
|
15
|
+
}),
|
|
16
|
+
controlItem: {
|
|
17
|
+
justifyContent: "flex-end",
|
|
18
|
+
flexGrow: 1
|
|
19
|
+
},
|
|
20
|
+
controlParametersItem: {
|
|
21
|
+
justifyContent: "flex-start",
|
|
22
|
+
flexGrow: 1,
|
|
23
|
+
height: "fit-content",
|
|
24
|
+
paddingBottom: 4
|
|
25
|
+
},
|
|
26
|
+
marginTopButton: {
|
|
27
|
+
marginTop: "10px",
|
|
28
|
+
position: "sticky",
|
|
29
|
+
bottom: 0
|
|
30
|
+
},
|
|
31
|
+
panel: (theme) => ({
|
|
32
|
+
marginTop: theme.spacing(2),
|
|
33
|
+
marginBottom: theme.spacing(1)
|
|
34
|
+
}),
|
|
35
|
+
title: (theme) => ({
|
|
36
|
+
padding: theme.spacing(2)
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
parametersStyles
|
|
41
|
+
};
|