@gridsuite/commons-ui 0.171.0 → 0.172.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 -1
- package/dist/components/parameters/common/contingency-table/contingency-table.d.ts +4 -2
- package/dist/components/parameters/common/contingency-table/contingency-table.js +22 -11
- package/dist/components/parameters/common/contingency-table/types.d.ts +4 -0
- package/dist/components/parameters/common/parameters.js +1 -1
- package/dist/components/parameters/index.js +6 -1
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.d.ts +4 -2
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +4 -2
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.d.ts +4 -2
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +3 -1
- package/dist/components/parameters/short-circuit/constants.d.ts +5 -0
- package/dist/components/parameters/short-circuit/constants.js +10 -0
- package/dist/components/parameters/short-circuit/index.js +6 -1
- package/dist/components/parameters/short-circuit/short-circuit-general-tab-panel.d.ts +10 -0
- package/dist/components/parameters/short-circuit/short-circuit-general-tab-panel.js +206 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-content.d.ts +7 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-content.js +108 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +33 -30
- package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.d.ts +5 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.js +72 -25
- package/dist/components/parameters/short-circuit/short-circuit-power-electronics-tab-panel.d.ts +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +95 -0
- package/dist/components/parameters/short-circuit/short-circuit-study-area-tab-panel.d.ts +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-study-area-tab-panel.js +143 -0
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.d.ts +5 -0
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +28 -8
- package/dist/index.js +6 -1
- package/dist/services/directory.js +1 -1
- package/dist/services/explore.js +1 -1
- package/dist/translations/en/parameters.d.ts +10 -1
- package/dist/translations/en/parameters.js +10 -1
- package/dist/translations/fr/parameters.d.ts +10 -1
- package/dist/translations/fr/parameters.js +10 -1
- package/dist/utils/constants/adornments.js +1 -1
- package/package.json +1 -1
- package/dist/components/parameters/short-circuit/short-circuit-fields.d.ts +0 -10
- package/dist/components/parameters/short-circuit/short-circuit-fields.js +0 -276
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useWatch } from "react-hook-form";
|
|
4
|
+
import { Grid, Tabs, Tab, Box } from "@mui/material";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
import { getTabStyle, parametersStyles } from "../parameters-style.js";
|
|
7
|
+
import { ShortCircuitParametersTabValues } from "./short-circuit-parameters-utils.js";
|
|
8
|
+
import { ShortCircuitGeneralTabPanel } from "./short-circuit-general-tab-panel.js";
|
|
9
|
+
import { ShortCircuitStudyAreaTabPanel } from "./short-circuit-study-area-tab-panel.js";
|
|
10
|
+
import { ShortCircuitPowerElectronicsTabPanel } from "./short-circuit-power-electronics-tab-panel.js";
|
|
11
|
+
import { SPECIFIC_PARAMETERS } from "../common/constants.js";
|
|
12
|
+
import "../../../utils/conversionUtils.js";
|
|
13
|
+
import "../../../utils/types/equipmentType.js";
|
|
14
|
+
import "@mui/icons-material";
|
|
15
|
+
import "../../../utils/yupConfig.js";
|
|
16
|
+
import "localized-countries";
|
|
17
|
+
import "localized-countries/data/fr";
|
|
18
|
+
import "localized-countries/data/en";
|
|
19
|
+
import "notistack";
|
|
20
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
21
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
22
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
23
|
+
import "../../treeViewFinder/TreeViewFinder.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 "../common/widget/parameter-line-slider.js";
|
|
43
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
44
|
+
const styles = {
|
|
45
|
+
container: {
|
|
46
|
+
...parametersStyles.scrollableGrid,
|
|
47
|
+
maxHeight: "100%"
|
|
48
|
+
},
|
|
49
|
+
maxWidth: {
|
|
50
|
+
width: "100%"
|
|
51
|
+
},
|
|
52
|
+
wrapper: {
|
|
53
|
+
flexGrow: 1,
|
|
54
|
+
overflow: "auto",
|
|
55
|
+
paddingLeft: 1
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
function ShortCircuitParametersContent({
|
|
59
|
+
shortCircuitMethods,
|
|
60
|
+
isDeveloperMode
|
|
61
|
+
}) {
|
|
62
|
+
const { resetAll, selectedTab, handleTabChange, tabIndexesWithError } = shortCircuitMethods;
|
|
63
|
+
const watchSpecificParameters = useWatch({
|
|
64
|
+
name: `${SPECIFIC_PARAMETERS}`
|
|
65
|
+
});
|
|
66
|
+
const isThereSpecificParameters = useMemo(
|
|
67
|
+
() => Object.keys(watchSpecificParameters).length > 0 && watchSpecificParameters.constructor === Object,
|
|
68
|
+
[watchSpecificParameters]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ jsx(Grid, { item: true, sx: { width: "100%" }, children: /* @__PURE__ */ jsxs(Tabs, { value: selectedTab, onChange: handleTabChange, children: [
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Tab,
|
|
74
|
+
{
|
|
75
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: ShortCircuitParametersTabValues.GENERAL }),
|
|
76
|
+
value: ShortCircuitParametersTabValues.GENERAL,
|
|
77
|
+
sx: getTabStyle(tabIndexesWithError, ShortCircuitParametersTabValues.GENERAL)
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
isThereSpecificParameters && isDeveloperMode && /* @__PURE__ */ jsx(
|
|
81
|
+
Tab,
|
|
82
|
+
{
|
|
83
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: ShortCircuitParametersTabValues.STUDY_AREA }),
|
|
84
|
+
value: ShortCircuitParametersTabValues.STUDY_AREA,
|
|
85
|
+
sx: getTabStyle(tabIndexesWithError, ShortCircuitParametersTabValues.STUDY_AREA)
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
isThereSpecificParameters && isDeveloperMode && /* @__PURE__ */ jsx(
|
|
89
|
+
Tab,
|
|
90
|
+
{
|
|
91
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: ShortCircuitParametersTabValues.POWER_ELECTRONICS }),
|
|
92
|
+
value: ShortCircuitParametersTabValues.POWER_ELECTRONICS,
|
|
93
|
+
sx: getTabStyle(tabIndexesWithError, ShortCircuitParametersTabValues.POWER_ELECTRONICS)
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] }) }),
|
|
97
|
+
/* @__PURE__ */ jsx(Box, { sx: styles.wrapper, children: /* @__PURE__ */ jsx(Grid, { container: true, sx: styles.container, children: /* @__PURE__ */ jsxs(Grid, { item: true, sx: styles.maxWidth, children: [
|
|
98
|
+
/* @__PURE__ */ jsx(ShortCircuitGeneralTabPanel, { resetAll, value: selectedTab }),
|
|
99
|
+
isThereSpecificParameters && isDeveloperMode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
100
|
+
/* @__PURE__ */ jsx(ShortCircuitStudyAreaTabPanel, { value: selectedTab }),
|
|
101
|
+
/* @__PURE__ */ jsx(ShortCircuitPowerElectronicsTabPanel, { value: selectedTab })
|
|
102
|
+
] })
|
|
103
|
+
] }) }) })
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
ShortCircuitParametersContent as default
|
|
108
|
+
};
|
|
@@ -33,42 +33,45 @@ import "uuid";
|
|
|
33
33
|
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
34
34
|
import "react-querybuilder";
|
|
35
35
|
import { parametersStyles } from "../parameters-style.js";
|
|
36
|
-
import
|
|
36
|
+
import ShortCircuitParametersContent from "./short-circuit-parameters-content.js";
|
|
37
|
+
const styles = {
|
|
38
|
+
shortCircuitParameters: {
|
|
39
|
+
height: "100%",
|
|
40
|
+
display: "flex",
|
|
41
|
+
position: "relative",
|
|
42
|
+
flexDirection: "column"
|
|
43
|
+
}
|
|
44
|
+
};
|
|
37
45
|
function ShortCircuitParametersForm({
|
|
38
46
|
shortCircuitMethods,
|
|
39
47
|
renderTitleFields,
|
|
40
48
|
renderActions,
|
|
41
49
|
isDeveloperMode
|
|
42
50
|
}) {
|
|
43
|
-
const { formMethods, formSchema, paramsLoaded
|
|
44
|
-
return /* @__PURE__ */ jsx(CustomFormProvider, { validationSchema: formSchema, ...formMethods, removeOptional: true, children: /* @__PURE__ */ jsxs(
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
) });
|
|
51
|
+
const { formMethods, formSchema, paramsLoaded } = shortCircuitMethods;
|
|
52
|
+
return /* @__PURE__ */ jsx(CustomFormProvider, { validationSchema: formSchema, ...formMethods, removeOptional: true, children: /* @__PURE__ */ jsxs(Box, { sx: styles.shortCircuitParameters, children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Grid, { item: true, container: true, direction: "column", children: renderTitleFields?.() }),
|
|
54
|
+
paramsLoaded ? /* @__PURE__ */ jsx(Grid, { sx: parametersStyles.scrollableGrid, children: /* @__PURE__ */ jsx(
|
|
55
|
+
ShortCircuitParametersContent,
|
|
56
|
+
{
|
|
57
|
+
isDeveloperMode,
|
|
58
|
+
shortCircuitMethods
|
|
59
|
+
}
|
|
60
|
+
) }) : /* @__PURE__ */ jsx(LinearProgress, {}),
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
Grid,
|
|
63
|
+
{
|
|
64
|
+
item: true,
|
|
65
|
+
container: true,
|
|
66
|
+
direction: "column",
|
|
67
|
+
sx: {
|
|
68
|
+
position: "absolute",
|
|
69
|
+
bottom: "15px"
|
|
70
|
+
},
|
|
71
|
+
children: renderActions?.()
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }) });
|
|
72
75
|
}
|
|
73
76
|
export {
|
|
74
77
|
ShortCircuitParametersForm
|
|
@@ -2,6 +2,11 @@ import { InitialVoltage } from './constants';
|
|
|
2
2
|
import { default as yup } from '../../../utils/yupConfig';
|
|
3
3
|
import { SpecificParameterInfos, SpecificParametersValues } from '../../../utils';
|
|
4
4
|
import { SnackInputs } from '../../../hooks';
|
|
5
|
+
export declare enum ShortCircuitParametersTabValues {
|
|
6
|
+
GENERAL = "General",
|
|
7
|
+
STUDY_AREA = "StudyArea",
|
|
8
|
+
POWER_ELECTRONICS = "PowerElectronics"
|
|
9
|
+
}
|
|
5
10
|
export declare const getCommonShortCircuitParametersFormSchema: () => yup.ObjectSchema<{
|
|
6
11
|
commonParameters: {
|
|
7
12
|
withFeederResult: NonNullable<boolean | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, InitialVoltage, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS } from "./constants.js";
|
|
1
|
+
import { SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, InitialVoltage, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS, NODE_CLUSTER, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS, NODE_CLUSTER_FILTER_IDS } from "./constants.js";
|
|
2
2
|
import "../../../utils/yupConfig.js";
|
|
3
3
|
import { COMMON_PARAMETERS, SPECIFIC_PARAMETERS } from "../common/constants.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
@@ -41,6 +41,12 @@ import "react-querybuilder";
|
|
|
41
41
|
import "../common/widget/parameter-line-slider.js";
|
|
42
42
|
import "../common/limitreductions/columns-definitions.js";
|
|
43
43
|
import { getSpecificParametersFormSchema, getDefaultSpecificParamsValues, getAllSpecificParametersValues, formatSpecificParameters } from "../common/utils.js";
|
|
44
|
+
var ShortCircuitParametersTabValues = /* @__PURE__ */ ((ShortCircuitParametersTabValues2) => {
|
|
45
|
+
ShortCircuitParametersTabValues2["GENERAL"] = "General";
|
|
46
|
+
ShortCircuitParametersTabValues2["STUDY_AREA"] = "StudyArea";
|
|
47
|
+
ShortCircuitParametersTabValues2["POWER_ELECTRONICS"] = "PowerElectronics";
|
|
48
|
+
return ShortCircuitParametersTabValues2;
|
|
49
|
+
})(ShortCircuitParametersTabValues || {});
|
|
44
50
|
const getCommonShortCircuitParametersFormSchema = () => {
|
|
45
51
|
return yup.object().shape({
|
|
46
52
|
[COMMON_PARAMETERS]: yup.object().shape({
|
|
@@ -68,6 +74,15 @@ const getSpecificShortCircuitParametersFormSchema = (specificParametersDescripti
|
|
|
68
74
|
type: yup.string().oneOf(["WIND", "SOLAR", "HVDC"]).required()
|
|
69
75
|
})
|
|
70
76
|
).required() : void 0;
|
|
77
|
+
const nodeClusterParam = specificParametersDescriptionForProvider?.find(
|
|
78
|
+
(specificParam) => specificParam.name === NODE_CLUSTER
|
|
79
|
+
);
|
|
80
|
+
const nodeClusterSchema = nodeClusterParam ? yup.array().of(
|
|
81
|
+
yup.object().shape({
|
|
82
|
+
[ID]: yup.string().required(),
|
|
83
|
+
[NAME]: yup.string().required()
|
|
84
|
+
})
|
|
85
|
+
) : void 0;
|
|
71
86
|
const powerElectronicsClustersParam = specificParametersDescriptionForProvider?.find(
|
|
72
87
|
(specificParam) => specificParam.name === SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS
|
|
73
88
|
);
|
|
@@ -92,7 +107,8 @@ const getSpecificShortCircuitParametersFormSchema = (specificParametersDescripti
|
|
|
92
107
|
const mergedSpecificShape = {
|
|
93
108
|
...existingSpecificFields,
|
|
94
109
|
...powerElectronicsMaterialsSchema ? { [SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS]: powerElectronicsMaterialsSchema } : {},
|
|
95
|
-
...powerElectronicsClustersSchema ? { [SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS]: powerElectronicsClustersSchema } : {}
|
|
110
|
+
...powerElectronicsClustersSchema ? { [SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS]: powerElectronicsClustersSchema } : {},
|
|
111
|
+
...nodeClusterSchema ? { [NODE_CLUSTER_FILTER_IDS]: nodeClusterSchema } : {}
|
|
96
112
|
};
|
|
97
113
|
const overrideSchema = yup.object().shape({
|
|
98
114
|
[SPECIFIC_PARAMETERS]: yup.object().shape(mergedSpecificShape)
|
|
@@ -133,6 +149,12 @@ const getDefaultShortCircuitSpecificParamsValues = (specificParametersDescriptio
|
|
|
133
149
|
active: false
|
|
134
150
|
}));
|
|
135
151
|
}
|
|
152
|
+
const nodeClusterParam = specificParametersDescriptionForProvider.find(
|
|
153
|
+
(specificParam) => specificParam.name === NODE_CLUSTER
|
|
154
|
+
);
|
|
155
|
+
if (nodeClusterParam) {
|
|
156
|
+
defaultValues[NODE_CLUSTER_FILTER_IDS] = nodeClusterParam.defaultValue;
|
|
157
|
+
}
|
|
136
158
|
const powerElectronicsClustersParam = specificParametersDescriptionForProvider.find(
|
|
137
159
|
(specificParam) => specificParam.name === SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS
|
|
138
160
|
);
|
|
@@ -144,31 +166,42 @@ const getDefaultShortCircuitSpecificParamsValues = (specificParametersDescriptio
|
|
|
144
166
|
const getShortCircuitSpecificParametersValues = (formData, _specificParametersValues) => {
|
|
145
167
|
const powerElectronicsMaterialsParam = formData[SPECIFIC_PARAMETERS][SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS];
|
|
146
168
|
const powerElectronicsClustersParam = formData[SPECIFIC_PARAMETERS][SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS];
|
|
169
|
+
const nodeClusterFilterIds = formData[SPECIFIC_PARAMETERS][NODE_CLUSTER_FILTER_IDS];
|
|
170
|
+
const finalSpecificParameters = getAllSpecificParametersValues(
|
|
171
|
+
formData,
|
|
172
|
+
_specificParametersValues
|
|
173
|
+
);
|
|
147
174
|
if (powerElectronicsMaterialsParam && powerElectronicsClustersParam) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})
|
|
168
|
-
)
|
|
169
|
-
};
|
|
175
|
+
finalSpecificParameters[SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS] = JSON.stringify(
|
|
176
|
+
powerElectronicsMaterialsParam.filter((sParam) => sParam.active).map((sParam) => {
|
|
177
|
+
const { active, ...rest } = sParam;
|
|
178
|
+
return rest;
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
finalSpecificParameters[SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS] = JSON.stringify(
|
|
182
|
+
powerElectronicsClustersParam.map((sParam) => {
|
|
183
|
+
const { filters, ...rest } = sParam;
|
|
184
|
+
const lightFilters = (
|
|
185
|
+
// keep only id and name in filters for backend
|
|
186
|
+
filters?.map((filter) => ({
|
|
187
|
+
filterId: filter[ID],
|
|
188
|
+
filterName: filter.name
|
|
189
|
+
})) ?? []
|
|
190
|
+
);
|
|
191
|
+
return { ...rest, filters: lightFilters };
|
|
192
|
+
})
|
|
193
|
+
);
|
|
170
194
|
}
|
|
171
|
-
|
|
195
|
+
if (nodeClusterFilterIds) {
|
|
196
|
+
const lightFilters = nodeClusterFilterIds.map((filter) => {
|
|
197
|
+
return {
|
|
198
|
+
filterId: filter[ID],
|
|
199
|
+
filterName: filter.name
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
finalSpecificParameters[NODE_CLUSTER_FILTER_IDS] = JSON.stringify(lightFilters);
|
|
203
|
+
}
|
|
204
|
+
return finalSpecificParameters;
|
|
172
205
|
};
|
|
173
206
|
const formatElectronicsMaterialsParamString = (defaultValues, specificParamValue, snackError) => {
|
|
174
207
|
const electronicsMaterialsArrayInParams = parsePowerElectronicsMaterialsParamString(
|
|
@@ -229,9 +262,23 @@ const formatShortCircuitSpecificParameters = (specificParametersDescriptionForPr
|
|
|
229
262
|
])?.[SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS];
|
|
230
263
|
}
|
|
231
264
|
}
|
|
265
|
+
const nodeClusterParam = specificParametersDescriptionForProvider.find((p) => p.name === NODE_CLUSTER);
|
|
266
|
+
if (nodeClusterParam) {
|
|
267
|
+
if (Object.hasOwn(specificParamsList, NODE_CLUSTER_FILTER_IDS)) {
|
|
268
|
+
const filters = JSON.parse(specificParamsList[NODE_CLUSTER_FILTER_IDS]);
|
|
269
|
+
formatted[NODE_CLUSTER_FILTER_IDS] = filters.map((filter) => ({
|
|
270
|
+
[ID]: filter.filterId,
|
|
271
|
+
[NAME]: filter.filterName
|
|
272
|
+
// from back to front -> {id: uuid, name: string}
|
|
273
|
+
}));
|
|
274
|
+
} else {
|
|
275
|
+
formatted[NODE_CLUSTER_FILTER_IDS] = getDefaultSpecificParamsValues([nodeClusterParam])?.[NODE_CLUSTER_FILTER_IDS];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
232
278
|
return formatted;
|
|
233
279
|
};
|
|
234
280
|
export {
|
|
281
|
+
ShortCircuitParametersTabValues,
|
|
235
282
|
formatShortCircuitSpecificParameters,
|
|
236
283
|
getCommonShortCircuitParametersFormSchema,
|
|
237
284
|
getDefaultShortCircuitSpecificParamsValues,
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Grid } from "@mui/material";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { ShortCircuitIccMaterialTable } from "./short-circuit-icc-material-table.js";
|
|
6
|
+
import { SPECIFIC_PARAMETERS } from "../common/constants.js";
|
|
7
|
+
import { TabPanel } from "../common/parameters.js";
|
|
8
|
+
import "../../../utils/conversionUtils.js";
|
|
9
|
+
import "../../../utils/types/equipmentType.js";
|
|
10
|
+
import "@mui/icons-material";
|
|
11
|
+
import "../../../utils/yupConfig.js";
|
|
12
|
+
import "localized-countries";
|
|
13
|
+
import "localized-countries/data/fr";
|
|
14
|
+
import "localized-countries/data/en";
|
|
15
|
+
import "notistack";
|
|
16
|
+
import "react-hook-form";
|
|
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 { FieldLabel } from "../../inputs/reactHookForm/utils/FieldLabel.js";
|
|
22
|
+
import "../../overflowableText/OverflowableText.js";
|
|
23
|
+
import "yup";
|
|
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 { SwitchInput } from "../../inputs/reactHookForm/booleans/SwitchInput.js";
|
|
30
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
32
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
34
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
35
|
+
import "@react-querybuilder/material";
|
|
36
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
37
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
38
|
+
import "uuid";
|
|
39
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
40
|
+
import "react-querybuilder";
|
|
41
|
+
import "../common/widget/parameter-line-slider.js";
|
|
42
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
43
|
+
import GridSection from "../../grid/grid-section.js";
|
|
44
|
+
import GridItem from "../../grid/grid-item.js";
|
|
45
|
+
import { SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS, SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS, SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS } from "./constants.js";
|
|
46
|
+
import { ShortCircuitIccClusterTable } from "./short-circuit-icc-cluster-table.js";
|
|
47
|
+
import { COLUMNS_DEFINITIONS_ICC_MATERIALS, COLUMNS_DEFINITIONS_ICC_CLUSTERS } from "./columns-definition.js";
|
|
48
|
+
import { ShortCircuitParametersTabValues } from "./short-circuit-parameters-utils.js";
|
|
49
|
+
const iccMaterialsColumnsDef = COLUMNS_DEFINITIONS_ICC_MATERIALS.map((col) => ({
|
|
50
|
+
...col,
|
|
51
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: col.label }),
|
|
52
|
+
tooltip: /* @__PURE__ */ jsx(FormattedMessage, { id: col.tooltip })
|
|
53
|
+
}));
|
|
54
|
+
const iccClustersColumnsDef = COLUMNS_DEFINITIONS_ICC_CLUSTERS.map((col) => ({
|
|
55
|
+
...col,
|
|
56
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: col.label }),
|
|
57
|
+
tooltip: /* @__PURE__ */ jsx(FormattedMessage, { id: col.tooltip })
|
|
58
|
+
}));
|
|
59
|
+
function createRows() {
|
|
60
|
+
const rowData = {};
|
|
61
|
+
iccClustersColumnsDef.forEach((column) => {
|
|
62
|
+
rowData[column.dataKey] = column.initialValue;
|
|
63
|
+
});
|
|
64
|
+
return rowData;
|
|
65
|
+
}
|
|
66
|
+
const ShortCircuitPowerElectronicsTabPanel = forwardRef(
|
|
67
|
+
({ ...othersTabPanelProps }, ref) => {
|
|
68
|
+
const modelPowerElectronics = /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", spacing: 2, direction: "row", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 10, children: /* @__PURE__ */ jsx(FieldLabel, { label: "ShortCircuitModelPowerElectronics" }) }),
|
|
70
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 2, children: /* @__PURE__ */ jsx(SwitchInput, { name: `${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS}` }) })
|
|
71
|
+
] });
|
|
72
|
+
return /* @__PURE__ */ jsxs(TabPanel, { index: ShortCircuitParametersTabValues.POWER_ELECTRONICS, ref, ...othersTabPanelProps, children: [
|
|
73
|
+
/* @__PURE__ */ jsx(GridSection, { title: "ShortCircuitPowerElectronicsSection", heading: 4 }),
|
|
74
|
+
/* @__PURE__ */ jsx(Grid, { container: true, xl: 6, children: /* @__PURE__ */ jsx(GridItem, { size: 10, children: modelPowerElectronics }) }),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
ShortCircuitIccMaterialTable,
|
|
77
|
+
{
|
|
78
|
+
formName: `${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS}`,
|
|
79
|
+
columnsDefinition: iccMaterialsColumnsDef
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
ShortCircuitIccClusterTable,
|
|
84
|
+
{
|
|
85
|
+
formName: `${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS}`,
|
|
86
|
+
columnsDefinition: iccClustersColumnsDef,
|
|
87
|
+
createRows
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
export {
|
|
94
|
+
ShortCircuitPowerElectronicsTabPanel
|
|
95
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Grid, Box } from "@mui/material";
|
|
4
|
+
import { useFormContext } from "react-hook-form";
|
|
5
|
+
import { SPECIFIC_PARAMETERS } from "../common/constants.js";
|
|
6
|
+
import { TabPanel } from "../common/parameters.js";
|
|
7
|
+
import "react-intl";
|
|
8
|
+
import { ActivePowerAdornment } from "../../../utils/constants/adornments.js";
|
|
9
|
+
import "../../../utils/conversionUtils.js";
|
|
10
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
11
|
+
import { EquipmentType } from "../../../utils/types/equipmentType.js";
|
|
12
|
+
import "@mui/icons-material";
|
|
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 "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
19
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
20
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
21
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
22
|
+
import { FieldLabel } from "../../inputs/reactHookForm/utils/FieldLabel.js";
|
|
23
|
+
import "../../overflowableText/OverflowableText.js";
|
|
24
|
+
import { OverflowableChipWithHelperText } from "../../inputs/reactHookForm/OverflowableChipWithHelperText.js";
|
|
25
|
+
import "yup";
|
|
26
|
+
import { DirectoryItemsInput } from "../../inputs/reactHookForm/DirectoryItemsInput.js";
|
|
27
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
28
|
+
import "../../customAGGrid/customAggrid.js";
|
|
29
|
+
import "ag-grid-community";
|
|
30
|
+
import "react-papaparse";
|
|
31
|
+
import "react-csv-downloader";
|
|
32
|
+
import { RadioInput } from "../../inputs/reactHookForm/booleans/RadioInput.js";
|
|
33
|
+
import { FloatInput } from "../../inputs/reactHookForm/numbers/FloatInput.js";
|
|
34
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
35
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
36
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
37
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
38
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
39
|
+
import "@react-querybuilder/material";
|
|
40
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
41
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
42
|
+
import "uuid";
|
|
43
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
44
|
+
import "react-querybuilder";
|
|
45
|
+
import "../common/widget/parameter-line-slider.js";
|
|
46
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
47
|
+
import GridSection from "../../grid/grid-section.js";
|
|
48
|
+
import GridItem from "../../grid/grid-item.js";
|
|
49
|
+
import { NODE_CLUSTER_FILTER_IDS, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER, onlyStartedGeneratorsOptions, STARTED_GENERATORS_IN_CALCULATION_CLUSTER_THRESHOLD, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_OUTSIDE_CALCULATION_CLUSTER, STARTED_GENERATORS_OUTSIDE_CALCULATION_CLUSTER_THRESHOLD } from "./constants.js";
|
|
50
|
+
import { ShortCircuitParametersTabValues } from "./short-circuit-parameters-utils.js";
|
|
51
|
+
const equipmentTypes = [EquipmentType.VOLTAGE_LEVEL];
|
|
52
|
+
const styles = {
|
|
53
|
+
h4: {
|
|
54
|
+
marginBottom: 1
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const ShortCircuitStudyAreaTabPanel = forwardRef(
|
|
58
|
+
({ ...othersTabPanelProps }, ref) => {
|
|
59
|
+
const { setValue } = useFormContext();
|
|
60
|
+
const startedGeneratorsInCalculationClusterThreshold = /* @__PURE__ */ jsx(
|
|
61
|
+
FloatInput,
|
|
62
|
+
{
|
|
63
|
+
name: `${SPECIFIC_PARAMETERS}.${STARTED_GENERATORS_IN_CALCULATION_CLUSTER_THRESHOLD}`,
|
|
64
|
+
label: "startedGeneratorsInCalculationClusterThreshold",
|
|
65
|
+
adornment: ActivePowerAdornment
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
const inClusterOnlyStartedGenerators = /* @__PURE__ */ jsx(
|
|
69
|
+
RadioInput,
|
|
70
|
+
{
|
|
71
|
+
name: `${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER}`,
|
|
72
|
+
options: Object.values(onlyStartedGeneratorsOptions),
|
|
73
|
+
formProps: {
|
|
74
|
+
onChange: (_event, value) => {
|
|
75
|
+
setValue(
|
|
76
|
+
`${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER}`,
|
|
77
|
+
value === "true",
|
|
78
|
+
{
|
|
79
|
+
shouldDirty: true
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
const startedGeneratorsOutsideCalculationClusterThreshold = /* @__PURE__ */ jsx(
|
|
87
|
+
FloatInput,
|
|
88
|
+
{
|
|
89
|
+
name: `${SPECIFIC_PARAMETERS}.${STARTED_GENERATORS_OUTSIDE_CALCULATION_CLUSTER_THRESHOLD}`,
|
|
90
|
+
label: "startedGeneratorsOutsideCalculationClusterThreshold",
|
|
91
|
+
adornment: ActivePowerAdornment
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
const outClusterOnlyStartedGenerators = /* @__PURE__ */ jsx(
|
|
95
|
+
RadioInput,
|
|
96
|
+
{
|
|
97
|
+
name: `${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_OUTSIDE_CALCULATION_CLUSTER}`,
|
|
98
|
+
options: Object.values(onlyStartedGeneratorsOptions),
|
|
99
|
+
formProps: {
|
|
100
|
+
onChange: (_event, value) => {
|
|
101
|
+
setValue(
|
|
102
|
+
`${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_OUTSIDE_CALCULATION_CLUSTER}`,
|
|
103
|
+
value === "true",
|
|
104
|
+
{
|
|
105
|
+
shouldDirty: true
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
return /* @__PURE__ */ jsxs(TabPanel, { index: ShortCircuitParametersTabValues.STUDY_AREA, ref, ...othersTabPanelProps, children: [
|
|
113
|
+
/* @__PURE__ */ jsx(GridSection, { title: "ShortCircuitInClusterFilter", heading: 4 }),
|
|
114
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: true, sx: { paddingBottom: 4 }, children: /* @__PURE__ */ jsx(
|
|
115
|
+
DirectoryItemsInput,
|
|
116
|
+
{
|
|
117
|
+
titleId: "FiltersListsSelection",
|
|
118
|
+
label: "Filters",
|
|
119
|
+
name: `${SPECIFIC_PARAMETERS}.${NODE_CLUSTER_FILTER_IDS}`,
|
|
120
|
+
elementType: ElementType.FILTER,
|
|
121
|
+
equipmentTypes,
|
|
122
|
+
ChipComponent: OverflowableChipWithHelperText,
|
|
123
|
+
chipProps: { variant: "outlined" },
|
|
124
|
+
fullHeight: true
|
|
125
|
+
}
|
|
126
|
+
) }),
|
|
127
|
+
/* @__PURE__ */ jsx(GridSection, { title: "ShortCircuitStartedGeneratorsMode", heading: 4, customStyle: styles.h4 }),
|
|
128
|
+
/* @__PURE__ */ jsxs(Box, { sx: { paddingTop: 2, display: "flex", alignItems: "center" }, children: [
|
|
129
|
+
/* @__PURE__ */ jsx(GridItem, { size: 2, children: /* @__PURE__ */ jsx(FieldLabel, { label: "ShortCircuitInCluster" }) }),
|
|
130
|
+
/* @__PURE__ */ jsx(GridItem, { size: 3, children: inClusterOnlyStartedGenerators }),
|
|
131
|
+
/* @__PURE__ */ jsx(GridItem, { size: 2, children: startedGeneratorsInCalculationClusterThreshold })
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ jsxs(Box, { sx: { paddingTop: 2, display: "flex", alignItems: "center" }, children: [
|
|
134
|
+
/* @__PURE__ */ jsx(GridItem, { size: 2, children: /* @__PURE__ */ jsx(FieldLabel, { label: "ShortCircuitOutCluster" }) }),
|
|
135
|
+
/* @__PURE__ */ jsx(GridItem, { size: 3, children: outClusterOnlyStartedGenerators }),
|
|
136
|
+
/* @__PURE__ */ jsx(GridItem, { size: 2, children: startedGeneratorsOutsideCalculationClusterThreshold })
|
|
137
|
+
] })
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
export {
|
|
142
|
+
ShortCircuitStudyAreaTabPanel
|
|
143
|
+
};
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { FieldErrors, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
2
3
|
import { ObjectSchema } from 'yup';
|
|
3
4
|
import { UUID } from 'node:crypto';
|
|
4
5
|
import { PredefinedParameters } from './constants';
|
|
5
6
|
import { SpecificParameterInfos, UseParametersBackendReturnProps } from '../../../utils';
|
|
6
7
|
import { ShortCircuitParametersInfos } from './short-circuit-parameters.type';
|
|
7
8
|
import { ComputingType } from '../common';
|
|
9
|
+
import { ShortCircuitParametersTabValues } from './short-circuit-parameters-utils';
|
|
8
10
|
export interface UseShortCircuitParametersFormReturn {
|
|
9
11
|
formMethods: UseFormReturn;
|
|
10
12
|
formSchema: ObjectSchema<any>;
|
|
13
|
+
selectedTab: ShortCircuitParametersTabValues;
|
|
14
|
+
handleTabChange: (event: SyntheticEvent, newValue: ShortCircuitParametersTabValues) => void;
|
|
15
|
+
tabIndexesWithError: ShortCircuitParametersTabValues[];
|
|
11
16
|
resetAll: (predefinedParameter: PredefinedParameters) => void;
|
|
12
17
|
specificParametersDescriptionForProvider: SpecificParameterInfos[];
|
|
13
18
|
toShortCircuitFormValues: (_params: ShortCircuitParametersInfos) => any;
|