@gridsuite/commons-ui 0.142.0 → 0.144.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 (102) hide show
  1. package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -1
  2. package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +2 -2
  3. package/dist/components/dnd-table/dnd-table.js +3 -3
  4. package/dist/components/index.js +6 -3
  5. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +2 -1
  6. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +118 -75
  7. package/dist/components/inputs/reactHookForm/OverflowableChip.d.ts +3 -2
  8. package/dist/components/inputs/reactHookForm/OverflowableChip.js +5 -5
  9. package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.d.ts +1 -1
  10. package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.js +20 -4
  11. package/dist/components/inputs/reactHookForm/selectInputs/SelectInput.js +3 -1
  12. package/dist/components/inputs/reactHookForm/text/DescriptionField.d.ts +3 -1
  13. package/dist/components/inputs/reactHookForm/text/DescriptionField.js +13 -4
  14. package/dist/components/overflowableText/OverflowableText.js +9 -1
  15. package/dist/components/parameters/common/ProviderParam.js +3 -3
  16. package/dist/components/parameters/common/constant.d.ts +3 -0
  17. package/dist/components/parameters/common/constant.js +6 -0
  18. package/dist/components/parameters/common/index.js +4 -1
  19. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +3 -3
  20. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +2 -2
  21. package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +3 -3
  22. package/dist/components/parameters/common/utils.d.ts +14 -0
  23. package/dist/components/parameters/common/utils.js +89 -0
  24. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +3 -3
  25. package/dist/components/parameters/common/widget/parameter-float.js +3 -3
  26. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +3 -3
  27. package/dist/components/parameters/common/widget/parameter-line-slider.js +3 -3
  28. package/dist/components/parameters/index.js +6 -3
  29. package/dist/components/parameters/loadflow/constants.d.ts +0 -3
  30. package/dist/components/parameters/loadflow/constants.js +0 -6
  31. package/dist/components/parameters/loadflow/index.js +1 -4
  32. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +7 -3
  33. package/dist/components/parameters/loadflow/load-flow-parameter-field.js +3 -3
  34. package/dist/components/parameters/loadflow/load-flow-parameters-form.js +5 -5
  35. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +3 -3
  36. package/dist/components/parameters/loadflow/load-flow-parameters-type.d.ts +11 -0
  37. package/dist/components/parameters/loadflow/load-flow-parameters-type.js +1 -0
  38. package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +0 -11
  39. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +3 -50
  40. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.d.ts +3 -3
  41. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +33 -59
  42. package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +3 -3
  43. package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -2
  44. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
  45. package/dist/components/parameters/pcc-min/pcc-min-form-utils.js +3 -3
  46. package/dist/components/parameters/pcc-min/pcc-min-parameters-form.js +3 -3
  47. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +3 -3
  48. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +3 -3
  49. package/dist/components/parameters/sensi/sensitivity-Flow-parameters.js +3 -3
  50. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +3 -3
  51. package/dist/components/parameters/sensi/sensitivity-table.js +1 -1
  52. package/dist/components/parameters/sensi/table-cell.js +3 -3
  53. package/dist/components/parameters/short-circuit/constants.d.ts +12 -0
  54. package/dist/components/parameters/short-circuit/constants.js +16 -1
  55. package/dist/components/parameters/short-circuit/index.js +5 -2
  56. package/dist/components/parameters/short-circuit/short-circuit-fields.js +56 -15
  57. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.d.ts +3 -1
  58. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +24 -5
  59. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +5 -5
  60. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.d.ts +4 -3
  61. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +22 -29
  62. package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.d.ts +27 -0
  63. package/dist/components/parameters/short-circuit/short-circuit-parameters-utils.js +61 -0
  64. package/dist/components/parameters/short-circuit/short-circuit-parameters.type.d.ts +7 -21
  65. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.d.ts +15 -15
  66. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +121 -128
  67. package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +3 -3
  68. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
  69. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +3 -3
  70. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +3 -3
  71. package/dist/hooks/use-parameters-backend.d.ts +2 -2
  72. package/dist/hooks/use-parameters-backend.js +6 -4
  73. package/dist/index.js +13 -7
  74. package/dist/services/index.d.ts +1 -0
  75. package/dist/services/index.js +6 -5
  76. package/dist/services/short-circuit-analysis.d.ts +3 -0
  77. package/dist/services/short-circuit-analysis.js +25 -4
  78. package/dist/services/study.d.ts +1 -3
  79. package/dist/services/study.js +0 -19
  80. package/dist/services/utils.d.ts +0 -4
  81. package/dist/services/utils.js +4 -10
  82. package/dist/translations/en/businessErrorsEn.d.ts +17 -0
  83. package/dist/translations/en/businessErrorsEn.js +20 -3
  84. package/dist/translations/en/inputsEn.d.ts +1 -1
  85. package/dist/translations/en/inputsEn.js +1 -1
  86. package/dist/translations/en/parameters.d.ts +3 -0
  87. package/dist/translations/en/parameters.js +3 -0
  88. package/dist/translations/fr/businessErrorsFr.d.ts +17 -0
  89. package/dist/translations/fr/businessErrorsFr.js +20 -3
  90. package/dist/translations/fr/inputsFr.d.ts +1 -1
  91. package/dist/translations/fr/inputsFr.js +1 -1
  92. package/dist/translations/fr/parameters.d.ts +3 -0
  93. package/dist/translations/fr/parameters.js +3 -0
  94. package/dist/utils/error.js +8 -0
  95. package/dist/utils/index.js +2 -0
  96. package/dist/utils/types/NetworkTimeoutError.d.ts +10 -0
  97. package/dist/utils/types/NetworkTimeoutError.js +9 -0
  98. package/dist/utils/types/index.d.ts +1 -0
  99. package/dist/utils/types/index.js +2 -0
  100. package/dist/utils/types/loadflow.type.d.ts +1 -1
  101. package/dist/utils/types/parameters.type.d.ts +6 -3
  102. package/package.json +2 -2
