@gridsuite/commons-ui 0.163.0 → 0.165.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/directoryItemSelector/DirectoryItemSelector.js +1 -1
- package/dist/components/dnd-table/dnd-table.js +1 -0
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +1 -1
- package/dist/components/filter/utils/filterApi.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +34 -3
- package/dist/components/inputs/index.js +4 -0
- package/dist/components/inputs/reactHookForm/CountrySelectionInput.d.ts +5 -0
- package/dist/components/inputs/reactHookForm/CountrySelectionInput.js +27 -0
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +1 -1
- package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js +1 -1
- package/dist/components/inputs/reactHookForm/expandableInput/DeletableRow.d.ts +8 -0
- package/dist/components/inputs/reactHookForm/expandableInput/DeletableRow.js +41 -0
- package/dist/components/inputs/reactHookForm/expandableInput/ExpandableInput.d.ts +24 -0
- package/dist/components/inputs/reactHookForm/expandableInput/ExpandableInput.js +80 -0
- package/dist/components/inputs/reactHookForm/expandableInput/index.d.ts +7 -0
- package/dist/components/inputs/reactHookForm/expandableInput/index.js +4 -0
- package/dist/components/inputs/reactHookForm/index.d.ts +2 -0
- package/dist/components/inputs/reactHookForm/index.js +4 -0
- package/dist/components/inputs/reactHookForm/text/TextInput.js +1 -1
- package/dist/components/network-modifications/common/form.utils.d.ts +8 -0
- package/dist/components/network-modifications/common/form.utils.js +14 -0
- package/dist/components/network-modifications/common/index.d.ts +8 -0
- package/dist/components/network-modifications/common/index.js +24 -0
- package/dist/components/network-modifications/common/properties/PropertiesForm.d.ts +7 -0
- package/dist/components/network-modifications/common/properties/PropertiesForm.js +109 -0
- package/dist/components/network-modifications/common/properties/PropertyForm.d.ts +8 -0
- package/dist/components/network-modifications/common/properties/PropertyForm.js +102 -0
- package/dist/components/network-modifications/common/properties/index.d.ts +10 -0
- package/dist/components/network-modifications/common/properties/index.js +20 -0
- package/dist/components/network-modifications/common/properties/properties.type.d.ts +14 -0
- package/dist/components/network-modifications/common/properties/properties.type.js +1 -0
- package/dist/components/network-modifications/common/properties/propertyUtils.d.ts +38 -0
- package/dist/components/network-modifications/common/properties/propertyUtils.js +161 -0
- package/dist/components/network-modifications/index.d.ts +8 -0
- package/dist/components/network-modifications/index.js +31 -0
- package/dist/components/network-modifications/substation/creation/SubstationCreationForm.d.ts +7 -0
- package/dist/components/network-modifications/substation/creation/SubstationCreationForm.js +52 -0
- package/dist/components/network-modifications/substation/creation/index.d.ts +9 -0
- package/dist/components/network-modifications/substation/creation/index.js +9 -0
- package/dist/components/network-modifications/substation/creation/substationCreation.types.d.ts +8 -0
- package/dist/components/network-modifications/substation/creation/substationCreation.types.js +1 -0
- package/dist/components/network-modifications/substation/creation/substationCreation.utils.d.ts +24 -0
- package/dist/components/network-modifications/substation/creation/substationCreation.utils.js +44 -0
- package/dist/components/network-modifications/substation/index.d.ts +7 -0
- package/dist/components/network-modifications/substation/index.js +9 -0
- package/dist/components/parameters/common/constant.d.ts +0 -8
- package/dist/components/parameters/common/constant.js +1 -12
- package/dist/components/parameters/common/index.js +1 -3
- package/dist/components/parameters/common/parameters-creation-dialog.js +1 -1
- package/dist/components/parameters/index.js +1 -3
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +2 -2
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/network-visualizations/map-parameters.js +1 -1
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -1
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
- package/dist/components/parameters/pcc-min/pcc-min-parameters-inline.js +1 -1
- package/dist/components/parameters/pcc-min/use-pcc-min-parameters-form.js +1 -1
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -2
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +2 -2
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +2 -2
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/general-parameters.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +5 -9
- package/dist/hooks/useModificationLabelComputer.d.ts +2 -1
- package/dist/hooks/usePredefinedProperties.js +1 -1
- package/dist/hooks/useSnackMessage.d.ts +1 -3
- package/dist/index.js +62 -6
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +5 -2
- package/dist/services/networkModification.d.ts +6 -0
- package/dist/services/networkModification.js +26 -0
- package/dist/services/security-analysis.d.ts +0 -1
- package/dist/services/security-analysis.js +1 -5
- package/dist/services/sensitivity-analysis.js +1 -2
- package/dist/services/study.js +7 -6
- package/dist/services/utils.d.ts +1 -0
- package/dist/services/utils.js +5 -1
- package/dist/translations/en/businessErrorsEn.d.ts +2 -1
- package/dist/translations/en/businessErrorsEn.js +2 -1
- package/dist/translations/en/commonButtonEn.d.ts +1 -0
- package/dist/translations/en/commonButtonEn.js +2 -1
- package/dist/translations/en/networkModificationsEn.d.ts +11 -6
- package/dist/translations/en/networkModificationsEn.js +18 -1
- package/dist/translations/fr/businessErrorsFr.d.ts +2 -1
- package/dist/translations/fr/businessErrorsFr.js +2 -1
- package/dist/translations/fr/commonButtonFr.d.ts +1 -0
- package/dist/translations/fr/commonButtonFr.js +2 -1
- package/dist/translations/fr/networkModificationsFr.d.ts +11 -6
- package/dist/translations/fr/networkModificationsFr.js +18 -1
- package/dist/utils/constants/adornments.d.ts +44 -0
- package/dist/utils/constants/adornments.js +58 -0
- package/dist/utils/constants/fieldConstants.d.ts +7 -0
- package/dist/utils/constants/fieldConstants.js +7 -0
- package/dist/utils/constants/index.d.ts +2 -0
- package/dist/utils/constants/index.js +16 -1
- package/dist/utils/constants/translationKeys.d.ts +2 -0
- package/dist/utils/constants/translationKeys.js +6 -0
- package/dist/utils/error.d.ts +2 -0
- package/dist/utils/error.js +27 -22
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +25 -3
- package/dist/utils/labelUtils.d.ts +0 -1
- package/dist/utils/labelUtils.js +1 -8
- package/dist/utils/ts-utils.d.ts +18 -0
- package/dist/utils/ts-utils.js +40 -0
- package/dist/utils/types/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024, 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
1
|
export declare const networkModificationsFr: {
|
|
8
2
|
'network_modifications.modificationsCount': string;
|
|
9
3
|
'network_modifications.EQUIPMENT_DELETION': string;
|
|
@@ -71,4 +65,15 @@ export declare const networkModificationsFr: {
|
|
|
71
65
|
'network_modifications.CREATE_VOLTAGE_LEVEL_TOPOLOGY': string;
|
|
72
66
|
'network_modifications.CREATE_VOLTAGE_LEVEL_SECTION': string;
|
|
73
67
|
'network_modifications.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS': string;
|
|
68
|
+
ModificationReadError: string;
|
|
69
|
+
CreateSubstation: string;
|
|
70
|
+
SubstationCreationError: string;
|
|
71
|
+
AdditionalInformation: string;
|
|
72
|
+
AddProperty: string;
|
|
73
|
+
PropertyName: string;
|
|
74
|
+
PropertyValue: string;
|
|
75
|
+
Name: string;
|
|
76
|
+
Country: string;
|
|
77
|
+
DuplicatedPropsError: string;
|
|
78
|
+
YupRequired: string;
|
|
74
79
|
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { YUP_REQUIRED, DUPLICATED_PROPS_ERROR } from "../../utils/constants/translationKeys.js";
|
|
2
|
+
import "../../utils/conversionUtils.js";
|
|
3
|
+
import "../../utils/types/equipmentType.js";
|
|
4
|
+
import "react/jsx-runtime";
|
|
5
|
+
import "@mui/icons-material";
|
|
6
|
+
import "../../utils/yupConfig.js";
|
|
1
7
|
const networkModificationsFr = {
|
|
2
8
|
"network_modifications.modificationsCount": "{hide, select, false {{count, plural, =0 {aucune modification} =1 {# modification} other {# modifications}}} other {...}}",
|
|
3
9
|
"network_modifications.EQUIPMENT_DELETION": "Suppression de {computedLabel}",
|
|
@@ -64,7 +70,18 @@ const networkModificationsFr = {
|
|
|
64
70
|
"network_modifications.BALANCES_ADJUSTMENT_MODIFICATION": "Modification d'équilibrage bilan",
|
|
65
71
|
"network_modifications.CREATE_VOLTAGE_LEVEL_TOPOLOGY": "Ajout d'un jeu de barre dans le poste {computedLabel}",
|
|
66
72
|
"network_modifications.CREATE_VOLTAGE_LEVEL_SECTION": "Ajout de section / tronçon dans le poste {computedLabel}",
|
|
67
|
-
"network_modifications.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS": "Déplacements de départs dans le poste {computedLabel}"
|
|
73
|
+
"network_modifications.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS": "Déplacements de départs dans le poste {computedLabel}",
|
|
74
|
+
ModificationReadError: "Une erreur est survenue lors de la récupération de la modification",
|
|
75
|
+
CreateSubstation: "Créer un site",
|
|
76
|
+
SubstationCreationError: "Erreur lors de la création d'un site'",
|
|
77
|
+
AdditionalInformation: "Informations complémentaires",
|
|
78
|
+
AddProperty: "Ajouter une propriété",
|
|
79
|
+
PropertyName: "Nom de la propriété",
|
|
80
|
+
PropertyValue: "Valeur de la propriété",
|
|
81
|
+
Name: "Nom",
|
|
82
|
+
Country: "Pays",
|
|
83
|
+
[DUPLICATED_PROPS_ERROR]: "Propriétés dupliquées : chaque propriété doit être unique",
|
|
84
|
+
[YUP_REQUIRED]: "Ce champ doit être renseigné"
|
|
68
85
|
};
|
|
69
86
|
export {
|
|
70
87
|
networkModificationsFr
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const MicroSusceptanceAdornment: {
|
|
2
|
+
position: string;
|
|
3
|
+
text: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const SusceptanceAdornment: {
|
|
6
|
+
position: string;
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const OhmAdornment: {
|
|
10
|
+
position: string;
|
|
11
|
+
text: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const AmpereAdornment: {
|
|
14
|
+
position: string;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const KiloAmpereAdornment: {
|
|
18
|
+
position: string;
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const ActivePowerAdornment: {
|
|
22
|
+
position: string;
|
|
23
|
+
text: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const ReactivePowerAdornment: {
|
|
26
|
+
position: string;
|
|
27
|
+
text: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const MVAPowerAdornment: {
|
|
30
|
+
position: string;
|
|
31
|
+
text: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const VoltageAdornment: {
|
|
34
|
+
position: string;
|
|
35
|
+
text: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const KilometerAdornment: {
|
|
38
|
+
position: string;
|
|
39
|
+
text: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const PercentageAdornment: {
|
|
42
|
+
position: string;
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { MICRO_SIEMENS, SIEMENS, OHM, AMPERE, KILO_AMPERE, MEGA_WATT, MEGA_VAR, MEGA_VOLT_AMPERE, KILO_VOLT, KILO_METER, PERCENTAGE } from "./unitsConstants.js";
|
|
2
|
+
const MicroSusceptanceAdornment = {
|
|
3
|
+
position: "end",
|
|
4
|
+
text: MICRO_SIEMENS
|
|
5
|
+
};
|
|
6
|
+
const SusceptanceAdornment = {
|
|
7
|
+
position: "end",
|
|
8
|
+
text: SIEMENS
|
|
9
|
+
};
|
|
10
|
+
const OhmAdornment = {
|
|
11
|
+
position: "end",
|
|
12
|
+
text: OHM
|
|
13
|
+
};
|
|
14
|
+
const AmpereAdornment = {
|
|
15
|
+
position: "end",
|
|
16
|
+
text: AMPERE
|
|
17
|
+
};
|
|
18
|
+
const KiloAmpereAdornment = {
|
|
19
|
+
position: "end",
|
|
20
|
+
text: KILO_AMPERE
|
|
21
|
+
};
|
|
22
|
+
const ActivePowerAdornment = {
|
|
23
|
+
position: "end",
|
|
24
|
+
text: MEGA_WATT
|
|
25
|
+
};
|
|
26
|
+
const ReactivePowerAdornment = {
|
|
27
|
+
position: "end",
|
|
28
|
+
text: MEGA_VAR
|
|
29
|
+
};
|
|
30
|
+
const MVAPowerAdornment = {
|
|
31
|
+
position: "end",
|
|
32
|
+
text: MEGA_VOLT_AMPERE
|
|
33
|
+
};
|
|
34
|
+
const VoltageAdornment = {
|
|
35
|
+
position: "end",
|
|
36
|
+
text: KILO_VOLT
|
|
37
|
+
};
|
|
38
|
+
const KilometerAdornment = {
|
|
39
|
+
position: "end",
|
|
40
|
+
text: KILO_METER
|
|
41
|
+
};
|
|
42
|
+
const PercentageAdornment = {
|
|
43
|
+
position: "end",
|
|
44
|
+
text: PERCENTAGE
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
ActivePowerAdornment,
|
|
48
|
+
AmpereAdornment,
|
|
49
|
+
KiloAmpereAdornment,
|
|
50
|
+
KilometerAdornment,
|
|
51
|
+
MVAPowerAdornment,
|
|
52
|
+
MicroSusceptanceAdornment,
|
|
53
|
+
OhmAdornment,
|
|
54
|
+
PercentageAdornment,
|
|
55
|
+
ReactivePowerAdornment,
|
|
56
|
+
SusceptanceAdornment,
|
|
57
|
+
VoltageAdornment
|
|
58
|
+
};
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
7
|
export declare enum FieldConstants {
|
|
8
|
+
ADDED = "added",
|
|
9
|
+
ADDITIONAL_PROPERTIES = "AdditionalProperties",
|
|
8
10
|
AG_GRID_ROW_UUID = "agGridRowUuid",
|
|
9
11
|
API_CALL = "apiCall",
|
|
10
12
|
CASE_FILE = "caseFile",
|
|
@@ -16,11 +18,14 @@ export declare enum FieldConstants {
|
|
|
16
18
|
COUNTRIES_1 = "countries1",
|
|
17
19
|
COUNTRIES_2 = "countries2",
|
|
18
20
|
COUNTRIES = "countries",
|
|
21
|
+
COUNTRY = "country",
|
|
19
22
|
CURRENT_PARAMETERS = "currentParameters",
|
|
23
|
+
DELETION_MARK = "deletionMark",
|
|
20
24
|
DESCRIPTION = "description",
|
|
21
25
|
DIRECTORY = "directory",
|
|
22
26
|
ENERGY_SOURCE = "energySource",
|
|
23
27
|
EQUIPMENT_ID = "equipmentID",
|
|
28
|
+
EQUIPMENT_NAME = "equipmentName",
|
|
24
29
|
EQUIPMENT_IDS = "equipmentIDs",
|
|
25
30
|
EQUIPMENT_TABLE = "equipmentTable",
|
|
26
31
|
EQUIPMENT_TYPE = "equipmentType",
|
|
@@ -37,12 +42,14 @@ export declare enum FieldConstants {
|
|
|
37
42
|
NOMINAL_VOLTAGE = "nominalVoltage",
|
|
38
43
|
OPERATION_TYPE = "type",
|
|
39
44
|
TYPE = "type",
|
|
45
|
+
PREVIOUS_VALUE = "previousValue",
|
|
40
46
|
PROPERTY_NAME = "propertyName",
|
|
41
47
|
PROPERTY_OPERATOR = "propertyOperator",
|
|
42
48
|
PROPERTY = "PROPERTY",
|
|
43
49
|
PROPERTY_VALUES = "propertyValues",
|
|
44
50
|
SCRIPT = "script",
|
|
45
51
|
STUDY_NAME = "studyName",
|
|
52
|
+
VALUE = "value",
|
|
46
53
|
VALUE_1 = "value1",
|
|
47
54
|
VALUE_2 = "value2"
|
|
48
55
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var FieldConstants = /* @__PURE__ */ ((FieldConstants2) => {
|
|
2
|
+
FieldConstants2["ADDED"] = "added";
|
|
3
|
+
FieldConstants2["ADDITIONAL_PROPERTIES"] = "AdditionalProperties";
|
|
2
4
|
FieldConstants2["AG_GRID_ROW_UUID"] = "agGridRowUuid";
|
|
3
5
|
FieldConstants2["API_CALL"] = "apiCall";
|
|
4
6
|
FieldConstants2["CASE_FILE"] = "caseFile";
|
|
@@ -10,11 +12,14 @@ var FieldConstants = /* @__PURE__ */ ((FieldConstants2) => {
|
|
|
10
12
|
FieldConstants2["COUNTRIES_1"] = "countries1";
|
|
11
13
|
FieldConstants2["COUNTRIES_2"] = "countries2";
|
|
12
14
|
FieldConstants2["COUNTRIES"] = "countries";
|
|
15
|
+
FieldConstants2["COUNTRY"] = "country";
|
|
13
16
|
FieldConstants2["CURRENT_PARAMETERS"] = "currentParameters";
|
|
17
|
+
FieldConstants2["DELETION_MARK"] = "deletionMark";
|
|
14
18
|
FieldConstants2["DESCRIPTION"] = "description";
|
|
15
19
|
FieldConstants2["DIRECTORY"] = "directory";
|
|
16
20
|
FieldConstants2["ENERGY_SOURCE"] = "energySource";
|
|
17
21
|
FieldConstants2["EQUIPMENT_ID"] = "equipmentID";
|
|
22
|
+
FieldConstants2["EQUIPMENT_NAME"] = "equipmentName";
|
|
18
23
|
FieldConstants2["EQUIPMENT_IDS"] = "equipmentIDs";
|
|
19
24
|
FieldConstants2["EQUIPMENT_TABLE"] = "equipmentTable";
|
|
20
25
|
FieldConstants2["EQUIPMENT_TYPE"] = "equipmentType";
|
|
@@ -31,12 +36,14 @@ var FieldConstants = /* @__PURE__ */ ((FieldConstants2) => {
|
|
|
31
36
|
FieldConstants2["NOMINAL_VOLTAGE"] = "nominalVoltage";
|
|
32
37
|
FieldConstants2["OPERATION_TYPE"] = "type";
|
|
33
38
|
FieldConstants2["TYPE"] = "type";
|
|
39
|
+
FieldConstants2["PREVIOUS_VALUE"] = "previousValue";
|
|
34
40
|
FieldConstants2["PROPERTY_NAME"] = "propertyName";
|
|
35
41
|
FieldConstants2["PROPERTY_OPERATOR"] = "propertyOperator";
|
|
36
42
|
FieldConstants2["PROPERTY"] = "PROPERTY";
|
|
37
43
|
FieldConstants2["PROPERTY_VALUES"] = "propertyValues";
|
|
38
44
|
FieldConstants2["SCRIPT"] = "script";
|
|
39
45
|
FieldConstants2["STUDY_NAME"] = "studyName";
|
|
46
|
+
FieldConstants2["VALUE"] = "value";
|
|
40
47
|
FieldConstants2["VALUE_1"] = "value1";
|
|
41
48
|
FieldConstants2["VALUE_2"] = "value2";
|
|
42
49
|
return FieldConstants2;
|
|
@@ -4,9 +4,11 @@
|
|
|
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 './adornments';
|
|
7
8
|
export * from './fetchStatus';
|
|
8
9
|
export * from './fieldConstants';
|
|
9
10
|
export * from './uiConstants';
|
|
10
11
|
export * from './unitsConstants';
|
|
11
12
|
export * from './configConstants';
|
|
12
13
|
export * from './filterConstant';
|
|
14
|
+
export * from './translationKeys';
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import { ActivePowerAdornment, AmpereAdornment, KiloAmpereAdornment, KilometerAdornment, MVAPowerAdornment, MicroSusceptanceAdornment, OhmAdornment, PercentageAdornment, ReactivePowerAdornment, SusceptanceAdornment, VoltageAdornment } from "./adornments.js";
|
|
1
2
|
import { FetchStatus } from "./fetchStatus.js";
|
|
2
3
|
import { FieldConstants } from "./fieldConstants.js";
|
|
3
4
|
import { MAX_CHAR_DESCRIPTION } from "./uiConstants.js";
|
|
4
5
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./unitsConstants.js";
|
|
5
6
|
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./configConstants.js";
|
|
6
7
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./filterConstant.js";
|
|
8
|
+
import { DUPLICATED_PROPS_ERROR, YUP_REQUIRED } from "./translationKeys.js";
|
|
7
9
|
export {
|
|
8
10
|
AMPERE,
|
|
11
|
+
ActivePowerAdornment,
|
|
12
|
+
AmpereAdornment,
|
|
9
13
|
COMMON_APP_NAME,
|
|
10
14
|
COMMON_CONFIG_PARAMS_NAMES,
|
|
11
15
|
DEGREE,
|
|
16
|
+
DUPLICATED_PROPS_ERROR,
|
|
12
17
|
FILTERS,
|
|
13
18
|
FILTER_ID,
|
|
14
19
|
FILTER_NAME,
|
|
@@ -18,16 +23,26 @@ export {
|
|
|
18
23
|
KILO_AMPERE,
|
|
19
24
|
KILO_METER,
|
|
20
25
|
KILO_VOLT,
|
|
26
|
+
KiloAmpereAdornment,
|
|
27
|
+
KilometerAdornment,
|
|
21
28
|
LAST_SELECTED_DIRECTORY,
|
|
22
29
|
MAX_CHAR_DESCRIPTION,
|
|
23
30
|
MEGA_VAR,
|
|
24
31
|
MEGA_VOLT_AMPERE,
|
|
25
32
|
MEGA_WATT,
|
|
26
33
|
MICRO_SIEMENS,
|
|
34
|
+
MVAPowerAdornment,
|
|
35
|
+
MicroSusceptanceAdornment,
|
|
27
36
|
OHM,
|
|
37
|
+
OhmAdornment,
|
|
28
38
|
PARAM_DEVELOPER_MODE,
|
|
29
39
|
PARAM_LANGUAGE,
|
|
30
40
|
PARAM_THEME,
|
|
31
41
|
PERCENTAGE,
|
|
32
|
-
|
|
42
|
+
PercentageAdornment,
|
|
43
|
+
ReactivePowerAdornment,
|
|
44
|
+
SIEMENS,
|
|
45
|
+
SusceptanceAdornment,
|
|
46
|
+
VoltageAdornment,
|
|
47
|
+
YUP_REQUIRED
|
|
33
48
|
};
|
package/dist/utils/error.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SnackInputs, UseSnackMessageReturn } from '../hooks/useSnackMessage';
|
|
2
|
+
import { ErrorMessageDescriptor } from './types';
|
|
2
3
|
export type HeaderSnackInputs = Pick<SnackInputs, 'headerId' | 'headerTxt' | 'headerValues'>;
|
|
3
4
|
export declare function catchErrorHandler(error: unknown, callback: (message: string) => void): void;
|
|
5
|
+
export declare function extractErrorMessageDescriptor(error: unknown, errorMessageIdFallback: string): ErrorMessageDescriptor;
|
|
4
6
|
export declare function snackWithFallback(snackError: UseSnackMessageReturn['snackError'], error: unknown, headerInputs?: HeaderSnackInputs): void;
|
package/dist/utils/error.js
CHANGED
|
@@ -8,33 +8,37 @@ function catchErrorHandler(error, callback) {
|
|
|
8
8
|
callback("unknown error");
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function extractErrorMessageDescriptor(error, errorMessageIdFallback) {
|
|
12
12
|
if (error instanceof NetworkTimeoutError) {
|
|
13
|
-
|
|
14
|
-
messageId: error.message,
|
|
15
|
-
...headerInputs
|
|
16
|
-
});
|
|
17
|
-
return;
|
|
13
|
+
return { descriptor: { id: error.message } };
|
|
18
14
|
}
|
|
19
15
|
if (error instanceof ProblemDetailError) {
|
|
20
16
|
if (error.businessErrorCode) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
} else {
|
|
27
|
-
snackError({
|
|
28
|
-
messageId: "errors.technicalError",
|
|
29
|
-
messageValues: {
|
|
30
|
-
message: error.message,
|
|
31
|
-
serverName: error.serverName,
|
|
32
|
-
timestamp: error.timestamp,
|
|
33
|
-
traceId: error.traceId
|
|
34
|
-
},
|
|
35
|
-
...headerInputs
|
|
36
|
-
});
|
|
17
|
+
return {
|
|
18
|
+
descriptor: { id: error.businessErrorCode },
|
|
19
|
+
values: error.businessErrorValues
|
|
20
|
+
};
|
|
37
21
|
}
|
|
22
|
+
return {
|
|
23
|
+
descriptor: { id: "errors.technicalError" },
|
|
24
|
+
values: {
|
|
25
|
+
message: error.message,
|
|
26
|
+
serverName: error.serverName,
|
|
27
|
+
timestamp: error.timestamp,
|
|
28
|
+
traceId: error.traceId
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return { descriptor: { id: errorMessageIdFallback } };
|
|
33
|
+
}
|
|
34
|
+
function snackWithFallback(snackError, error, headerInputs) {
|
|
35
|
+
if (error instanceof NetworkTimeoutError || error instanceof ProblemDetailError) {
|
|
36
|
+
const { descriptor, values } = extractErrorMessageDescriptor(error, "");
|
|
37
|
+
snackError({
|
|
38
|
+
messageId: descriptor.id,
|
|
39
|
+
messageValues: values,
|
|
40
|
+
...headerInputs
|
|
41
|
+
});
|
|
38
42
|
} else {
|
|
39
43
|
catchErrorHandler(error, (message) => {
|
|
40
44
|
snackError({
|
|
@@ -46,5 +50,6 @@ function snackWithFallback(snackError, error, headerInputs) {
|
|
|
46
50
|
}
|
|
47
51
|
export {
|
|
48
52
|
catchErrorHandler,
|
|
53
|
+
extractErrorMessageDescriptor,
|
|
49
54
|
snackWithFallback
|
|
50
55
|
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -9,12 +9,13 @@ export * from './constants';
|
|
|
9
9
|
export * from './conversionUtils';
|
|
10
10
|
export * from './error';
|
|
11
11
|
export * from './functions';
|
|
12
|
+
export * from './labelUtils';
|
|
12
13
|
export * from './langs';
|
|
13
14
|
export * from './mapper';
|
|
14
15
|
export * from './navigator-clipboard';
|
|
15
16
|
export * from './constants/notificationsProvider';
|
|
16
17
|
export * from './styles';
|
|
17
18
|
export * from './types';
|
|
19
|
+
export * from './ts-utils';
|
|
18
20
|
export * from './validation-functions';
|
|
19
|
-
export * from './labelUtils';
|
|
20
21
|
export { default as yupConfig } from './yupConfig';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { equalsArray } from "./algos.js";
|
|
2
|
+
import { ActivePowerAdornment, AmpereAdornment, KiloAmpereAdornment, KilometerAdornment, MVAPowerAdornment, MicroSusceptanceAdornment, OhmAdornment, PercentageAdornment, ReactivePowerAdornment, SusceptanceAdornment, VoltageAdornment } from "./constants/adornments.js";
|
|
2
3
|
import { FetchStatus } from "./constants/fetchStatus.js";
|
|
3
4
|
import { FieldConstants } from "./constants/fieldConstants.js";
|
|
4
5
|
import { MAX_CHAR_DESCRIPTION } from "./constants/uiConstants.js";
|
|
5
6
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./constants/unitsConstants.js";
|
|
6
7
|
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./constants/configConstants.js";
|
|
7
8
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./constants/filterConstant.js";
|
|
9
|
+
import { DUPLICATED_PROPS_ERROR, YUP_REQUIRED } from "./constants/translationKeys.js";
|
|
8
10
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
9
|
-
import { catchErrorHandler, snackWithFallback } from "./error.js";
|
|
11
|
+
import { catchErrorHandler, extractErrorMessageDescriptor, snackWithFallback } from "./error.js";
|
|
10
12
|
import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
13
|
+
import { getEquipmentTypeShortLabel } from "./labelUtils.js";
|
|
11
14
|
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
|
|
12
15
|
import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
13
16
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
@@ -26,13 +29,15 @@ import { FieldType } from "./types/fieldType.js";
|
|
|
26
29
|
import { ParameterType } from "./types/parameters.type.js";
|
|
27
30
|
import { SolverTypeInfos } from "./types/dynamic-simulation.type.js";
|
|
28
31
|
import { DistributionType, SensitivityType } from "./types/sensitivity-analysis.type.js";
|
|
32
|
+
import { getIdOrSelf, notNull, notUndefined, parseIntData, removeNullFields, sanitizeString } from "./ts-utils.js";
|
|
29
33
|
import { toNumber, validateValueIsANumber } from "./validation-functions.js";
|
|
30
|
-
import { getEquipmentTypeShortLabel, getEquipmentTypeTagLabel } from "./labelUtils.js";
|
|
31
34
|
import "./yupConfig.js";
|
|
32
35
|
import * as yup from "yup";
|
|
33
36
|
export {
|
|
34
37
|
ALL_EQUIPMENTS,
|
|
35
38
|
AMPERE,
|
|
39
|
+
ActivePowerAdornment,
|
|
40
|
+
AmpereAdornment,
|
|
36
41
|
AnnouncementSeverity,
|
|
37
42
|
ArrayAction,
|
|
38
43
|
BASE_EQUIPMENTS,
|
|
@@ -43,6 +48,7 @@ export {
|
|
|
43
48
|
CustomError,
|
|
44
49
|
DARK_THEME,
|
|
45
50
|
DEGREE,
|
|
51
|
+
DUPLICATED_PROPS_ERROR,
|
|
46
52
|
DanglingLine,
|
|
47
53
|
DistributionType,
|
|
48
54
|
ElementType,
|
|
@@ -62,6 +68,8 @@ export {
|
|
|
62
68
|
KILO_AMPERE,
|
|
63
69
|
KILO_METER,
|
|
64
70
|
KILO_VOLT,
|
|
71
|
+
KiloAmpereAdornment,
|
|
72
|
+
KilometerAdornment,
|
|
65
73
|
LANG_ENGLISH,
|
|
66
74
|
LANG_FRENCH,
|
|
67
75
|
LANG_SYSTEM,
|
|
@@ -76,10 +84,13 @@ export {
|
|
|
76
84
|
MEGA_WATT,
|
|
77
85
|
MICRO_SIEMENS,
|
|
78
86
|
MODIFICATION_TYPES,
|
|
87
|
+
MVAPowerAdornment,
|
|
88
|
+
MicroSusceptanceAdornment,
|
|
79
89
|
ModificationType,
|
|
80
90
|
NetworkTimeoutError,
|
|
81
91
|
NotificationsUrlKeys,
|
|
82
92
|
OHM,
|
|
93
|
+
OhmAdornment,
|
|
83
94
|
OperatingStatus,
|
|
84
95
|
PARAM_DEVELOPER_MODE,
|
|
85
96
|
PARAM_LANGUAGE,
|
|
@@ -89,7 +100,9 @@ export {
|
|
|
89
100
|
PREFIX_DIRECTORY_NOTIFICATION_WS,
|
|
90
101
|
PREFIX_STUDY_NOTIFICATION_WS,
|
|
91
102
|
ParameterType,
|
|
103
|
+
PercentageAdornment,
|
|
92
104
|
ProblemDetailError,
|
|
105
|
+
ReactivePowerAdornment,
|
|
93
106
|
SEARCH_EQUIPMENTS,
|
|
94
107
|
SIEMENS,
|
|
95
108
|
SVC,
|
|
@@ -97,12 +110,15 @@ export {
|
|
|
97
110
|
ShuntCompensator,
|
|
98
111
|
SolverTypeInfos,
|
|
99
112
|
Substation,
|
|
113
|
+
SusceptanceAdornment,
|
|
100
114
|
TYPE_TAG_MAX_SIZE,
|
|
101
115
|
ThreeWindingTransfo,
|
|
102
116
|
TwoWindingTransfo,
|
|
103
117
|
VL_TAG_MAX_SIZE,
|
|
104
118
|
VSC,
|
|
119
|
+
VoltageAdornment,
|
|
105
120
|
VoltageLevel,
|
|
121
|
+
YUP_REQUIRED,
|
|
106
122
|
areArrayElementsUnique,
|
|
107
123
|
arraysContainIdenticalStrings,
|
|
108
124
|
catchErrorHandler,
|
|
@@ -112,10 +128,11 @@ export {
|
|
|
112
128
|
equalsArray,
|
|
113
129
|
equipmentStyles,
|
|
114
130
|
equipmentTypesForPredefinedPropertiesMapper,
|
|
131
|
+
extractErrorMessageDescriptor,
|
|
115
132
|
getEquipmentTypeShortLabel,
|
|
116
|
-
getEquipmentTypeTagLabel,
|
|
117
133
|
getEquipmentsInfosForSearchBar,
|
|
118
134
|
getFileIcon,
|
|
135
|
+
getIdOrSelf,
|
|
119
136
|
isBlankOrEmpty,
|
|
120
137
|
isEmpty,
|
|
121
138
|
isObjectEmpty,
|
|
@@ -124,8 +141,13 @@ export {
|
|
|
124
141
|
makeComposeClasses,
|
|
125
142
|
mergeSx,
|
|
126
143
|
microUnitToUnit,
|
|
144
|
+
notNull,
|
|
145
|
+
notUndefined,
|
|
146
|
+
parseIntData,
|
|
147
|
+
removeNullFields,
|
|
127
148
|
roundToDefaultPrecision,
|
|
128
149
|
roundToPrecision,
|
|
150
|
+
sanitizeString,
|
|
129
151
|
snackWithFallback,
|
|
130
152
|
toNestedGlobalSelectors,
|
|
131
153
|
toNumber,
|
package/dist/utils/labelUtils.js
CHANGED
|
@@ -5,13 +5,6 @@ function getEquipmentTypeShortLabel(equipmentType) {
|
|
|
5
5
|
}
|
|
6
6
|
return ALL_EQUIPMENTS[equipmentType]?.shortLabel ?? "";
|
|
7
7
|
}
|
|
8
|
-
function getEquipmentTypeTagLabel(equipmentType) {
|
|
9
|
-
if (!equipmentType) {
|
|
10
|
-
return "";
|
|
11
|
-
}
|
|
12
|
-
return ALL_EQUIPMENTS[equipmentType]?.tagLabel ?? "";
|
|
13
|
-
}
|
|
14
8
|
export {
|
|
15
|
-
getEquipmentTypeShortLabel
|
|
16
|
-
getEquipmentTypeTagLabel
|
|
9
|
+
getEquipmentTypeShortLabel
|
|
17
10
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024, 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 type Nullable<T> = {
|
|
8
|
+
[K in keyof T]: T[K] | null;
|
|
9
|
+
};
|
|
10
|
+
export type DeepNullable<T> = {
|
|
11
|
+
[K in keyof T]: DeepNullable<T[K]> | null;
|
|
12
|
+
};
|
|
13
|
+
export declare function notUndefined<T>(value: T | undefined): value is T;
|
|
14
|
+
export declare function notNull<T>(value: T | null): value is T;
|
|
15
|
+
export declare const removeNullFields: <T extends Record<string, any>>(data: T) => T;
|
|
16
|
+
export declare function parseIntData(val: string | number, defaultValue: string | number): string | number;
|
|
17
|
+
export declare function sanitizeString(val: string | null | undefined): string | null;
|
|
18
|
+
export declare const getIdOrSelf: (e: any) => any;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function notUndefined(value) {
|
|
2
|
+
return value !== void 0;
|
|
3
|
+
}
|
|
4
|
+
function notNull(value) {
|
|
5
|
+
return value !== null;
|
|
6
|
+
}
|
|
7
|
+
const removeNullFields = (data) => {
|
|
8
|
+
const result = Object.entries(data).reduce((acc, [key, value]) => {
|
|
9
|
+
if (value === null) {
|
|
10
|
+
return acc;
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
13
|
+
const cleaned = removeNullFields(value);
|
|
14
|
+
if (Object.keys(cleaned).length > 0) {
|
|
15
|
+
acc[key] = cleaned;
|
|
16
|
+
}
|
|
17
|
+
return acc;
|
|
18
|
+
}
|
|
19
|
+
acc[key] = value;
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
function parseIntData(val, defaultValue) {
|
|
25
|
+
const intValue = Number.parseInt(String(val), 10);
|
|
26
|
+
return Number.isNaN(intValue) ? defaultValue : intValue;
|
|
27
|
+
}
|
|
28
|
+
function sanitizeString(val) {
|
|
29
|
+
const trimmedValue = val?.trim();
|
|
30
|
+
return trimmedValue === void 0 || trimmedValue === "" ? null : trimmedValue;
|
|
31
|
+
}
|
|
32
|
+
const getIdOrSelf = (e) => e?.id ?? e;
|
|
33
|
+
export {
|
|
34
|
+
getIdOrSelf,
|
|
35
|
+
notNull,
|
|
36
|
+
notUndefined,
|
|
37
|
+
parseIntData,
|
|
38
|
+
removeNullFields,
|
|
39
|
+
sanitizeString
|
|
40
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UUID } from 'node:crypto';
|
|
2
|
+
import { IntlShape } from 'react-intl';
|
|
2
3
|
import { ElementType } from './elementType';
|
|
3
4
|
export type Input = string | number;
|
|
4
5
|
export type ElementAttributes = {
|
|
@@ -60,3 +61,8 @@ export declare enum ArrayAction {
|
|
|
60
61
|
ADD = "ADD",
|
|
61
62
|
REMOVE = "REMOVE"
|
|
62
63
|
}
|
|
64
|
+
export type FormatValues = Parameters<IntlShape['formatMessage']>[1];
|
|
65
|
+
export type ErrorMessageDescriptor = {
|
|
66
|
+
descriptor: Parameters<IntlShape['formatMessage']>[0];
|
|
67
|
+
values?: FormatValues;
|
|
68
|
+
};
|