@gridsuite/commons-ui 0.163.0 → 0.164.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 +39 -0
- package/dist/components/network-modifications/common/properties/propertyUtils.js +160 -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 +43 -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 +59 -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.js +1 -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 +10 -0
- package/dist/translations/en/networkModificationsEn.js +11 -1
- package/dist/translations/fr/businessErrorsFr.js +1 -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 +10 -0
- package/dist/translations/fr/networkModificationsFr.js +11 -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 +1 -0
- package/dist/utils/constants/index.js +13 -1
- 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 +22 -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
|
@@ -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,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 './adornments';
|
|
7
8
|
export * from './fetchStatus';
|
|
8
9
|
export * from './fieldConstants';
|
|
9
10
|
export * from './uiConstants';
|
|
@@ -1,3 +1,4 @@
|
|
|
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";
|
|
@@ -6,6 +7,8 @@ import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, P
|
|
|
6
7
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./filterConstant.js";
|
|
7
8
|
export {
|
|
8
9
|
AMPERE,
|
|
10
|
+
ActivePowerAdornment,
|
|
11
|
+
AmpereAdornment,
|
|
9
12
|
COMMON_APP_NAME,
|
|
10
13
|
COMMON_CONFIG_PARAMS_NAMES,
|
|
11
14
|
DEGREE,
|
|
@@ -18,16 +21,25 @@ export {
|
|
|
18
21
|
KILO_AMPERE,
|
|
19
22
|
KILO_METER,
|
|
20
23
|
KILO_VOLT,
|
|
24
|
+
KiloAmpereAdornment,
|
|
25
|
+
KilometerAdornment,
|
|
21
26
|
LAST_SELECTED_DIRECTORY,
|
|
22
27
|
MAX_CHAR_DESCRIPTION,
|
|
23
28
|
MEGA_VAR,
|
|
24
29
|
MEGA_VOLT_AMPERE,
|
|
25
30
|
MEGA_WATT,
|
|
26
31
|
MICRO_SIEMENS,
|
|
32
|
+
MVAPowerAdornment,
|
|
33
|
+
MicroSusceptanceAdornment,
|
|
27
34
|
OHM,
|
|
35
|
+
OhmAdornment,
|
|
28
36
|
PARAM_DEVELOPER_MODE,
|
|
29
37
|
PARAM_LANGUAGE,
|
|
30
38
|
PARAM_THEME,
|
|
31
39
|
PERCENTAGE,
|
|
32
|
-
|
|
40
|
+
PercentageAdornment,
|
|
41
|
+
ReactivePowerAdornment,
|
|
42
|
+
SIEMENS,
|
|
43
|
+
SusceptanceAdornment,
|
|
44
|
+
VoltageAdornment
|
|
33
45
|
};
|
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,4 +1,5 @@
|
|
|
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";
|
|
@@ -6,8 +7,9 @@ import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT
|
|
|
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";
|
|
8
9
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
9
|
-
import { catchErrorHandler, snackWithFallback } from "./error.js";
|
|
10
|
+
import { catchErrorHandler, extractErrorMessageDescriptor, snackWithFallback } from "./error.js";
|
|
10
11
|
import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
12
|
+
import { getEquipmentTypeShortLabel } from "./labelUtils.js";
|
|
11
13
|
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
|
|
12
14
|
import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
13
15
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
@@ -26,13 +28,15 @@ import { FieldType } from "./types/fieldType.js";
|
|
|
26
28
|
import { ParameterType } from "./types/parameters.type.js";
|
|
27
29
|
import { SolverTypeInfos } from "./types/dynamic-simulation.type.js";
|
|
28
30
|
import { DistributionType, SensitivityType } from "./types/sensitivity-analysis.type.js";
|
|
31
|
+
import { getIdOrSelf, notNull, notUndefined, parseIntData, removeNullFields, sanitizeString } from "./ts-utils.js";
|
|
29
32
|
import { toNumber, validateValueIsANumber } from "./validation-functions.js";
|
|
30
|
-
import { getEquipmentTypeShortLabel, getEquipmentTypeTagLabel } from "./labelUtils.js";
|
|
31
33
|
import "./yupConfig.js";
|
|
32
34
|
import * as yup from "yup";
|
|
33
35
|
export {
|
|
34
36
|
ALL_EQUIPMENTS,
|
|
35
37
|
AMPERE,
|
|
38
|
+
ActivePowerAdornment,
|
|
39
|
+
AmpereAdornment,
|
|
36
40
|
AnnouncementSeverity,
|
|
37
41
|
ArrayAction,
|
|
38
42
|
BASE_EQUIPMENTS,
|
|
@@ -62,6 +66,8 @@ export {
|
|
|
62
66
|
KILO_AMPERE,
|
|
63
67
|
KILO_METER,
|
|
64
68
|
KILO_VOLT,
|
|
69
|
+
KiloAmpereAdornment,
|
|
70
|
+
KilometerAdornment,
|
|
65
71
|
LANG_ENGLISH,
|
|
66
72
|
LANG_FRENCH,
|
|
67
73
|
LANG_SYSTEM,
|
|
@@ -76,10 +82,13 @@ export {
|
|
|
76
82
|
MEGA_WATT,
|
|
77
83
|
MICRO_SIEMENS,
|
|
78
84
|
MODIFICATION_TYPES,
|
|
85
|
+
MVAPowerAdornment,
|
|
86
|
+
MicroSusceptanceAdornment,
|
|
79
87
|
ModificationType,
|
|
80
88
|
NetworkTimeoutError,
|
|
81
89
|
NotificationsUrlKeys,
|
|
82
90
|
OHM,
|
|
91
|
+
OhmAdornment,
|
|
83
92
|
OperatingStatus,
|
|
84
93
|
PARAM_DEVELOPER_MODE,
|
|
85
94
|
PARAM_LANGUAGE,
|
|
@@ -89,7 +98,9 @@ export {
|
|
|
89
98
|
PREFIX_DIRECTORY_NOTIFICATION_WS,
|
|
90
99
|
PREFIX_STUDY_NOTIFICATION_WS,
|
|
91
100
|
ParameterType,
|
|
101
|
+
PercentageAdornment,
|
|
92
102
|
ProblemDetailError,
|
|
103
|
+
ReactivePowerAdornment,
|
|
93
104
|
SEARCH_EQUIPMENTS,
|
|
94
105
|
SIEMENS,
|
|
95
106
|
SVC,
|
|
@@ -97,11 +108,13 @@ export {
|
|
|
97
108
|
ShuntCompensator,
|
|
98
109
|
SolverTypeInfos,
|
|
99
110
|
Substation,
|
|
111
|
+
SusceptanceAdornment,
|
|
100
112
|
TYPE_TAG_MAX_SIZE,
|
|
101
113
|
ThreeWindingTransfo,
|
|
102
114
|
TwoWindingTransfo,
|
|
103
115
|
VL_TAG_MAX_SIZE,
|
|
104
116
|
VSC,
|
|
117
|
+
VoltageAdornment,
|
|
105
118
|
VoltageLevel,
|
|
106
119
|
areArrayElementsUnique,
|
|
107
120
|
arraysContainIdenticalStrings,
|
|
@@ -112,10 +125,11 @@ export {
|
|
|
112
125
|
equalsArray,
|
|
113
126
|
equipmentStyles,
|
|
114
127
|
equipmentTypesForPredefinedPropertiesMapper,
|
|
128
|
+
extractErrorMessageDescriptor,
|
|
115
129
|
getEquipmentTypeShortLabel,
|
|
116
|
-
getEquipmentTypeTagLabel,
|
|
117
130
|
getEquipmentsInfosForSearchBar,
|
|
118
131
|
getFileIcon,
|
|
132
|
+
getIdOrSelf,
|
|
119
133
|
isBlankOrEmpty,
|
|
120
134
|
isEmpty,
|
|
121
135
|
isObjectEmpty,
|
|
@@ -124,8 +138,13 @@ export {
|
|
|
124
138
|
makeComposeClasses,
|
|
125
139
|
mergeSx,
|
|
126
140
|
microUnitToUnit,
|
|
141
|
+
notNull,
|
|
142
|
+
notUndefined,
|
|
143
|
+
parseIntData,
|
|
144
|
+
removeNullFields,
|
|
127
145
|
roundToDefaultPrecision,
|
|
128
146
|
roundToPrecision,
|
|
147
|
+
sanitizeString,
|
|
129
148
|
snackWithFallback,
|
|
130
149
|
toNestedGlobalSelectors,
|
|
131
150
|
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
|
+
};
|