@gridsuite/commons-ui 0.106.1 → 0.107.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/grid/grid-item.d.ts +8 -0
- package/dist/components/grid/grid-item.js +8 -0
- package/dist/components/grid/grid-section.d.ts +8 -0
- package/dist/components/grid/grid-section.js +9 -0
- package/dist/components/grid/index.d.ts +8 -0
- package/dist/components/grid/index.js +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +19 -0
- package/dist/components/parameters/common/index.d.ts +1 -0
- package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +14 -0
- package/dist/components/parameters/common/parameters-edition-dialog-props.js +1 -0
- package/dist/components/parameters/index.d.ts +1 -0
- package/dist/components/parameters/index.js +16 -0
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.d.ts +1 -14
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +0 -3
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +0 -35
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -2
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +4 -4
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.d.ts +2 -14
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +7 -1
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +7 -1
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.d.ts +16 -2
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +15 -6
- package/dist/components/parameters/short-circuit/constants.d.ts +37 -0
- package/dist/components/parameters/short-circuit/constants.js +58 -0
- package/dist/components/parameters/short-circuit/index.d.ts +10 -0
- package/dist/components/parameters/short-circuit/index.js +18 -0
- package/dist/components/parameters/short-circuit/short-circuit-fields.d.ts +9 -0
- package/dist/components/parameters/short-circuit/short-circuit-fields.js +169 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.d.ts +2 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +91 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.d.ts +9 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +69 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.d.ts +8 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +147 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters.type.d.ts +38 -0
- package/dist/components/parameters/short-circuit/short-circuit-parameters.type.js +1 -0
- package/dist/components/parameters/short-circuit/short-circuit-voltage-table.d.ts +5 -0
- package/dist/components/parameters/short-circuit/short-circuit-voltage-table.js +38 -0
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.d.ts +29 -0
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +222 -0
- package/dist/index.js +23 -1
- package/dist/services/index.js +4 -1
- package/dist/services/short-circuit-analysis.d.ts +2 -0
- package/dist/services/short-circuit-analysis.js +13 -0
- package/dist/services/study.d.ts +4 -0
- package/dist/services/study.js +25 -1
- package/dist/translations/en/parameters.d.ts +28 -0
- package/dist/translations/en/parameters.js +29 -1
- package/dist/translations/fr/parameters.d.ts +28 -0
- package/dist/translations/fr/parameters.js +29 -1
- package/package.json +1 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { Grid } from "@mui/material";
|
|
4
|
+
import { red, green } from "@mui/material/colors";
|
|
5
|
+
import { Lens } from "@mui/icons-material";
|
|
6
|
+
import { useWatch } from "react-hook-form";
|
|
7
|
+
import { SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, intlPredefinedParametersOptions, intlInitialVoltageProfileMode, PredefinedParameters, InitialVoltage, SHORT_CIRCUIT_WITH_FEEDER_RESULT } from "./constants.js";
|
|
8
|
+
import { VoltageTable } from "./short-circuit-voltage-table.js";
|
|
9
|
+
import GridItem from "../../grid/grid-item.js";
|
|
10
|
+
import GridSection from "../../grid/grid-section.js";
|
|
11
|
+
import "react-intl";
|
|
12
|
+
import { FieldLabel } from "../../inputs/reactHookForm/utils/FieldLabel.js";
|
|
13
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
14
|
+
import "yup";
|
|
15
|
+
import "notistack";
|
|
16
|
+
import "../../overflowableText/OverflowableText.js";
|
|
17
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
18
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
19
|
+
import "../../customAGGrid/customAggrid.js";
|
|
20
|
+
import "ag-grid-community";
|
|
21
|
+
import "react-papaparse";
|
|
22
|
+
import "react-csv-downloader";
|
|
23
|
+
import { CheckboxInput } from "../../inputs/reactHookForm/booleans/CheckboxInput.js";
|
|
24
|
+
import { RadioInput } from "../../inputs/reactHookForm/booleans/RadioInput.js";
|
|
25
|
+
import { SwitchInput } from "../../inputs/reactHookForm/booleans/SwitchInput.js";
|
|
26
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
27
|
+
import "localized-countries";
|
|
28
|
+
import "localized-countries/data/fr";
|
|
29
|
+
import "localized-countries/data/en";
|
|
30
|
+
import { MuiSelectInput } from "../../inputs/reactHookForm/selectInputs/MuiSelectInput.js";
|
|
31
|
+
import "../../../utils/conversionUtils.js";
|
|
32
|
+
import "../../../utils/types/equipmentType.js";
|
|
33
|
+
import "../../../utils/yupConfig.js";
|
|
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
|
+
var Status = /* @__PURE__ */ ((Status2) => {
|
|
41
|
+
Status2["SUCCESS"] = "SUCCESS";
|
|
42
|
+
Status2["ERROR"] = "ERROR";
|
|
43
|
+
return Status2;
|
|
44
|
+
})(Status || {});
|
|
45
|
+
function ShortCircuitFields({ resetAll }) {
|
|
46
|
+
const [status, setStatus] = useState(
|
|
47
|
+
"SUCCESS"
|
|
48
|
+
/* SUCCESS */
|
|
49
|
+
);
|
|
50
|
+
const watchInitialVoltageProfileMode = useWatch({
|
|
51
|
+
name: SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE
|
|
52
|
+
});
|
|
53
|
+
const watchPredefinedParams = useWatch({
|
|
54
|
+
name: SHORT_CIRCUIT_PREDEFINED_PARAMS
|
|
55
|
+
});
|
|
56
|
+
const watchLoads = useWatch({
|
|
57
|
+
name: SHORT_CIRCUIT_WITH_LOADS
|
|
58
|
+
});
|
|
59
|
+
const watchShuntCompensators = useWatch({
|
|
60
|
+
name: SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS
|
|
61
|
+
});
|
|
62
|
+
const watchVSC = useWatch({
|
|
63
|
+
name: SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS
|
|
64
|
+
});
|
|
65
|
+
const watchNeutralPosition = useWatch({
|
|
66
|
+
name: SHORT_CIRCUIT_WITH_NEUTRAL_POSITION
|
|
67
|
+
});
|
|
68
|
+
const isIccMinFeaturesDefaultConfiguration = useMemo(() => {
|
|
69
|
+
return !watchLoads && !watchShuntCompensators && !watchVSC && !watchNeutralPosition;
|
|
70
|
+
}, [watchLoads, watchShuntCompensators, watchVSC, watchNeutralPosition]);
|
|
71
|
+
const isIccMaxFeaturesDefaultConfiguration = useMemo(() => {
|
|
72
|
+
return !watchLoads && !watchShuntCompensators && watchVSC && !watchNeutralPosition;
|
|
73
|
+
}, [watchLoads, watchShuntCompensators, watchVSC, watchNeutralPosition]);
|
|
74
|
+
const predefinedParamsOptions = useMemo(() => {
|
|
75
|
+
return intlPredefinedParametersOptions();
|
|
76
|
+
}, []);
|
|
77
|
+
const initialVoltageProfileMode = useMemo(() => {
|
|
78
|
+
return intlInitialVoltageProfileMode();
|
|
79
|
+
}, []);
|
|
80
|
+
const getStatus = (state, styles) => {
|
|
81
|
+
const color = state === "SUCCESS" ? styles.succeed : styles.fail;
|
|
82
|
+
return /* @__PURE__ */ jsx(Lens, { fontSize: "medium", sx: color });
|
|
83
|
+
};
|
|
84
|
+
const statusToShow = useMemo(() => {
|
|
85
|
+
const styles = {
|
|
86
|
+
succeed: {
|
|
87
|
+
color: green[500]
|
|
88
|
+
},
|
|
89
|
+
fail: {
|
|
90
|
+
color: red[500]
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return getStatus(status, styles);
|
|
94
|
+
}, [status]);
|
|
95
|
+
const onPredefinedParametersManualChange = (event) => {
|
|
96
|
+
const newPredefinedParameters = event.target.value;
|
|
97
|
+
console.debug("onPredefinedParametersManualChange new:", newPredefinedParameters);
|
|
98
|
+
resetAll(newPredefinedParameters);
|
|
99
|
+
};
|
|
100
|
+
const feederResult = /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", spacing: 2, direction: "row", children: [
|
|
101
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 10, children: /* @__PURE__ */ jsx(FieldLabel, { label: "descWithFeederResult" }) }),
|
|
102
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 2, children: /* @__PURE__ */ jsx(SwitchInput, { name: SHORT_CIRCUIT_WITH_FEEDER_RESULT }) })
|
|
103
|
+
] });
|
|
104
|
+
const predefinedParameters = /* @__PURE__ */ jsx(
|
|
105
|
+
MuiSelectInput,
|
|
106
|
+
{
|
|
107
|
+
name: SHORT_CIRCUIT_PREDEFINED_PARAMS,
|
|
108
|
+
options: predefinedParamsOptions,
|
|
109
|
+
onChange: onPredefinedParametersManualChange,
|
|
110
|
+
fullWidth: true
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
const initialVoltageProfileModeField = /* @__PURE__ */ jsx(
|
|
114
|
+
RadioInput,
|
|
115
|
+
{
|
|
116
|
+
name: SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
|
|
117
|
+
options: Object.values(initialVoltageProfileMode)
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
const loads = /* @__PURE__ */ jsx(CheckboxInput, { name: SHORT_CIRCUIT_WITH_LOADS, label: "shortCircuitLoads" });
|
|
121
|
+
const vsc = /* @__PURE__ */ jsx(CheckboxInput, { name: SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, label: "shortCircuitHvdc" });
|
|
122
|
+
const shuntCompensators = /* @__PURE__ */ jsx(CheckboxInput, { name: SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, label: "shortCircuitShuntCompensators" });
|
|
123
|
+
const neutralPosition = /* @__PURE__ */ jsx(CheckboxInput, { name: SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, label: "shortCircuitNeutralPosition" });
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const isIccMaxWithNominalVoltageMap = watchPredefinedParams === PredefinedParameters.ICC_MAX_WITH_NOMINAL_VOLTAGE_MAP;
|
|
126
|
+
const isIccMinWithNominal = watchPredefinedParams === PredefinedParameters.ICC_MIN_WITH_NOMINAL_VOLTAGE_MAP;
|
|
127
|
+
const isInitialVoltageNominal = watchInitialVoltageProfileMode === InitialVoltage.NOMINAL;
|
|
128
|
+
const isIccMaxNominalDefaultConfiguration = isIccMaxWithNominalVoltageMap && isInitialVoltageNominal;
|
|
129
|
+
const isIccMinNominalDefaultConfiguration = isIccMinWithNominal && isInitialVoltageNominal;
|
|
130
|
+
const isCEI909DefaultConfiguration = watchPredefinedParams === PredefinedParameters.ICC_MAX_WITH_CEI909 && watchInitialVoltageProfileMode === InitialVoltage.CEI909;
|
|
131
|
+
const isIccMaxDefaultConfiguration = (isIccMaxNominalDefaultConfiguration || isCEI909DefaultConfiguration) && isIccMaxFeaturesDefaultConfiguration;
|
|
132
|
+
const isIccMinDefaultConfiguration = isIccMinNominalDefaultConfiguration && isIccMinFeaturesDefaultConfiguration;
|
|
133
|
+
setStatus(
|
|
134
|
+
isIccMaxDefaultConfiguration || isIccMinDefaultConfiguration ? "SUCCESS" : "ERROR"
|
|
135
|
+
/* ERROR */
|
|
136
|
+
);
|
|
137
|
+
}, [
|
|
138
|
+
watchInitialVoltageProfileMode,
|
|
139
|
+
watchPredefinedParams,
|
|
140
|
+
isIccMaxFeaturesDefaultConfiguration,
|
|
141
|
+
isIccMinFeaturesDefaultConfiguration
|
|
142
|
+
]);
|
|
143
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, paddingLeft: 2, children: [
|
|
144
|
+
/* @__PURE__ */ jsx(Grid, { container: true, paddingTop: 2, xl: 6, children: /* @__PURE__ */ jsx(GridItem, { size: 10, children: feederResult }) }),
|
|
145
|
+
/* @__PURE__ */ jsx(GridSection, { title: "ShortCircuitPredefinedParameters", heading: 4 }),
|
|
146
|
+
/* @__PURE__ */ jsxs(Grid, { xl: 6, container: true, spacing: 1, alignItems: "center", children: [
|
|
147
|
+
/* @__PURE__ */ jsx(GridItem, { size: 9, children: predefinedParameters }),
|
|
148
|
+
/* @__PURE__ */ jsx(GridItem, { size: 2, children: statusToShow })
|
|
149
|
+
] }),
|
|
150
|
+
/* @__PURE__ */ jsx(GridSection, { title: "ShortCircuitCharacteristics", heading: 4 }),
|
|
151
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
|
|
152
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, children: [
|
|
153
|
+
/* @__PURE__ */ jsx(GridItem, { children: loads }),
|
|
154
|
+
/* @__PURE__ */ jsx(GridItem, { children: shuntCompensators })
|
|
155
|
+
] }),
|
|
156
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 8, children: [
|
|
157
|
+
/* @__PURE__ */ jsx(GridItem, { children: vsc }),
|
|
158
|
+
/* @__PURE__ */ jsx(GridItem, { children: neutralPosition })
|
|
159
|
+
] })
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ jsx(GridSection, { title: "ShortCircuitVoltageProfileMode", heading: 4 }),
|
|
162
|
+
/* @__PURE__ */ jsx(Grid, { container: true, children: /* @__PURE__ */ jsx(GridItem, { size: 12, children: initialVoltageProfileModeField }) }),
|
|
163
|
+
/* @__PURE__ */ jsx(VoltageTable, { voltageProfileMode: watchInitialVoltageProfileMode })
|
|
164
|
+
] });
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
ShortCircuitFields,
|
|
168
|
+
Status
|
|
169
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ParametersEditionDialogProps } from '../common';
|
|
2
|
+
export declare function ShortCircuitParametersEditionDialog({ id, open, onClose, titleId, name, description, activeDirectory, language, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CustomMuiDialog } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
3
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
4
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "@mui/material";
|
|
7
|
+
import "react-intl";
|
|
8
|
+
import "react-hook-form";
|
|
9
|
+
import "@mui/icons-material";
|
|
10
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
11
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
12
|
+
import "notistack";
|
|
13
|
+
import "../../../utils/conversionUtils.js";
|
|
14
|
+
import "../../../utils/types/equipmentType.js";
|
|
15
|
+
import "../../../utils/yupConfig.js";
|
|
16
|
+
import { NameElementEditorForm } from "../common/name-element-editor/name-element-editor-form.js";
|
|
17
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
18
|
+
import "yup";
|
|
19
|
+
import "../../overflowableText/OverflowableText.js";
|
|
20
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
21
|
+
import "../../customAGGrid/customAggrid.js";
|
|
22
|
+
import "ag-grid-community";
|
|
23
|
+
import "react-papaparse";
|
|
24
|
+
import "react-csv-downloader";
|
|
25
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
26
|
+
import "localized-countries";
|
|
27
|
+
import "localized-countries/data/fr";
|
|
28
|
+
import "localized-countries/data/en";
|
|
29
|
+
import "@react-querybuilder/material";
|
|
30
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
31
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
32
|
+
import "uuid";
|
|
33
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
34
|
+
import "react-querybuilder";
|
|
35
|
+
import { useShortCircuitParametersForm } from "./use-short-circuit-parameters-form.js";
|
|
36
|
+
import { ShortCircuitParametersForm } from "./short-circuit-parameters-form.js";
|
|
37
|
+
function ShortCircuitParametersEditionDialog({
|
|
38
|
+
id,
|
|
39
|
+
open,
|
|
40
|
+
onClose,
|
|
41
|
+
titleId,
|
|
42
|
+
name,
|
|
43
|
+
description,
|
|
44
|
+
activeDirectory,
|
|
45
|
+
language
|
|
46
|
+
}) {
|
|
47
|
+
const shortCircuitMethods = useShortCircuitParametersForm({
|
|
48
|
+
parametersUuid: id,
|
|
49
|
+
name,
|
|
50
|
+
description,
|
|
51
|
+
studyUuid: null,
|
|
52
|
+
studyShortCircuitParameters: null
|
|
53
|
+
});
|
|
54
|
+
const {
|
|
55
|
+
formState: { errors, dirtyFields }
|
|
56
|
+
} = shortCircuitMethods.formMethods;
|
|
57
|
+
const disableSave = Object.keys(errors).length > 0 || Object.keys(dirtyFields).length === 0;
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
CustomMuiDialog,
|
|
60
|
+
{
|
|
61
|
+
open,
|
|
62
|
+
onClose,
|
|
63
|
+
onSave: shortCircuitMethods.onSaveDialog,
|
|
64
|
+
formSchema: shortCircuitMethods.formSchema,
|
|
65
|
+
formMethods: shortCircuitMethods.formMethods,
|
|
66
|
+
titleId,
|
|
67
|
+
removeOptional: true,
|
|
68
|
+
language,
|
|
69
|
+
disabledSave: disableSave,
|
|
70
|
+
children: /* @__PURE__ */ jsx(
|
|
71
|
+
ShortCircuitParametersForm,
|
|
72
|
+
{
|
|
73
|
+
shortCircuitMethods,
|
|
74
|
+
renderTitleFields: () => {
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
NameElementEditorForm,
|
|
77
|
+
{
|
|
78
|
+
initialElementName: name,
|
|
79
|
+
activeDirectory,
|
|
80
|
+
elementType: ElementType.SHORT_CIRCUIT_PARAMETERS
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
ShortCircuitParametersEditionDialog
|
|
91
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UseShortCircuitParametersFormReturn } from './use-short-circuit-parameters-form';
|
|
3
|
+
interface ShortCircuitParametersFormProps {
|
|
4
|
+
shortCircuitMethods: UseShortCircuitParametersFormReturn;
|
|
5
|
+
renderTitleFields?: () => ReactNode;
|
|
6
|
+
renderActions?: () => ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function ShortCircuitParametersForm({ shortCircuitMethods, renderTitleFields, renderActions, }: Readonly<ShortCircuitParametersFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Grid, LinearProgress } from "@mui/material";
|
|
3
|
+
import "react-intl";
|
|
4
|
+
import "@mui/icons-material";
|
|
5
|
+
import "react";
|
|
6
|
+
import "react-hook-form";
|
|
7
|
+
import { CustomFormProvider } from "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
8
|
+
import "yup";
|
|
9
|
+
import "notistack";
|
|
10
|
+
import "../../overflowableText/OverflowableText.js";
|
|
11
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
12
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
13
|
+
import "../../customAGGrid/customAggrid.js";
|
|
14
|
+
import "ag-grid-community";
|
|
15
|
+
import "react-papaparse";
|
|
16
|
+
import "react-csv-downloader";
|
|
17
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
18
|
+
import "localized-countries";
|
|
19
|
+
import "localized-countries/data/fr";
|
|
20
|
+
import "localized-countries/data/en";
|
|
21
|
+
import "../../../utils/conversionUtils.js";
|
|
22
|
+
import "../../../utils/types/equipmentType.js";
|
|
23
|
+
import "../../../utils/yupConfig.js";
|
|
24
|
+
import "@react-querybuilder/material";
|
|
25
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
26
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
27
|
+
import "uuid";
|
|
28
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
29
|
+
import "react-querybuilder";
|
|
30
|
+
import { parametersStyles } from "../parameters-style.js";
|
|
31
|
+
import { ShortCircuitFields } from "./short-circuit-fields.js";
|
|
32
|
+
function ShortCircuitParametersForm({
|
|
33
|
+
shortCircuitMethods,
|
|
34
|
+
renderTitleFields,
|
|
35
|
+
renderActions
|
|
36
|
+
}) {
|
|
37
|
+
const { formMethods, formSchema, paramsLoading, resetAll } = shortCircuitMethods;
|
|
38
|
+
return /* @__PURE__ */ jsx(CustomFormProvider, { validationSchema: formSchema, ...formMethods, removeOptional: true, children: /* @__PURE__ */ jsxs(
|
|
39
|
+
Box,
|
|
40
|
+
{
|
|
41
|
+
sx: {
|
|
42
|
+
height: "100%",
|
|
43
|
+
display: "flex",
|
|
44
|
+
position: "relative",
|
|
45
|
+
flexDirection: "column"
|
|
46
|
+
},
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Grid, { item: true, container: true, direction: "column", children: renderTitleFields == null ? void 0 : renderTitleFields() }),
|
|
49
|
+
paramsLoading ? /* @__PURE__ */ jsx(LinearProgress, {}) : /* @__PURE__ */ jsx(Grid, { sx: parametersStyles.scrollableGrid, children: /* @__PURE__ */ jsx(ShortCircuitFields, { resetAll }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
Grid,
|
|
52
|
+
{
|
|
53
|
+
item: true,
|
|
54
|
+
container: true,
|
|
55
|
+
direction: "column",
|
|
56
|
+
sx: {
|
|
57
|
+
position: "absolute",
|
|
58
|
+
bottom: "15px"
|
|
59
|
+
},
|
|
60
|
+
children: renderActions == null ? void 0 : renderActions()
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
) });
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
ShortCircuitParametersForm
|
|
69
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { UUID } from 'crypto';
|
|
3
|
+
import { ShortCircuitParametersInfos } from './short-circuit-parameters.type';
|
|
4
|
+
export declare function ShortCircuitParametersInLine({ studyUuid, setHaveDirtyFields, shortCircuitParameters, }: Readonly<{
|
|
5
|
+
studyUuid: UUID | null;
|
|
6
|
+
setHaveDirtyFields: Dispatch<SetStateAction<boolean>>;
|
|
7
|
+
shortCircuitParameters: ShortCircuitParametersInfos | null;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useEffect } from "react";
|
|
3
|
+
import { Box, Grid } from "@mui/material";
|
|
4
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
|
+
import "../../../utils/types/equipmentType.js";
|
|
6
|
+
import "localized-countries";
|
|
7
|
+
import "localized-countries/data/fr";
|
|
8
|
+
import "localized-countries/data/en";
|
|
9
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
10
|
+
import "@mui/icons-material";
|
|
11
|
+
import "react-hook-form";
|
|
12
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
13
|
+
import "yup";
|
|
14
|
+
import "../../overflowableText/OverflowableText.js";
|
|
15
|
+
import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
|
|
16
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
17
|
+
import "../../customAGGrid/customAggrid.js";
|
|
18
|
+
import "ag-grid-community";
|
|
19
|
+
import "react-papaparse";
|
|
20
|
+
import "react-csv-downloader";
|
|
21
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
22
|
+
import "../../../utils/conversionUtils.js";
|
|
23
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
24
|
+
import "../../../utils/yupConfig.js";
|
|
25
|
+
import { SubmitButton } from "../../inputs/reactHookForm/utils/SubmitButton.js";
|
|
26
|
+
import "@react-querybuilder/material";
|
|
27
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
28
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
29
|
+
import "uuid";
|
|
30
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
31
|
+
import "react-querybuilder";
|
|
32
|
+
import { LabelledButton } from "../common/parameters.js";
|
|
33
|
+
import { CreateParameterDialog } from "../common/parameters-creation-dialog.js";
|
|
34
|
+
import "../common/widget/parameter-line-slider.js";
|
|
35
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
36
|
+
import { SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, InitialVoltage } from "./constants.js";
|
|
37
|
+
import { fetchShortCircuitParameters } from "../../../services/short-circuit-analysis.js";
|
|
38
|
+
import { ShortCircuitParametersForm } from "./short-circuit-parameters-form.js";
|
|
39
|
+
import { useShortCircuitParametersForm } from "./use-short-circuit-parameters-form.js";
|
|
40
|
+
function ShortCircuitParametersInLine({
|
|
41
|
+
studyUuid,
|
|
42
|
+
setHaveDirtyFields,
|
|
43
|
+
shortCircuitParameters
|
|
44
|
+
}) {
|
|
45
|
+
const shortCircuitMethods = useShortCircuitParametersForm({
|
|
46
|
+
parametersUuid: null,
|
|
47
|
+
name: null,
|
|
48
|
+
description: null,
|
|
49
|
+
studyUuid,
|
|
50
|
+
studyShortCircuitParameters: shortCircuitParameters
|
|
51
|
+
});
|
|
52
|
+
const intl = useIntl();
|
|
53
|
+
const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
|
|
54
|
+
const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
|
|
55
|
+
const { snackError } = useSnackMessage();
|
|
56
|
+
const { getCurrentValues, formMethods } = shortCircuitMethods;
|
|
57
|
+
const { setValue, formState, handleSubmit } = formMethods;
|
|
58
|
+
const replaceFormValues = useCallback(
|
|
59
|
+
(param) => {
|
|
60
|
+
const dirty = { shouldDirty: true };
|
|
61
|
+
setValue(SHORT_CIRCUIT_WITH_FEEDER_RESULT, param.parameters.withFeederResult, dirty);
|
|
62
|
+
setValue(SHORT_CIRCUIT_PREDEFINED_PARAMS, param.predefinedParameters, dirty);
|
|
63
|
+
setValue(SHORT_CIRCUIT_WITH_LOADS, param.parameters.withLoads, dirty);
|
|
64
|
+
setValue(SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, param.parameters.withVSCConverterStations, dirty);
|
|
65
|
+
setValue(SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, param.parameters.withShuntCompensators, dirty);
|
|
66
|
+
setValue(SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, !param.parameters.withNeutralPosition, dirty);
|
|
67
|
+
setValue(
|
|
68
|
+
SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
|
|
69
|
+
param.parameters.initialVoltageProfileMode === InitialVoltage.CONFIGURED ? InitialVoltage.CEI909 : param.parameters.initialVoltageProfileMode,
|
|
70
|
+
dirty
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
[setValue]
|
|
74
|
+
);
|
|
75
|
+
const handleLoadParameters = useCallback(
|
|
76
|
+
(newParams) => {
|
|
77
|
+
if (newParams == null ? void 0 : newParams.length) {
|
|
78
|
+
setOpenSelectParameterDialog(false);
|
|
79
|
+
const paramUuid = newParams[0].id;
|
|
80
|
+
fetchShortCircuitParameters(paramUuid).then((parameters) => {
|
|
81
|
+
replaceFormValues(parameters);
|
|
82
|
+
}).catch((error) => {
|
|
83
|
+
console.error(error);
|
|
84
|
+
snackError({
|
|
85
|
+
messageTxt: error.message,
|
|
86
|
+
headerId: "paramsRetrievingError"
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
setOpenSelectParameterDialog(false);
|
|
91
|
+
},
|
|
92
|
+
[snackError, replaceFormValues]
|
|
93
|
+
);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
setHaveDirtyFields(!!Object.keys(formState.dirtyFields).length);
|
|
96
|
+
}, [formState, setHaveDirtyFields]);
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
ShortCircuitParametersForm,
|
|
99
|
+
{
|
|
100
|
+
shortCircuitMethods,
|
|
101
|
+
renderActions: () => {
|
|
102
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
103
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, item: true, children: [
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
LabelledButton,
|
|
106
|
+
{
|
|
107
|
+
callback: () => setOpenSelectParameterDialog(true),
|
|
108
|
+
label: "settings.button.chooseSettings"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(LabelledButton, { callback: () => setOpenCreateParameterDialog(true), label: "save" }),
|
|
112
|
+
/* @__PURE__ */ jsx(SubmitButton, { onClick: handleSubmit(shortCircuitMethods.onSaveInline), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) })
|
|
113
|
+
] }),
|
|
114
|
+
openCreateParameterDialog && /* @__PURE__ */ jsx(
|
|
115
|
+
CreateParameterDialog,
|
|
116
|
+
{
|
|
117
|
+
studyUuid,
|
|
118
|
+
open: openCreateParameterDialog,
|
|
119
|
+
onClose: () => setOpenCreateParameterDialog(false),
|
|
120
|
+
parameterValues: () => getCurrentValues(),
|
|
121
|
+
parameterFormatter: (newParams) => newParams,
|
|
122
|
+
parameterType: ElementType.SHORT_CIRCUIT_PARAMETERS
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
openSelectParameterDialog && /* @__PURE__ */ jsx(
|
|
126
|
+
DirectoryItemSelector,
|
|
127
|
+
{
|
|
128
|
+
open: openSelectParameterDialog,
|
|
129
|
+
onClose: handleLoadParameters,
|
|
130
|
+
types: [ElementType.SHORT_CIRCUIT_PARAMETERS],
|
|
131
|
+
title: intl.formatMessage({
|
|
132
|
+
id: "showSelectParameterDialog"
|
|
133
|
+
}),
|
|
134
|
+
multiSelect: false,
|
|
135
|
+
validationButtonText: intl.formatMessage({
|
|
136
|
+
id: "validate"
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
export {
|
|
146
|
+
ShortCircuitParametersInLine
|
|
147
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { InitialVoltage, PredefinedParameters } from './constants';
|
|
2
|
+
export interface VoltageRange {
|
|
3
|
+
minimumNominalVoltage: number;
|
|
4
|
+
maximumNominalVoltage: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ShortCircuitParametersDto {
|
|
7
|
+
withFeederResult: boolean;
|
|
8
|
+
withLoads: boolean;
|
|
9
|
+
withVSCConverterStations: boolean;
|
|
10
|
+
withShuntCompensators: boolean;
|
|
11
|
+
withNeutralPosition: boolean;
|
|
12
|
+
initialVoltageProfileMode: InitialVoltage;
|
|
13
|
+
voltageRanges?: VoltageRange[];
|
|
14
|
+
}
|
|
15
|
+
export interface ShortCircuitParametersInfos {
|
|
16
|
+
parameters: ShortCircuitParametersDto;
|
|
17
|
+
predefinedParameters: PredefinedParameters;
|
|
18
|
+
cei909VoltageRanges?: any;
|
|
19
|
+
}
|
|
20
|
+
interface VoltageRanges {
|
|
21
|
+
maximumNominalVoltage: number;
|
|
22
|
+
minimumNominalVoltage: number;
|
|
23
|
+
voltage: number;
|
|
24
|
+
voltageRangeCoefficient: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ShortCircuitParameters {
|
|
27
|
+
predefinedParameters: NonNullable<PredefinedParameters | undefined>;
|
|
28
|
+
parameters: {
|
|
29
|
+
withFeederResult: boolean;
|
|
30
|
+
withLoads: boolean;
|
|
31
|
+
withVSCConverterStations: boolean;
|
|
32
|
+
withShuntCompensators: boolean;
|
|
33
|
+
withNeutralPosition: boolean;
|
|
34
|
+
initialVoltageProfileMode: NonNullable<InitialVoltage | undefined>;
|
|
35
|
+
voltageRanges?: VoltageRanges;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Table, TableBody, TableRow, TableCell } from "@mui/material";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { InitialVoltage } from "./constants.js";
|
|
6
|
+
function VoltageTable({ voltageProfileMode }) {
|
|
7
|
+
const intl = useIntl();
|
|
8
|
+
const rows = useMemo(
|
|
9
|
+
() => [
|
|
10
|
+
{
|
|
11
|
+
name: intl.formatMessage({ id: "shortCircuitNominalVoltage" }),
|
|
12
|
+
values: [`380 ${intl.formatMessage({ id: "Or" })} 400`, 225, 150, 90, 63, 45, 20]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: intl.formatMessage({ id: "shortCircuitInitialVoltage" }),
|
|
16
|
+
values: voltageProfileMode === InitialVoltage.NOMINAL ? [400, 225, 150, 90, 63, 45, 20] : [420, 245, 165, 99, 69.3, 49.5, 22]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
[voltageProfileMode, intl]
|
|
20
|
+
);
|
|
21
|
+
return /* @__PURE__ */ jsx(Table, { children: /* @__PURE__ */ jsx(TableBody, { children: rows.map((row) => /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(TableCell, { children: row.name }),
|
|
23
|
+
row.values.map((value) => /* @__PURE__ */ jsx(
|
|
24
|
+
TableCell,
|
|
25
|
+
{
|
|
26
|
+
sx: {
|
|
27
|
+
width: "10%",
|
|
28
|
+
textAlign: "center"
|
|
29
|
+
},
|
|
30
|
+
children: value
|
|
31
|
+
},
|
|
32
|
+
value
|
|
33
|
+
))
|
|
34
|
+
] }, row.name)) }) });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
VoltageTable
|
|
38
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import { ObjectSchema } from 'yup';
|
|
3
|
+
import { UUID } from 'crypto';
|
|
4
|
+
import { PredefinedParameters } from './constants';
|
|
5
|
+
import { ShortCircuitParametersInfos } from './short-circuit-parameters.type';
|
|
6
|
+
export interface UseShortCircuitParametersFormReturn {
|
|
7
|
+
formMethods: UseFormReturn;
|
|
8
|
+
formSchema: ObjectSchema<any>;
|
|
9
|
+
paramsLoading: boolean;
|
|
10
|
+
onSaveInline: (formData: Record<string, any>) => void;
|
|
11
|
+
onSaveDialog: (formData: Record<string, any>) => void;
|
|
12
|
+
resetAll: (predefinedParameter: PredefinedParameters) => void;
|
|
13
|
+
getCurrentValues: () => FieldValues;
|
|
14
|
+
}
|
|
15
|
+
type UseShortCircuitParametersFormProps = {
|
|
16
|
+
parametersUuid: UUID;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string | null;
|
|
19
|
+
studyUuid: null;
|
|
20
|
+
studyShortCircuitParameters: null;
|
|
21
|
+
} | {
|
|
22
|
+
parametersUuid: null;
|
|
23
|
+
name: null;
|
|
24
|
+
description: null;
|
|
25
|
+
studyUuid: UUID | null;
|
|
26
|
+
studyShortCircuitParameters: ShortCircuitParametersInfos | null;
|
|
27
|
+
};
|
|
28
|
+
export declare const useShortCircuitParametersForm: ({ parametersUuid, name, description, studyUuid, studyShortCircuitParameters, }: UseShortCircuitParametersFormProps) => UseShortCircuitParametersFormReturn;
|
|
29
|
+
export {};
|