@gridsuite/commons-ui 0.107.0 → 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.
Files changed (115) hide show
  1. package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +10 -10
  2. package/dist/components/directoryItemSelector/DirectoryItemSelector.js +1 -0
  3. package/dist/components/dnd-table/dnd-table-add-rows-dialog.d.ts +13 -0
  4. package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +69 -0
  5. package/dist/components/dnd-table/dnd-table-bottom-left-buttons.d.ts +17 -0
  6. package/dist/components/dnd-table/dnd-table-bottom-left-buttons.js +48 -0
  7. package/dist/components/dnd-table/dnd-table-bottom-right-buttons.d.ts +17 -0
  8. package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +104 -0
  9. package/dist/components/dnd-table/dnd-table.d.ts +28 -0
  10. package/dist/components/dnd-table/dnd-table.js +394 -0
  11. package/dist/components/dnd-table/dnd-table.type.d.ts +51 -0
  12. package/dist/components/dnd-table/dnd-table.type.js +16 -0
  13. package/dist/components/dnd-table/index.d.ts +11 -0
  14. package/dist/components/dnd-table/index.js +14 -0
  15. package/dist/components/filter/HeaderFilterForm.js +4 -4
  16. package/dist/components/filter/expert/expertFilterConstants.d.ts +15 -0
  17. package/dist/components/filter/expert/expertFilterConstants.js +28 -0
  18. package/dist/components/filter/expert/expertFilterUtils.js +1 -1
  19. package/dist/components/index.d.ts +1 -0
  20. package/dist/components/index.js +57 -1
  21. package/dist/components/inputs/index.js +6 -0
  22. package/dist/components/inputs/reactHookForm/chip-items-input.d.ts +13 -0
  23. package/dist/components/inputs/reactHookForm/chip-items-input.js +129 -0
  24. package/dist/components/inputs/reactHookForm/index.d.ts +2 -0
  25. package/dist/components/inputs/reactHookForm/index.js +6 -0
  26. package/dist/components/inputs/reactHookForm/tableInputs/index.d.ts +8 -0
  27. package/dist/components/inputs/reactHookForm/tableInputs/index.js +6 -0
  28. package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.d.ts +12 -0
  29. package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +110 -0
  30. package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.d.ts +8 -0
  31. package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +43 -0
  32. package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +4 -2
  33. package/dist/components/parameters/common/ProviderParam.js +6 -6
  34. package/dist/components/parameters/common/constant.d.ts +8 -0
  35. package/dist/components/parameters/common/constant.js +12 -1
  36. package/dist/components/parameters/common/index.js +3 -1
  37. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +7 -7
  38. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +6 -6
  39. package/dist/components/parameters/common/name-element-editor/name-element-editor-form.js +8 -8
  40. package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +11 -10
  41. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +7 -7
  42. package/dist/components/parameters/common/widget/parameter-float.js +6 -6
  43. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +11 -10
  44. package/dist/components/parameters/common/widget/parameter-line-slider.js +6 -6
  45. package/dist/components/parameters/index.d.ts +1 -0
  46. package/dist/components/parameters/index.js +39 -1
  47. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +6 -6
  48. package/dist/components/parameters/loadflow/load-flow-parameter-field.js +6 -6
  49. package/dist/components/parameters/loadflow/load-flow-parameters-form.js +6 -6
  50. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +6 -6
  51. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +3 -3
  52. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +2 -1
  53. package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +6 -6
  54. package/dist/components/parameters/network-visualizations/network-visualizations-form.js +7 -7
  55. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +3 -3
  56. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +2 -2
  57. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +12 -11
  58. package/dist/components/parameters/short-circuit/short-circuit-fields.js +5 -5
  59. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +3 -3
  60. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +6 -6
  61. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +2 -2
  62. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +11 -10
  63. package/dist/components/parameters/voltage-init/constants.d.ts +39 -0
  64. package/dist/components/parameters/voltage-init/constants.js +65 -0
  65. package/dist/components/parameters/voltage-init/equipment-selection-parameters.d.ts +7 -0
  66. package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +119 -0
  67. package/dist/components/parameters/voltage-init/general-parameters.d.ts +4 -0
  68. package/dist/components/parameters/voltage-init/general-parameters.js +112 -0
  69. package/dist/components/parameters/voltage-init/index.d.ts +10 -0
  70. package/dist/components/parameters/voltage-init/index.js +38 -0
  71. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.d.ts +32 -0
  72. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +218 -0
  73. package/dist/components/parameters/voltage-init/voltage-init-form-utils.d.ts +4 -0
  74. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +220 -0
  75. package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.d.ts +2 -0
  76. package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.js +97 -0
  77. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.d.ts +30 -0
  78. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +150 -0
  79. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.d.ts +8 -0
  80. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +152 -0
  81. package/dist/components/parameters/voltage-init/voltage-init.type.d.ts +33 -0
  82. package/dist/components/parameters/voltage-init/voltage-init.type.js +8 -0
  83. package/dist/components/parameters/voltage-init/voltage-limits-parameters.d.ts +7 -0
  84. package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +188 -0
  85. package/dist/components/treeViewFinder/TreeViewFinder.d.ts +2 -0
  86. package/dist/index.js +69 -2
  87. package/dist/services/index.d.ts +1 -0
  88. package/dist/services/index.js +6 -2
  89. package/dist/services/study.d.ts +2 -0
  90. package/dist/services/study.js +15 -1
  91. package/dist/services/voltage-init.d.ts +4 -0
  92. package/dist/services/voltage-init.js +14 -0
  93. package/dist/translations/en/dndTableEn.d.ts +16 -0
  94. package/dist/translations/en/dndTableEn.js +13 -0
  95. package/dist/translations/en/filterExpertEn.d.ts +3 -0
  96. package/dist/translations/en/filterExpertEn.js +4 -1
  97. package/dist/translations/en/index.d.ts +1 -0
  98. package/dist/translations/en/index.js +2 -0
  99. package/dist/translations/en/parameters.d.ts +30 -0
  100. package/dist/translations/en/parameters.js +31 -1
  101. package/dist/translations/fr/dndTableFr.d.ts +16 -0
  102. package/dist/translations/fr/dndTableFr.js +13 -0
  103. package/dist/translations/fr/filterExpertFr.d.ts +3 -0
  104. package/dist/translations/fr/filterExpertFr.js +4 -1
  105. package/dist/translations/fr/index.d.ts +1 -0
  106. package/dist/translations/fr/index.js +2 -0
  107. package/dist/translations/fr/parameters.d.ts +31 -0
  108. package/dist/translations/fr/parameters.js +32 -1
  109. package/dist/utils/index.d.ts +1 -0
  110. package/dist/utils/index.js +3 -0
  111. package/dist/utils/types/fieldType.d.ts +3 -0
  112. package/dist/utils/types/fieldType.js +3 -0
  113. package/dist/utils/validation-functions.d.ts +8 -0
  114. package/dist/utils/validation-functions.js +23 -0
  115. package/package.json +1 -1
