@gridsuite/commons-ui 0.285.0 → 0.286.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/ui/reactHookForm/DirectoryItemsInput.d.ts +2 -1
- package/dist/components/ui/reactHookForm/DirectoryItemsInput.js +14 -2
- package/dist/components/ui/reactHookForm/text/DescriptionField.d.ts +3 -1
- package/dist/components/ui/reactHookForm/text/DescriptionField.js +12 -2
- package/dist/features/index.js +2 -1
- package/dist/features/network-modification-table/renderers/reference-link-cell.js +4 -4
- package/dist/features/network-modification-table/utils.js +1 -1
- package/dist/features/parameters/common/widget/parameter-line-directory-items-input.d.ts +4 -1
- package/dist/features/parameters/common/widget/parameter-line-directory-items-input.js +8 -4
- package/dist/features/process-configs/index.js +2 -1
- package/dist/features/process-configs/process-config.utils.d.ts +31 -0
- package/dist/features/process-configs/process-config.utils.js +53 -0
- package/dist/index.js +2 -1
- package/dist/utils/types/network-modification-metadata.d.ts +3 -3
- package/package.json +1 -1
|
@@ -18,9 +18,10 @@ export interface DirectoryItemsInputProps<CP extends OverflowableChipProps = Ove
|
|
|
18
18
|
fullHeight?: boolean;
|
|
19
19
|
fullWidth?: boolean;
|
|
20
20
|
dataTestId?: string;
|
|
21
|
+
showPlaceHolder?: boolean;
|
|
21
22
|
}
|
|
22
23
|
export declare function DirectoryItemsInput<CP extends OverflowableChipProps = OverflowableChipProps>({ label, name, elementType, // Used to specify type of element (Filter, Contingency list, ...)
|
|
23
24
|
equipmentTypes, // Mostly used for filters, it allows the user to get elements of specific equipment only
|
|
24
25
|
itemFilter, // Used to further filter the results displayed according to specific requirement
|
|
25
26
|
titleId, // title of directory item selector dialogue
|
|
26
|
-
hideErrorMessage, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, fullHeight, fullWidth, dataTestId, }: Readonly<DirectoryItemsInputProps<CP>>): import("react").JSX.Element;
|
|
27
|
+
hideErrorMessage, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, fullHeight, fullWidth, dataTestId, showPlaceHolder, }: Readonly<DirectoryItemsInputProps<CP>>): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, FormControl, InputLabel, Select, IconButton, OutlinedInput } from "@mui/material";
|
|
2
|
+
import { Box, FormControl, InputLabel, Select, IconButton, Typography, OutlinedInput } from "@mui/material";
|
|
3
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";
|
|
@@ -71,7 +71,8 @@ function DirectoryItemsInput({
|
|
|
71
71
|
chipProps,
|
|
72
72
|
fullHeight = false,
|
|
73
73
|
fullWidth = true,
|
|
74
|
-
dataTestId
|
|
74
|
+
dataTestId,
|
|
75
|
+
showPlaceHolder = false
|
|
75
76
|
}) {
|
|
76
77
|
const { snackError } = useSnackMessage();
|
|
77
78
|
const intl = useIntl();
|
|
@@ -233,6 +234,17 @@ function DirectoryItemsInput({
|
|
|
233
234
|
),
|
|
234
235
|
renderValue: (directoryElements) => /* @__PURE__ */ jsxs(Box, { sx: styles.renderDirectoryElements, children: [
|
|
235
236
|
/* @__PURE__ */ jsx(CustomTooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { size: "small", disabled: disable, children: /* @__PURE__ */ jsx(DriveFolderUpload, { "data-testid": "DriveFolderUploadIcon" }) }) }) }),
|
|
237
|
+
showPlaceHolder && !directoryElements?.length && /* @__PURE__ */ jsx(
|
|
238
|
+
Typography,
|
|
239
|
+
{
|
|
240
|
+
variant: "body2",
|
|
241
|
+
color: "text.secondary",
|
|
242
|
+
sx: {
|
|
243
|
+
whiteSpace: "nowrap"
|
|
244
|
+
},
|
|
245
|
+
children: intl.formatMessage({ id: "importElements" })
|
|
246
|
+
}
|
|
247
|
+
),
|
|
236
248
|
directoryElements?.map((item, index) => {
|
|
237
249
|
const elementName = watchedElements?.[index]?.[NAME] ?? getValues(`${name}.${index}.${NAME}`) ?? item?.[NAME];
|
|
238
250
|
const equipmentTypeShortLabel = getEquipmentTypeShortLabel(
|
|
@@ -3,5 +3,7 @@ export interface DescriptionFieldProps {
|
|
|
3
3
|
expandingTextSx?: SxStyle;
|
|
4
4
|
maxCharactersNumber?: number;
|
|
5
5
|
rows?: number;
|
|
6
|
+
buttonLabel?: string;
|
|
7
|
+
buttonSx?: SxStyle;
|
|
6
8
|
}
|
|
7
|
-
export declare function DescriptionField({ expandingTextSx, maxCharactersNumber, rows, }: Readonly<DescriptionFieldProps>): import("react").JSX.Element;
|
|
9
|
+
export declare function DescriptionField({ expandingTextSx, maxCharactersNumber, rows, buttonLabel, buttonSx, }: Readonly<DescriptionFieldProps>): import("react").JSX.Element;
|
|
@@ -12,7 +12,9 @@ import { AddButton } from "../../addButton/AddButton.js";
|
|
|
12
12
|
function DescriptionField({
|
|
13
13
|
expandingTextSx,
|
|
14
14
|
maxCharactersNumber = MAX_CHAR_DESCRIPTION,
|
|
15
|
-
rows = 3
|
|
15
|
+
rows = 3,
|
|
16
|
+
buttonLabel,
|
|
17
|
+
buttonSx
|
|
16
18
|
}) {
|
|
17
19
|
const { setValue, getValues } = useFormContext();
|
|
18
20
|
const description = getValues(FieldConstants.DESCRIPTION);
|
|
@@ -29,7 +31,15 @@ function DescriptionField({
|
|
|
29
31
|
setIsDescriptionFieldVisible(true);
|
|
30
32
|
}
|
|
31
33
|
}, [description]);
|
|
32
|
-
return !isDescriptionFieldVisible ? /* @__PURE__ */ jsx(
|
|
34
|
+
return !isDescriptionFieldVisible ? /* @__PURE__ */ jsx(
|
|
35
|
+
AddButton,
|
|
36
|
+
{
|
|
37
|
+
onClick: handleOpenDescription,
|
|
38
|
+
"data-testid": "AddDescriptionButton",
|
|
39
|
+
sx: buttonSx,
|
|
40
|
+
label: buttonLabel || "AddDescription"
|
|
41
|
+
}
|
|
42
|
+
) : /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "flex-start" }, children: [
|
|
33
43
|
/* @__PURE__ */ jsx(
|
|
34
44
|
ExpandingTextField,
|
|
35
45
|
{
|
package/dist/features/index.js
CHANGED
|
@@ -322,7 +322,7 @@ import { RESULTS_LOADING_DELAY } from "./results/constants.js";
|
|
|
322
322
|
import { ProcessType } from "./process-configs/common/process-config.type.js";
|
|
323
323
|
import { emptyProcessConfigModificationsFormData, getProcessConfigModificationsBackendFromFormData, getProcessConfigModificationsFormData, processConfigModificationsShape } from "./process-configs/common/process-config-modifications-edition.utils.js";
|
|
324
324
|
import { ProcessConfigModificationsEdition } from "./process-configs/common/process-config-modifications-edition.js";
|
|
325
|
-
import { isProcessType } from "./process-configs/process-config.utils.js";
|
|
325
|
+
import { getNamedProcessConfigFormData, isProcessType } from "./process-configs/process-config.utils.js";
|
|
326
326
|
import { LFProcessConfigEditionDialog } from "./process-configs/lf-process-config-edition-dialog.js";
|
|
327
327
|
import { SAProcessConfigEditionDialog } from "./process-configs/sa-process-config-edition-dialog.js";
|
|
328
328
|
import { SCProcessConfigEditionDialog } from "./process-configs/sc-process-config-edition-dialog.js";
|
|
@@ -956,6 +956,7 @@ export {
|
|
|
956
956
|
getLineCharacteristicsEmptyFormData,
|
|
957
957
|
getLineCharacteristicsFormData,
|
|
958
958
|
getLineCharacteristicsValidationSchemaProps,
|
|
959
|
+
getNamedProcessConfigFormData,
|
|
959
960
|
getNewVoltageLevelData,
|
|
960
961
|
getNoRowsMessage,
|
|
961
962
|
getOptionLabel,
|
|
@@ -83,15 +83,15 @@ function ReferenceLinkCell({ data, disabled = false }) {
|
|
|
83
83
|
fetchNetworkModification(data.uuid).then((res) => res.json()),
|
|
84
84
|
fetchAppsMetadata()
|
|
85
85
|
]).then(([referenceInfos, metadata]) => {
|
|
86
|
-
const
|
|
86
|
+
const referencedId = referenceInfos?.referencedId;
|
|
87
87
|
const exploreUrl = metadata?.find(isExploreMetadata)?.url;
|
|
88
|
-
if (!
|
|
88
|
+
if (!referencedId || !exploreUrl) {
|
|
89
89
|
throw new Error(
|
|
90
|
-
`Cannot build reference link: ${!
|
|
90
|
+
`Cannot build reference link: ${!referencedId ? "referencedId" : "exploreUrl"} is missing`
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
const link = new URL(
|
|
94
|
-
`${exploreUrl}/elements/${
|
|
94
|
+
`${exploreUrl}/elements/${referencedId}`,
|
|
95
95
|
globalThis.location.origin
|
|
96
96
|
).toString();
|
|
97
97
|
return navigator.clipboard.writeText(link).then(() => snackInfo({ headerId: "linkCopied" }));
|
|
@@ -11,6 +11,9 @@ type DirectoryItemsInputLineProps = {
|
|
|
11
11
|
elementType: string;
|
|
12
12
|
hideErrorMessage?: boolean;
|
|
13
13
|
allowMultiSelect?: boolean;
|
|
14
|
+
labelGridSize?: number;
|
|
15
|
+
inputGridSize?: number;
|
|
16
|
+
showPlaceHolder?: boolean;
|
|
14
17
|
};
|
|
15
|
-
export declare function ParameterLineDirectoryItemsInput({ label, name, equipmentTypes, elementType, hideErrorMessage, allowMultiSelect, }: Readonly<DirectoryItemsInputLineProps>): import("react").JSX.Element;
|
|
18
|
+
export declare function ParameterLineDirectoryItemsInput({ label, name, equipmentTypes, elementType, hideErrorMessage, allowMultiSelect, labelGridSize, inputGridSize, showPlaceHolder, }: Readonly<DirectoryItemsInputLineProps>): import("react").JSX.Element;
|
|
16
19
|
export {};
|
|
@@ -37,11 +37,14 @@ function ParameterLineDirectoryItemsInput({
|
|
|
37
37
|
equipmentTypes,
|
|
38
38
|
elementType,
|
|
39
39
|
hideErrorMessage,
|
|
40
|
-
allowMultiSelect = true
|
|
40
|
+
allowMultiSelect = true,
|
|
41
|
+
labelGridSize = 7,
|
|
42
|
+
inputGridSize = 5,
|
|
43
|
+
showPlaceHolder = false
|
|
41
44
|
}) {
|
|
42
45
|
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, paddingTop: 1, paddingBottom: 1, sx: { width: "100%" }, children: [
|
|
43
|
-
/* @__PURE__ */ jsx(Grid, { size:
|
|
44
|
-
/* @__PURE__ */ jsx(Grid, { size:
|
|
46
|
+
/* @__PURE__ */ jsx(Grid, { size: labelGridSize, sx: parametersStyles.parameterName, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
|
|
47
|
+
/* @__PURE__ */ jsx(Grid, { size: inputGridSize, sx: parametersStyles.controlItem, children: /* @__PURE__ */ jsx(
|
|
45
48
|
DirectoryItemsInput,
|
|
46
49
|
{
|
|
47
50
|
name,
|
|
@@ -51,7 +54,8 @@ function ParameterLineDirectoryItemsInput({
|
|
|
51
54
|
hideErrorMessage,
|
|
52
55
|
label: void 0,
|
|
53
56
|
itemFilter: void 0,
|
|
54
|
-
allowMultiSelect
|
|
57
|
+
allowMultiSelect,
|
|
58
|
+
showPlaceHolder
|
|
55
59
|
}
|
|
56
60
|
) })
|
|
57
61
|
] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProcessType } from "./common/process-config.type.js";
|
|
2
2
|
import { emptyProcessConfigModificationsFormData, getProcessConfigModificationsBackendFromFormData, getProcessConfigModificationsFormData, processConfigModificationsShape } from "./common/process-config-modifications-edition.utils.js";
|
|
3
3
|
import { ProcessConfigModificationsEdition } from "./common/process-config-modifications-edition.js";
|
|
4
|
-
import { isProcessType } from "./process-config.utils.js";
|
|
4
|
+
import { getNamedProcessConfigFormData, isProcessType } from "./process-config.utils.js";
|
|
5
5
|
import { LFProcessConfigEditionDialog } from "./lf-process-config-edition-dialog.js";
|
|
6
6
|
import { SAProcessConfigEditionDialog } from "./sa-process-config-edition-dialog.js";
|
|
7
7
|
import { SCProcessConfigEditionDialog } from "./sc-process-config-edition-dialog.js";
|
|
@@ -12,6 +12,7 @@ export {
|
|
|
12
12
|
SAProcessConfigEditionDialog,
|
|
13
13
|
SCProcessConfigEditionDialog,
|
|
14
14
|
emptyProcessConfigModificationsFormData,
|
|
15
|
+
getNamedProcessConfigFormData,
|
|
15
16
|
getProcessConfigModificationsBackendFromFormData,
|
|
16
17
|
getProcessConfigModificationsFormData,
|
|
17
18
|
isProcessType,
|
|
@@ -1,2 +1,33 @@
|
|
|
1
1
|
import { ProcessType } from './common';
|
|
2
2
|
export declare function isProcessType(type: string): type is ProcessType;
|
|
3
|
+
export declare function getNamedProcessConfigFormData(processConfig: any, name: string, description: string | null): Promise<{
|
|
4
|
+
description?: string | null | undefined;
|
|
5
|
+
name?: string | null | undefined;
|
|
6
|
+
loadflowParameters: {
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
id: string;
|
|
9
|
+
}[];
|
|
10
|
+
modifications: {
|
|
11
|
+
description?: string | null | undefined;
|
|
12
|
+
active: NonNullable<boolean | undefined>;
|
|
13
|
+
modification: {
|
|
14
|
+
name?: string | undefined;
|
|
15
|
+
id: string;
|
|
16
|
+
}[];
|
|
17
|
+
}[];
|
|
18
|
+
} | {
|
|
19
|
+
description?: string | null | undefined;
|
|
20
|
+
name?: string | null | undefined;
|
|
21
|
+
shortcircuitParameters: {
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
id: string;
|
|
24
|
+
}[];
|
|
25
|
+
modifications: {
|
|
26
|
+
description?: string | null | undefined;
|
|
27
|
+
active: NonNullable<boolean | undefined>;
|
|
28
|
+
modification: {
|
|
29
|
+
name?: string | undefined;
|
|
30
|
+
id: string;
|
|
31
|
+
}[];
|
|
32
|
+
}[];
|
|
33
|
+
}>;
|
|
@@ -58,9 +58,62 @@ import "../../components/composite/report/report-viewer/log-table/log-table.js";
|
|
|
58
58
|
import "react-window";
|
|
59
59
|
import "../../components/composite/report/report-treeview/treeview-item.js";
|
|
60
60
|
import "../../components/composite/report/report-viewer/context/report-viewer-context.js";
|
|
61
|
+
import "../parameters/common/parameter-layout/parameter-layout-provider.js";
|
|
62
|
+
import "../parameters/common/widget/parameter-line-slider.js";
|
|
63
|
+
import "../parameters/common/contingency-table/contingency-table.js";
|
|
64
|
+
import "../parameters/common/contingency-table/columns-definitions.js";
|
|
65
|
+
import "@hookform/resolvers/yup";
|
|
66
|
+
import "../parameters/network-visualizations/constants.js";
|
|
67
|
+
import "../parameters/loadflow/load-flow-parameters-context.js";
|
|
68
|
+
import "../parameters/loadflow/load-flow-parameters-utils.js";
|
|
69
|
+
import "../parameters/loadflow/load-flow-parameters-content.js";
|
|
70
|
+
import "../parameters/short-circuit/short-circuit-parameters-content.js";
|
|
71
|
+
import "../parameters/short-circuit/short-circuit-parameters-utils.js";
|
|
72
|
+
import "../parameters/voltage-init/constants.js";
|
|
73
|
+
import "../parameters/voltage-init/voltage-init-form-utils.js";
|
|
74
|
+
import "../parameters/security-analysis/constants.js";
|
|
75
|
+
import "../parameters/security-analysis/security-analysis-parameters-utils.js";
|
|
76
|
+
import "../parameters/sensi/utils.js";
|
|
77
|
+
import "../parameters/sensi/columns-definitions.js";
|
|
78
|
+
import "../parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js";
|
|
79
|
+
import "../parameters/dynamic-simulation/dynamic-simulation.type.js";
|
|
80
|
+
import "../parameters/dynamic-simulation/time-delay/time-delay-parameters-utils.js";
|
|
81
|
+
import "../parameters/dynamic-simulation/time-delay/time-delay-parameters.js";
|
|
82
|
+
import "../parameters/dynamic-simulation/solver/solver-parameters-utils.js";
|
|
83
|
+
import "../parameters/dynamic-simulation/solver/solver-parameters.js";
|
|
84
|
+
import "../parameters/dynamic-simulation/mapping/mapping-parameters-utils.js";
|
|
85
|
+
import "../parameters/dynamic-simulation/network/network-parameters-utils.js";
|
|
86
|
+
import "../parameters/dynamic-simulation/network/network-parameters.js";
|
|
87
|
+
import "../parameters/dynamic-simulation/curve/dialog/curve-preview.js";
|
|
88
|
+
import "../parameters/dynamic-simulation/curve/dialog/curve-selector.js";
|
|
89
|
+
import "../parameters/dynamic-simulation/curve/common/grid-search.js";
|
|
90
|
+
import "../parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js";
|
|
91
|
+
import "../parameters/dynamic-security-analysis/scenario-parameters.js";
|
|
92
|
+
import "../parameters/dynamic-security-analysis/contingency-parameters.js";
|
|
93
|
+
import "../parameters/dynamic-security-analysis/dynamic-security-analysis.type.js";
|
|
94
|
+
import "../parameters/dynamic-margin-calculation/time-delay-parameters.js";
|
|
95
|
+
import "../parameters/dynamic-margin-calculation/loads-variations-parameters.js";
|
|
96
|
+
import "../parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js";
|
|
97
|
+
import "../parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js";
|
|
98
|
+
import { getNamedLFProcessConfigFormData } from "./loadflow/lf-process-config-edition.utils.js";
|
|
99
|
+
import { getNamedSAProcessConfigFormData } from "./security-analysis/sa-process-config-edition.utils.js";
|
|
100
|
+
import { getNamedSCProcessConfigFormData } from "./shortcircuit/sc-process-config-edition.utils.js";
|
|
61
101
|
function isProcessType(type) {
|
|
62
102
|
return Object.values(ProcessType).includes(type);
|
|
63
103
|
}
|
|
104
|
+
async function getNamedProcessConfigFormData(processConfig, name, description) {
|
|
105
|
+
switch (processConfig.processType) {
|
|
106
|
+
case ProcessType.LOADFLOW:
|
|
107
|
+
return getNamedLFProcessConfigFormData(processConfig, name, description);
|
|
108
|
+
case ProcessType.SECURITY_ANALYSIS:
|
|
109
|
+
return getNamedSAProcessConfigFormData(processConfig, name, description);
|
|
110
|
+
case ProcessType.SHORT_CIRCUIT:
|
|
111
|
+
return getNamedSCProcessConfigFormData(processConfig, name, description);
|
|
112
|
+
default:
|
|
113
|
+
throw new Error(`Unsupported process type: ${processConfig.processType}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
64
116
|
export {
|
|
117
|
+
getNamedProcessConfigFormData,
|
|
65
118
|
isProcessType
|
|
66
119
|
};
|
package/dist/index.js
CHANGED
|
@@ -518,7 +518,7 @@ import { RESULTS_LOADING_DELAY } from "./features/results/constants.js";
|
|
|
518
518
|
import { ProcessType } from "./features/process-configs/common/process-config.type.js";
|
|
519
519
|
import { emptyProcessConfigModificationsFormData, getProcessConfigModificationsBackendFromFormData, getProcessConfigModificationsFormData, processConfigModificationsShape } from "./features/process-configs/common/process-config-modifications-edition.utils.js";
|
|
520
520
|
import { ProcessConfigModificationsEdition } from "./features/process-configs/common/process-config-modifications-edition.js";
|
|
521
|
-
import { isProcessType } from "./features/process-configs/process-config.utils.js";
|
|
521
|
+
import { getNamedProcessConfigFormData, isProcessType } from "./features/process-configs/process-config.utils.js";
|
|
522
522
|
import { LFProcessConfigEditionDialog } from "./features/process-configs/lf-process-config-edition-dialog.js";
|
|
523
523
|
import { SAProcessConfigEditionDialog } from "./features/process-configs/sa-process-config-edition-dialog.js";
|
|
524
524
|
import { SCProcessConfigEditionDialog } from "./features/process-configs/sc-process-config-edition-dialog.js";
|
|
@@ -1702,6 +1702,7 @@ export {
|
|
|
1702
1702
|
getLoadTypeLabel,
|
|
1703
1703
|
getNameElementEditorEmptyFormData,
|
|
1704
1704
|
getNameElementEditorSchema,
|
|
1705
|
+
getNamedProcessConfigFormData,
|
|
1705
1706
|
getNetworkModificationsFromComposite,
|
|
1706
1707
|
getNetworkVisualizationsParameters,
|
|
1707
1708
|
getNewVoltageLevelData,
|
|
@@ -23,8 +23,8 @@ export interface ComposedModificationMetadata extends BasicComposedModificationM
|
|
|
23
23
|
export interface ReferencedCompositeModifications extends NetworkModificationMetadata {
|
|
24
24
|
modificationsInfos?: NetworkModificationMetadata[];
|
|
25
25
|
}
|
|
26
|
-
export interface
|
|
27
|
-
|
|
26
|
+
export interface ModificationReferenceInfos extends NetworkModificationMetadata {
|
|
27
|
+
referencedId?: UUID;
|
|
28
28
|
referenceType?: string;
|
|
29
|
-
|
|
29
|
+
referencedInfos?: BasicComposedModificationMetadata;
|
|
30
30
|
}
|