@gridsuite/commons-ui 0.166.0 → 0.167.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.
Files changed (55) hide show
  1. package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +2 -2
  2. package/dist/components/dnd-table/dnd-table.d.ts +1 -2
  3. package/dist/components/dnd-table/dnd-table.js +2 -0
  4. package/dist/components/dnd-table/dnd-table.type.d.ts +6 -1
  5. package/dist/components/dnd-table/dnd-table.type.js +1 -0
  6. package/dist/components/index.js +15 -0
  7. package/dist/components/parameters/common/ProviderParam.js +2 -2
  8. package/dist/components/parameters/common/parameter-dnd-table-field.d.ts +9 -0
  9. package/dist/components/parameters/common/parameter-dnd-table-field.js +85 -0
  10. package/dist/components/parameters/common/parameter-field.d.ts +15 -0
  11. package/dist/components/parameters/{loadflow/load-flow-parameter-field.js → common/parameter-field.js} +7 -13
  12. package/dist/components/parameters/dynamic-margin-calculation/constants.d.ts +18 -0
  13. package/dist/components/parameters/dynamic-margin-calculation/constants.js +26 -0
  14. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-dialog.d.ts +6 -0
  15. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-dialog.js +1 -0
  16. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.d.ts +9 -0
  17. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +95 -0
  18. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.d.ts +10 -0
  19. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +176 -0
  20. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.d.ts +10 -0
  21. package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js +8 -0
  22. package/dist/components/parameters/dynamic-margin-calculation/index.d.ts +8 -0
  23. package/dist/components/parameters/dynamic-margin-calculation/index.js +17 -0
  24. package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.d.ts +29 -0
  25. package/dist/components/parameters/dynamic-margin-calculation/loads-variations-parameters.js +154 -0
  26. package/dist/components/parameters/dynamic-margin-calculation/time-delay-parameters.d.ts +24 -0
  27. package/dist/components/parameters/dynamic-margin-calculation/time-delay-parameters.js +62 -0
  28. package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.d.ts +30 -0
  29. package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +179 -0
  30. package/dist/components/parameters/index.d.ts +1 -0
  31. package/dist/components/parameters/index.js +15 -0
  32. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +4 -4
  33. package/dist/index.js +22 -0
  34. package/dist/services/dynamic-margin-calculation.d.ts +5 -0
  35. package/dist/services/dynamic-margin-calculation.js +35 -0
  36. package/dist/services/index.d.ts +1 -0
  37. package/dist/services/index.js +4 -0
  38. package/dist/translations/en/businessErrorsEn.d.ts +2 -0
  39. package/dist/translations/en/businessErrorsEn.js +3 -1
  40. package/dist/translations/en/parameters.d.ts +20 -0
  41. package/dist/translations/en/parameters.js +22 -1
  42. package/dist/translations/fr/businessErrorsFr.d.ts +2 -0
  43. package/dist/translations/fr/businessErrorsFr.js +3 -1
  44. package/dist/translations/fr/parameters.d.ts +20 -0
  45. package/dist/translations/fr/parameters.js +22 -1
  46. package/dist/utils/index.js +3 -0
  47. package/dist/utils/types/dynamic-margin-calculation.type.d.ts +32 -0
  48. package/dist/utils/types/dynamic-margin-calculation.type.js +14 -0
  49. package/dist/utils/types/elementType.d.ts +1 -0
  50. package/dist/utils/types/elementType.js +1 -0
  51. package/dist/utils/types/index.d.ts +1 -0
  52. package/dist/utils/types/index.js +3 -0
  53. package/dist/utils/types/parameters.type.d.ts +2 -1
  54. package/package.json +1 -1
  55. package/dist/components/parameters/loadflow/load-flow-parameter-field.d.ts +0 -19
