@gridsuite/commons-ui 0.161.0 → 0.162.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/filter/expert/expertFilterUtils.js +6 -1
- package/dist/components/parameters/short-circuit/short-circuit-fields.js +4 -2
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +20 -16
- package/dist/index.js +2 -1
- package/dist/translations/en/businessErrorsEn.js +1 -1
- package/dist/translations/fr/businessErrorsFr.js +4 -4
- package/dist/utils/functions.d.ts +6 -0
- package/dist/utils/functions.js +4 -0
- package/dist/utils/index.js +2 -1
- package/package.json +1 -1
|
@@ -4,6 +4,11 @@ import { DataType } from "./expertFilter.type.js";
|
|
|
4
4
|
import { OPERATOR_OPTIONS, RULES, FIELDS_OPTIONS } from "./expertFilterConstants.js";
|
|
5
5
|
import { isBlankOrEmpty, convertOutputValue, convertInputValue } from "../../../utils/conversionUtils.js";
|
|
6
6
|
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
7
|
+
import "../../../utils/types/equipmentType.js";
|
|
8
|
+
import { isEmpty } from "../../../utils/functions.js";
|
|
9
|
+
import "react/jsx-runtime";
|
|
10
|
+
import "@mui/icons-material";
|
|
11
|
+
import "../../../utils/yupConfig.js";
|
|
7
12
|
const searchTree = (tree, key, value) => {
|
|
8
13
|
const stack = Object.values(tree);
|
|
9
14
|
while (stack.length) {
|
|
@@ -262,7 +267,7 @@ const queryValidator = (query) => {
|
|
|
262
267
|
reasons: void 0
|
|
263
268
|
};
|
|
264
269
|
} else if (rule.id && rule.operator === OPERATOR_OPTIONS.BETWEEN.name) {
|
|
265
|
-
if (
|
|
270
|
+
if (isEmpty(rule.value?.[0]) || isEmpty(rule.value?.[1])) {
|
|
266
271
|
result[rule.id] = {
|
|
267
272
|
valid: false,
|
|
268
273
|
reasons: [RULES.EMPTY_RULE]
|
|
@@ -88,7 +88,8 @@ function ShortCircuitFields({ resetAll, isDeveloperMode = true }) {
|
|
|
88
88
|
name: `${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER}`
|
|
89
89
|
});
|
|
90
90
|
const isIccMinFeaturesDefaultConfiguration = useMemo(() => {
|
|
91
|
-
return !watchLoads && !watchShuntCompensators && !watchVSC && !watchNeutralPosition && watchOnlyStartedGeneratorsInCalculationCluster
|
|
91
|
+
return !watchLoads && !watchShuntCompensators && !watchVSC && !watchNeutralPosition && // if watchOnlyStartedGeneratorsInCalculationCluster is undefined, we consider IccMinFeaturesDefaultConfiguration as true
|
|
92
|
+
(watchOnlyStartedGeneratorsInCalculationCluster ?? true);
|
|
92
93
|
}, [
|
|
93
94
|
watchLoads,
|
|
94
95
|
watchShuntCompensators,
|
|
@@ -97,7 +98,8 @@ function ShortCircuitFields({ resetAll, isDeveloperMode = true }) {
|
|
|
97
98
|
watchOnlyStartedGeneratorsInCalculationCluster
|
|
98
99
|
]);
|
|
99
100
|
const isIccMaxFeaturesDefaultConfiguration = useMemo(() => {
|
|
100
|
-
return !watchLoads && !watchShuntCompensators && watchVSC && !watchNeutralPosition &&
|
|
101
|
+
return !watchLoads && !watchShuntCompensators && watchVSC && !watchNeutralPosition && // if watchOnlyStartedGeneratorsInCalculationCluster is undefined, we consider IccMaxFeaturesDefaultConfiguration as true
|
|
102
|
+
!(watchOnlyStartedGeneratorsInCalculationCluster ?? false);
|
|
101
103
|
}, [
|
|
102
104
|
watchLoads,
|
|
103
105
|
watchShuntCompensators,
|
|
@@ -32,7 +32,7 @@ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
|
32
32
|
import "uuid";
|
|
33
33
|
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
34
34
|
import "react-querybuilder";
|
|
35
|
-
import { SHORT_CIRCUIT_PREDEFINED_PARAMS, PredefinedParameters,
|
|
35
|
+
import { SHORT_CIRCUIT_PREDEFINED_PARAMS, PredefinedParameters, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, InitialVoltage, SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER, SHORT_CIRCUIT_VOLTAGE_RANGES } from "./constants.js";
|
|
36
36
|
import "../../filter/HeaderFilterForm.js";
|
|
37
37
|
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
38
38
|
import { SPECIFIC_PARAMETERS, COMMON_PARAMETERS, VERSION_PARAMETER, PROVIDER } from "../common/constant.js";
|
|
@@ -82,28 +82,32 @@ const useShortCircuitParametersForm = ({
|
|
|
82
82
|
const resetAll = useCallback(
|
|
83
83
|
(predefinedParameter) => {
|
|
84
84
|
const dirty = { shouldDirty: true };
|
|
85
|
+
setValue(`${COMMON_PARAMETERS}.${SHORT_CIRCUIT_WITH_LOADS}`, false, dirty);
|
|
85
86
|
setValue(
|
|
86
|
-
COMMON_PARAMETERS
|
|
87
|
-
|
|
88
|
-
...params?.commonParameters,
|
|
89
|
-
// for VERSION_PARAMETER and other non managed params
|
|
90
|
-
[SHORT_CIRCUIT_WITH_FEEDER_RESULT]: false,
|
|
91
|
-
[SHORT_CIRCUIT_WITH_LOADS]: false,
|
|
92
|
-
[SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS]: predefinedParameter !== PredefinedParameters.ICC_MIN_WITH_NOMINAL_VOLTAGE_MAP,
|
|
93
|
-
[SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS]: false,
|
|
94
|
-
[SHORT_CIRCUIT_WITH_NEUTRAL_POSITION]: false,
|
|
95
|
-
[SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE]: predefinedParameter === PredefinedParameters.ICC_MAX_WITH_CEI909 ? InitialVoltage.CEI909 : InitialVoltage.NOMINAL
|
|
96
|
-
},
|
|
87
|
+
`${COMMON_PARAMETERS}.${SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS}`,
|
|
88
|
+
predefinedParameter !== PredefinedParameters.ICC_MIN_WITH_NOMINAL_VOLTAGE_MAP,
|
|
97
89
|
dirty
|
|
98
90
|
);
|
|
99
|
-
setValue(
|
|
91
|
+
setValue(`${COMMON_PARAMETERS}.${SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS}`, false, dirty);
|
|
92
|
+
setValue(`${COMMON_PARAMETERS}.${SHORT_CIRCUIT_WITH_NEUTRAL_POSITION}`, false, dirty);
|
|
100
93
|
setValue(
|
|
101
|
-
`${
|
|
102
|
-
predefinedParameter === PredefinedParameters.
|
|
94
|
+
`${COMMON_PARAMETERS}.${SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE}`,
|
|
95
|
+
predefinedParameter === PredefinedParameters.ICC_MAX_WITH_CEI909 ? InitialVoltage.CEI909 : InitialVoltage.NOMINAL,
|
|
103
96
|
dirty
|
|
104
97
|
);
|
|
98
|
+
setValue(SHORT_CIRCUIT_PREDEFINED_PARAMS, predefinedParameter, dirty);
|
|
99
|
+
const onlyStartedGeneratorsInCalculationCluster = specificParametersDescriptionForProvider?.find(
|
|
100
|
+
(specificParam) => specificParam.name === SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER
|
|
101
|
+
);
|
|
102
|
+
if (onlyStartedGeneratorsInCalculationCluster) {
|
|
103
|
+
setValue(
|
|
104
|
+
`${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER}`,
|
|
105
|
+
predefinedParameter === PredefinedParameters.ICC_MIN_WITH_NOMINAL_VOLTAGE_MAP,
|
|
106
|
+
dirty
|
|
107
|
+
);
|
|
108
|
+
}
|
|
105
109
|
},
|
|
106
|
-
[
|
|
110
|
+
[setValue, specificParametersDescriptionForProvider]
|
|
107
111
|
);
|
|
108
112
|
const formatNewParams = useCallback(
|
|
109
113
|
(formData) => {
|
package/dist/index.js
CHANGED
|
@@ -216,7 +216,7 @@ import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, P
|
|
|
216
216
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./utils/constants/filterConstant.js";
|
|
217
217
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
218
218
|
import { catchErrorHandler, snackWithFallback } from "./utils/error.js";
|
|
219
|
-
import { areArrayElementsUnique, arraysContainIdenticalStrings, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
219
|
+
import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
220
220
|
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./utils/langs.js";
|
|
221
221
|
import { getFileIcon } from "./utils/mapper/getFileIcon.js";
|
|
222
222
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
@@ -829,6 +829,7 @@ export {
|
|
|
829
829
|
intlInitialVoltageProfileMode,
|
|
830
830
|
intlPredefinedParametersOptions,
|
|
831
831
|
isBlankOrEmpty,
|
|
832
|
+
isEmpty,
|
|
832
833
|
isFieldRequired,
|
|
833
834
|
isFloatNumber,
|
|
834
835
|
isIntegerNumber,
|
|
@@ -30,7 +30,7 @@ const businessErrorsEn = {
|
|
|
30
30
|
"study.networkExportFailed": "Failed to export network.",
|
|
31
31
|
"study.tooManyNadConfigs": "Maximum number of NAD configuration exceeded.",
|
|
32
32
|
"study.tooManyMapCards": "Maximum number of cards exceeded.",
|
|
33
|
-
"study.elementAlreadyExists": "An element with the
|
|
33
|
+
"study.elementAlreadyExists": "An element with the name {fileName} already exists",
|
|
34
34
|
"useradmin.permissionDenied": "You don't have permission to perform this action.",
|
|
35
35
|
"useradmin.userNotFound": "User not found.",
|
|
36
36
|
"useradmin.userAlreadyExists": "User already exists.",
|
|
@@ -6,9 +6,9 @@ const businessErrorsFr = {
|
|
|
6
6
|
"directory.moveInDescendantNotAllowed": "Impossible de déplacer un élément dans l’un de ses descendants.",
|
|
7
7
|
"directory.someElementsAreMissing": "Certains des éléments demandés sont manquants.",
|
|
8
8
|
"directory.elementNotFound": "L'élément du dossier demandé est introuvable.",
|
|
9
|
-
"directory.parentPermissionDenied": "Vous n'avez pas les droits d'accès
|
|
10
|
-
"directory.childPermissionDenied": "Le dossier contient au moins un sous-dossier pour lequel vous n'avez pas les droits d'accès
|
|
11
|
-
"directory.targetPermissionDenied": "Vous n'avez pas les droits d'accès
|
|
9
|
+
"directory.parentPermissionDenied": "Vous n'avez pas les droits d'accès suffisants sur le dossier parent",
|
|
10
|
+
"directory.childPermissionDenied": "Le dossier contient au moins un sous-dossier pour lequel vous n'avez pas les droits d'accès s",
|
|
11
|
+
"directory.targetPermissionDenied": "Vous n'avez pas les droits d'accès suffisants sur le dossier cible",
|
|
12
12
|
"explore.permissionDenied": "Vous n'êtes pas autorisé à effectuer cette action.",
|
|
13
13
|
"explore.maxElementsExceeded": "Vous avez atteint votre quota utilisateur en termes de situations et d'études ({limit} situations et études).",
|
|
14
14
|
"explore.incorrectCaseFile": "Le fichier réseau fourni est incorrect.",
|
|
@@ -30,7 +30,7 @@ const businessErrorsFr = {
|
|
|
30
30
|
"study.networkExportFailed": "Échec de l'export de réseau.",
|
|
31
31
|
"study.tooManyNadConfigs": "Nombre maximal de configurations d'image nodale de zone atteint.",
|
|
32
32
|
"study.tooManyMapCards": "Nombre maximal de carte atteint.",
|
|
33
|
-
"study.elementAlreadyExists": "Un élément avec le
|
|
33
|
+
"study.elementAlreadyExists": "Un élément avec le nom {fileName} est déjà présent",
|
|
34
34
|
"useradmin.permissionDenied": "Vous n'avez pas la permission d'effectuer cette action.",
|
|
35
35
|
"useradmin.userNotFound": "Utilisateur introuvable.",
|
|
36
36
|
"useradmin.userAlreadyExists": "L'utilisateur existe déjà.",
|
|
@@ -14,4 +14,10 @@ export declare function keyGenerator(): () => number;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function arraysContainIdenticalStrings(array1: string[] | undefined, array2: string[] | undefined): boolean;
|
|
16
16
|
export declare const areArrayElementsUnique: (array: unknown[]) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* returns true if element is null or undefined
|
|
19
|
+
* for string values return true if element is an empty string
|
|
20
|
+
* for number values return true if element is NaN
|
|
21
|
+
*/
|
|
22
|
+
export declare function isEmpty(value: any): boolean;
|
|
17
23
|
export declare const isObjectEmpty: (object: object) => boolean;
|
package/dist/utils/functions.js
CHANGED
|
@@ -12,10 +12,14 @@ const areArrayElementsUnique = (array) => {
|
|
|
12
12
|
const uniqueValues = [...new Set(array)];
|
|
13
13
|
return uniqueValues.length === array.length;
|
|
14
14
|
};
|
|
15
|
+
function isEmpty(value) {
|
|
16
|
+
return value === void 0 || value === null || typeof value === "string" && value.trim() === "" || typeof value === "number" && Number.isNaN(value);
|
|
17
|
+
}
|
|
15
18
|
const isObjectEmpty = (object) => object && Object.keys(object).length === 0;
|
|
16
19
|
export {
|
|
17
20
|
areArrayElementsUnique,
|
|
18
21
|
arraysContainIdenticalStrings,
|
|
22
|
+
isEmpty,
|
|
19
23
|
isObjectEmpty,
|
|
20
24
|
keyGenerator
|
|
21
25
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, P
|
|
|
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
9
|
import { catchErrorHandler, snackWithFallback } from "./error.js";
|
|
10
|
-
import { areArrayElementsUnique, arraysContainIdenticalStrings, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
10
|
+
import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
11
11
|
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
|
|
12
12
|
import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
13
13
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
@@ -117,6 +117,7 @@ export {
|
|
|
117
117
|
getEquipmentsInfosForSearchBar,
|
|
118
118
|
getFileIcon,
|
|
119
119
|
isBlankOrEmpty,
|
|
120
|
+
isEmpty,
|
|
120
121
|
isObjectEmpty,
|
|
121
122
|
keyGenerator,
|
|
122
123
|
kiloUnitToUnit,
|