@@ -6,12 +6,12 @@ import { useForm } from "react-hook-form";
6
6
  import { yupResolver } from "@hookform/resolvers/yup";
7
7
  import "../../../utils/yupConfig.js";
8
8
  import "../../overflowableText/OverflowableText.js";
9
- import "../../../utils/types/equipmentType.js";
10
9
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
11
10
  import { MAX_CHAR_DESCRIPTION } from "../../../utils/constants/uiConstants.js";
12
11
  import "../../../utils/conversionUtils.js";
13
12
  import "@mui/icons-material";
14
13
  import { ElementType } from "../../../utils/types/elementType.js";
14
+ import "../../../utils/types/equipmentType.js";
15
15
  import "localized-countries";
16
16
  import "localized-countries/data/fr";
17
17
  import "localized-countries/data/en";
@@ -3,11 +3,11 @@ import { Dialog, DialogTitle, DialogContent, TextField, DialogActions, Button }
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { useState } from "react";
5
5
  import "../overflowableText/OverflowableText.js";
6
- import "react-hook-form";
7
- import "../../utils/types/equipmentType.js";
8
6
  import "../../utils/conversionUtils.js";
9
7
  import "@mui/icons-material";
8
+ import "../../utils/types/equipmentType.js";
10
9
  import "../../utils/yupConfig.js";
10
+ import "react-hook-form";
11
11
  import "localized-countries";
12
12
  import "localized-countries/data/fr";
13
13
  import "localized-countries/data/en";
@@ -10,14 +10,14 @@ import { DndTableBottomLeftButtons } from "./dnd-table-bottom-left-buttons.js";
10
10
  import { DndTableBottomRightButtons } from "./dnd-table-bottom-right-buttons.js";
11
11
  import { DndTableAddRowsDialog } from "./dnd-table-add-rows-dialog.js";
12
12
  import "../overflowableText/OverflowableText.js";
13
+ import "../../utils/conversionUtils.js";
14
+ import "../../utils/types/equipmentType.js";
15
+ import "../../utils/yupConfig.js";
13
16
  import { ChipItemsInput } from "../inputs/reactHookForm/chip-items-input.js";
14
17
  import { DirectoryItemsInput } from "../inputs/reactHookForm/DirectoryItemsInput.js";
15
18
  import { RawReadOnlyInput } from "../inputs/reactHookForm/RawReadOnlyInput.js";
16
19
  import "../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
17
20
  import "../customAGGrid/customAggrid.js";
18
- import "../../utils/conversionUtils.js";
19
- import "../../utils/types/equipmentType.js";
20
- import "../../utils/yupConfig.js";
21
21
  import "ag-grid-community";
22
22
  import "react-papaparse";
23
23
  import "react-csv-downloader";
@@ -133,7 +133,7 @@ import { DeviceHubIcon } from "./icons/DeviceHubIcon.js";
133
133
  import { TuneIcon } from "./icons/TuneIcon.js";
134
134
  import { PhotoLibraryIcon } from "./icons/PhotoLibraryIcon.js";
135
135
  import { ComputingType, formatComputingTypeLabel, isValidComputingType } from "./parameters/common/computing-type.js";
136
- import { PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, ReactivePowerAdornment, VOLTAGE_LEVEL, VoltageAdornment } from "./parameters/common/constant.js";
136
+ import { COMMON_PARAMETERS, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, ReactivePowerAdornment, SPECIFIC_PARAMETERS, VERSION_PARAMETER, VOLTAGE_LEVEL, VoltageAdornment } from "./parameters/common/constant.js";
137
137
  import { LineSeparator } from "./parameters/common/line-separator.js";
138
138
  import { LabelledButton, SwitchWithLabel, TabPanel } from "./parameters/common/parameters.js";
139
139
  import { CreateParameterDialog } from "./parameters/common/parameters-creation-dialog.js";
