@gridsuite/commons-ui 0.107.1 → 0.108.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/dialogs/elementSaveDialog/ElementSaveDialog.js +10 -10
- package/dist/components/dnd-table/dnd-table-add-rows-dialog.d.ts +13 -0
- package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +69 -0
- package/dist/components/dnd-table/dnd-table-bottom-left-buttons.d.ts +17 -0
- package/dist/components/dnd-table/dnd-table-bottom-left-buttons.js +48 -0
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.d.ts +17 -0
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +104 -0
- package/dist/components/dnd-table/dnd-table.d.ts +28 -0
- package/dist/components/dnd-table/dnd-table.js +394 -0
- package/dist/components/dnd-table/dnd-table.type.d.ts +51 -0
- package/dist/components/dnd-table/dnd-table.type.js +16 -0
- package/dist/components/dnd-table/index.d.ts +11 -0
- package/dist/components/dnd-table/index.js +14 -0
- package/dist/components/filter/HeaderFilterForm.js +4 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +57 -1
- package/dist/components/inputs/index.js +6 -0
- package/dist/components/inputs/reactHookForm/chip-items-input.d.ts +13 -0
- package/dist/components/inputs/reactHookForm/chip-items-input.js +129 -0
- package/dist/components/inputs/reactHookForm/index.d.ts +2 -0
- package/dist/components/inputs/reactHookForm/index.js +6 -0
- package/dist/components/inputs/reactHookForm/tableInputs/index.d.ts +8 -0
- package/dist/components/inputs/reactHookForm/tableInputs/index.js +6 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.d.ts +12 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +110 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.d.ts +8 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +43 -0
- package/dist/components/parameters/common/ProviderParam.js +6 -6
- package/dist/components/parameters/common/constant.d.ts +8 -0
- package/dist/components/parameters/common/constant.js +12 -1
- package/dist/components/parameters/common/index.js +3 -1
- package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +7 -7
- package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +6 -6
- package/dist/components/parameters/common/name-element-editor/name-element-editor-form.js +8 -8
- package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +11 -10
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +7 -7
- package/dist/components/parameters/common/widget/parameter-float.js +6 -6
- package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +11 -10
- package/dist/components/parameters/common/widget/parameter-line-slider.js +6 -6
- package/dist/components/parameters/index.d.ts +1 -0
- package/dist/components/parameters/index.js +39 -1
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +6 -6
- package/dist/components/parameters/loadflow/load-flow-parameter-field.js +6 -6
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +6 -6
- package/dist/components/parameters/loadflow/load-flow-parameters-header.js +6 -6
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +3 -3
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +2 -1
- package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +6 -6
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +7 -7
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +3 -3
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +2 -2
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +12 -11
- package/dist/components/parameters/short-circuit/short-circuit-fields.js +5 -5
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +3 -3
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +6 -6
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +2 -2
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +11 -10
- package/dist/components/parameters/voltage-init/constants.d.ts +39 -0
- package/dist/components/parameters/voltage-init/constants.js +65 -0
- package/dist/components/parameters/voltage-init/equipment-selection-parameters.d.ts +7 -0
- package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +119 -0
- package/dist/components/parameters/voltage-init/general-parameters.d.ts +4 -0
- package/dist/components/parameters/voltage-init/general-parameters.js +112 -0
- package/dist/components/parameters/voltage-init/index.d.ts +10 -0
- package/dist/components/parameters/voltage-init/index.js +38 -0
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.d.ts +32 -0
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +218 -0
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.d.ts +4 -0
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +220 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.d.ts +2 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.js +97 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.d.ts +30 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +150 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.d.ts +8 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +152 -0
- package/dist/components/parameters/voltage-init/voltage-init.type.d.ts +33 -0
- package/dist/components/parameters/voltage-init/voltage-init.type.js +8 -0
- package/dist/components/parameters/voltage-init/voltage-limits-parameters.d.ts +7 -0
- package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +188 -0
- package/dist/index.js +69 -2
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +6 -2
- package/dist/services/study.d.ts +2 -0
- package/dist/services/study.js +15 -1
- package/dist/services/voltage-init.d.ts +4 -0
- package/dist/services/voltage-init.js +14 -0
- package/dist/translations/en/dndTableEn.d.ts +16 -0
- package/dist/translations/en/dndTableEn.js +13 -0
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/en/parameters.d.ts +30 -0
- package/dist/translations/en/parameters.js +31 -1
- package/dist/translations/fr/dndTableFr.d.ts +16 -0
- package/dist/translations/fr/dndTableFr.js +13 -0
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/translations/fr/parameters.d.ts +31 -0
- package/dist/translations/fr/parameters.js +32 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/validation-functions.d.ts +8 -0
- package/dist/utils/validation-functions.js +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DEFAULT_GENERAL_APPLY_MODIFICATIONS, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, FILTERS, FILTER_ID, FILTER_NAME, GENERAL, GENERAL_APPLY_MODIFICATIONS, GENERATORS_SELECTION_TYPE, HIGH_VOLTAGE_LIMIT, ID, LEG_SIDE, LOW_VOLTAGE_LIMIT, PRIORITY, RATIO_TAP_CHANGER_POSITION, RATIO_TAP_CHANGER_TARGET_V, REACTIVE_SLACKS_THRESHOLD, SELECTION_TYPE, SHUNT_COMPENSATORS_SELECTION_TYPE, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, TRANSFORMERS_SELECTION_TYPE, UPDATE_BUS_VOLTAGE, VARIABLE_Q_GENERATORS, VARIABLE_SHUNT_COMPENSATORS, VARIABLE_TRANSFORMERS, VOLTAGE_LIMITS_DEFAULT, VOLTAGE_LIMITS_MODIFICATION, VoltageInitTabValues } from "./constants.js";
|
|
2
|
+
import { EquipmentsSelectionType } from "./voltage-init.type.js";
|
|
3
|
+
import { VoltageInitParametersEditionDialog } from "./voltage-init-parameters-dialog.js";
|
|
4
|
+
import { VoltageInitParametersInLine } from "./voltage-init-parameters-inline.js";
|
|
5
|
+
export {
|
|
6
|
+
DEFAULT_GENERAL_APPLY_MODIFICATIONS,
|
|
7
|
+
DEFAULT_REACTIVE_SLACKS_THRESHOLD,
|
|
8
|
+
DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
|
|
9
|
+
DEFAULT_UPDATE_BUS_VOLTAGE,
|
|
10
|
+
EquipmentsSelectionType,
|
|
11
|
+
FILTERS,
|
|
12
|
+
FILTER_ID,
|
|
13
|
+
FILTER_NAME,
|
|
14
|
+
GENERAL,
|
|
15
|
+
GENERAL_APPLY_MODIFICATIONS,
|
|
16
|
+
GENERATORS_SELECTION_TYPE,
|
|
17
|
+
HIGH_VOLTAGE_LIMIT,
|
|
18
|
+
ID,
|
|
19
|
+
LEG_SIDE,
|
|
20
|
+
LOW_VOLTAGE_LIMIT,
|
|
21
|
+
PRIORITY,
|
|
22
|
+
RATIO_TAP_CHANGER_POSITION,
|
|
23
|
+
RATIO_TAP_CHANGER_TARGET_V,
|
|
24
|
+
REACTIVE_SLACKS_THRESHOLD,
|
|
25
|
+
SELECTION_TYPE,
|
|
26
|
+
SHUNT_COMPENSATORS_SELECTION_TYPE,
|
|
27
|
+
SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
|
|
28
|
+
TRANSFORMERS_SELECTION_TYPE,
|
|
29
|
+
UPDATE_BUS_VOLTAGE,
|
|
30
|
+
VARIABLE_Q_GENERATORS,
|
|
31
|
+
VARIABLE_SHUNT_COMPENSATORS,
|
|
32
|
+
VARIABLE_TRANSFORMERS,
|
|
33
|
+
VOLTAGE_LIMITS_DEFAULT,
|
|
34
|
+
VOLTAGE_LIMITS_MODIFICATION,
|
|
35
|
+
VoltageInitParametersEditionDialog,
|
|
36
|
+
VoltageInitParametersInLine,
|
|
37
|
+
VoltageInitTabValues
|
|
38
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FieldErrors, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
3
|
+
import { ObjectSchema } from 'yup';
|
|
4
|
+
import { UUID } from 'crypto';
|
|
5
|
+
import { VoltageInitTabValues as TabValues } from './constants';
|
|
6
|
+
import { VoltageInitStudyParameters } from './voltage-init.type';
|
|
7
|
+
export interface UseVoltageInitParametersFormReturn {
|
|
8
|
+
formMethods: UseFormReturn;
|
|
9
|
+
formSchema: ObjectSchema<any>;
|
|
10
|
+
selectedTab: TabValues;
|
|
11
|
+
handleTabChange: (event: SyntheticEvent, newValue: TabValues) => void;
|
|
12
|
+
paramsLoading: boolean;
|
|
13
|
+
onSaveInline: (formData: Record<string, any>) => void;
|
|
14
|
+
onSaveDialog: (formData: Record<string, any>) => void;
|
|
15
|
+
tabIndexesWithError: TabValues[];
|
|
16
|
+
onValidationError: (errors: FieldErrors) => void;
|
|
17
|
+
}
|
|
18
|
+
type UseVoltageInitParametersFormProps = {
|
|
19
|
+
parametersUuid: UUID;
|
|
20
|
+
name: string;
|
|
21
|
+
description: string | null;
|
|
22
|
+
studyUuid: null;
|
|
23
|
+
parameters: null;
|
|
24
|
+
} | {
|
|
25
|
+
parametersUuid: null;
|
|
26
|
+
name: null;
|
|
27
|
+
description: null;
|
|
28
|
+
studyUuid: UUID | null;
|
|
29
|
+
parameters: VoltageInitStudyParameters | null;
|
|
30
|
+
};
|
|
31
|
+
export declare const useVoltageInitParametersForm: ({ parametersUuid, name, description, studyUuid, parameters, }: UseVoltageInitParametersFormProps) => UseVoltageInitParametersFormReturn;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { useForm } from "react-hook-form";
|
|
2
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
|
+
import { useState, useCallback, useMemo, useEffect } from "react";
|
|
4
|
+
import "../../../utils/yupConfig.js";
|
|
5
|
+
import "react/jsx-runtime";
|
|
6
|
+
import "react-intl";
|
|
7
|
+
import "@mui/material";
|
|
8
|
+
import "../../../utils/types/equipmentType.js";
|
|
9
|
+
import { updateParameter } from "../../../services/explore.js";
|
|
10
|
+
import { updateVoltageInitParameters } from "../../../services/study.js";
|
|
11
|
+
import { getVoltageInitParameters } from "../../../services/voltage-init.js";
|
|
12
|
+
import "localized-countries";
|
|
13
|
+
import "localized-countries/data/fr";
|
|
14
|
+
import "localized-countries/data/en";
|
|
15
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
16
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
17
|
+
import "@mui/icons-material";
|
|
18
|
+
import * as yup from "yup";
|
|
19
|
+
import "../../overflowableText/OverflowableText.js";
|
|
20
|
+
import { NAME, DESCRIPTION_INPUT } from "../../inputs/reactHookForm/DirectoryItemsInput.js";
|
|
21
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
22
|
+
import "../../customAGGrid/customAggrid.js";
|
|
23
|
+
import "ag-grid-community";
|
|
24
|
+
import "react-papaparse";
|
|
25
|
+
import "react-csv-downloader";
|
|
26
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
27
|
+
import { isBlankOrEmpty } from "../../../utils/conversionUtils.js";
|
|
28
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
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 { VoltageInitTabValues, VARIABLE_SHUNT_COMPENSATORS, ID, SHUNT_COMPENSATORS_SELECTION_TYPE, VARIABLE_TRANSFORMERS, TRANSFORMERS_SELECTION_TYPE, VARIABLE_Q_GENERATORS, GENERATORS_SELECTION_TYPE, VOLTAGE_LIMITS_DEFAULT, HIGH_VOLTAGE_LIMIT, LOW_VOLTAGE_LIMIT, FILTERS, VOLTAGE_LIMITS_MODIFICATION, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, REACTIVE_SLACKS_THRESHOLD, UPDATE_BUS_VOLTAGE, GENERAL_APPLY_MODIFICATIONS, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, DEFAULT_GENERAL_APPLY_MODIFICATIONS, GENERAL } from "./constants.js";
|
|
36
|
+
import "../../filter/HeaderFilterForm.js";
|
|
37
|
+
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
38
|
+
import { fromVoltageInitParametersFormToParamValues, fromVoltageInitParamsDataToFormValues, fromStudyVoltageInitParamsDataToFormValues } from "./voltage-init-form-utils.js";
|
|
39
|
+
import "@hello-pangea/dnd";
|
|
40
|
+
import { SELECTED } from "../../dnd-table/dnd-table.type.js";
|
|
41
|
+
const useVoltageInitParametersForm = ({
|
|
42
|
+
parametersUuid,
|
|
43
|
+
name,
|
|
44
|
+
description,
|
|
45
|
+
studyUuid,
|
|
46
|
+
parameters
|
|
47
|
+
}) => {
|
|
48
|
+
const [selectedTab, setSelectedTab] = useState(VoltageInitTabValues.GENERAL);
|
|
49
|
+
const [paramsLoading, setParamsLoading] = useState(false);
|
|
50
|
+
const [tabIndexesWithError, setTabIndexesWithError] = useState([]);
|
|
51
|
+
const { snackError } = useSnackMessage();
|
|
52
|
+
const handleTabChange = useCallback((_event, newValue) => {
|
|
53
|
+
setSelectedTab(newValue);
|
|
54
|
+
}, []);
|
|
55
|
+
const formSchema = useMemo(() => {
|
|
56
|
+
return yup.object({
|
|
57
|
+
[VoltageInitTabValues.GENERAL]: yup.object().shape({
|
|
58
|
+
[GENERAL_APPLY_MODIFICATIONS]: yup.boolean(),
|
|
59
|
+
[UPDATE_BUS_VOLTAGE]: yup.boolean().required(),
|
|
60
|
+
[REACTIVE_SLACKS_THRESHOLD]: yup.number().min(0, "ReactiveSlacksThresholdMustBeGreaterOrEqualToZero").required(),
|
|
61
|
+
[SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: yup.number().min(0, "ShuntCompensatorActivationThresholdMustBeGreaterOrEqualToZero").required()
|
|
62
|
+
}),
|
|
63
|
+
[VOLTAGE_LIMITS_MODIFICATION]: yup.array().of(
|
|
64
|
+
yup.object().shape({
|
|
65
|
+
[SELECTED]: yup.boolean().required(),
|
|
66
|
+
[FILTERS]: yup.array().of(
|
|
67
|
+
yup.object().shape({
|
|
68
|
+
[ID]: yup.string().required(),
|
|
69
|
+
[NAME]: yup.string().required()
|
|
70
|
+
})
|
|
71
|
+
).min(1, "FilterInputMinError"),
|
|
72
|
+
[LOW_VOLTAGE_LIMIT]: yup.number().nullable(),
|
|
73
|
+
[HIGH_VOLTAGE_LIMIT]: yup.number().nullable()
|
|
74
|
+
})
|
|
75
|
+
),
|
|
76
|
+
[VOLTAGE_LIMITS_DEFAULT]: yup.array().of(
|
|
77
|
+
yup.object().shape({
|
|
78
|
+
[SELECTED]: yup.boolean().required(),
|
|
79
|
+
[FILTERS]: yup.array().of(
|
|
80
|
+
yup.object().shape({
|
|
81
|
+
[ID]: yup.string().required(),
|
|
82
|
+
[NAME]: yup.string().required()
|
|
83
|
+
})
|
|
84
|
+
).min(1, "FilterInputMinError"),
|
|
85
|
+
[LOW_VOLTAGE_LIMIT]: yup.number().min(0).nullable().test((value, context) => {
|
|
86
|
+
return !isBlankOrEmpty(value) || !isBlankOrEmpty(context.parent[HIGH_VOLTAGE_LIMIT]);
|
|
87
|
+
}),
|
|
88
|
+
[HIGH_VOLTAGE_LIMIT]: yup.number().min(0).nullable().test((value, context) => {
|
|
89
|
+
return !isBlankOrEmpty(value) || !isBlankOrEmpty(context.parent[LOW_VOLTAGE_LIMIT]);
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
),
|
|
93
|
+
[GENERATORS_SELECTION_TYPE]: yup.mixed().required(),
|
|
94
|
+
[VARIABLE_Q_GENERATORS]: yup.array().of(
|
|
95
|
+
yup.object().shape({
|
|
96
|
+
[ID]: yup.string().required(),
|
|
97
|
+
[NAME]: yup.string().required()
|
|
98
|
+
})
|
|
99
|
+
),
|
|
100
|
+
[TRANSFORMERS_SELECTION_TYPE]: yup.mixed().required(),
|
|
101
|
+
[VARIABLE_TRANSFORMERS]: yup.array().of(
|
|
102
|
+
yup.object().shape({
|
|
103
|
+
[ID]: yup.string().required(),
|
|
104
|
+
[NAME]: yup.string().required()
|
|
105
|
+
})
|
|
106
|
+
),
|
|
107
|
+
[SHUNT_COMPENSATORS_SELECTION_TYPE]: yup.mixed().required(),
|
|
108
|
+
[VARIABLE_SHUNT_COMPENSATORS]: yup.array().of(
|
|
109
|
+
yup.object().shape({
|
|
110
|
+
[ID]: yup.string().required(),
|
|
111
|
+
[NAME]: yup.string().required()
|
|
112
|
+
})
|
|
113
|
+
)
|
|
114
|
+
}).concat(getNameElementEditorSchema(name));
|
|
115
|
+
}, [name]);
|
|
116
|
+
const formMethods = useForm({
|
|
117
|
+
defaultValues: {
|
|
118
|
+
...getNameElementEditorEmptyFormData(name, description),
|
|
119
|
+
[VoltageInitTabValues.GENERAL]: {
|
|
120
|
+
[GENERAL_APPLY_MODIFICATIONS]: DEFAULT_GENERAL_APPLY_MODIFICATIONS,
|
|
121
|
+
[UPDATE_BUS_VOLTAGE]: DEFAULT_UPDATE_BUS_VOLTAGE,
|
|
122
|
+
[REACTIVE_SLACKS_THRESHOLD]: DEFAULT_REACTIVE_SLACKS_THRESHOLD,
|
|
123
|
+
[SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD
|
|
124
|
+
},
|
|
125
|
+
[VOLTAGE_LIMITS_MODIFICATION]: [],
|
|
126
|
+
[VOLTAGE_LIMITS_DEFAULT]: [],
|
|
127
|
+
[GENERATORS_SELECTION_TYPE]: "ALL_EXCEPT",
|
|
128
|
+
[VARIABLE_Q_GENERATORS]: [],
|
|
129
|
+
[TRANSFORMERS_SELECTION_TYPE]: "NONE_EXCEPT",
|
|
130
|
+
[VARIABLE_TRANSFORMERS]: [],
|
|
131
|
+
[SHUNT_COMPENSATORS_SELECTION_TYPE]: "NONE_EXCEPT",
|
|
132
|
+
[VARIABLE_SHUNT_COMPENSATORS]: []
|
|
133
|
+
},
|
|
134
|
+
resolver: yupResolver(formSchema)
|
|
135
|
+
});
|
|
136
|
+
const { reset } = formMethods;
|
|
137
|
+
const onValidationError = useCallback(
|
|
138
|
+
(errors) => {
|
|
139
|
+
const tabsInError = [];
|
|
140
|
+
if ((errors == null ? void 0 : errors[GENERAL]) && VoltageInitTabValues.GENERAL !== selectedTab) {
|
|
141
|
+
tabsInError.push(VoltageInitTabValues.GENERAL);
|
|
142
|
+
}
|
|
143
|
+
setTabIndexesWithError(tabsInError);
|
|
144
|
+
},
|
|
145
|
+
[selectedTab]
|
|
146
|
+
);
|
|
147
|
+
const onSaveInline = useCallback(
|
|
148
|
+
(formData) => {
|
|
149
|
+
if (studyUuid) {
|
|
150
|
+
updateVoltageInitParameters(studyUuid, fromVoltageInitParametersFormToParamValues(formData)).catch(
|
|
151
|
+
(error) => {
|
|
152
|
+
snackError({
|
|
153
|
+
messageTxt: error.message,
|
|
154
|
+
headerId: "updateVoltageInitParametersError"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
[snackError, studyUuid]
|
|
161
|
+
);
|
|
162
|
+
const onSaveDialog = useCallback(
|
|
163
|
+
(formData) => {
|
|
164
|
+
if (parametersUuid) {
|
|
165
|
+
updateParameter(
|
|
166
|
+
parametersUuid,
|
|
167
|
+
fromVoltageInitParametersFormToParamValues(formData).computationParameters,
|
|
168
|
+
formData[NAME],
|
|
169
|
+
ElementType.VOLTAGE_INIT_PARAMETERS,
|
|
170
|
+
formData[DESCRIPTION_INPUT] ?? ""
|
|
171
|
+
).catch((error) => {
|
|
172
|
+
snackError({
|
|
173
|
+
messageTxt: error.message,
|
|
174
|
+
headerId: "updateVoltageInitParametersError"
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
[parametersUuid, snackError]
|
|
180
|
+
);
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (parametersUuid) {
|
|
183
|
+
const timer = setTimeout(() => {
|
|
184
|
+
setParamsLoading(true);
|
|
185
|
+
}, 700);
|
|
186
|
+
getVoltageInitParameters(parametersUuid).then((params) => {
|
|
187
|
+
reset(fromVoltageInitParamsDataToFormValues(params));
|
|
188
|
+
}).catch((error) => {
|
|
189
|
+
snackError({
|
|
190
|
+
messageTxt: error.message,
|
|
191
|
+
headerId: "paramsRetrievingError"
|
|
192
|
+
});
|
|
193
|
+
}).finally(() => {
|
|
194
|
+
clearTimeout(timer);
|
|
195
|
+
setParamsLoading(false);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}, [parametersUuid, reset, snackError]);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (parameters) {
|
|
201
|
+
reset(fromStudyVoltageInitParamsDataToFormValues(parameters));
|
|
202
|
+
}
|
|
203
|
+
}, [parameters, reset]);
|
|
204
|
+
return {
|
|
205
|
+
formMethods,
|
|
206
|
+
formSchema,
|
|
207
|
+
selectedTab,
|
|
208
|
+
handleTabChange,
|
|
209
|
+
paramsLoading,
|
|
210
|
+
onSaveInline,
|
|
211
|
+
onSaveDialog,
|
|
212
|
+
tabIndexesWithError,
|
|
213
|
+
onValidationError
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
useVoltageInitParametersForm
|
|
218
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VoltageInitParameters, VoltageInitStudyParameters } from './voltage-init.type';
|
|
2
|
+
export declare const fromVoltageInitParametersFormToParamValues: (newParams: Record<string, any>) => VoltageInitStudyParameters;
|
|
3
|
+
export declare const fromVoltageInitParamsDataToFormValues: (parameters: VoltageInitParameters) => Record<string, any>;
|
|
4
|
+
export declare const fromStudyVoltageInitParamsDataToFormValues: (parameters: VoltageInitStudyParameters) => Record<string, any>;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { EquipmentsSelectionType } from "./voltage-init.type.js";
|
|
2
|
+
import { DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, DEFAULT_GENERAL_APPLY_MODIFICATIONS, VARIABLE_SHUNT_COMPENSATORS, FILTER_NAME, FILTER_ID, ID, SHUNT_COMPENSATORS_SELECTION_TYPE, VARIABLE_TRANSFORMERS, TRANSFORMERS_SELECTION_TYPE, VARIABLE_Q_GENERATORS, GENERATORS_SELECTION_TYPE, VOLTAGE_LIMITS_DEFAULT, FILTERS, HIGH_VOLTAGE_LIMIT, LOW_VOLTAGE_LIMIT, PRIORITY, VOLTAGE_LIMITS_MODIFICATION, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, VoltageInitTabValues, REACTIVE_SLACKS_THRESHOLD, UPDATE_BUS_VOLTAGE, GENERAL_APPLY_MODIFICATIONS } from "./constants.js";
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "@mui/material";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-hook-form";
|
|
8
|
+
import "../../../utils/types/equipmentType.js";
|
|
9
|
+
import "localized-countries";
|
|
10
|
+
import "localized-countries/data/fr";
|
|
11
|
+
import "localized-countries/data/en";
|
|
12
|
+
import "notistack";
|
|
13
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
14
|
+
import "@mui/icons-material";
|
|
15
|
+
import "yup";
|
|
16
|
+
import "../../overflowableText/OverflowableText.js";
|
|
17
|
+
import { NAME } from "../../inputs/reactHookForm/DirectoryItemsInput.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 "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
24
|
+
import "../../../utils/conversionUtils.js";
|
|
25
|
+
import "../../../utils/yupConfig.js";
|
|
26
|
+
import "@react-querybuilder/material";
|
|
27
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
28
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
29
|
+
import "uuid";
|
|
30
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
31
|
+
import "react-querybuilder";
|
|
32
|
+
import "@hello-pangea/dnd";
|
|
33
|
+
import { SELECTED } from "../../dnd-table/dnd-table.type.js";
|
|
34
|
+
const fromVoltageInitParametersFormToParamValues = (newParams) => {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
36
|
+
return {
|
|
37
|
+
applyModifications: ((_a = newParams == null ? void 0 : newParams[VoltageInitTabValues.GENERAL]) == null ? void 0 : _a[GENERAL_APPLY_MODIFICATIONS]) ?? DEFAULT_GENERAL_APPLY_MODIFICATIONS,
|
|
38
|
+
computationParameters: {
|
|
39
|
+
[UPDATE_BUS_VOLTAGE]: ((_b = newParams == null ? void 0 : newParams[VoltageInitTabValues.GENERAL]) == null ? void 0 : _b[UPDATE_BUS_VOLTAGE]) ?? DEFAULT_UPDATE_BUS_VOLTAGE,
|
|
40
|
+
[REACTIVE_SLACKS_THRESHOLD]: ((_c = newParams == null ? void 0 : newParams[VoltageInitTabValues.GENERAL]) == null ? void 0 : _c[REACTIVE_SLACKS_THRESHOLD]) ?? DEFAULT_REACTIVE_SLACKS_THRESHOLD,
|
|
41
|
+
[SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: ((_d = newParams == null ? void 0 : newParams[VoltageInitTabValues.GENERAL]) == null ? void 0 : _d[SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]) ?? DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
|
|
42
|
+
[VOLTAGE_LIMITS_MODIFICATION]: ((_e = newParams.voltageLimitsModification) == null ? void 0 : _e.map((voltageLimit) => {
|
|
43
|
+
var _a2, _b2;
|
|
44
|
+
return {
|
|
45
|
+
[PRIORITY]: (_a2 = newParams.voltageLimitsModification) == null ? void 0 : _a2.indexOf(voltageLimit),
|
|
46
|
+
[LOW_VOLTAGE_LIMIT]: voltageLimit[LOW_VOLTAGE_LIMIT] ?? 0,
|
|
47
|
+
[HIGH_VOLTAGE_LIMIT]: voltageLimit[HIGH_VOLTAGE_LIMIT] ?? 0,
|
|
48
|
+
[FILTERS]: ((_b2 = voltageLimit[FILTERS]) == null ? void 0 : _b2.map((filter) => {
|
|
49
|
+
return {
|
|
50
|
+
[FILTER_ID]: filter[ID],
|
|
51
|
+
[FILTER_NAME]: filter[NAME]
|
|
52
|
+
};
|
|
53
|
+
})) ?? []
|
|
54
|
+
};
|
|
55
|
+
})) ?? [],
|
|
56
|
+
[VOLTAGE_LIMITS_DEFAULT]: ((_f = newParams.voltageLimitsDefault) == null ? void 0 : _f.map((voltageLimit) => {
|
|
57
|
+
var _a2, _b2;
|
|
58
|
+
return {
|
|
59
|
+
[PRIORITY]: (_a2 = newParams.voltageLimitsDefault) == null ? void 0 : _a2.indexOf(voltageLimit),
|
|
60
|
+
[LOW_VOLTAGE_LIMIT]: voltageLimit[LOW_VOLTAGE_LIMIT] ?? 0,
|
|
61
|
+
[HIGH_VOLTAGE_LIMIT]: voltageLimit[HIGH_VOLTAGE_LIMIT] ?? 0,
|
|
62
|
+
[FILTERS]: ((_b2 = voltageLimit[FILTERS]) == null ? void 0 : _b2.map((filter) => {
|
|
63
|
+
return {
|
|
64
|
+
[FILTER_ID]: filter[ID],
|
|
65
|
+
[FILTER_NAME]: filter[NAME]
|
|
66
|
+
};
|
|
67
|
+
})) ?? []
|
|
68
|
+
};
|
|
69
|
+
})) ?? [],
|
|
70
|
+
[GENERATORS_SELECTION_TYPE]: newParams[GENERATORS_SELECTION_TYPE] ?? EquipmentsSelectionType.ALL_EXCEPT,
|
|
71
|
+
[VARIABLE_Q_GENERATORS]: ((_g = newParams[VARIABLE_Q_GENERATORS]) == null ? void 0 : _g.map((filter) => {
|
|
72
|
+
return {
|
|
73
|
+
[FILTER_ID]: filter[ID],
|
|
74
|
+
[FILTER_NAME]: filter[NAME]
|
|
75
|
+
};
|
|
76
|
+
})) ?? [],
|
|
77
|
+
[TRANSFORMERS_SELECTION_TYPE]: newParams[TRANSFORMERS_SELECTION_TYPE] ?? EquipmentsSelectionType.NONE_EXCEPT,
|
|
78
|
+
[VARIABLE_TRANSFORMERS]: ((_h = newParams[VARIABLE_TRANSFORMERS]) == null ? void 0 : _h.map((filter) => {
|
|
79
|
+
return {
|
|
80
|
+
[FILTER_ID]: filter[ID],
|
|
81
|
+
[FILTER_NAME]: filter[NAME]
|
|
82
|
+
};
|
|
83
|
+
})) ?? [],
|
|
84
|
+
[SHUNT_COMPENSATORS_SELECTION_TYPE]: newParams[SHUNT_COMPENSATORS_SELECTION_TYPE] ?? EquipmentsSelectionType.NONE_EXCEPT,
|
|
85
|
+
[VARIABLE_SHUNT_COMPENSATORS]: ((_i = newParams[VARIABLE_SHUNT_COMPENSATORS]) == null ? void 0 : _i.map((filter) => {
|
|
86
|
+
return {
|
|
87
|
+
[FILTER_ID]: filter[ID],
|
|
88
|
+
[FILTER_NAME]: filter[NAME]
|
|
89
|
+
};
|
|
90
|
+
})) ?? []
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
const fromVoltageInitParamsDataToFormValues = (parameters) => {
|
|
95
|
+
var _a, _b, _c, _d, _e;
|
|
96
|
+
return {
|
|
97
|
+
[VoltageInitTabValues.GENERAL]: {
|
|
98
|
+
[GENERAL_APPLY_MODIFICATIONS]: DEFAULT_GENERAL_APPLY_MODIFICATIONS,
|
|
99
|
+
[UPDATE_BUS_VOLTAGE]: parameters[UPDATE_BUS_VOLTAGE],
|
|
100
|
+
[REACTIVE_SLACKS_THRESHOLD]: parameters.reactiveSlacksThreshold,
|
|
101
|
+
[SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: parameters.shuntCompensatorActivationThreshold
|
|
102
|
+
},
|
|
103
|
+
[VOLTAGE_LIMITS_MODIFICATION]: ((_a = parameters == null ? void 0 : parameters.voltageLimitsModification) == null ? void 0 : _a.map((voltageLimit) => {
|
|
104
|
+
var _a2;
|
|
105
|
+
return {
|
|
106
|
+
[SELECTED]: false,
|
|
107
|
+
[FILTERS]: (_a2 = voltageLimit[FILTERS]) == null ? void 0 : _a2.map((filter) => {
|
|
108
|
+
return {
|
|
109
|
+
[ID]: filter[FILTER_ID],
|
|
110
|
+
[NAME]: filter[FILTER_NAME]
|
|
111
|
+
};
|
|
112
|
+
}),
|
|
113
|
+
[LOW_VOLTAGE_LIMIT]: voltageLimit[LOW_VOLTAGE_LIMIT],
|
|
114
|
+
[HIGH_VOLTAGE_LIMIT]: voltageLimit[HIGH_VOLTAGE_LIMIT]
|
|
115
|
+
};
|
|
116
|
+
})) ?? [],
|
|
117
|
+
[VOLTAGE_LIMITS_DEFAULT]: ((_b = parameters == null ? void 0 : parameters.voltageLimitsDefault) == null ? void 0 : _b.map((voltageLimit) => {
|
|
118
|
+
var _a2;
|
|
119
|
+
return {
|
|
120
|
+
[SELECTED]: false,
|
|
121
|
+
[FILTERS]: (_a2 = voltageLimit[FILTERS]) == null ? void 0 : _a2.map((filter) => {
|
|
122
|
+
return {
|
|
123
|
+
[ID]: filter[FILTER_ID],
|
|
124
|
+
[NAME]: filter[FILTER_NAME]
|
|
125
|
+
};
|
|
126
|
+
}),
|
|
127
|
+
[LOW_VOLTAGE_LIMIT]: voltageLimit[LOW_VOLTAGE_LIMIT],
|
|
128
|
+
[HIGH_VOLTAGE_LIMIT]: voltageLimit[HIGH_VOLTAGE_LIMIT]
|
|
129
|
+
};
|
|
130
|
+
})) ?? [],
|
|
131
|
+
[GENERATORS_SELECTION_TYPE]: (parameters == null ? void 0 : parameters[GENERATORS_SELECTION_TYPE]) ?? EquipmentsSelectionType.ALL_EXCEPT,
|
|
132
|
+
[VARIABLE_Q_GENERATORS]: (_c = parameters == null ? void 0 : parameters[VARIABLE_Q_GENERATORS]) == null ? void 0 : _c.map((filter) => {
|
|
133
|
+
return {
|
|
134
|
+
[ID]: filter[FILTER_ID],
|
|
135
|
+
[NAME]: filter[FILTER_NAME]
|
|
136
|
+
};
|
|
137
|
+
}),
|
|
138
|
+
[TRANSFORMERS_SELECTION_TYPE]: (parameters == null ? void 0 : parameters[TRANSFORMERS_SELECTION_TYPE]) ?? EquipmentsSelectionType.NONE_EXCEPT,
|
|
139
|
+
[VARIABLE_TRANSFORMERS]: (_d = parameters == null ? void 0 : parameters[VARIABLE_TRANSFORMERS]) == null ? void 0 : _d.map((filter) => {
|
|
140
|
+
return {
|
|
141
|
+
[ID]: filter[FILTER_ID],
|
|
142
|
+
[NAME]: filter[FILTER_NAME]
|
|
143
|
+
};
|
|
144
|
+
}),
|
|
145
|
+
[SHUNT_COMPENSATORS_SELECTION_TYPE]: (parameters == null ? void 0 : parameters[SHUNT_COMPENSATORS_SELECTION_TYPE]) ?? EquipmentsSelectionType.NONE_EXCEPT,
|
|
146
|
+
[VARIABLE_SHUNT_COMPENSATORS]: (_e = parameters == null ? void 0 : parameters[VARIABLE_SHUNT_COMPENSATORS]) == null ? void 0 : _e.map((filter) => {
|
|
147
|
+
return {
|
|
148
|
+
[ID]: filter[FILTER_ID],
|
|
149
|
+
[NAME]: filter[FILTER_NAME]
|
|
150
|
+
};
|
|
151
|
+
})
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
const fromStudyVoltageInitParamsDataToFormValues = (parameters) => {
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
156
|
+
return {
|
|
157
|
+
[VoltageInitTabValues.GENERAL]: {
|
|
158
|
+
[GENERAL_APPLY_MODIFICATIONS]: parameters.applyModifications,
|
|
159
|
+
[UPDATE_BUS_VOLTAGE]: ((_a = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _a[UPDATE_BUS_VOLTAGE]) ?? DEFAULT_UPDATE_BUS_VOLTAGE,
|
|
160
|
+
[REACTIVE_SLACKS_THRESHOLD]: (_b = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _b.reactiveSlacksThreshold,
|
|
161
|
+
[SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: (_c = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _c.shuntCompensatorActivationThreshold
|
|
162
|
+
},
|
|
163
|
+
[VOLTAGE_LIMITS_MODIFICATION]: ((_e = (_d = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _d.voltageLimitsModification) == null ? void 0 : _e.map((voltageLimit) => {
|
|
164
|
+
var _a2;
|
|
165
|
+
return {
|
|
166
|
+
[SELECTED]: false,
|
|
167
|
+
[FILTERS]: (_a2 = voltageLimit[FILTERS]) == null ? void 0 : _a2.map((filter) => {
|
|
168
|
+
return {
|
|
169
|
+
[ID]: filter[FILTER_ID],
|
|
170
|
+
[NAME]: filter[FILTER_NAME]
|
|
171
|
+
};
|
|
172
|
+
}),
|
|
173
|
+
[LOW_VOLTAGE_LIMIT]: voltageLimit[LOW_VOLTAGE_LIMIT],
|
|
174
|
+
[HIGH_VOLTAGE_LIMIT]: voltageLimit[HIGH_VOLTAGE_LIMIT]
|
|
175
|
+
};
|
|
176
|
+
})) ?? [],
|
|
177
|
+
[VOLTAGE_LIMITS_DEFAULT]: ((_g = (_f = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _f.voltageLimitsDefault) == null ? void 0 : _g.map((voltageLimit) => {
|
|
178
|
+
var _a2;
|
|
179
|
+
return {
|
|
180
|
+
[SELECTED]: false,
|
|
181
|
+
[FILTERS]: (_a2 = voltageLimit[FILTERS]) == null ? void 0 : _a2.map((filter) => {
|
|
182
|
+
return {
|
|
183
|
+
[ID]: filter[FILTER_ID],
|
|
184
|
+
[NAME]: filter[FILTER_NAME]
|
|
185
|
+
};
|
|
186
|
+
}),
|
|
187
|
+
[LOW_VOLTAGE_LIMIT]: voltageLimit[LOW_VOLTAGE_LIMIT],
|
|
188
|
+
[HIGH_VOLTAGE_LIMIT]: voltageLimit[HIGH_VOLTAGE_LIMIT]
|
|
189
|
+
};
|
|
190
|
+
})) ?? [],
|
|
191
|
+
[GENERATORS_SELECTION_TYPE]: ((_h = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _h[GENERATORS_SELECTION_TYPE]) ?? EquipmentsSelectionType.ALL_EXCEPT,
|
|
192
|
+
[VARIABLE_Q_GENERATORS]: (_j = (_i = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _i[VARIABLE_Q_GENERATORS]) == null ? void 0 : _j.map((filter) => {
|
|
193
|
+
return {
|
|
194
|
+
[ID]: filter[FILTER_ID],
|
|
195
|
+
[NAME]: filter[FILTER_NAME]
|
|
196
|
+
};
|
|
197
|
+
}),
|
|
198
|
+
[TRANSFORMERS_SELECTION_TYPE]: ((_k = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _k[TRANSFORMERS_SELECTION_TYPE]) ?? EquipmentsSelectionType.NONE_EXCEPT,
|
|
199
|
+
[VARIABLE_TRANSFORMERS]: (_m = (_l = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _l[VARIABLE_TRANSFORMERS]) == null ? void 0 : _m.map((filter) => {
|
|
200
|
+
return {
|
|
201
|
+
[ID]: filter[FILTER_ID],
|
|
202
|
+
[NAME]: filter[FILTER_NAME]
|
|
203
|
+
};
|
|
204
|
+
}),
|
|
205
|
+
[SHUNT_COMPENSATORS_SELECTION_TYPE]: ((_n = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _n[SHUNT_COMPENSATORS_SELECTION_TYPE]) ?? EquipmentsSelectionType.NONE_EXCEPT,
|
|
206
|
+
[VARIABLE_SHUNT_COMPENSATORS]: (_p = (_o = parameters == null ? void 0 : parameters.computationParameters) == null ? void 0 : _o[VARIABLE_SHUNT_COMPENSATORS]) == null ? void 0 : _p.map(
|
|
207
|
+
(filter) => {
|
|
208
|
+
return {
|
|
209
|
+
[ID]: filter[FILTER_ID],
|
|
210
|
+
[NAME]: filter[FILTER_NAME]
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
fromStudyVoltageInitParamsDataToFormValues,
|
|
218
|
+
fromVoltageInitParametersFormToParamValues,
|
|
219
|
+
fromVoltageInitParamsDataToFormValues
|
|
220
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ParametersEditionDialogProps } from '../common';
|
|
2
|
+
export declare function VoltageInitParametersEditionDialog({ id, open, onClose, titleId, name, description, activeDirectory, language, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 "localized-countries";
|
|
18
|
+
import "localized-countries/data/fr";
|
|
19
|
+
import "localized-countries/data/en";
|
|
20
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
21
|
+
import "yup";
|
|
22
|
+
import "../../overflowableText/OverflowableText.js";
|
|
23
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
24
|
+
import "../../customAGGrid/customAggrid.js";
|
|
25
|
+
import "ag-grid-community";
|
|
26
|
+
import "react-papaparse";
|
|
27
|
+
import "react-csv-downloader";
|
|
28
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
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 { useVoltageInitParametersForm } from "./use-voltage-init-parameters-form.js";
|
|
36
|
+
import { VoltageInitParametersForm } from "./voltage-init-parameters-form.js";
|
|
37
|
+
function VoltageInitParametersEditionDialog({
|
|
38
|
+
id,
|
|
39
|
+
open,
|
|
40
|
+
onClose,
|
|
41
|
+
titleId,
|
|
42
|
+
name,
|
|
43
|
+
description,
|
|
44
|
+
activeDirectory,
|
|
45
|
+
language
|
|
46
|
+
}) {
|
|
47
|
+
const voltageInitMethods = useVoltageInitParametersForm({
|
|
48
|
+
parametersUuid: id,
|
|
49
|
+
name,
|
|
50
|
+
description,
|
|
51
|
+
studyUuid: null,
|
|
52
|
+
parameters: null
|
|
53
|
+
});
|
|
54
|
+
const {
|
|
55
|
+
formState: { errors, dirtyFields }
|
|
56
|
+
} = voltageInitMethods.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: voltageInitMethods.onSaveDialog,
|
|
64
|
+
formSchema: voltageInitMethods.formSchema,
|
|
65
|
+
formMethods: voltageInitMethods.formMethods,
|
|
66
|
+
titleId,
|
|
67
|
+
removeOptional: true,
|
|
68
|
+
language,
|
|
69
|
+
disabledSave: disableSave,
|
|
70
|
+
PaperProps: {
|
|
71
|
+
sx: {
|
|
72
|
+
height: "90vh"
|
|
73
|
+
// we want the dialog height to be fixed even when switching tabs
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
children: /* @__PURE__ */ jsx(
|
|
77
|
+
VoltageInitParametersForm,
|
|
78
|
+
{
|
|
79
|
+
voltageInitMethods,
|
|
80
|
+
renderTitleFields: () => {
|
|
81
|
+
return /* @__PURE__ */ jsx(
|
|
82
|
+
NameElementEditorForm,
|
|
83
|
+
{
|
|
84
|
+
initialElementName: name,
|
|
85
|
+
activeDirectory,
|
|
86
|
+
elementType: ElementType.VOLTAGE_INIT_PARAMETERS
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
VoltageInitParametersEditionDialog
|
|
97
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { UseVoltageInitParametersFormReturn } from './use-voltage-init-parameters-form';
|
|
4
|
+
export declare const styles: {
|
|
5
|
+
gridWithActions: (theme: Theme) => {
|
|
6
|
+
overflowY: string;
|
|
7
|
+
overflowX: string;
|
|
8
|
+
paddingRight: string;
|
|
9
|
+
paddingTop: string;
|
|
10
|
+
paddingBottom: string;
|
|
11
|
+
flexGrow: number;
|
|
12
|
+
maxHeight: string;
|
|
13
|
+
};
|
|
14
|
+
gridWithoutActions: (theme: Theme) => {
|
|
15
|
+
overflowY: string;
|
|
16
|
+
overflowX: string;
|
|
17
|
+
paddingRight: string;
|
|
18
|
+
paddingTop: string;
|
|
19
|
+
paddingBottom: string;
|
|
20
|
+
flexGrow: number;
|
|
21
|
+
maxHeight: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
interface VoltageInitParametersFormProps {
|
|
25
|
+
voltageInitMethods: UseVoltageInitParametersFormReturn;
|
|
26
|
+
renderTitleFields?: () => ReactNode;
|
|
27
|
+
renderActions?: () => ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export declare function VoltageInitParametersForm({ voltageInitMethods, renderTitleFields, renderActions, }: Readonly<VoltageInitParametersFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export {};
|