@gridsuite/commons-ui 0.143.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.
- package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -1
- package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +2 -2
- package/dist/components/dnd-table/dnd-table.js +3 -3
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +2 -1
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +118 -75
- package/dist/components/inputs/reactHookForm/OverflowableChip.d.ts +3 -2
- package/dist/components/inputs/reactHookForm/OverflowableChip.js +5 -5
- package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.d.ts +1 -1
- package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.js +20 -4
- package/dist/components/inputs/reactHookForm/selectInputs/SelectInput.js +3 -1
- package/dist/components/inputs/reactHookForm/text/DescriptionField.d.ts +3 -1
- package/dist/components/inputs/reactHookForm/text/DescriptionField.js +13 -4
- package/dist/components/overflowableText/OverflowableText.js +9 -1
- package/dist/components/parameters/common/ProviderParam.js +3 -3
- package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +3 -3
- package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +2 -2
- package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +3 -3
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +3 -3
- package/dist/components/parameters/common/widget/parameter-float.js +3 -3
- package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +3 -3
- package/dist/components/parameters/common/widget/parameter-line-slider.js +3 -3
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +2 -2
- package/dist/components/parameters/loadflow/load-flow-parameter-field.js +3 -3
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +3 -3
- package/dist/components/parameters/loadflow/load-flow-parameters-header.js +3 -3
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +7 -4
- package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +3 -3
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -2
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
- package/dist/components/parameters/pcc-min/pcc-min-form-utils.js +3 -3
- package/dist/components/parameters/pcc-min/pcc-min-parameters-form.js +3 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +3 -3
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +3 -3
- package/dist/components/parameters/sensi/sensitivity-Flow-parameters.js +3 -3
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +3 -3
- package/dist/components/parameters/sensi/sensitivity-table.js +1 -1
- package/dist/components/parameters/sensi/table-cell.js +3 -3
- package/dist/components/parameters/short-circuit/short-circuit-fields.js +1 -1
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +3 -3
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +3 -3
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +3 -3
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +3 -3
- package/dist/index.js +2 -1
- package/dist/services/index.js +1 -2
- package/dist/services/utils.d.ts +0 -4
- package/dist/services/utils.js +4 -10
- package/dist/translations/en/businessErrorsEn.d.ts +17 -0
- package/dist/translations/en/businessErrorsEn.js +20 -3
- package/dist/translations/en/inputsEn.d.ts +1 -1
- package/dist/translations/en/inputsEn.js +1 -1
- package/dist/translations/fr/businessErrorsFr.d.ts +17 -0
- package/dist/translations/fr/businessErrorsFr.js +20 -3
- package/dist/translations/fr/inputsFr.d.ts +1 -1
- package/dist/translations/fr/inputsFr.js +1 -1
- package/dist/utils/error.js +8 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/types/NetworkTimeoutError.d.ts +10 -0
- package/dist/utils/types/NetworkTimeoutError.js +9 -0
- package/dist/utils/types/index.d.ts +1 -0
- package/dist/utils/types/index.js +2 -0
- package/package.json +1 -1
|
@@ -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";
|
|
@@ -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 {
|
|
2
|
-
import { FormControl, Tooltip, IconButton } from "@mui/material";
|
|
3
|
-
import {
|
|
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
|
-
|
|
28
|
+
selectDirectoryElements: {
|
|
29
29
|
display: "flex",
|
|
30
|
-
gap: "8px",
|
|
31
30
|
flexWrap: "wrap",
|
|
32
|
-
flexDirection: "row",
|
|
33
31
|
alignContent: "flex-start",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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(
|
|
175
|
-
|
|
215
|
+
label && /* @__PURE__ */ jsx(InputLabel, { htmlFor: inputId, shrink: hasElements, sx: styles.inputLabel, children: fullLabel }),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
Select,
|
|
176
218
|
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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 {
|
|
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
|
-
|
|
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(
|
|
9
|
-
|
|
10
|
-
|
|
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(
|
|
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
|
-
|
|
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:
|
|
32
|
-
rows
|
|
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: {
|
|
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";
|
|
@@ -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";
|
package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js
CHANGED
|
@@ -3,12 +3,12 @@ import { TableCell } from "@mui/material";
|
|
|
3
3
|
import { VOLTAGE_LEVEL } from "../constant.js";
|
|
4
4
|
import "react-intl";
|
|
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";
|
|
@@ -2,12 +2,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Tooltip, Grid } from "@mui/material";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import "../../../overflowableText/OverflowableText.js";
|
|
5
|
-
import "react";
|
|
6
|
-
import "react-hook-form";
|
|
7
|
-
import "../../../../utils/types/equipmentType.js";
|
|
8
5
|
import "../../../../utils/conversionUtils.js";
|
|
9
6
|
import "@mui/icons-material";
|
|
7
|
+
import "../../../../utils/types/equipmentType.js";
|
|
10
8
|
import "../../../../utils/yupConfig.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";
|
|
@@ -3,12 +3,12 @@ import { Grid } from "@mui/material";
|
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import { parametersStyles } from "../../parameters-style.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";
|
|
@@ -3,12 +3,12 @@ import { Grid } from "@mui/material";
|
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import { parametersStyles } from "../../parameters-style.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";
|
|
@@ -7,11 +7,11 @@ import { ParameterType } from "../../../utils/types/parameters.type.js";
|
|
|
7
7
|
import "@mui/material";
|
|
8
8
|
import "react-intl";
|
|
9
9
|
import "../../overflowableText/OverflowableText.js";
|
|
10
|
-
import "react-hook-form";
|
|
11
|
-
import "../../../utils/types/equipmentType.js";
|
|
12
10
|
import "../../../utils/conversionUtils.js";
|
|
13
11
|
import "@mui/icons-material";
|
|
12
|
+
import "../../../utils/types/equipmentType.js";
|
|
14
13
|
import "../../../utils/yupConfig.js";
|
|
14
|
+
import "react-hook-form";
|
|
15
15
|
import "localized-countries";
|
|
16
16
|
import "localized-countries/data/fr";
|
|
17
17
|
import "localized-countries/data/en";
|
|
@@ -4,12 +4,12 @@ import { FormattedMessage } from "react-intl";
|
|
|
4
4
|
import { parametersStyles } from "../parameters-style.js";
|
|
5
5
|
import { ParameterType } from "../../../utils/types/parameters.type.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";
|