@gridsuite/commons-ui 0.107.1 → 0.109.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 +60 -4
- 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 +42 -4
- package/dist/components/parameters/loadflow/constants.d.ts +0 -1
- package/dist/components/parameters/loadflow/constants.js +0 -2
- package/dist/components/parameters/loadflow/index.js +1 -2
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +7 -12
- 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 +48 -12
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +0 -4
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +1 -2
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +2 -1
- package/dist/components/parameters/network-visualizations/constants.js +5 -1
- package/dist/components/parameters/network-visualizations/index.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/network-visualizations.types.d.ts +2 -1
- package/dist/components/parameters/network-visualizations/network-visualizations.types.js +2 -0
- 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 +173 -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 +72 -5
- 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/networkModificationsEn.js +12 -12
- package/dist/translations/en/parameters.d.ts +32 -1
- package/dist/translations/en/parameters.js +33 -2
- 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/networkModificationsFr.js +12 -12
- package/dist/translations/fr/parameters.d.ts +33 -1
- package/dist/translations/fr/parameters.js +34 -2
- 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,173 @@
|
|
|
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 { updateVoltageInitParameters } from "../../../services/study.js";
|
|
7
|
+
import { getVoltageInitParameters } from "../../../services/voltage-init.js";
|
|
8
|
+
import "localized-countries";
|
|
9
|
+
import "localized-countries/data/fr";
|
|
10
|
+
import "localized-countries/data/en";
|
|
11
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
12
|
+
import "react-hook-form";
|
|
13
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
14
|
+
import { SubmitButton } from "../../inputs/reactHookForm/utils/SubmitButton.js";
|
|
15
|
+
import "@mui/icons-material";
|
|
16
|
+
import "yup";
|
|
17
|
+
import "../../overflowableText/OverflowableText.js";
|
|
18
|
+
import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
|
|
19
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
20
|
+
import "../../customAGGrid/customAggrid.js";
|
|
21
|
+
import "ag-grid-community";
|
|
22
|
+
import "react-papaparse";
|
|
23
|
+
import "react-csv-downloader";
|
|
24
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
25
|
+
import { PopupConfirmationDialog } from "../../dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
|
|
26
|
+
import "../../../utils/conversionUtils.js";
|
|
27
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
28
|
+
import "../../../utils/yupConfig.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 { LabelledButton } from "../common/parameters.js";
|
|
36
|
+
import { CreateParameterDialog } from "../common/parameters-creation-dialog.js";
|
|
37
|
+
import "../common/widget/parameter-line-slider.js";
|
|
38
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
39
|
+
import { useVoltageInitParametersForm } from "./use-voltage-init-parameters-form.js";
|
|
40
|
+
import { VoltageInitParametersForm } from "./voltage-init-parameters-form.js";
|
|
41
|
+
import { fromVoltageInitParamsDataToFormValues, fromVoltageInitParametersFormToParamValues } from "./voltage-init-form-utils.js";
|
|
42
|
+
import { DEFAULT_GENERAL_APPLY_MODIFICATIONS } from "./constants.js";
|
|
43
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
44
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
45
|
+
function VoltageInitParametersInLine({
|
|
46
|
+
studyUuid,
|
|
47
|
+
setHaveDirtyFields,
|
|
48
|
+
voltageInitParameters
|
|
49
|
+
}) {
|
|
50
|
+
const voltageInitMethods = useVoltageInitParametersForm({
|
|
51
|
+
parametersUuid: null,
|
|
52
|
+
name: null,
|
|
53
|
+
description: null,
|
|
54
|
+
studyUuid,
|
|
55
|
+
parameters: voltageInitParameters
|
|
56
|
+
});
|
|
57
|
+
const intl = useIntl();
|
|
58
|
+
const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
|
|
59
|
+
const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
|
|
60
|
+
const [openResetConfirmation, setOpenResetConfirmation] = useState(false);
|
|
61
|
+
const { snackError } = useSnackMessage();
|
|
62
|
+
const { formState, getValues, handleSubmit, reset, trigger } = voltageInitMethods.formMethods;
|
|
63
|
+
const handleLoadParameters = useCallback(
|
|
64
|
+
(newParams) => {
|
|
65
|
+
if (newParams == null ? void 0 : newParams.length) {
|
|
66
|
+
setOpenSelectParameterDialog(false);
|
|
67
|
+
const parametersUuid = newParams[0].id;
|
|
68
|
+
getVoltageInitParameters(parametersUuid).then((params) => {
|
|
69
|
+
reset(fromVoltageInitParamsDataToFormValues(params), {
|
|
70
|
+
keepDefaultValues: true
|
|
71
|
+
});
|
|
72
|
+
}).catch((error) => {
|
|
73
|
+
snackError({
|
|
74
|
+
messageTxt: error.message,
|
|
75
|
+
headerId: "paramsRetrievingError"
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
setOpenSelectParameterDialog(false);
|
|
80
|
+
},
|
|
81
|
+
[reset, snackError]
|
|
82
|
+
);
|
|
83
|
+
const resetVoltageInitParameters = useCallback(() => {
|
|
84
|
+
updateVoltageInitParameters(studyUuid, {
|
|
85
|
+
applyModifications: DEFAULT_GENERAL_APPLY_MODIFICATIONS,
|
|
86
|
+
computationParameters: null
|
|
87
|
+
// null means Reset
|
|
88
|
+
}).catch((error) => {
|
|
89
|
+
snackError({
|
|
90
|
+
messageTxt: error.message,
|
|
91
|
+
headerId: "updateVoltageInitParametersError"
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
setOpenResetConfirmation(false);
|
|
95
|
+
}, [studyUuid, snackError]);
|
|
96
|
+
const handleResetClick = useCallback(() => {
|
|
97
|
+
setOpenResetConfirmation(true);
|
|
98
|
+
}, []);
|
|
99
|
+
const handleCancelReset = useCallback(() => {
|
|
100
|
+
setOpenResetConfirmation(false);
|
|
101
|
+
}, []);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
setHaveDirtyFields(!!Object.keys(formState.dirtyFields).length);
|
|
104
|
+
}, [formState, setHaveDirtyFields]);
|
|
105
|
+
const handleOpenSaveDialog = useCallback(() => {
|
|
106
|
+
trigger().then((isValid) => {
|
|
107
|
+
if (isValid) {
|
|
108
|
+
setOpenCreateParameterDialog(true);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}, [trigger]);
|
|
112
|
+
return /* @__PURE__ */ jsx(
|
|
113
|
+
VoltageInitParametersForm,
|
|
114
|
+
{
|
|
115
|
+
voltageInitMethods,
|
|
116
|
+
renderActions: () => {
|
|
117
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
118
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, item: true, children: [
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
LabelledButton,
|
|
121
|
+
{
|
|
122
|
+
callback: () => setOpenSelectParameterDialog(true),
|
|
123
|
+
label: "settings.button.chooseSettings"
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx(LabelledButton, { callback: handleOpenSaveDialog, label: "save" }),
|
|
127
|
+
/* @__PURE__ */ jsx(LabelledButton, { callback: handleResetClick, label: "resetToDefault" }),
|
|
128
|
+
/* @__PURE__ */ jsx(SubmitButton, { onClick: handleSubmit(voltageInitMethods.onSaveInline), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) })
|
|
129
|
+
] }),
|
|
130
|
+
openCreateParameterDialog && /* @__PURE__ */ jsx(
|
|
131
|
+
CreateParameterDialog,
|
|
132
|
+
{
|
|
133
|
+
studyUuid,
|
|
134
|
+
open: openCreateParameterDialog,
|
|
135
|
+
onClose: () => setOpenCreateParameterDialog(false),
|
|
136
|
+
parameterValues: getValues,
|
|
137
|
+
parameterFormatter: (params) => fromVoltageInitParametersFormToParamValues(params).computationParameters,
|
|
138
|
+
parameterType: ElementType.VOLTAGE_INIT_PARAMETERS
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
openSelectParameterDialog && /* @__PURE__ */ jsx(
|
|
142
|
+
DirectoryItemSelector,
|
|
143
|
+
{
|
|
144
|
+
open: openSelectParameterDialog,
|
|
145
|
+
onClose: handleLoadParameters,
|
|
146
|
+
types: [ElementType.VOLTAGE_INIT_PARAMETERS],
|
|
147
|
+
title: intl.formatMessage({
|
|
148
|
+
id: "showSelectParameterDialog"
|
|
149
|
+
}),
|
|
150
|
+
multiSelect: false,
|
|
151
|
+
validationButtonText: intl.formatMessage({
|
|
152
|
+
id: "validate"
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
openResetConfirmation && /* @__PURE__ */ jsx(
|
|
157
|
+
PopupConfirmationDialog,
|
|
158
|
+
{
|
|
159
|
+
message: "resetParamsConfirmation",
|
|
160
|
+
validateButtonLabel: "validate",
|
|
161
|
+
openConfirmationPopup: openResetConfirmation,
|
|
162
|
+
setOpenConfirmationPopup: handleCancelReset,
|
|
163
|
+
handlePopupConfirmation: resetVoltageInitParameters
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
] });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
export {
|
|
172
|
+
VoltageInitParametersInLine
|
|
173
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UUID } from 'crypto';
|
|
2
|
+
import { FILTER_ID, FILTER_NAME, FILTERS, GENERATORS_SELECTION_TYPE, HIGH_VOLTAGE_LIMIT, LOW_VOLTAGE_LIMIT, REACTIVE_SLACKS_THRESHOLD, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, SHUNT_COMPENSATORS_SELECTION_TYPE, TRANSFORMERS_SELECTION_TYPE, UPDATE_BUS_VOLTAGE, VARIABLE_Q_GENERATORS, VARIABLE_SHUNT_COMPENSATORS, VARIABLE_TRANSFORMERS, VOLTAGE_LIMITS_DEFAULT, VOLTAGE_LIMITS_MODIFICATION } from './constants';
|
|
3
|
+
export declare enum EquipmentsSelectionType {
|
|
4
|
+
ALL_EXCEPT = "ALL_EXCEPT",
|
|
5
|
+
NONE_EXCEPT = "NONE_EXCEPT"
|
|
6
|
+
}
|
|
7
|
+
type FilterIdentifier = {
|
|
8
|
+
[FILTER_ID]: UUID;
|
|
9
|
+
[FILTER_NAME]: string;
|
|
10
|
+
};
|
|
11
|
+
type VoltageLimitParam = {
|
|
12
|
+
[FILTERS]: FilterIdentifier[];
|
|
13
|
+
[LOW_VOLTAGE_LIMIT]: number;
|
|
14
|
+
[HIGH_VOLTAGE_LIMIT]: number;
|
|
15
|
+
};
|
|
16
|
+
export type VoltageInitParameters = {
|
|
17
|
+
[UPDATE_BUS_VOLTAGE]: boolean;
|
|
18
|
+
[REACTIVE_SLACKS_THRESHOLD]: number;
|
|
19
|
+
[SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD]: number;
|
|
20
|
+
[VOLTAGE_LIMITS_MODIFICATION]: VoltageLimitParam[];
|
|
21
|
+
[VOLTAGE_LIMITS_DEFAULT]: VoltageLimitParam[];
|
|
22
|
+
[GENERATORS_SELECTION_TYPE]: EquipmentsSelectionType;
|
|
23
|
+
[VARIABLE_Q_GENERATORS]: FilterIdentifier[];
|
|
24
|
+
[TRANSFORMERS_SELECTION_TYPE]: EquipmentsSelectionType;
|
|
25
|
+
[VARIABLE_TRANSFORMERS]: FilterIdentifier[];
|
|
26
|
+
[SHUNT_COMPENSATORS_SELECTION_TYPE]: EquipmentsSelectionType;
|
|
27
|
+
[VARIABLE_SHUNT_COMPENSATORS]: FilterIdentifier[];
|
|
28
|
+
};
|
|
29
|
+
export type VoltageInitStudyParameters = {
|
|
30
|
+
applyModifications: boolean;
|
|
31
|
+
computationParameters: VoltageInitParameters | null;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var EquipmentsSelectionType = /* @__PURE__ */ ((EquipmentsSelectionType2) => {
|
|
2
|
+
EquipmentsSelectionType2["ALL_EXCEPT"] = "ALL_EXCEPT";
|
|
3
|
+
EquipmentsSelectionType2["NONE_EXCEPT"] = "NONE_EXCEPT";
|
|
4
|
+
return EquipmentsSelectionType2;
|
|
5
|
+
})(EquipmentsSelectionType || {});
|
|
6
|
+
export {
|
|
7
|
+
EquipmentsSelectionType
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export declare function VoltageLimitsParameters(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useFieldArray } from "react-hook-form";
|
|
4
|
+
import { Info } from "@mui/icons-material";
|
|
5
|
+
import { Tooltip, IconButton, Grid, Typography } from "@mui/material";
|
|
6
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
7
|
+
import { FILTERS, LOW_VOLTAGE_LIMIT, HIGH_VOLTAGE_LIMIT, VOLTAGE_LIMITS_MODIFICATION, VOLTAGE_LIMITS_DEFAULT } from "./constants.js";
|
|
8
|
+
import "../../../utils/conversionUtils.js";
|
|
9
|
+
import { ElementType } from "../../../utils/types/elementType.js";
|
|
10
|
+
import { EquipmentType } from "../../../utils/types/equipmentType.js";
|
|
11
|
+
import "../../../utils/yupConfig.js";
|
|
12
|
+
import { VoltageAdornment } from "../common/constant.js";
|
|
13
|
+
import "localized-countries";
|
|
14
|
+
import "localized-countries/data/fr";
|
|
15
|
+
import "localized-countries/data/en";
|
|
16
|
+
import "notistack";
|
|
17
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
18
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
19
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
20
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
21
|
+
import "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 "../common/widget/parameter-line-slider.js";
|
|
36
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
37
|
+
import { DndTable } from "../../dnd-table/dnd-table.js";
|
|
38
|
+
import { DndColumnType, SELECTED } from "../../dnd-table/dnd-table.type.js";
|
|
39
|
+
function VoltageLimitsParameters() {
|
|
40
|
+
const intl = useIntl();
|
|
41
|
+
const VoltageLevelFilterTooltip = useMemo(() => {
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
Tooltip,
|
|
44
|
+
{
|
|
45
|
+
title: intl.formatMessage({
|
|
46
|
+
id: "VoltageLevelFilterTooltip"
|
|
47
|
+
}),
|
|
48
|
+
children: /* @__PURE__ */ jsx(IconButton, { children: /* @__PURE__ */ jsx(Info, {}) })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}, [intl]);
|
|
52
|
+
const VOLTAGE_LIMITS_MODIFICATION_COLUMNS_DEFINITIONS = useMemo(() => {
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
label: "VoltageLevelFilter",
|
|
56
|
+
dataKey: FILTERS,
|
|
57
|
+
initialValue: [],
|
|
58
|
+
editable: true,
|
|
59
|
+
type: DndColumnType.DIRECTORY_ITEMS,
|
|
60
|
+
equipmentTypes: [EquipmentType.VOLTAGE_LEVEL],
|
|
61
|
+
elementType: ElementType.FILTER,
|
|
62
|
+
titleId: "FiltersListsSelection",
|
|
63
|
+
extra: VoltageLevelFilterTooltip
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: "LowVoltageLimitAdjustment",
|
|
67
|
+
dataKey: LOW_VOLTAGE_LIMIT,
|
|
68
|
+
initialValue: null,
|
|
69
|
+
editable: true,
|
|
70
|
+
type: DndColumnType.NUMERIC,
|
|
71
|
+
adornment: VoltageAdornment,
|
|
72
|
+
textAlign: "right"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "HighVoltageLimitAdjustment",
|
|
76
|
+
dataKey: HIGH_VOLTAGE_LIMIT,
|
|
77
|
+
initialValue: null,
|
|
78
|
+
editable: true,
|
|
79
|
+
type: DndColumnType.NUMERIC,
|
|
80
|
+
adornment: VoltageAdornment,
|
|
81
|
+
textAlign: "right"
|
|
82
|
+
}
|
|
83
|
+
].map((column) => ({
|
|
84
|
+
...column,
|
|
85
|
+
label: intl.formatMessage({ id: column.label }).toLowerCase().replace(/^\w/, (c) => c.toUpperCase())
|
|
86
|
+
}));
|
|
87
|
+
}, [VoltageLevelFilterTooltip, intl]);
|
|
88
|
+
const VOLTAGE_LIMITS_DEFAULT_COLUMNS_DEFINITIONS = useMemo(() => {
|
|
89
|
+
return [
|
|
90
|
+
{
|
|
91
|
+
label: "VoltageLevelFilter",
|
|
92
|
+
dataKey: FILTERS,
|
|
93
|
+
initialValue: [],
|
|
94
|
+
editable: true,
|
|
95
|
+
type: DndColumnType.DIRECTORY_ITEMS,
|
|
96
|
+
equipmentTypes: [EquipmentType.VOLTAGE_LEVEL],
|
|
97
|
+
elementType: ElementType.FILTER,
|
|
98
|
+
titleId: "FiltersListsSelection",
|
|
99
|
+
extra: VoltageLevelFilterTooltip
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: "LowVoltageLimitDefault",
|
|
103
|
+
dataKey: LOW_VOLTAGE_LIMIT,
|
|
104
|
+
initialValue: null,
|
|
105
|
+
editable: true,
|
|
106
|
+
type: DndColumnType.NUMERIC,
|
|
107
|
+
adornment: VoltageAdornment,
|
|
108
|
+
textAlign: "right"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
label: "HighVoltageLimitDefault",
|
|
112
|
+
dataKey: HIGH_VOLTAGE_LIMIT,
|
|
113
|
+
initialValue: null,
|
|
114
|
+
editable: true,
|
|
115
|
+
type: DndColumnType.NUMERIC,
|
|
116
|
+
adornment: VoltageAdornment,
|
|
117
|
+
textAlign: "right"
|
|
118
|
+
}
|
|
119
|
+
].map((column) => ({
|
|
120
|
+
...column,
|
|
121
|
+
label: intl.formatMessage({ id: column.label }).toLowerCase().replace(/^\w/, (c) => c.toUpperCase())
|
|
122
|
+
}));
|
|
123
|
+
}, [VoltageLevelFilterTooltip, intl]);
|
|
124
|
+
const newModificationRowData = useMemo(() => {
|
|
125
|
+
const newRowData = {};
|
|
126
|
+
newRowData[SELECTED] = false;
|
|
127
|
+
VOLTAGE_LIMITS_MODIFICATION_COLUMNS_DEFINITIONS.forEach((column) => {
|
|
128
|
+
newRowData[column.dataKey] = column.initialValue;
|
|
129
|
+
});
|
|
130
|
+
return newRowData;
|
|
131
|
+
}, [VOLTAGE_LIMITS_MODIFICATION_COLUMNS_DEFINITIONS]);
|
|
132
|
+
const createVoltageLimitModificationRows = () => [newModificationRowData];
|
|
133
|
+
const newDefaultRowData = useMemo(() => {
|
|
134
|
+
const newRowData = {};
|
|
135
|
+
newRowData[SELECTED] = false;
|
|
136
|
+
VOLTAGE_LIMITS_DEFAULT_COLUMNS_DEFINITIONS.forEach((column) => {
|
|
137
|
+
newRowData[column.dataKey] = column.initialValue;
|
|
138
|
+
});
|
|
139
|
+
return newRowData;
|
|
140
|
+
}, [VOLTAGE_LIMITS_DEFAULT_COLUMNS_DEFINITIONS]);
|
|
141
|
+
const createVoltageLimitDefaultRows = () => [newDefaultRowData];
|
|
142
|
+
const useVoltageLimitsModificationFieldArrayOutput = useFieldArray({
|
|
143
|
+
name: `${VOLTAGE_LIMITS_MODIFICATION}`
|
|
144
|
+
});
|
|
145
|
+
const useVoltageLimitsDefaultFieldArrayOutput = useFieldArray({
|
|
146
|
+
name: `${VOLTAGE_LIMITS_DEFAULT}`
|
|
147
|
+
});
|
|
148
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, children: [
|
|
149
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", children: [
|
|
150
|
+
/* @__PURE__ */ jsx(Typography, { component: "span", variant: "h6", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "AdjustExistingLimits" }) }),
|
|
151
|
+
/* @__PURE__ */ jsx(
|
|
152
|
+
Tooltip,
|
|
153
|
+
{
|
|
154
|
+
title: /* @__PURE__ */ jsx(FormattedMessage, { id: "AdjustExistingLimitsInfo" }),
|
|
155
|
+
placement: "right-start",
|
|
156
|
+
sx: { marginLeft: 1 },
|
|
157
|
+
children: /* @__PURE__ */ jsx(Info, {})
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
DndTable,
|
|
163
|
+
{
|
|
164
|
+
arrayFormName: `${VOLTAGE_LIMITS_MODIFICATION}`,
|
|
165
|
+
columnsDefinition: VOLTAGE_LIMITS_MODIFICATION_COLUMNS_DEFINITIONS,
|
|
166
|
+
useFieldArrayOutput: useVoltageLimitsModificationFieldArrayOutput,
|
|
167
|
+
createRows: createVoltageLimitModificationRows,
|
|
168
|
+
tableHeight: 270,
|
|
169
|
+
withAddRowsDialog: false
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ jsx(Typography, { component: "span", variant: "h6", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "SetDefaultLimits" }) }),
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
DndTable,
|
|
175
|
+
{
|
|
176
|
+
arrayFormName: `${VOLTAGE_LIMITS_DEFAULT}`,
|
|
177
|
+
columnsDefinition: VOLTAGE_LIMITS_DEFAULT_COLUMNS_DEFINITIONS,
|
|
178
|
+
useFieldArrayOutput: useVoltageLimitsDefaultFieldArrayOutput,
|
|
179
|
+
createRows: createVoltageLimitDefaultRows,
|
|
180
|
+
tableHeight: 270,
|
|
181
|
+
withAddRowsDialog: false
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
] });
|
|
185
|
+
}
|
|
186
|
+
export {
|
|
187
|
+
VoltageLimitsParameters
|
|
188
|
+
};
|