@@ -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 {};
@@ -0,0 +1,150 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Box, Grid, LinearProgress, Tabs, Tab } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { getTabIndicatorStyle, getTabStyle } from "../parameters-style.js";
5
+ import "react";
6
+ import "react-hook-form";
7
+ import "../../../utils/types/equipmentType.js";
8
+ import "localized-countries";
9
+ import "localized-countries/data/fr";
10
+ import "localized-countries/data/en";
11
+ import "notistack";
12
+ import { CustomFormProvider } from "../../inputs/reactHookForm/provider/CustomFormProvider.js";
13
+ import "@mui/icons-material";
14
+ import "yup";
15
+ import "../../overflowableText/OverflowableText.js";
16
+ import "../../treeViewFinder/TreeViewFinder.js";
17
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
18
+ import "../../customAGGrid/customAggrid.js";
19
+ import "ag-grid-community";
20
+ import "react-papaparse";
21
+ import "react-csv-downloader";
22
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
23
+ import "../../../utils/conversionUtils.js";
24
+ import "../../../utils/yupConfig.js";
25
+ import "@react-querybuilder/material";
26
+ import "../../filter/expert/expertFilterConstants.js";
27
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
28
+ import "uuid";
29
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
30
+ import "react-querybuilder";
31
+ import { TabPanel } from "../common/parameters.js";
32
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
33
+ import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
34
+ import "../common/widget/parameter-line-slider.js";
35
+ import "../common/limitreductions/columns-definitions.js";
36
+ import { VoltageInitTabValues } from "./constants.js";
37
+ import { GeneralParameters } from "./general-parameters.js";
38
+ import { EquipmentSelectionParameters } from "./equipment-selection-parameters.js";
39
+ import { VoltageLimitsParameters } from "./voltage-limits-parameters.js";
40
+ const styles = {
41
+ gridWithActions: (theme) => ({
42
+ overflowY: "auto",
43
+ overflowX: "hidden",
44
+ paddingRight: theme.spacing(2),
45
+ paddingTop: theme.spacing(2),
46
+ paddingBottom: theme.spacing(1),
47
+ flexGrow: 1,
48
+ maxHeight: "85%"
49
+ }),
50
+ gridWithoutActions: (theme) => ({
51
+ overflowY: "auto",
52
+ overflowX: "hidden",
53
+ paddingRight: theme.spacing(2),
54
+ paddingTop: theme.spacing(2),
55
+ paddingBottom: theme.spacing(1),
56
+ flexGrow: 1,
57
+ maxHeight: "100%"
58
+ })
59
+ };
60
+ function VoltageInitParametersForm({
61
+ voltageInitMethods,
62
+ renderTitleFields,
63
+ renderActions
64
+ }) {
65
+ const { formMethods, formSchema, selectedTab, handleTabChange, paramsLoading, tabIndexesWithError } = voltageInitMethods;
66
+ return /* @__PURE__ */ jsx(CustomFormProvider, { validationSchema: formSchema, ...formMethods, removeOptional: true, children: /* @__PURE__ */ jsxs(
67
+ Box,
68
+ {
69
+ sx: {
70
+ height: "100%",
71
+ position: "relative"
72
+ },
73
+ children: [
74
+ /* @__PURE__ */ jsxs(Grid, { item: true, container: true, sx: renderActions ? styles.gridWithActions : styles.gridWithoutActions, children: [
75
+ /* @__PURE__ */ jsx(Grid, { item: true, container: true, direction: "column", children: renderTitleFields == null ? void 0 : renderTitleFields() }),
76
+ paramsLoading ? /* @__PURE__ */ jsx(LinearProgress, {}) : /* @__PURE__ */ jsxs(
77
+ Box,
78
+ {
79
+ sx: {
80
+ height: "100%",
81
+ width: "100%"
82
+ },
83
+ children: [
84
+ /* @__PURE__ */ jsxs(
85
+ Tabs,
86
+ {
87
+ value: selectedTab,
88
+ variant: "scrollable",
89
+ onChange: handleTabChange,
90
+ TabIndicatorProps: {
91
+ sx: getTabIndicatorStyle(tabIndexesWithError, selectedTab)
92
+ },
93
+ children: [
94
+ /* @__PURE__ */ jsx(
95
+ Tab,
96
+ {
97
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageInitParametersGeneralTabLabel" }),
98
+ value: VoltageInitTabValues.GENERAL,
99
+ sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.GENERAL)
100
+ }
101
+ ),
102
+ /* @__PURE__ */ jsx(
103
+ Tab,
104
+ {
105
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "VoltageLimits" }),
106
+ value: VoltageInitTabValues.VOLTAGE_LIMITS,
107
+ sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.VOLTAGE_LIMITS)
108
+ }
109
+ ),
110
+ /* @__PURE__ */ jsx(
111
+ Tab,
112
+ {
113
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "EquipmentSelection" }),
114
+ value: VoltageInitTabValues.EQUIPMENTS_SELECTION,
115
+ sx: getTabStyle(tabIndexesWithError, VoltageInitTabValues.EQUIPMENTS_SELECTION)
116
+ }
117
+ )
118
+ ]
119
+ }
120
+ ),
121
+ /* @__PURE__ */ jsxs(Grid, { container: true, children: [
122
+ /* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: VoltageInitTabValues.GENERAL, children: /* @__PURE__ */ jsx(GeneralParameters, { withApplyModifications: renderActions != null }) }),
123
+ /* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: VoltageInitTabValues.VOLTAGE_LIMITS, children: /* @__PURE__ */ jsx(VoltageLimitsParameters, {}) }),
124
+ /* @__PURE__ */ jsx(TabPanel, { value: selectedTab, index: VoltageInitTabValues.EQUIPMENTS_SELECTION, children: /* @__PURE__ */ jsx(EquipmentSelectionParameters, {}) })
125
+ ] })
126
+ ]
127
+ }
128
+ )
129
+ ] }),
130
+ renderActions && /* @__PURE__ */ jsx(
131
+ Grid,
132
+ {
133
+ item: true,
134
+ container: true,
135
+ direction: "column",
136
+ sx: {
137
+ position: "fixed",
138
+ bottom: "15px"
139
+ },
140
+ children: renderActions()
141
+ }
142
+ )
143
+ ]
144
+ }
145
+ ) });
146
+ }
147
+ export {
148
+ VoltageInitParametersForm,
149
+ styles
150
+ };
@@ -0,0 +1,8 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { UUID } from 'crypto';
3
+ import { VoltageInitStudyParameters } from './voltage-init.type';
4
+ export declare function VoltageInitParametersInLine({ studyUuid, setHaveDirtyFields, voltageInitParameters, }: Readonly<{
5
+ studyUuid: UUID | null;
6
+ setHaveDirtyFields: Dispatch<SetStateAction<boolean>>;
7
+ voltageInitParameters: VoltageInitStudyParameters | null;
8
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,152 @@
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 "../../../utils/conversionUtils.js";
26
+ import { ElementType } from "../../../utils/types/elementType.js";
27
+ import "../../../utils/yupConfig.js";
28
+ import "@react-querybuilder/material";
29
+ import "../../filter/expert/expertFilterConstants.js";
30
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
31
+ import "uuid";
32
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
33
+ import "react-querybuilder";
34
+ import { LabelledButton } from "../common/parameters.js";
35
+ import { CreateParameterDialog } from "../common/parameters-creation-dialog.js";
36
+ import "../common/widget/parameter-line-slider.js";
37
+ import "../common/limitreductions/columns-definitions.js";
38
+ import { useVoltageInitParametersForm } from "./use-voltage-init-parameters-form.js";
39
+ import { VoltageInitParametersForm } from "./voltage-init-parameters-form.js";
40
+ import { fromVoltageInitParamsDataToFormValues, fromVoltageInitParametersFormToParamValues } from "./voltage-init-form-utils.js";
41
+ import { DEFAULT_GENERAL_APPLY_MODIFICATIONS } from "./constants.js";
42
+ function VoltageInitParametersInLine({
43
+ studyUuid,
44
+ setHaveDirtyFields,
45
+ voltageInitParameters
46
+ }) {
47
+ const voltageInitMethods = useVoltageInitParametersForm({
48
+ parametersUuid: null,
49
+ name: null,
50
+ description: null,
51
+ studyUuid,
52
+ parameters: voltageInitParameters
53
+ });
54
+ const intl = useIntl();
55
+ const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
56
+ const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
57
+ const { snackError } = useSnackMessage();
58
+ const { formState, getValues, handleSubmit, reset, trigger } = voltageInitMethods.formMethods;
59
+ const handleLoadParameters = useCallback(
60
+ (newParams) => {
61
+ if (newParams == null ? void 0 : newParams.length) {
62
+ setOpenSelectParameterDialog(false);
63
+ const parametersUuid = newParams[0].id;
64
+ getVoltageInitParameters(parametersUuid).then((params) => {
65
+ reset(fromVoltageInitParamsDataToFormValues(params), {
66
+ keepDefaultValues: true
67
+ });
68
+ }).catch((error) => {
69
+ snackError({
70
+ messageTxt: error.message,
71
+ headerId: "paramsRetrievingError"
72
+ });
73
+ });
74
+ }
75
+ setOpenSelectParameterDialog(false);
76
+ },
77
+ [reset, snackError]
78
+ );
79
+ const resetVoltageInitParameters = useCallback(() => {
80
+ updateVoltageInitParameters(studyUuid, {
81
+ applyModifications: DEFAULT_GENERAL_APPLY_MODIFICATIONS,
82
+ computationParameters: null
83
+ // null means Reset
84
+ }).catch((error) => {
85
+ snackError({
86
+ messageTxt: error.message,
87
+ headerId: "updateVoltageInitParametersError"
88
+ });
89
+ });
90
+ }, [studyUuid, snackError]);
91
+ useEffect(() => {
92
+ setHaveDirtyFields(!!Object.keys(formState.dirtyFields).length);
93
+ }, [formState, setHaveDirtyFields]);
94
+ const handleOpenSaveDialog = useCallback(() => {
95
+ trigger().then((isValid) => {
96
+ if (isValid) {
97
+ setOpenCreateParameterDialog(true);
98
+ }
99
+ });
100
+ }, [trigger]);
101
+ return /* @__PURE__ */ jsx(
102
+ VoltageInitParametersForm,
103
+ {
104
+ voltageInitMethods,
105
+ renderActions: () => {
106
+ return /* @__PURE__ */ jsxs(Box, { children: [
107
+ /* @__PURE__ */ jsxs(Grid, { container: true, item: true, children: [
108
+ /* @__PURE__ */ jsx(
109
+ LabelledButton,
110
+ {
111
+ callback: () => setOpenSelectParameterDialog(true),
112
+ label: "settings.button.chooseSettings"
113
+ }
114
+ ),
115
+ /* @__PURE__ */ jsx(LabelledButton, { callback: handleOpenSaveDialog, label: "save" }),
116
+ /* @__PURE__ */ jsx(LabelledButton, { callback: resetVoltageInitParameters, label: "resetToDefault" }),
117
+ /* @__PURE__ */ jsx(SubmitButton, { onClick: handleSubmit(voltageInitMethods.onSaveInline), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) })
118
+ ] }),
119
+ openCreateParameterDialog && /* @__PURE__ */ jsx(
120
+ CreateParameterDialog,
121
+ {
122
+ studyUuid,
123
+ open: openCreateParameterDialog,
124
+ onClose: () => setOpenCreateParameterDialog(false),
125
+ parameterValues: getValues,
126
+ parameterFormatter: (params) => fromVoltageInitParametersFormToParamValues(params).computationParameters,
127
+ parameterType: ElementType.VOLTAGE_INIT_PARAMETERS
128
+ }
129
+ ),
130
+ openSelectParameterDialog && /* @__PURE__ */ jsx(
131
+ DirectoryItemSelector,
132
+ {
133
+ open: openSelectParameterDialog,
134
+ onClose: handleLoadParameters,
135
+ types: [ElementType.VOLTAGE_INIT_PARAMETERS],
136
+ title: intl.formatMessage({
137
+ id: "showSelectParameterDialog"
138
+ }),
139
+ multiSelect: false,
140
+ validationButtonText: intl.formatMessage({
141
+ id: "validate"
142
+ })
143
+ }
144
+ )
145
+ ] });
146
+ }
147
+ }
148
+ );
149
+ }
150
+ export {
151
+ VoltageInitParametersInLine
152
+ };
@@ -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
+ };