@@ -155,10 +155,10 @@ import { CENTER_LABEL, COMPONENT_LIBRARY, DIAGONAL_LABEL, INTL_LINE_FLOW_MODE_OP
155
155
  import { MAP_BASEMAP_CARTO, MAP_BASEMAP_CARTO_NOLABEL, MAP_BASEMAP_ETALAB, MAP_BASEMAP_MAPBOX, NadPositionsGenerationMode, SubstationLayout } from "./parameters/network-visualizations/network-visualizations.types.js";
156
156
  import { NetworkVisualizationParametersInline } from "./parameters/network-visualizations/network-visualizations-parameters-inline.js";
157
157
  import { NetworkVisualizationsParametersEditionDialog } from "./parameters/network-visualizations/network-visualizations-parameters-dialog.js";
158
- import { BALANCE_TYPE, COMMON_PARAMETERS, CONNECTED_COMPONENT_MODE, COUNTRIES_TO_BALANCE, DC, DC_POWER_FACTOR, DC_USE_TRANSFORMER_RATIO, DEFAULT_LIMIT_REDUCTION_VALUE, DISTRIBUTED_SLACK, HVDC_AC_EMULATION, MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, PARAM_LIMIT_REDUCTION, PARAM_PROVIDER_OPENLOADFLOW, PHASE_SHIFTER_REGULATION_ON, READ_SLACK_BUS, SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON, SPECIFIC_PARAMETERS, TWT_SPLIT_SHUNT_ADMITTANCE, USE_REACTIVE_LIMITS, VERSION_PARAMETER, VOLTAGE_INIT_MODE, WRITE_SLACK_BUS, alertThresholdMarks } from "./parameters/loadflow/constants.js";
158
+ import { BALANCE_TYPE, CONNECTED_COMPONENT_MODE, COUNTRIES_TO_BALANCE, DC, DC_POWER_FACTOR, DC_USE_TRANSFORMER_RATIO, DEFAULT_LIMIT_REDUCTION_VALUE, DISTRIBUTED_SLACK, HVDC_AC_EMULATION, MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, PARAM_LIMIT_REDUCTION, PARAM_PROVIDER_OPENLOADFLOW, PHASE_SHIFTER_REGULATION_ON, READ_SLACK_BUS, SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON, TWT_SPLIT_SHUNT_ADMITTANCE, USE_REACTIVE_LIMITS, VOLTAGE_INIT_MODE, WRITE_SLACK_BUS, alertThresholdMarks } from "./parameters/loadflow/constants.js";
159
159
  import { LoadFlowParametersInline } from "./parameters/loadflow/load-flow-parameters-inline.js";
160
160
  import { LoadFlowParametersEditionDialog } from "./parameters/loadflow/load-flow-parameters-dialog.js";
161
- import { InitialVoltage, PredefinedParameters, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, intlInitialVoltageProfileMode, intlPredefinedParametersOptions } from "./parameters/short-circuit/constants.js";
161
+ import { InitialVoltage, PredefinedParameters, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_VOLTAGE_RANGES, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, intlInitialVoltageProfileMode, intlPredefinedParametersOptions, onlyStartedGeneratorsOptions } from "./parameters/short-circuit/constants.js";
162
162
  import { ShortCircuitParametersInLine } from "./parameters/short-circuit/short-circuit-parameters-inline.js";
163
163
  import { ShortCircuitParametersEditionDialog } from "./parameters/short-circuit/short-circuit-parameters-dialog.js";
164
164
  import { DEFAULT_GENERAL_APPLY_MODIFICATIONS, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, GENERAL, GENERAL_APPLY_MODIFICATIONS, GENERATORS_SELECTION_TYPE, HIGH_VOLTAGE_LIMIT, 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 "./parameters/voltage-init/constants.js";
@@ -416,7 +416,9 @@ export {
416
416
  SELECTION_TYPE,
417
417
  SENSITIVITY_TYPES,
418
418
  SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
419
+ SHORT_CIRCUIT_ONLY_STARTED_GENERATORS,
419
420
  SHORT_CIRCUIT_PREDEFINED_PARAMS,
421
+ SHORT_CIRCUIT_VOLTAGE_RANGES,
420
422
  SHORT_CIRCUIT_WITH_FEEDER_RESULT,
421
423
  SHORT_CIRCUIT_WITH_LOADS,
422
424
  SHORT_CIRCUIT_WITH_NEUTRAL_POSITION,
@@ -523,6 +525,7 @@ export {
523
525
  isValidComputingType,
524
526
  login,
525
527
  logout,
528
+ onlyStartedGeneratorsOptions,
526
529
  queryValidator,
527
530
  recursiveRemove,
528
531
  sanitizePercentageValue,
@@ -17,9 +17,10 @@ export interface DirectoryItemsInputProps<CP extends OverflowableChipProps = Ove
17
17
  ChipComponent?: ComponentType<CP>;
18
18
  chipProps?: Partial<CP>;
19
19
  fullHeight?: boolean;
20
+ fullWidth?: boolean;
20
21
  }
21
22
  export declare function DirectoryItemsInput<CP extends OverflowableChipProps = OverflowableChipProps>({ label, name, elementType, // Used to specify type of element (Filter, Contingency list, ...)
22
23
  equipmentTypes, // Mostly used for filters, it allows the user to get elements of specific equipment only
23
24
  itemFilter, // Used to further filter the results displayed according to specific requirement
24
25
  titleId, // title of directory item selector dialogue
25
- hideErrorMessage, onRowChanged, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, fullHeight, }: Readonly<DirectoryItemsInputProps<CP>>): import("react/jsx-runtime").JSX.Element;
26
+ hideErrorMessage, onRowChanged, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, fullHeight, fullWidth, }: Readonly<DirectoryItemsInputProps<CP>>): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,9 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { FormControl, Tooltip, IconButton } from "@mui/material";
3
- import { Folder } from "@mui/icons-material";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Box, FormControl, InputLabel, Select, Tooltip, IconButton, OutlinedInput } from "@mui/material";
3
+ import { DriveFolderUpload } from "@mui/icons-material";
4
4
  import { useState, useMemo, useCallback, useEffect } from "react";