@@ -0,0 +1,176 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import { useIntl, FormattedMessage } from "react-intl";
4
+ import { useState, useCallback, useEffect } from "react";
5
+ import "../../../utils/conversionUtils.js";
6
+ import { snackWithFallback } from "../../../utils/error.js";
7
+ import { ElementType } from "../../../utils/types/elementType.js";
8
+ import "../../../utils/types/equipmentType.js";
9
+ import "@mui/icons-material";
10
+ import { mergeSx } from "../../../utils/styles.js";
11
+ import "../../../utils/yupConfig.js";
12
+ import { DynamicMarginCalculationForm } from "./dynamic-margin-calculation-form.js";
13
+ import { useDynamicMarginCalculationParametersForm, toParamsInfos, toFormValues } from "./use-dynamic-margin-calculation-parameters-form.js";
14
+ import { LabelledButton } from "../common/parameters.js";
15
+ import { SubmitButton } from "../../inputs/reactHookForm/utils/SubmitButton.js";
16
+ import { PopupConfirmationDialog } from "../../dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
17
+ import { parametersStyles } from "../parameters-style.js";
18
+ import { CreateParameterDialog } from "../common/parameters-creation-dialog.js";
19
+ import "../../overflowableText/OverflowableText.js";
20
+ import "react-hook-form";
21
+ import { fetchDynamicMarginCalculationParameters } from "../../../services/dynamic-margin-calculation.js";
22
+ import "localized-countries";
23
+ import "localized-countries/data/fr";
24
+ import "localized-countries/data/en";
25
+ import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
26
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
27
+ import "yup";
28
+ import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
29
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
30
+ import "../../customAGGrid/customAggrid.js";
31
+ import "ag-grid-community";
32
+ import "react-papaparse";
33
+ import "react-csv-downloader";
34
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
35
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
36
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
37
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
38
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
39
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
40
+ import "@react-querybuilder/material";
41
+ import "../../filter/expert/expertFilterConstants.js";
42
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
43
+ import "uuid";
44
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
45
+ import "react-querybuilder";
46
+ import "../common/widget/parameter-line-slider.js";
47
+ import "../common/limitreductions/columns-definitions.js";
48
+ function DynamicMarginCalculationInline({
49
+ studyUuid,
50
+ parametersBackend,
51
+ setHaveDirtyFields
52
+ }) {
53
+ const [providers, , , , , params, , updateParams, resetParams, ,] = parametersBackend;
54
+ const dynamicMarginCalculationMethods = useDynamicMarginCalculationParametersForm({
55
+ providers,
56
+ params,
57
+ name: null,
58
+ description: null
59
+ });
60
+ const intl = useIntl();
61
+ const { snackError } = useSnackMessage();
62
+ const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
63
+ const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
64
+ const [openResetConfirmation, setOpenResetConfirmation] = useState(false);
65
+ const { formMethods, onError } = dynamicMarginCalculationMethods;
66
+ const { reset, handleSubmit, getValues, formState } = formMethods;
67
+ const handleResetClick = useCallback(() => {
68
+ setOpenResetConfirmation(true);
69
+ }, []);
70
+ const handleCancelReset = useCallback(() => {
71
+ setOpenResetConfirmation(false);
72
+ }, []);
73
+ const handleReset = useCallback(() => {
74
+ resetParams();
75
+ setOpenResetConfirmation(false);
76
+ }, [resetParams]);
77
+ const onSubmit = useCallback(
78
+ (formData) => {
79
+ updateParams(toParamsInfos(formData));
80
+ },
81
+ [updateParams]
82
+ );
83
+ const handleLoadParameter = useCallback(
84
+ (newParams) => {
85
+ if (newParams?.length) {
86
+ setOpenSelectParameterDialog(false);
87
+ const parametersUuid = newParams[0].id;
88
+ fetchDynamicMarginCalculationParameters(parametersUuid).then((_params) => {
89
+ reset(toFormValues(_params), {
90
+ keepDefaultValues: true
91
+ });
92
+ }).catch((error) => {
93
+ snackWithFallback(snackError, error, { headerId: "paramsRetrievingError" });
94
+ });
95
+ }
96
+ setOpenSelectParameterDialog(false);
97
+ },
98
+ [reset, snackError]
99
+ );
100
+ useEffect(() => {
101
+ setHaveDirtyFields(!!Object.keys(formState.dirtyFields).length);
102
+ }, [formState, setHaveDirtyFields]);
103
+ const renderActions = () => {
104
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
105
+ /* @__PURE__ */ jsx(Grid, { container: true, item: true, children: /* @__PURE__ */ jsxs(
106
+ Grid,
107
+ {
108
+ sx: mergeSx(parametersStyles.controlParametersItem, {
109
+ paddingBottom: 2,
110
+ paddingLeft: 0
111
+ }),
112
+ children: [
113
+ /* @__PURE__ */ jsx(
114
+ LabelledButton,
115
+ {
116
+ disabled: true,
117
+ callback: () => setOpenSelectParameterDialog(true),
118
+ label: "settings.button.chooseSettings"
119
+ }
120
+ ),
121
+ /* @__PURE__ */ jsx(LabelledButton, { disabled: true, callback: () => setOpenCreateParameterDialog(true), label: "save" }),
122
+ /* @__PURE__ */ jsx(LabelledButton, { callback: handleResetClick, label: "resetToDefault" }),
123
+ /* @__PURE__ */ jsx(SubmitButton, { variant: "outlined", onClick: handleSubmit(onSubmit, onError), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) })
124
+ ]
125
+ }
126
+ ) }),
127
+ openCreateParameterDialog && /* @__PURE__ */ jsx(
128
+ CreateParameterDialog,
129
+ {
130
+ studyUuid,
131
+ open: openCreateParameterDialog,
132
+ onClose: () => setOpenCreateParameterDialog(false),
133
+ parameterValues: getValues,
134
+ parameterFormatter: toParamsInfos,
135
+ parameterType: ElementType.DYNAMIC_MARGIN_CALCULATION_PARAMETERS
136
+ }
137
+ ),
138
+ openSelectParameterDialog && /* @__PURE__ */ jsx(
139
+ DirectoryItemSelector,
140
+ {
141
+ open: openSelectParameterDialog,
142
+ onClose: handleLoadParameter,
143
+ types: [ElementType.DYNAMIC_MARGIN_CALCULATION_PARAMETERS],
144
+ title: intl.formatMessage({
145
+ id: "showSelectParameterDialog"
146
+ }),
147
+ onlyLeaves: true,
148
+ multiSelect: false,
149
+ validationButtonText: intl.formatMessage({
150
+ id: "validate"
151
+ })
152
+ }
153
+ ),
154
+ openResetConfirmation && /* @__PURE__ */ jsx(
155
+ PopupConfirmationDialog,
156
+ {
157
+ message: "resetParamsConfirmation",
158
+ validateButtonLabel: "validate",
159
+ openConfirmationPopup: openResetConfirmation,
160
+ setOpenConfirmationPopup: handleCancelReset,
161
+ handlePopupConfirmation: handleReset
162
+ }
163
+ )
164
+ ] });
165
+ };
166
+ return /* @__PURE__ */ jsx(
167
+ DynamicMarginCalculationForm,
168
+ {
169
+ dynamicMarginCalculationMethods,
170
+ renderActions
171
+ }
172
+ );
173
+ }
174
+ export {
175
+ DynamicMarginCalculationInline
176
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2026, 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 enum TabValues {
8
+ TAB_TIME_DELAY = "TAB_TIME_DELAY",
9
+ TAB_LOADS_VARIATIONS = "TAB_LOADS_VARIATIONS"
10
+ }
@@ -0,0 +1,8 @@
1
+ var TabValues = /* @__PURE__ */ ((TabValues2) => {
2
+ TabValues2["TAB_TIME_DELAY"] = "TAB_TIME_DELAY";
3
+ TabValues2["TAB_LOADS_VARIATIONS"] = "TAB_LOADS_VARIATIONS";
4
+ return TabValues2;
5
+ })(TabValues || {});
6
+ export {
7
+ TabValues
8
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2026, 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 * from './constants';
8
+ export * from './dynamic-margin-calculation-inline';
@@ -0,0 +1,17 @@
1
+ import { ACCURACY, ACTIVE, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./constants.js";
2
+ import { DynamicMarginCalculationInline } from "./dynamic-margin-calculation-inline.js";
3
+ export {
4
+ ACCURACY,
5
+ ACTIVE,
6
+ CALCULATION_TYPE,
7
+ DynamicMarginCalculationInline,
8
+ LOADS_VARIATIONS,
9
+ LOAD_FILTERS,
10
+ LOAD_INCREASE_START_TIME,
11
+ LOAD_INCREASE_STOP_TIME,
12
+ LOAD_MODELS_RULE,
13
+ MARGIN_CALCULATION_START_TIME,
14
+ START_TIME,
15
+ STOP_TIME,
16
+ VARIATION
17
+ };
@@ -0,0 +1,29 @@
1
+ import { default as yup } from '../../../utils/yupConfig';
2
+ export declare const formSchema: yup.ObjectSchema<{
3
+ calculationType: string;
4
+ accuracy: number;
5
+ loadModelsRule: string;
6
+ loadsVariations: {
7
+ active?: yup.Maybe<boolean | null | undefined>;
8
+ id?: string | null | undefined;
9
+ loadFilters?: {
10
+ name?: yup.Maybe<string | null | undefined>;
11
+ id: string;
12
+ }[] | undefined;
13
+ variation: number;
14
+ }[] | undefined;
15
+ }, yup.AnyObject, {
16
+ calculationType: undefined;
17
+ accuracy: undefined;
18
+ loadModelsRule: undefined;
19
+ loadsVariations: "";
20
+ }, "">;
21
+ export declare const emptyFormData: {
22
+ calculationType: string;
23
+ accuracy: number;
24
+ loadModelsRule: string;
25
+ loadsVariations: never[];
26
+ };
27
+ export default function LoadsVariationsParameters({ path }: Readonly<{
28
+ path: string;
29
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,154 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import { Grid } from "@mui/material";
5
+ import "../../../utils/yupConfig.js";
6
+ import { LOADS_VARIATIONS, ACTIVE, VARIATION, LOAD_FILTERS, LOAD_MODELS_RULE, ACCURACY, CALCULATION_TYPE } from "./constants.js";
7
+ import { ID } from "../../../utils/constants/filterConstant.js";
8
+ import "../../../utils/conversionUtils.js";
9
+ import { ElementType } from "../../../utils/types/elementType.js";
10
+ import { EquipmentType } from "../../../utils/types/equipmentType.js";
11
+ import { ParameterType } from "../../../utils/types/parameters.type.js";
12
+ import { CalculationType, LoadModelsRule } from "../../../utils/types/dynamic-margin-calculation.type.js";
13
+ import "@mui/icons-material";
14
+ import ParameterField from "../common/parameter-field.js";
15
+ import "../../overflowableText/OverflowableText.js";
16
+ import "react-hook-form";
17
+ import "localized-countries";
18
+ import "localized-countries/data/fr";
19
+ import "localized-countries/data/en";
20
+ import "notistack";
21
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
22
+ import * as yup from "yup";
23
+ import "../../treeViewFinder/TreeViewFinder.js";
24
+ import { NAME } from "../../inputs/reactHookForm/constants.js";
25
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
26
+ import "../../customAGGrid/customAggrid.js";
27
+ import "ag-grid-community";
28
+ import "react-papaparse";
29
+ import "react-csv-downloader";
30
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
31
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
32
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
33
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
34
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
35
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
36
+ import "@react-querybuilder/material";
37
+ import "../../filter/expert/expertFilterConstants.js";
38
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
39
+ import "uuid";
40
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
41
+ import "react-querybuilder";
42
+ import ParameterDndTableField from "../common/parameter-dnd-table-field.js";
43
+ import "@hello-pangea/dnd";
44
+ import { DndColumnType } from "../../dnd-table/dnd-table.type.js";
45
+ const formSchema = yup.object().shape({
46
+ [CALCULATION_TYPE]: yup.string().required(),
47
+ [ACCURACY]: yup.number().required(),
48
+ [LOAD_MODELS_RULE]: yup.string().required(),
49
+ [LOADS_VARIATIONS]: yup.array().of(
50
+ yup.object().shape({
51
+ [ID]: yup.string().nullable(),
52
+ // not shown in form, used to identify a row
53
+ [LOAD_FILTERS]: yup.array().of(
54
+ yup.object().shape({
55
+ [ID]: yup.string().required(),
56
+ [NAME]: yup.string().nullable().notRequired()
57
+ })
58
+ ).min(1),
59
+ [VARIATION]: yup.number().min(0).required(),
60
+ [ACTIVE]: yup.boolean().nullable().notRequired()
61
+ })
62
+ )
63
+ });
64
+ const emptyFormData = {
65
+ [CALCULATION_TYPE]: "",
66
+ [ACCURACY]: 0,
67
+ [LOAD_MODELS_RULE]: "",
68
+ [LOADS_VARIATIONS]: []
69
+ };
70
+ const params = [
71
+ {
72
+ name: CALCULATION_TYPE,
73
+ type: ParameterType.STRING,
74
+ label: "DynamicMarginCalculationCalculationType",
75
+ possibleValues: [
76
+ { id: CalculationType.GLOBAL_MARGIN, label: "DynamicMarginCalculationCalculationTypeGlobalMargin" },
77
+ { id: CalculationType.LOCAL_MARGIN, label: "DynamicMarginCalculationCalculationTypeLocalMargin" }
78
+ ],
79
+ sx: { width: "100%" }
80
+ },
81
+ {
82
+ name: ACCURACY,
83
+ type: ParameterType.DOUBLE,
84
+ label: "DynamicMarginCalculationAccuracy"
85
+ },
86
+ {
87
+ name: LOAD_MODELS_RULE,
88
+ type: ParameterType.STRING,
89
+ label: "DynamicMarginCalculationLoadModelsRule",
90
+ possibleValues: [
91
+ { id: LoadModelsRule.ALL_LOADS, label: "DynamicMarginCalculationLoadModelsRuleAllLoads" },
92
+ { id: LoadModelsRule.TARGETED_LOADS, label: "DynamicMarginCalculationLoadModelsRuleTargetedLoads" }
93
+ ],
94
+ sx: { width: "100%" }
95
+ }
96
+ // LOADS_VARIATIONS displayed in a separated component, i.e., ParameterDndTableField
97
+ ];
98
+ const loadsVariationsColumnsDefinition = [
99
+ {
100
+ label: "DynamicMarginCalculationLoadsFilter",
101
+ dataKey: LOAD_FILTERS,
102
+ initialValue: [],
103
+ editable: true,
104
+ type: DndColumnType.DIRECTORY_ITEMS,
105
+ equipmentTypes: [EquipmentType.LOAD],
106
+ elementType: ElementType.FILTER,
107
+ titleId: "FiltersListsSelection"
108
+ },
109
+ {
110
+ label: "DynamicMarginCalculationLoadsVariation",
111
+ dataKey: VARIATION,
112
+ editable: true,
113
+ type: DndColumnType.NUMERIC,
114
+ textAlign: "right"
115
+ },
116
+ {
117
+ label: "DynamicMarginCalculationLoadsActive",
118
+ initialValue: true,
119
+ dataKey: ACTIVE,
120
+ editable: true,
121
+ width: 100,
122
+ type: DndColumnType.SWITCH
123
+ }
124
+ ];
125
+ function LoadsVariationsParameters({ path }) {
126
+ const inlt = useIntl();
127
+ const translatedColumnsDefinition = useMemo(() => {
128
+ return loadsVariationsColumnsDefinition.map((colDef) => ({
129
+ ...colDef,
130
+ label: inlt.formatMessage({ id: colDef.label })
131
+ }));
132
+ }, [inlt]);
133
+ return /* @__PURE__ */ jsxs(Grid, { container: true, children: [
134
+ params.map((param) => {
135
+ const { name, type, ...otherParams } = param;
136
+ return /* @__PURE__ */ jsx(ParameterField, { id: path, name: param.name, type: param.type, ...otherParams }, param.name);
137
+ }),
138
+ /* @__PURE__ */ jsx(
139
+ ParameterDndTableField,
140
+ {
141
+ name: `${path}.${LOADS_VARIATIONS}`,
142
+ label: "DynamicMarginCalculationLoadsVariations",
143
+ tooltipProps: { title: "DynamicMarginCalculationLoadsVariations" },
144
+ columnsDefinition: translatedColumnsDefinition,
145
+ tableHeight: 270
146
+ }
147
+ )
148
+ ] });
149
+ }
150
+ export {
151
+ LoadsVariationsParameters as default,
152
+ emptyFormData,
153
+ formSchema
154
+ };
@@ -0,0 +1,24 @@
1
+ import { default as yup } from '../../../utils/yupConfig';
2
+ export declare const formSchema: yup.ObjectSchema<{
3
+ startTime: number;
4
+ stopTime: number;
5
+ marginCalculationStartTime: number;
6
+ loadIncreaseStartTime: number;
7
+ loadIncreaseStopTime: number;
8
+ }, yup.AnyObject, {
9
+ startTime: undefined;
10
+ stopTime: undefined;
11
+ marginCalculationStartTime: undefined;
12
+ loadIncreaseStartTime: undefined;
13
+ loadIncreaseStopTime: undefined;
14
+ }, "">;
15
+ export declare const emptyFormData: {
16
+ startTime: number;
17
+ stopTime: number;
18
+ marginCalculationStartTime: number;
19
+ loadIncreaseStartTime: number;
20
+ loadIncreaseStopTime: number;
21
+ };
22
+ export default function TimeDelayParameters({ path }: Readonly<{
23
+ path: string;
24
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,62 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import "../../../utils/yupConfig.js";
4
+ import { LOAD_INCREASE_STOP_TIME, LOAD_INCREASE_START_TIME, MARGIN_CALCULATION_START_TIME, STOP_TIME, START_TIME } from "./constants.js";
5
+ import "../../../utils/conversionUtils.js";
6
+ import "../../../utils/types/equipmentType.js";
7
+ import { ParameterType } from "../../../utils/types/parameters.type.js";
8
+ import "@mui/icons-material";
9
+ import ParameterField from "../common/parameter-field.js";
10
+ import * as yup from "yup";
11
+ const formSchema = yup.object().shape({
12
+ [START_TIME]: yup.number().required(),
13
+ [STOP_TIME]: yup.number().required(),
14
+ [MARGIN_CALCULATION_START_TIME]: yup.number().required(),
15
+ [LOAD_INCREASE_START_TIME]: yup.number().required(),
16
+ [LOAD_INCREASE_STOP_TIME]: yup.number().required()
17
+ });
18
+ const emptyFormData = {
19
+ [START_TIME]: 0,
20
+ [STOP_TIME]: 0,
21
+ [MARGIN_CALCULATION_START_TIME]: 0,
22
+ [LOAD_INCREASE_START_TIME]: 0,
23
+ [LOAD_INCREASE_STOP_TIME]: 0
24
+ };
25
+ const params = [
26
+ {
27
+ name: START_TIME,
28
+ type: ParameterType.DOUBLE,
29
+ label: "DynamicMarginCalculationStartTime"
30
+ },
31
+ {
32
+ name: STOP_TIME,
33
+ type: ParameterType.DOUBLE,
34
+ label: "DynamicMarginCalculationStopTime"
35
+ },
36
+ {
37
+ name: MARGIN_CALCULATION_START_TIME,
38
+ type: ParameterType.DOUBLE,
39
+ label: "DynamicMarginCalculationMarginCalculationStartTime"
40
+ },
41
+ {
42
+ name: LOAD_INCREASE_START_TIME,
43
+ type: ParameterType.DOUBLE,
44
+ label: "DynamicMarginCalculationLoadIncreaseStartTime"
45
+ },
46
+ {
47
+ name: LOAD_INCREASE_STOP_TIME,
48
+ type: ParameterType.DOUBLE,
49
+ label: "DynamicMarginCalculationLoadIncreaseStopTime"
50
+ }
51
+ ];
52
+ function TimeDelayParameters({ path }) {
53
+ return /* @__PURE__ */ jsx(Grid, { container: true, children: params.map((param) => {
54
+ const { name, type, ...otherParams } = param;
55
+ return /* @__PURE__ */ jsx(ParameterField, { id: path, name: param.name, type: param.type, ...otherParams }, param.name);
56
+ }) });
57
+ }
58
+ export {
59
+ TimeDelayParameters as default,
60
+ emptyFormData,
61
+ formSchema
62
+ };
@@ -0,0 +1,30 @@
1
+ import { FieldErrors, FieldValues, UseFormReturn } from 'react-hook-form';
2
+ import { ObjectSchema } from 'yup';
3
+ import { SyntheticEvent } from 'react';
4
+ import { DynamicMarginCalculationParametersInfos } from '../../../utils/types/dynamic-margin-calculation.type';
5
+ import { TabValues } from './dynamic-margin-calculation.type';
6
+ export declare const toFormValues: (_params: DynamicMarginCalculationParametersInfos) => FieldValues;
7
+ export declare const toParamsInfos: (_formData: FieldValues) => DynamicMarginCalculationParametersInfos;
8
+ export type UseTabsReturn<TTabValue extends string> = {
9
+ selectedTab: TTabValue;
10
+ tabsWithError: TTabValue[];
11
+ onTabChange: (event: SyntheticEvent, newValue: TTabValue) => void;
12
+ onError: (errors: FieldErrors) => void;
13
+ };
14
+ export type UseComputationParametersFormReturn<TTabValue extends string> = UseTabsReturn<TTabValue> & {
15
+ formMethods: UseFormReturn;
16
+ formSchema: ObjectSchema<any>;
17
+ paramsLoaded: boolean;
18
+ formattedProviders: {
19
+ id: string;
20
+ label: string;
21
+ }[];
22
+ };
23
+ export type UseDynamicMarginCalculationParametersFormReturn = UseComputationParametersFormReturn<TabValues>;
24
+ export type UseParametersFormProps = {
25
+ providers: Record<string, string>;
26
+ params: DynamicMarginCalculationParametersInfos | null;
27
+ name: string | null;
28
+ description: string | null;
29
+ };
30
+ export declare function useDynamicMarginCalculationParametersForm({ providers, params, name: initialName, description: initialDescription, }: Readonly<UseParametersFormProps>): UseDynamicMarginCalculationParametersFormReturn;