@gridsuite/commons-ui 0.138.0 → 0.139.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/cardErrorBoundary/CardErrorBoundary.d.ts +1 -1
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +2 -6
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +2 -4
- package/dist/components/elementSearch/hooks/useElementSearch.js +2 -4
- package/dist/components/filter/FilterCreationDialog.js +3 -16
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +4 -23
- package/dist/components/filter/expert/expertFilterUtils.d.ts +0 -1
- package/dist/components/filter/expert/expertFilterUtils.js +0 -11
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +3 -7
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +2 -4
- package/dist/components/filter/index.js +1 -2
- package/dist/components/filter/utils/filterApi.js +1 -1
- package/dist/components/index.js +1 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +7 -4
- package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.js +1 -1
- package/dist/components/parameters/common/parameters-creation-dialog.js +4 -9
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +3 -6
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +3 -5
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +2 -5
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +4 -12
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -5
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -5
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +3 -9
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +4 -12
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +2 -5
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +5 -16
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -12
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +3 -8
- package/dist/hooks/use-parameters-backend.js +10 -20
- package/dist/hooks/usePredefinedProperties.js +2 -3
- package/dist/hooks/useSnackMessage.d.ts +1 -2
- package/dist/index.js +9 -4
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +1 -4
- package/dist/services/utils.d.ts +0 -1
- package/dist/services/utils.js +7 -10
- package/dist/translations/en/businessErrorsEn.d.ts +18 -0
- package/dist/translations/en/businessErrorsEn.js +19 -1
- package/dist/translations/en/equipmentShortEn.js +3 -3
- package/dist/translations/fr/businessErrorsFr.d.ts +18 -0
- package/dist/translations/fr/businessErrorsFr.js +19 -1
- package/dist/translations/fr/equipmentShortFr.js +3 -3
- package/dist/utils/error.d.ts +4 -0
- package/dist/utils/error.js +28 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/labelUtils.d.ts +8 -0
- package/dist/utils/labelUtils.js +17 -0
- package/dist/{services/businessErrorCode.d.ts → utils/types/CustomError.d.ts} +3 -1
- package/dist/utils/types/CustomError.js +20 -0
- package/dist/utils/types/index.d.ts +1 -0
- package/dist/utils/types/index.js +3 -0
- package/package.json +1 -1
- package/dist/services/businessErrorCode.js +0 -10
package/dist/utils/index.js
CHANGED
|
@@ -6,12 +6,14 @@ import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT
|
|
|
6
6
|
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./constants/configConstants.js";
|
|
7
7
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./constants/filterConstant.js";
|
|
8
8
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
9
|
+
import { catchErrorHandler, snackWithFallback } from "./error.js";
|
|
9
10
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
10
11
|
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
|
|
11
12
|
import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
12
13
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
13
14
|
import { NotificationsUrlKeys, PREFIX_CONFIG_NOTIFICATION_WS, PREFIX_DIRECTORY_NOTIFICATION_WS, PREFIX_STUDY_NOTIFICATION_WS } from "./constants/notificationsProvider.js";
|
|
14
15
|
import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
|
|
16
|
+
import { CustomError, formatMessageValues } from "./types/CustomError.js";
|
|
15
17
|
import { ElementType } from "./types/elementType.js";
|
|
16
18
|
import { ALL_EQUIPMENTS, BASE_EQUIPMENTS, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./types/equipmentType.js";
|
|
17
19
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./types/equipmentTypes.js";
|
|
@@ -22,6 +24,7 @@ import { ParameterType } from "./types/parameters.type.js";
|
|
|
22
24
|
import { SolverTypeInfos } from "./types/dynamic-simulation.type.js";
|
|
23
25
|
import { DistributionType, SensitivityType } from "./types/sensitivity-analysis.type.js";
|
|
24
26
|
import { toNumber, validateValueIsANumber } from "./validation-functions.js";
|
|
27
|
+
import { getEquipmentTypeShortLabel, getEquipmentTypeTagLabel } from "./labelUtils.js";
|
|
25
28
|
import "./yupConfig.js";
|
|
26
29
|
import * as yup from "yup";
|
|
27
30
|
export {
|
|
@@ -34,6 +37,7 @@ export {
|
|
|
34
37
|
BusBar,
|
|
35
38
|
COMMON_APP_NAME,
|
|
36
39
|
COMMON_CONFIG_PARAMS_NAMES,
|
|
40
|
+
CustomError,
|
|
37
41
|
DARK_THEME,
|
|
38
42
|
DEGREE,
|
|
39
43
|
DanglingLine,
|
|
@@ -95,11 +99,15 @@ export {
|
|
|
95
99
|
VSC,
|
|
96
100
|
VoltageLevel,
|
|
97
101
|
areArrayElementsUnique,
|
|
102
|
+
catchErrorHandler,
|
|
98
103
|
convertInputValue,
|
|
99
104
|
convertOutputValue,
|
|
100
105
|
equalsArray,
|
|
101
106
|
equipmentStyles,
|
|
102
107
|
equipmentTypesForPredefinedPropertiesMapper,
|
|
108
|
+
formatMessageValues,
|
|
109
|
+
getEquipmentTypeShortLabel,
|
|
110
|
+
getEquipmentTypeTagLabel,
|
|
103
111
|
getEquipmentsInfosForSearchBar,
|
|
104
112
|
getFileIcon,
|
|
105
113
|
isBlankOrEmpty,
|
|
@@ -111,6 +119,7 @@ export {
|
|
|
111
119
|
microUnitToUnit,
|
|
112
120
|
roundToDefaultPrecision,
|
|
113
121
|
roundToPrecision,
|
|
122
|
+
snackWithFallback,
|
|
114
123
|
toNestedGlobalSelectors,
|
|
115
124
|
toNumber,
|
|
116
125
|
unitToKiloUnit,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, 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 getEquipmentTypeShortLabel(equipmentType: string | undefined): string;
|
|
8
|
+
export declare function getEquipmentTypeTagLabel(equipmentType: string | undefined): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ALL_EQUIPMENTS } from "./types/equipmentType.js";
|
|
2
|
+
function getEquipmentTypeShortLabel(equipmentType) {
|
|
3
|
+
if (!equipmentType) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
return ALL_EQUIPMENTS[equipmentType]?.shortLabel ?? "";
|
|
7
|
+
}
|
|
8
|
+
function getEquipmentTypeTagLabel(equipmentType) {
|
|
9
|
+
if (!equipmentType) {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
return ALL_EQUIPMENTS[equipmentType]?.tagLabel ?? "";
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
getEquipmentTypeShortLabel,
|
|
16
|
+
getEquipmentTypeTagLabel
|
|
17
|
+
};
|
|
@@ -7,5 +7,7 @@
|
|
|
7
7
|
export declare class CustomError extends Error {
|
|
8
8
|
status: number;
|
|
9
9
|
businessErrorCode?: string;
|
|
10
|
-
|
|
10
|
+
businessErrorValues?: Record<string, unknown>;
|
|
11
|
+
constructor(message: string, status: number, businessErrorCode?: string, businessErrorValues?: Record<string, unknown>);
|
|
11
12
|
}
|
|
13
|
+
export declare function formatMessageValues(properties: Record<string, unknown>): Record<string, string>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class CustomError extends Error {
|
|
2
|
+
constructor(message, status, businessErrorCode, businessErrorValues) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.status = status;
|
|
5
|
+
this.businessErrorCode = businessErrorCode;
|
|
6
|
+
this.businessErrorValues = businessErrorValues;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function formatMessageValues(properties) {
|
|
10
|
+
return Object.fromEntries(
|
|
11
|
+
Object.entries(properties).map(([key, value]) => [
|
|
12
|
+
key,
|
|
13
|
+
typeof value === "object" && value !== null ? JSON.stringify(value) : String(value)
|
|
14
|
+
])
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
CustomError,
|
|
19
|
+
formatMessageValues
|
|
20
|
+
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
+
export * from './CustomError';
|
|
7
8
|
export * from './elementType';
|
|
8
9
|
export * from './equipmentType';
|
|
9
10
|
export * from './equipmentTypes';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CustomError, formatMessageValues } from "./CustomError.js";
|
|
1
2
|
import { ElementType } from "./elementType.js";
|
|
2
3
|
import { ALL_EQUIPMENTS, BASE_EQUIPMENTS, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./equipmentType.js";
|
|
3
4
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./equipmentTypes.js";
|
|
@@ -14,6 +15,7 @@ export {
|
|
|
14
15
|
BASE_EQUIPMENTS,
|
|
15
16
|
Battery,
|
|
16
17
|
BusBar,
|
|
18
|
+
CustomError,
|
|
17
19
|
DanglingLine,
|
|
18
20
|
DistributionType,
|
|
19
21
|
ElementType,
|
|
@@ -43,5 +45,6 @@ export {
|
|
|
43
45
|
VSC,
|
|
44
46
|
VoltageLevel,
|
|
45
47
|
equipmentStyles,
|
|
48
|
+
formatMessageValues,
|
|
46
49
|
getEquipmentsInfosForSearchBar
|
|
47
50
|
};
|
package/package.json
CHANGED