5
5
  import { useFieldArray, useWatch, useController } from "react-hook-form";
6
6
  import { useIntl } from "react-intl";
7
- import { FieldLabel } from "./utils/FieldLabel.js";
8
- import { isFieldRequired } from "./utils/functions.js";
9
7
  import "./provider/CustomFormProvider.js";
10
8
  import { useCustomFormContext } from "./provider/useCustomFormContext.js";
11
9
  import { ErrorInput } from "./errorManagement/ErrorInput.js";
@@ -24,22 +22,34 @@ import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
24
22
  import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
25
23
  import { NAME } from "./constants.js";
26
24
  import { OverflowableChip } from "./OverflowableChip.js";
25
+ import { FieldLabel } from "./utils/FieldLabel.js";
26
+ import { isFieldRequired } from "./utils/functions.js";
27
27
  const styles = {
28
- formDirectoryElements: {
28
+ selectDirectoryElements: {
29
29
  display: "flex",
30
- gap: "8px",
31
30
  flexWrap: "wrap",
32
- flexDirection: "row",
33
31
  alignContent: "flex-start",
34
- alignItems: "center",
35
- border: "2px solid lightgray",
36
- padding: "2px 8px",
37
- borderRadius: "4px",
38
- overflow: "hidden"
32
+ cursor: "pointer",
33
+ "& .MuiSelect-select": {
34
+ paddingY: "3px",
35
+ paddingX: "8px !important"
36
+ // because of the hidden select icon at right, we force a smaller padding
37
+ },
38
+ "& .MuiSelect-icon": {
39
+ display: "none"
40
+ }
39
41
  },
40
- formDirectoryElementsError: (theme) => ({
41
- borderColor: theme.palette.error.main
42
- })
42
+ renderDirectoryElements: {
43
+ display: "flex",
44
+ flexWrap: "wrap",
45
+ alignItems: "center"
46
+ },
47
+ inputLabel: {
48
+ left: "30px",
49
+ "&.MuiInputLabel-shrink": {
50
+ transform: "translate(-16px, -9px) scale(0.75)"
51
+ }
52
+ }
43
53
  };
44
54
  function DirectoryItemsInput({
45
55
  label,
@@ -60,7 +70,8 @@ function DirectoryItemsInput({
60
70
  labelRequiredFromContext = true,
61
71
  ChipComponent = OverflowableChip,
62
72
  chipProps,
63
- fullHeight
73
+ fullHeight = false,
74
+ fullWidth = true
64
75
  }) {
65
76
  const { snackError } = useSnackMessage();
66
77
  const intl = useIntl();
@@ -112,8 +123,9 @@ function DirectoryItemsInput({
112
123
  },
113
124
  [append, getValues, snackError, name, onRowChanged, onChange, selected, remove]
114
125
  );
115
- const removeElements = useCallback(
116
- (index) => {
126
+ const handleDeleteChip = useCallback(
127
+ (event, index) => {
128
+ event.stopPropagation();
117
129
  const elemToRemove = getValues(name)[index];
118
130
  remove(index);
119
131
  const newElems = getValues(name);
@@ -122,7 +134,7 @@ function DirectoryItemsInput({
122
134
  },
123
135
  [onRowChanged, remove, getValues, name, onChange]
124
136
  );
125
- const handleChipClick = useCallback(
137
+ const openItemsSelector = useCallback(
126
138
  (index) => {
127
139
  const chips = getValues(name);
128
140
  const chip = chips.at(index)?.id;
@@ -138,9 +150,29 @@ function DirectoryItemsInput({
138
150
  },
139
151
  [getValues, name]
140
152
  );
153
+ const handleClickChip = useCallback(
154
+ (event, index) => {
155
+ event.stopPropagation();
156
+ openItemsSelector(index);
157
+ },
158
+ [openItemsSelector]
159
+ );
141
160
  const shouldReplaceElement = useMemo(() => {
142
161
  return allowMultiSelect === false && elements?.length === 1;
143
162
  }, [allowMultiSelect, elements]);
163
+ const handleClickInput = useCallback(() => {
164
+ if (disable) {
165
+ return;
166
+ }
167
+ if (shouldReplaceElement) {
168
+ openItemsSelector(0);
169
+ } else {
170
+ setDirectoryItemSelectorOpen(true);
171
+ if (allowMultiSelect) {
172
+ setMultiSelect(true);
173
+ }
174
+ }
175
+ }, [shouldReplaceElement, openItemsSelector, allowMultiSelect, disable]);
144
176
  const hasElementsWithoutName = useMemo(() => {
145
177
  const elementsToCheck = watchedElements ?? elements;
146
178
  return (elementsToCheck ?? []).some((item) => !item?.[NAME]);
@@ -159,69 +191,80 @@ function DirectoryItemsInput({
159
191
  clearErrors(name);
160
192
  }
161
193
  }, [clearErrors, getFieldState, hasElementsWithoutName, intl, name, setError]);
162
- return /* @__PURE__ */ jsxs(Fragment, { children: [
194
+ const inputId = `directory-items-input-${name}`;
195
+ const fullLabel = label && /* @__PURE__ */ jsx(
196
+ FieldLabel,
197
+ {
198
+ label,
199
+ optional: labelRequiredFromContext && !isFieldRequired(name, validationSchema, getValues())
200
+ }
201
+ );
202
+ const hasElements = elements && elements.length > 0;
203
+ const fullHeightSx = fullHeight ? { height: "100%" } : void 0;
204
+ const selectWidth = label ? `${6 + label.length * 0.8}ch` : "auto";
205
+ return /* @__PURE__ */ jsxs(Box, { sx: fullHeightSx, children: [
163
206
  /* @__PURE__ */ jsxs(
164
207
  FormControl,
165
208
  {
166
- sx: mergeSx(
167
- styles.formDirectoryElements,
168
- // @ts-expect-error
169
- error?.message && styles.formDirectoryElementsError,
170
- fullHeight && { height: "100%" }
171
- ),
209
+ size: "small",
210
+ fullWidth,
211
+ sx: fullHeightSx,
212
+ disabled: disable,
172
213
  error: !!error?.message,
173
214
  children: [
174
- /* @__PURE__ */ jsx(Tooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
175
- IconButton,
215
+ label && /* @__PURE__ */ jsx(InputLabel, { htmlFor: inputId, shrink: hasElements, sx: styles.inputLabel, children: fullLabel }),
216
+ /* @__PURE__ */ jsx(
217
+ Select,
176
218
  {
177
- size: "small",
178
- disabled: disable,
179
- onClick: () => {
180
- if (shouldReplaceElement) {
181
- handleChipClick(0);
182
- } else {
183
- setDirectoryItemSelectorOpen(true);
184
- if (allowMultiSelect) {
185
- setMultiSelect(true);
219
+ value: elements,
220
+ multiple: true,
221
+ displayEmpty: true,
222
+ notched: hasElements,
223
+ open: false,
224
+ onClick: handleClickInput,
225
+ sx: mergeSx(styles.selectDirectoryElements, { minWidth: selectWidth }, fullHeightSx),
226
+ input: /* @__PURE__ */ jsx(
227
+ OutlinedInput,
228
+ {
229
+ id: inputId,
230
+ ...label && {
231
+ label: fullLabel
186
232
  }
187
233
  }
188
- },
189
- children: /* @__PURE__ */ jsx(Folder, {})
190
- }
191
- ) }) }),
192
- elements?.map((item, index) => {
193
- const elementName = watchedElements?.[index]?.[NAME] ?? getValues(`${name}.${index}.${NAME}`) ?? item?.[NAME];
194
- const equipmentTypeShortLabel = getEquipmentTypeShortLabel(item?.specificMetadata?.equipmentType);
195
- const { sx: chipSx, ...otherChipProps } = chipProps ?? {};
196
- return /* @__PURE__ */ jsx(
197
- ChipComponent,
198
- {
199
- onDelete: () => removeElements(index),
200
- onClick: () => handleChipClick(index),
201
- label: elementName || intl.formatMessage({ id: "elementNotFound" }),
202
- ...equipmentTypeShortLabel && {
203
- helperText: intl.formatMessage({
204
- id: equipmentTypeShortLabel
205
- })
206
- },
207
- sx: mergeSx(
208
- !elementName ? (theme) => ({
209
- backgroundColor: theme.palette.error.light,
210
- borderColor: theme.palette.error.main,
211
- color: theme.palette.error.contrastText
212
- }) : void 0,
213
- chipSx
214
- ),
215
- ...otherChipProps
216
- },
217
- item.id
218
- );
219
- }),
220
- elements?.length === 0 && label && /* @__PURE__ */ jsx(
221
- FieldLabel,
222
- {
223
- label,
224
- optional: labelRequiredFromContext && !isFieldRequired(name, validationSchema, getValues())
234
+ ),
235
+ renderValue: (directoryElements) => /* @__PURE__ */ jsxs(Box, { sx: styles.renderDirectoryElements, children: [
236
+ /* @__PURE__ */ jsx(Tooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { size: "small", disabled: disable, children: /* @__PURE__ */ jsx(DriveFolderUpload, {}) }) }) }),
237
+ directoryElements?.map((item, index) => {
238
+ const elementName = watchedElements?.[index]?.[NAME] ?? getValues(`${name}.${index}.${NAME}`) ?? item?.[NAME];
239
+ const equipmentTypeShortLabel = getEquipmentTypeShortLabel(
240
+ item?.specificMetadata?.equipmentType
241
+ );
242
+ const { sx: chipSx, ...otherChipProps } = chipProps ?? {};
243
+ return /* @__PURE__ */ jsx(
244
+ ChipComponent,
245
+ {
246
+ onDelete: (e) => handleDeleteChip(e, index),
247
+ onClick: (e) => handleClickChip(e, index),
248
+ label: elementName || intl.formatMessage({ id: "elementNotFound" }),
249
+ ...equipmentTypeShortLabel && {
250
+ helperText: intl.formatMessage({
251
+ id: equipmentTypeShortLabel
252
+ })
253
+ },
254
+ sx: mergeSx(
255
+ !elementName ? (theme) => ({
256
+ backgroundColor: theme.palette.error.light,
257
+ borderColor: theme.palette.error.main,
258
+ color: theme.palette.error.contrastText
259
+ }) : void 0,
260
+ chipSx
261
+ ),
262
+ ...otherChipProps
263
+ },
264
+ item.id
265
+ );
266
+ })
267
+ ] })
225
268
  }
226
269
  )
227
270
  ]
@@ -1,4 +1,5 @@
1
- import { ChipProps } from '@mui/material';
1
+ import { BoxProps, ChipProps } from '@mui/material';
2
2
  export interface OverflowableChipProps extends ChipProps {
3
+ boxSx?: BoxProps['sx'];
3
4
  }
4
- export declare function OverflowableChip({ label, ...otherProps }: Readonly<OverflowableChipProps>): import("react/jsx-runtime").JSX.Element;
5
+ export declare function OverflowableChip({ label, boxSx, ...otherProps }: Readonly<OverflowableChipProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Chip, Box } from "@mui/material";
2
+ import { Box, Chip } from "@mui/material";
3
3
  import { OverflowableText } from "../../overflowableText/OverflowableText.js";
4
- function OverflowableChip({ label, ...otherProps }) {
5
- return /* @__PURE__ */ jsx(
4
+ function OverflowableChip({ label, boxSx, ...otherProps }) {
5
+ return /* @__PURE__ */ jsx(Box, { padding: "3px", sx: { cursor: "default", ...boxSx }, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
6
6
  Chip,
7
7
  {
8
8
  size: "small",
@@ -12,13 +12,13 @@ function OverflowableChip({ label, ...otherProps }) {
12
12
  text: label,
13
13
  sx: {
14
14
  maxWidth: "20ch",
15
- mx: "auto"
15
+ marginX: "auto"
16
16
  }
17
17
  }
18
18
  ) }),
19
19
  ...otherProps
20
20
  }
21
- );
21
+ ) });
22
22
  }
23
23
  export {
24
24
  OverflowableChip
@@ -2,4 +2,4 @@ import { OverflowableChipProps } from './OverflowableChip';
2
2
  export interface OverflowableChipWithHelperTextProps extends OverflowableChipProps {
3
3
  helperText?: string;
4
4
  }
5
- export declare function OverflowableChipWithHelperText({ helperText, ...otherProps }: Readonly<OverflowableChipWithHelperTextProps>): import("react/jsx-runtime").JSX.Element;
5
+ export declare function OverflowableChipWithHelperText({ helperText, boxSx, ...otherProps }: Readonly<OverflowableChipWithHelperTextProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,30 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Box, FormHelperText } from "@mui/material";
3
3
  import { OverflowableChip } from "./OverflowableChip.js";
4
+ import "../../../utils/conversionUtils.js";
5
+ import "@mui/icons-material";
6
+ import { mergeSx } from "../../../utils/styles.js";
7
+ import "../../../utils/types/equipmentType.js";
8
+ import "../../../utils/yupConfig.js";
4
9
  function OverflowableChipWithHelperText({
5
10
  helperText,
11
+ boxSx,
6
12
  ...otherProps
7
13
  }) {
8
- return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "left", flexDirection: "column" }, children: [
9
- /* @__PURE__ */ jsx(OverflowableChip, { ...otherProps }),
10
- helperText && /* @__PURE__ */ jsx(FormHelperText, { sx: { fontSize: "x-small" }, children: helperText })
11
- ] });
14
+ return /* @__PURE__ */ jsxs(
15
+ Box,
16
+ {
17
+ display: "flex",
18
+ alignItems: "left",
19
+ flexDirection: "column",
20
+ sx: mergeSx({ cursor: "default" }, boxSx),
21
+ onClick: (e) => e.stopPropagation(),
22
+ children: [
23
+ /* @__PURE__ */ jsx(OverflowableChip, { boxSx: { paddingBottom: "2px" }, ...otherProps }),
24
+ helperText && /* @__PURE__ */ jsx(FormHelperText, { sx: { fontSize: "x-small", margin: 0, marginLeft: 2 }, children: helperText })
25
+ ]
26
+ }
27
+ );
12
28
  }
13
29
  export {
14
30
  OverflowableChipWithHelperText
@@ -11,7 +11,9 @@ function SelectInput(props) {
11
11
  return null;
12
12
  }
13
13
  if (typeof value === "string") {
14
- return options.find((option) => typeof option !== "string" && option?.id === value) || null;
14
+ return options.find(
15
+ (option) => typeof option !== "string" && option?.id === value || typeof option === "string" && option === value
16
+ ) || null;
15
17
  }
16
18
  return options.find((option) => typeof option !== "string" && option?.id === value.id) || null;
17
19
  };
@@ -1,5 +1,7 @@
1
1
  import { SxStyle } from '../../../../utils/styles';
2
2
  export interface DescriptionFieldProps {
3
3
  expandingTextSx?: SxStyle;
4
+ maxCharactersNumber?: number;
5
+ rows?: number;
4
6
  }
5
- export declare function DescriptionField({ expandingTextSx }: Readonly<DescriptionFieldProps>): import("react/jsx-runtime").JSX.Element;
7
+ export declare function DescriptionField({ expandingTextSx, maxCharactersNumber, rows, }: Readonly<DescriptionFieldProps>): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,15 @@ import { ControlPoint, Delete } from "@mui/icons-material";
6
6
  import { useFormContext } from "react-hook-form";
7
7
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
8
8
  import { ExpandingTextField } from "./ExpandingTextField.js";
9
- function DescriptionField({ expandingTextSx }) {
9
+ import { MAX_CHAR_DESCRIPTION } from "../../../../utils/constants/uiConstants.js";
10
+ import "../../../../utils/conversionUtils.js";
11
+ import "../../../../utils/types/equipmentType.js";
12
+ import "../../../../utils/yupConfig.js";
13
+ function DescriptionField({
14
+ expandingTextSx,
15
+ maxCharactersNumber = MAX_CHAR_DESCRIPTION,
16
+ rows = 3
17
+ }) {
10
18
  const { setValue, getValues } = useFormContext();
11
19
  const description = getValues(FieldConstants.DESCRIPTION);
12
20
  const [isDescriptionFieldVisible, setIsDescriptionFieldVisible] = useState(!!description);
@@ -28,9 +36,10 @@ function DescriptionField({ expandingTextSx }) {
28
36
  {
29
37
  name: FieldConstants.DESCRIPTION,
30
38
  label: "descriptionProperty",
31
- minRows: 3,
32
- rows: 3,
33
- sx: expandingTextSx
39
+ minRows: rows,
40
+ rows,
41
+ sx: expandingTextSx,
42
+ maxCharactersNumber
34
43
  }
35
44
  ),
36
45
  /* @__PURE__ */ jsx(
@@ -68,7 +68,15 @@ const OverflowableText = styled(
68
68
  const tooltipStyleProps = {
69
69
  ...tooltipStyle && { classes: { tooltip: tooltipStyle } },
70
70
  ...finalTooltipSx && {
71
- slotProps: { tooltip: { sx: finalTooltipSx } }
71
+ slotProps: {
72
+ tooltip: {
73
+ onClick: (e) => e.stopPropagation(),
74
+ sx: finalTooltipSx
75
+ },
76
+ popper: {
77
+ onClick: (e) => e.stopPropagation()
78
+ }
79
+ }
72
80
  }
73
81
  };
74
82
  const boxSx = mergeSx(isMultiLine ? multilineOverflowStyle(maxLineCount) : overflowStyle.overflow, sx);
@@ -4,12 +4,12 @@ import { FormattedMessage } from "react-intl";
4
4
  import { LineSeparator } from "./line-separator.js";
5
5
  import { parametersStyles } from "../parameters-style.js";
6
6
  import "../../overflowableText/OverflowableText.js";
7
- import "react";
8
- import "react-hook-form";
9
- import "../../../utils/types/equipmentType.js";
10
7
  import "../../../utils/conversionUtils.js";
11
8
  import "@mui/icons-material";
9
+ import "../../../utils/types/equipmentType.js";
12
10
  import "../../../utils/yupConfig.js";
11
+ import "react";
12
+ import "react-hook-form";
13
13
  import "localized-countries";
14
14
  import "localized-countries/data/fr";
15
15
  import "localized-countries/data/en";
@@ -14,3 +14,6 @@ export declare const VoltageAdornment: {
14
14
  position: string;
15
15
  text: string;
16
16
  };
17
+ export declare const VERSION_PARAMETER = "version";
18
+ export declare const COMMON_PARAMETERS = "commonParameters";
19
+ export declare const SPECIFIC_PARAMETERS = "specificParametersPerProvider";
@@ -15,7 +15,11 @@ const VoltageAdornment = {
15
15
  position: "end",
16
16
  text: KILO_VOLT
17
17
  };
18
+ const VERSION_PARAMETER = "version";
19
+ const COMMON_PARAMETERS = "commonParameters";
20
+ const SPECIFIC_PARAMETERS = "specificParametersPerProvider";
18
21
  export {
22
+ COMMON_PARAMETERS,
19
23
  PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD,
20
24
  PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD,
21
25
  PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD,
@@ -24,6 +28,8 @@ export {
24
28
  PARAM_SA_PROVIDER,
25
29
  PROVIDER,
26
30
  ReactivePowerAdornment,
31
+ SPECIFIC_PARAMETERS,
32
+ VERSION_PARAMETER,
27
33
  VOLTAGE_LEVEL,
28
34
  VoltageAdornment
29
35
  };
@@ -1,5 +1,5 @@
1
1
  import { ComputingType, formatComputingTypeLabel, isValidComputingType } from "./computing-type.js";
2
- import { PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, ReactivePowerAdornment, VOLTAGE_LEVEL, VoltageAdornment } from "./constant.js";
2
+ import { COMMON_PARAMETERS, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, ReactivePowerAdornment, SPECIFIC_PARAMETERS, VERSION_PARAMETER, VOLTAGE_LEVEL, VoltageAdornment } from "./constant.js";
3
3
  import { LineSeparator } from "./line-separator.js";
4
4
  import { LabelledButton, SwitchWithLabel, TabPanel } from "./parameters.js";
5
5
  import { CreateParameterDialog } from "./parameters-creation-dialog.js";
@@ -19,6 +19,7 @@ import { LimitReductionTableRow } from "./limitreductions/limit-reduction-table-
19
19
  import { LimitReductionTableCell } from "./limitreductions/limit-reduction-table-cell.js";
20
20
  export {
21
21
  COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS,
22
+ COMMON_PARAMETERS,
22
23
  ComputingType,
23
24
  CreateParameterDialog,
24
25
  CustomVoltageLevelTable,
@@ -46,10 +47,12 @@ export {
46
47
  ParameterSwitch,
47
48
  ProviderParam,
48
49
  ReactivePowerAdornment,
50
+ SPECIFIC_PARAMETERS,
49
51
  SwitchWithLabel,
50
52
  TAB_INFO,
51
53
  TabPanel,
52
54
  TabValues,
55
+ VERSION_PARAMETER,
53
56
  VOLTAGE_LEVEL,
54
57
  VOLTAGE_LEVELS_FORM,
55
58
  VoltageAdornment,
@@ -3,12 +3,12 @@ import { Tooltip, TableCell } from "@mui/material";
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { VOLTAGE_LEVELS_FORM, LIMIT_REDUCTIONS_FORM } from "./columns-definitions.js";
5
5
  import "../../../overflowableText/OverflowableText.js";
6
- import "react";
7
- import "react-hook-form";
8
- import "../../../../utils/types/equipmentType.js";
9
6
  import "../../../../utils/conversionUtils.js";
10
7
  import "@mui/icons-material";
8
+ import "../../../../utils/types/equipmentType.js";
11
9
  import "../../../../utils/yupConfig.js";
10
+ import "react";
11
+ import "react-hook-form";
12
12
  import "localized-countries";
13
13
  import "localized-countries/data/fr";
14
14
  import "localized-countries/data/en";
@@ -5,11 +5,11 @@ import { COLUMNS_DEFINITIONS_LIMIT_REDUCTIONS, LIMIT_DURATION_FORM, LIMIT_REDUCT
5
5
  import { CustomVoltageLevelTable } from "../voltage-level-table/custom-voltage-level-table.js";
6
6
  import "@mui/material";
7
7
  import "../../../overflowableText/OverflowableText.js";
8
- import "react-hook-form";
9
- import "../../../../utils/types/equipmentType.js";
10
8
  import "../../../../utils/conversionUtils.js";
11
9
  import "@mui/icons-material";
10
+ import "../../../../utils/types/equipmentType.js";
12
11
  import "../../../../utils/yupConfig.js";
12
+ import "react-hook-form";
13
13
  import "localized-countries";
14
14
  import "localized-countries/data/fr";
15
15
  import "localized-countries/data/en";
@@ -3,11 +3,11 @@ import "react/jsx-runtime";
3
3
  import "react-intl";
4
4
  import "@mui/material";
5
5
  import "../../../overflowableText/OverflowableText.js";
6
- import "react";
7
- import "react-hook-form";
8
- import "../../../../utils/types/equipmentType.js";
9
6
  import "../../../../utils/conversionUtils.js";
10
7
  import "@mui/icons-material";
8
+ import "../../../../utils/types/equipmentType.js";
9
+ import "react";
10
+ import "react-hook-form";
11
11
  import "localized-countries";
12
12
  import "localized-countries/data/fr";
13
13
  import "localized-countries/data/en";