@gridsuite/commons-ui 0.131.0 → 0.133.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.
Files changed (50) hide show
  1. package/dist/components/customAGGrid/separatorCellRenderer.d.ts +2 -11
  2. package/dist/components/customAGGrid/separatorCellRenderer.js +7 -2
  3. package/dist/components/dnd-table/dnd-table.js +3 -3
  4. package/dist/components/filter/FilterCreationDialog.js +13 -3
  5. package/dist/components/filter/expert/ExpertFilterEditionDialog.js +12 -4
  6. package/dist/components/filter/expert/expertFilterConstants.d.ts +13 -12
  7. package/dist/components/filter/expert/expertFilterConstants.js +17 -48
  8. package/dist/components/filter/expert/expertFilterUtils.js +6 -2
  9. package/dist/components/filter/utils/filterApi.js +14 -6
  10. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +2 -2
  11. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +4 -2
  12. package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +4 -0
  13. package/dist/components/parameters/short-circuit/short-circuit-fields.d.ts +2 -1
  14. package/dist/components/parameters/short-circuit/short-circuit-fields.js +20 -5
  15. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.d.ts +1 -1
  16. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +4 -2
  17. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.d.ts +2 -1
  18. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +3 -2
  19. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.d.ts +2 -1
  20. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +3 -1
  21. package/dist/index.js +17 -3
  22. package/dist/services/businessErrorCode.d.ts +11 -0
  23. package/dist/services/businessErrorCode.js +10 -0
  24. package/dist/services/index.d.ts +1 -0
  25. package/dist/services/index.js +5 -1
  26. package/dist/services/utils.d.ts +14 -3
  27. package/dist/services/utils.js +44 -11
  28. package/dist/translations/en/businessErrorsEn.d.ts +28 -0
  29. package/dist/translations/en/businessErrorsEn.js +25 -0
  30. package/dist/translations/en/equipmentsEn.d.ts +1 -0
  31. package/dist/translations/en/equipmentsEn.js +2 -1
  32. package/dist/translations/en/errorsEn.d.ts +9 -0
  33. package/dist/translations/en/errorsEn.js +6 -0
  34. package/dist/translations/en/index.d.ts +2 -0
  35. package/dist/translations/en/index.js +4 -0
  36. package/dist/translations/fr/businessErrorsFr.d.ts +28 -0
  37. package/dist/translations/fr/businessErrorsFr.js +25 -0
  38. package/dist/translations/fr/equipmentsFr.d.ts +1 -0
  39. package/dist/translations/fr/equipmentsFr.js +2 -1
  40. package/dist/translations/fr/errorsFr.d.ts +9 -0
  41. package/dist/translations/fr/errorsFr.js +6 -0
  42. package/dist/translations/fr/index.d.ts +2 -0
  43. package/dist/translations/fr/index.js +4 -0
  44. package/dist/utils/index.js +4 -2
  45. package/dist/utils/types/equipmentType.d.ts +162 -8
  46. package/dist/utils/types/equipmentType.js +117 -9
  47. package/dist/utils/types/index.js +4 -2
  48. package/dist/utils/types/types.d.ts +4 -0
  49. package/dist/utils/types/types.js +7 -1
  50. package/package.json +4 -4
@@ -1,11 +1,2 @@
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
- type SeparatorCellRendererProps = {
8
- value: string;
9
- };
10
- export declare function SeparatorCellRenderer({ value }: Readonly<SeparatorCellRendererProps>): import("react/jsx-runtime").JSX.Element;
11
- export {};
1
+ import { TypographyProps } from '@mui/material';
2
+ export declare function SeparatorCellRenderer({ children, sx, ...otherProps }: Readonly<TypographyProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Typography } from "@mui/material";
3
+ import "../../utils/conversionUtils.js";
4
+ import "@mui/icons-material";
5
+ import { mergeSx } from "../../utils/styles.js";
6
+ import "../../utils/types/equipmentType.js";
7
+ import "../../utils/yupConfig.js";
3
8
  const styles = {
4
9
  separator: (theme) => ({
5
10
  fontWeight: "bold",
@@ -8,8 +13,8 @@ const styles = {
8
13
  marginTop: theme.spacing(1)
9
14
  })
10
15
  };
11
- function SeparatorCellRenderer({ value }) {
12
- return /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", color: "primary", sx: styles.separator, children: value });
16
+ function SeparatorCellRenderer({ children, sx, ...otherProps }) {
17
+ return /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", color: "primary", sx: mergeSx(styles.separator, sx), ...otherProps, children });
13
18
  }
14
19
  export {
15
20
  SeparatorCellRenderer
@@ -14,12 +14,12 @@ import { DirectoryItemsInput } from "../inputs/reactHookForm/DirectoryItemsInput
14
14
  import { RawReadOnlyInput } from "../inputs/reactHookForm/RawReadOnlyInput.js";
15
15
  import "../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
16
16
  import "../customAGGrid/customAggrid.js";
17
- import "ag-grid-community";
18
- import "react-papaparse";
19
- import "react-csv-downloader";
20
17
  import "../../utils/conversionUtils.js";
21
18
  import "../../utils/types/equipmentType.js";
22
19
  import "../../utils/yupConfig.js";
20
+ import "ag-grid-community";
21
+ import "react-papaparse";
22
+ import "react-csv-downloader";
23
23
  import "yup";
24
24
  import { AutocompleteInput } from "../inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
25
25
  import { CheckboxInput } from "../inputs/reactHookForm/booleans/CheckboxInput.js";
@@ -14,6 +14,10 @@ import { FilterType } from "./constants/FilterConstants.js";
14
14
  import { MAX_CHAR_DESCRIPTION } from "../../utils/constants/uiConstants.js";
15
15
  import { EXPERT_FILTER_QUERY } from "./expert/expertFilterConstants.js";
16
16
  import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./explicitNaming/ExplicitNamingFilterConstants.js";
17
+ import { CustomError } from "../../services/businessErrorCode.js";
18
+ import "../../utils/conversionUtils.js";
19
+ import "@mui/icons-material";
20
+ import "../../utils/types/equipmentType.js";
17
21
  import * as yup from "yup";
18
22
  const emptyFormData = {
19
23
  [FieldConstants.NAME]: "",
@@ -77,9 +81,15 @@ function FilterCreationDialog({
77
81
  activeDirectory,
78
82
  onClose,
79
83
  (error) => {
80
- snackError({
81
- messageTxt: error.message
82
- });
84
+ if (error instanceof CustomError && error.businessErrorCode != null) {
85
+ snackError({
86
+ messageId: error.businessErrorCode
87
+ });
88
+ } else {
89
+ snackError({
90
+ messageTxt: error.message
91
+ });
92
+ }
83
93
  }
84
94
  );
85
95
  }
@@ -17,6 +17,7 @@ import { catchErrorHandler } from "../../../services/utils.js";
17
17
  import "../../../utils/conversionUtils.js";
18
18
  import "@mui/icons-material";
19
19
  import "../../../utils/types/equipmentType.js";
20
+ import { CustomError } from "../../../services/businessErrorCode.js";
20
21
  import { EXPERT_FILTER_QUERY } from "./expertFilterConstants.js";
21
22
  import * as yup from "yup";
22
23
  const formSchema = yup.object().shape({
@@ -83,10 +84,17 @@ function ExpertFilterEditionDialog({
83
84
  null,
84
85
  onClose,
85
86
  (error) => {
86
- snackError({
87
- messageTxt: error.message,
88
- headerId: "cannotSaveFilter"
89
- });
87
+ if (error instanceof CustomError && error.businessErrorCode != null) {
88
+ snackError({
89
+ messageId: error.businessErrorCode,
90
+ headerId: "cannotSaveFilter"
91
+ });
92
+ } else {
93
+ snackError({
94
+ messageTxt: error.message,
95
+ headerId: "cannotSaveFilter"
96
+ });
97
+ }
90
98
  }
91
99
  );
92
100
  if (itemSelectionForCopy.sourceItemUuid === id) {
@@ -1,6 +1,7 @@
1
1
  import { Field } from 'react-querybuilder';
2
2
  import { CombinatorType, DataType, OperatorType } from './expertFilter.type';
3
3
  import { FieldType } from '../../../utils/types/fieldType';
4
+ import { EquipmentType } from '../../../utils';
4
5
  export declare enum RULES {
5
6
  EMPTY_RULE = "emptyRule",
6
7
  EMPTY_GROUP = "emptyGroup",
@@ -10,51 +11,51 @@ export declare enum RULES {
10
11
  export declare const EXPERT_FILTER_QUERY = "rules";
11
12
  export declare const EXPERT_FILTER_EQUIPMENTS: {
12
13
  SUBSTATION: {
13
- id: string;
14
+ id: EquipmentType;
14
15
  label: string;
15
16
  };
16
17
  VOLTAGE_LEVEL: {
17
- id: string;
18
+ id: EquipmentType;
18
19
  label: string;
19
20
  };
20
21
  LINE: {
21
- id: string;
22
+ id: EquipmentType;
22
23
  label: string;
23
24
  };
24
25
  TWO_WINDINGS_TRANSFORMER: {
25
- id: string;
26
+ id: EquipmentType;
26
27
  label: string;
27
28
  };
28
29
  THREE_WINDINGS_TRANSFORMER: {
29
- id: string;
30
+ id: EquipmentType;
30
31
  label: string;
31
32
  };
32
33
  GENERATOR: {
33
- id: string;
34
+ id: EquipmentType;
34
35
  label: string;
35
36
  };
36
37
  BATTERY: {
37
- id: string;
38
+ id: EquipmentType;
38
39
  label: string;
39
40
  };
40
41
  LOAD: {
41
- id: string;
42
+ id: EquipmentType;
42
43
  label: string;
43
44
  };
44
45
  SHUNT_COMPENSATOR: {
45
- id: string;
46
+ id: EquipmentType;
46
47
  label: string;
47
48
  };
48
49
  STATIC_VAR_COMPENSATOR: {
49
- id: string;
50
+ id: EquipmentType;
50
51
  label: string;
51
52
  };
52
53
  HVDC_LINE: {
53
- id: string;
54
+ id: EquipmentType;
54
55
  label: string;
55
56
  };
56
57
  DANGLING_LINE: {
57
- id: string;
58
+ id: EquipmentType;
58
59
  label: string;
59
60
  };
60
61
  };
@@ -1,6 +1,11 @@
1
1
  import { OperatorType, CombinatorType, DataType } from "./expertFilter.type.js";
2
2
  import { FieldType } from "../../../utils/types/fieldType.js";
3
3
  import { KILO_AMPERE, KILO_VOLT, MICRO_SIEMENS, SIEMENS, MEGA_VAR, MEGA_WATT, OHM, MEGA_VOLT_AMPERE } from "../../../utils/constants/unitsConstants.js";
4
+ import "../../../utils/conversionUtils.js";
5
+ import "react/jsx-runtime";
6
+ import "@mui/icons-material";
7
+ import { EquipmentType, ALL_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
8
+ import "../../../utils/yupConfig.js";
4
9
  var RULES = /* @__PURE__ */ ((RULES2) => {
5
10
  RULES2["EMPTY_RULE"] = "emptyRule";
6
11
  RULES2["EMPTY_GROUP"] = "emptyGroup";
@@ -10,54 +15,18 @@ var RULES = /* @__PURE__ */ ((RULES2) => {
10
15
  })(RULES || {});
11
16
  const EXPERT_FILTER_QUERY = "rules";
12
17
  const EXPERT_FILTER_EQUIPMENTS = {
13
- SUBSTATION: {
14
- id: "SUBSTATION",
15
- label: "Substations"
16
- },
17
- VOLTAGE_LEVEL: {
18
- id: "VOLTAGE_LEVEL",
19
- label: "VoltageLevels"
20
- },
21
- LINE: {
22
- id: "LINE",
23
- label: "Lines"
24
- },
25
- TWO_WINDINGS_TRANSFORMER: {
26
- id: "TWO_WINDINGS_TRANSFORMER",
27
- label: "TwoWindingsTransformers"
28
- },
29
- THREE_WINDINGS_TRANSFORMER: {
30
- id: "THREE_WINDINGS_TRANSFORMER",
31
- label: "ThreeWindingsTransformers"
32
- },
33
- GENERATOR: {
34
- id: "GENERATOR",
35
- label: "Generators"
36
- },
37
- BATTERY: {
38
- id: "BATTERY",
39
- label: "Batteries"
40
- },
41
- LOAD: {
42
- id: "LOAD",
43
- label: "Loads"
44
- },
45
- SHUNT_COMPENSATOR: {
46
- id: "SHUNT_COMPENSATOR",
47
- label: "ShuntCompensators"
48
- },
49
- STATIC_VAR_COMPENSATOR: {
50
- id: "STATIC_VAR_COMPENSATOR",
51
- label: "StaticVarCompensators"
52
- },
53
- HVDC_LINE: {
54
- id: "HVDC_LINE",
55
- label: "Hvdc"
56
- },
57
- DANGLING_LINE: {
58
- id: "DANGLING_LINE",
59
- label: "DanglingLines"
60
- }
18
+ [EquipmentType.SUBSTATION]: ALL_EQUIPMENTS[EquipmentType.SUBSTATION],
19
+ [EquipmentType.VOLTAGE_LEVEL]: ALL_EQUIPMENTS[EquipmentType.VOLTAGE_LEVEL],
20
+ [EquipmentType.LINE]: ALL_EQUIPMENTS[EquipmentType.LINE],
21
+ [EquipmentType.TWO_WINDINGS_TRANSFORMER]: ALL_EQUIPMENTS[EquipmentType.TWO_WINDINGS_TRANSFORMER],
22
+ [EquipmentType.THREE_WINDINGS_TRANSFORMER]: ALL_EQUIPMENTS[EquipmentType.THREE_WINDINGS_TRANSFORMER],
23
+ [EquipmentType.GENERATOR]: ALL_EQUIPMENTS[EquipmentType.GENERATOR],
24
+ [EquipmentType.BATTERY]: ALL_EQUIPMENTS[EquipmentType.BATTERY],
25
+ [EquipmentType.LOAD]: ALL_EQUIPMENTS[EquipmentType.LOAD],
26
+ [EquipmentType.SHUNT_COMPENSATOR]: ALL_EQUIPMENTS[EquipmentType.SHUNT_COMPENSATOR],
27
+ [EquipmentType.STATIC_VAR_COMPENSATOR]: ALL_EQUIPMENTS[EquipmentType.STATIC_VAR_COMPENSATOR],
28
+ [EquipmentType.HVDC_LINE]: ALL_EQUIPMENTS[EquipmentType.HVDC_LINE],
29
+ [EquipmentType.DANGLING_LINE]: ALL_EQUIPMENTS[EquipmentType.DANGLING_LINE]
61
30
  };
62
31
  const ENERGY_SOURCE_OPTIONS = [
63
32
  { name: "HYDRO", label: "Hydro" },
@@ -1,9 +1,13 @@
1
1
  import { defaultOperators, getParentPath, findPath, remove } from "react-querybuilder";
2
2
  import { validate } from "uuid";
3
3
  import { DataType } from "./expertFilter.type.js";
4
- import { OPERATOR_OPTIONS, RULES, FIELDS_OPTIONS, EXPERT_FILTER_EQUIPMENTS } from "./expertFilterConstants.js";
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 "react/jsx-runtime";
8
+ import "@mui/icons-material";
9
+ import { ALL_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
10
+ import "../../../utils/yupConfig.js";
7
11
  const searchTree = (tree, key, value) => {
8
12
  const stack = Object.values(tree);
9
13
  while (stack.length) {
@@ -367,7 +371,7 @@ function getFilterEquipmentTypeLabel(equipmentType) {
367
371
  if (!equipmentType) {
368
372
  return "";
369
373
  }
370
- return ((_a = EXPERT_FILTER_EQUIPMENTS[equipmentType]) == null ? void 0 : _a.label) ?? "";
374
+ return ((_a = ALL_EQUIPMENTS[equipmentType]) == null ? void 0 : _a.label) ?? "";
371
375
  }
372
376
  export {
373
377
  countRules,
@@ -73,9 +73,13 @@ const saveExpertFilter = (id, query, equipmentType, name, description, isFilterC
73
73
  ).then(() => {
74
74
  onClose();
75
75
  }).catch((error) => {
76
- catchErrorHandler(error, (message) => {
77
- onError(new Error(message));
78
- });
76
+ if (error instanceof Error) {
77
+ onError(error);
78
+ } else {
79
+ catchErrorHandler(error, (message) => {
80
+ onError(new Error(message));
81
+ });
82
+ }
79
83
  });
80
84
  } else {
81
85
  saveFilter(
@@ -91,9 +95,13 @@ const saveExpertFilter = (id, query, equipmentType, name, description, isFilterC
91
95
  ).then(() => {
92
96
  onClose();
93
97
  }).catch((error) => {
94
- catchErrorHandler(error, (message) => {
95
- onError(new Error(message));
96
- });
98
+ if (error instanceof Error) {
99
+ onError(error);
100
+ } else {
101
+ catchErrorHandler(error, (message) => {
102
+ onError(new Error(message));
103
+ });
104
+ }
97
105
  });
98
106
  }
99
107
  };
@@ -1,4 +1,4 @@
1
- import { ElementAttributes } from '../../../utils';
1
+ import { ArrayAction, ElementAttributes } from '../../../utils';
2
2
  export interface DirectoryItemsInputProps {
3
3
  label: string | undefined;
4
4
  name: string;
@@ -8,7 +8,7 @@ export interface DirectoryItemsInputProps {
8
8
  titleId?: string;
9
9
  hideErrorMessage?: boolean;
10
10
  onRowChanged?: (a: boolean) => void;
11
- onChange?: (e: any) => void;
11
+ onChange?: (e: any, action?: ArrayAction, element?: any) => void;
12
12
  disable?: boolean;
13
13
  allowMultiSelect?: boolean;
14
14
  labelRequiredFromContext?: boolean;
@@ -21,6 +21,7 @@ import { OverflowableText } from "../../overflowableText/OverflowableText.js";
21
21
  import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
22
22
  import "../../../utils/conversionUtils.js";
23
23
  import { mergeSx } from "../../../utils/styles.js";
24
+ import { ArrayAction } from "../../../utils/types/types.js";
24
25
  import "../../../utils/yupConfig.js";
25
26
  import { NAME } from "./constants.js";
26
27
  import { getFilterEquipmentTypeLabel } from "../../filter/expert/expertFilterUtils.js";
@@ -111,7 +112,7 @@ function DirectoryItemsInput({
111
112
  } else {
112
113
  append(otherElementAttributes);
113
114
  onRowChanged == null ? void 0 : onRowChanged(true);
114
- onChange == null ? void 0 : onChange(getValues(name));
115
+ onChange == null ? void 0 : onChange(getValues(name), ArrayAction.ADD, otherElementAttributes);
115
116
  }
116
117
  });
117
118
  setDirectoryItemSelectorOpen(false);
@@ -121,9 +122,10 @@ function DirectoryItemsInput({
121
122
  );
122
123
  const removeElements = useCallback(
123
124
  (index) => {
125
+ const currentValues = getValues(name);
124
126
  remove(index);
125
127
  onRowChanged == null ? void 0 : onRowChanged(true);
126
- onChange == null ? void 0 : onChange(getValues(name));
128
+ onChange == null ? void 0 : onChange(currentValues, ArrayAction.REMOVE, currentValues[index]);
127
129
  },
128
130
  [onRowChanged, remove, getValues, name, onChange]
129
131
  );
@@ -5,6 +5,10 @@ import { useTheme, Box } from "@mui/material";
5
5
  import { BottomRightButtons } from "./BottomRightButtons.js";
6
6
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
7
7
  import { CustomAGGrid } from "../../../customAGGrid/customAggrid.js";
8
+ import "../../../../utils/conversionUtils.js";
9
+ import "@mui/icons-material";
10
+ import "../../../../utils/types/equipmentType.js";
11
+ import "../../../../utils/yupConfig.js";
8
12
  const style = (customProps) => ({
9
13
  grid: (theme) => ({
10
14
  width: "auto",
@@ -1,9 +1,10 @@
1
1
  import { PredefinedParameters } from './constants';
2
2
  export interface ShortCircuitFieldsProps {
3
3
  resetAll: (predefinedParams: PredefinedParameters) => void;
4
+ enableDeveloperMode: boolean;
4
5
  }
5
6
  export declare enum Status {
6
7
  SUCCESS = "SUCCESS",
7
8
  ERROR = "ERROR"
8
9
  }
9
- export declare function ShortCircuitFields({ resetAll }: Readonly<ShortCircuitFieldsProps>): import("react/jsx-runtime").JSX.Element;
10
+ export declare function ShortCircuitFields({ resetAll, enableDeveloperMode }: Readonly<ShortCircuitFieldsProps>): import("react/jsx-runtime").JSX.Element;
@@ -3,8 +3,8 @@ import { useState, useMemo, useEffect } from "react";
3
3
  import { Grid } from "@mui/material";
4
4
  import { green, red } from "@mui/material/colors";
5
5
  import { Lens } from "@mui/icons-material";
6
- import { useWatch } from "react-hook-form";
7
- import { SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, intlPredefinedParametersOptions, intlInitialVoltageProfileMode, PredefinedParameters, InitialVoltage, SHORT_CIRCUIT_WITH_FEEDER_RESULT } from "./constants.js";
6
+ import { useWatch, useFormContext } from "react-hook-form";
7
+ import { SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, intlPredefinedParametersOptions, PredefinedParameters, intlInitialVoltageProfileMode, InitialVoltage, SHORT_CIRCUIT_WITH_FEEDER_RESULT } from "./constants.js";
8
8
  import { VoltageTable } from "./short-circuit-voltage-table.js";
9
9
  import GridItem from "../../grid/grid-item.js";
10
10
  import GridSection from "../../grid/grid-section.js";
@@ -42,7 +42,7 @@ var Status = /* @__PURE__ */ ((Status2) => {
42
42
  Status2["ERROR"] = "ERROR";
43
43
  return Status2;
44
44
  })(Status || {});
45
- function ShortCircuitFields({ resetAll }) {
45
+ function ShortCircuitFields({ resetAll, enableDeveloperMode = true }) {
46
46
  const [status, setStatus] = useState(
47
47
  "SUCCESS"
48
48
  /* SUCCESS */
@@ -72,8 +72,12 @@ function ShortCircuitFields({ resetAll }) {
72
72
  return !watchLoads && !watchShuntCompensators && watchVSC && !watchNeutralPosition;
73
73
  }, [watchLoads, watchShuntCompensators, watchVSC, watchNeutralPosition]);
74
74
  const predefinedParamsOptions = useMemo(() => {
75
- return intlPredefinedParametersOptions();
76
- }, []);
75
+ const options = intlPredefinedParametersOptions();
76
+ if (!enableDeveloperMode) {
77
+ return options.filter((opt) => opt.id !== PredefinedParameters.ICC_MIN_WITH_NOMINAL_VOLTAGE_MAP);
78
+ }
79
+ return options;
80
+ }, [enableDeveloperMode]);
77
81
  const initialVoltageProfileMode = useMemo(() => {
78
82
  return intlInitialVoltageProfileMode();
79
83
  }, []);
@@ -87,6 +91,17 @@ function ShortCircuitFields({ resetAll }) {
87
91
  console.debug("onPredefinedParametersManualChange new:", newPredefinedParameters);
88
92
  resetAll(newPredefinedParameters);
89
93
  };
94
+ const { setValue } = useFormContext();
95
+ useEffect(() => {
96
+ if (!enableDeveloperMode) {
97
+ if (watchPredefinedParams === PredefinedParameters.ICC_MIN_WITH_NOMINAL_VOLTAGE_MAP) {
98
+ setValue(SHORT_CIRCUIT_PREDEFINED_PARAMS, PredefinedParameters.ICC_MAX_WITH_NOMINAL_VOLTAGE_MAP, {
99
+ shouldDirty: false,
100
+ shouldValidate: true
101
+ });
102
+ }
103
+ }
104
+ }, [enableDeveloperMode, watchPredefinedParams, setValue]);
90
105
  const feederResult = /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", spacing: 2, direction: "row", children: [
91
106
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 10, children: /* @__PURE__ */ jsx(FieldLabel, { label: "descWithFeederResult" }) }),
92
107
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 2, children: /* @__PURE__ */ jsx(SwitchInput, { name: SHORT_CIRCUIT_WITH_FEEDER_RESULT }) })
@@ -1,2 +1,2 @@
1
1
  import { ParametersEditionDialogProps } from '../common';
2
- export declare function ShortCircuitParametersEditionDialog({ id, open, onClose, titleId, name, description, activeDirectory, language, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ShortCircuitParametersEditionDialog({ id, open, onClose, titleId, name, description, activeDirectory, language, enableDeveloperMode, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
@@ -42,7 +42,8 @@ function ShortCircuitParametersEditionDialog({
42
42
  name,
43
43
  description,
44
44
  activeDirectory,
45
- language
45
+ language,
46
+ enableDeveloperMode
46
47
  }) {
47
48
  const shortCircuitMethods = useShortCircuitParametersForm({
48
49
  parametersUuid: id,
@@ -80,7 +81,8 @@ function ShortCircuitParametersEditionDialog({
80
81
  elementType: ElementType.SHORT_CIRCUIT_PARAMETERS
81
82
  }
82
83
  );
83
- }
84
+ },
85
+ enableDeveloperMode: enableDeveloperMode ?? false
84
86
  }
85
87
  )
86
88
  }
@@ -4,6 +4,7 @@ interface ShortCircuitParametersFormProps {
4
4
  shortCircuitMethods: UseShortCircuitParametersFormReturn;
5
5
  renderTitleFields?: () => ReactNode;
6
6
  renderActions?: () => ReactNode;
7
+ enableDeveloperMode: boolean;
7
8
  }
8
- export declare function ShortCircuitParametersForm({ shortCircuitMethods, renderTitleFields, renderActions, }: Readonly<ShortCircuitParametersFormProps>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function ShortCircuitParametersForm({ shortCircuitMethods, renderTitleFields, renderActions, enableDeveloperMode, }: Readonly<ShortCircuitParametersFormProps>): import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -32,7 +32,8 @@ import { ShortCircuitFields } from "./short-circuit-fields.js";
32
32
  function ShortCircuitParametersForm({
33
33
  shortCircuitMethods,
34
34
  renderTitleFields,
35
- renderActions
35
+ renderActions,
36
+ enableDeveloperMode
36
37
  }) {
37
38
  const { formMethods, formSchema, paramsLoading, resetAll } = shortCircuitMethods;
38
39
  return /* @__PURE__ */ jsx(CustomFormProvider, { validationSchema: formSchema, ...formMethods, removeOptional: true, children: /* @__PURE__ */ jsxs(
@@ -46,7 +47,7 @@ function ShortCircuitParametersForm({
46
47
  },
47
48
  children: [
48
49
  /* @__PURE__ */ jsx(Grid, { item: true, container: true, direction: "column", children: renderTitleFields == null ? void 0 : renderTitleFields() }),
49
- paramsLoading ? /* @__PURE__ */ jsx(LinearProgress, {}) : /* @__PURE__ */ jsx(Grid, { sx: parametersStyles.scrollableGrid, children: /* @__PURE__ */ jsx(ShortCircuitFields, { resetAll }) }),
50
+ paramsLoading ? /* @__PURE__ */ jsx(LinearProgress, {}) : /* @__PURE__ */ jsx(Grid, { sx: parametersStyles.scrollableGrid, children: /* @__PURE__ */ jsx(ShortCircuitFields, { enableDeveloperMode, resetAll }) }),
50
51
  /* @__PURE__ */ jsx(
51
52
  Grid,
52
53
  {
@@ -1,7 +1,8 @@
1
1
  import { UUID } from 'node:crypto';
2
2
  import { ShortCircuitParametersInfos } from './short-circuit-parameters.type';
3
- export declare function ShortCircuitParametersInLine({ studyUuid, setHaveDirtyFields, shortCircuitParameters, }: Readonly<{
3
+ export declare function ShortCircuitParametersInLine({ studyUuid, setHaveDirtyFields, shortCircuitParameters, enableDeveloperMode, }: Readonly<{
4
4
  studyUuid: UUID | null;
5
5
  setHaveDirtyFields: (isDirty: boolean) => void;
6
6
  shortCircuitParameters: ShortCircuitParametersInfos | null;
7
+ enableDeveloperMode: boolean;
7
8
  }>): import("react/jsx-runtime").JSX.Element;
@@ -40,7 +40,8 @@ import { useShortCircuitParametersForm } from "./use-short-circuit-parameters-fo
40
40
  function ShortCircuitParametersInLine({
41
41
  studyUuid,
42
42
  setHaveDirtyFields,
43
- shortCircuitParameters
43
+ shortCircuitParameters,
44
+ enableDeveloperMode
44
45
  }) {
45
46
  const shortCircuitMethods = useShortCircuitParametersForm({
46
47
  parametersUuid: null,
@@ -98,6 +99,7 @@ function ShortCircuitParametersInLine({
98
99
  ShortCircuitParametersForm,
99
100
  {
100
101
  shortCircuitMethods,
102
+ enableDeveloperMode,
101
103
  renderActions: () => {
102
104
  return /* @__PURE__ */ jsxs(Box, { children: [
103
105
  /* @__PURE__ */ jsxs(Grid, { container: true, item: true, children: [
package/dist/index.js CHANGED
@@ -188,7 +188,7 @@ import { OptionalServicesStatus, useParametersBackend } from "./hooks/use-parame
188
188
  import { useCreateRowDataSensi } from "./hooks/use-create-row-data-sensi.js";
189
189
  import { LOGOUT_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, SIGNIN_CALLBACK_ERROR, UNAUTHORIZED_USER_INFO, USER, USER_VALIDATION_ERROR, resetAuthenticationRouterError, setLoggedUser, setLogoutError, setShowAuthenticationRouterLogin, setSignInCallbackError, setUnauthorizedUserInfo, setUserValidationError } from "./redux/actions/authActions.js";
190
190
  import { getUserToken, setCommonStore } from "./redux/commonStore.js";
191
- import { backendFetch, backendFetchJson, backendFetchText, catchErrorHandler, getRequestParamFromList } from "./services/utils.js";
191
+ import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, catchErrorHandler, getRequestParamFromList } from "./services/utils.js";
192
192
  import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./services/explore.js";
193
193
  import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
194
194
  import { elementAlreadyExists, fetchConfigParameter, fetchConfigParameters, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, getAppName, updateConfigParameter } from "./services/directory.js";
@@ -198,6 +198,7 @@ import { getNetworkVisualizationsParameters } from "./services/study-config.js";
198
198
  import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin.js";
199
199
  import { getVoltageInitParameters, getVoltageInitUrl } from "./services/voltage-init.js";
200
200
  import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./services/security-analysis.js";
201
+ import { CustomError } from "./services/businessErrorCode.js";
201
202
  import { equalsArray } from "./utils/algos.js";
202
203
  import { FetchStatus } from "./utils/constants/fetchStatus.js";
203
204
  import { FieldConstants } from "./utils/constants/fieldConstants.js";
@@ -212,9 +213,9 @@ import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equi
212
213
  import { NotificationsUrlKeys, PREFIX_CONFIG_NOTIFICATION_WS, PREFIX_DIRECTORY_NOTIFICATION_WS, PREFIX_STUDY_NOTIFICATION_WS } from "./utils/constants/notificationsProvider.js";
213
214
  import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
214
215
  import { ElementType } from "./utils/types/elementType.js";
215
- import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
216
+ import { ALL_EQUIPMENTS, BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
216
217
  import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./utils/types/equipmentTypes.js";
217
- import { AnnouncementSeverity } from "./utils/types/types.js";
218
+ import { AnnouncementSeverity, ArrayAction } from "./utils/types/types.js";
218
219
  import { MODIFICATION_TYPES, ModificationType } from "./utils/types/modificationType.js";
219
220
  import { FieldType } from "./utils/types/fieldType.js";
220
221
  import { ParameterType } from "./utils/types/parameters.type.js";
@@ -223,6 +224,7 @@ import { DistributionType, SensitivityType } from "./utils/types/sensitivity-ana
223
224
  import { toNumber, validateValueIsANumber } from "./utils/validation-functions.js";
224
225
  import "./utils/yupConfig.js";
225
226
  import { cardErrorBoundaryEn } from "./translations/en/cardErrorBoundaryEn.js";
227
+ import { businessErrorsEn } from "./translations/en/businessErrorsEn.js";
226
228
  import { commonButtonEn } from "./translations/en/commonButtonEn.js";
227
229
  import { csvEn } from "./translations/en/csvEn.js";
228
230
  import { descriptionEn } from "./translations/en/descriptionEn.js";
@@ -231,6 +233,7 @@ import { dndTableEn } from "./translations/en/dndTableEn.js";
231
233
  import { elementSearchEn } from "./translations/en/elementSearchEn.js";
232
234
  import { equipmentSearchEn } from "./translations/en/equipmentSearchEn.js";
233
235
  import { equipmentsEn } from "./translations/en/equipmentsEn.js";
236
+ import { errorsEn } from "./translations/en/errorsEn.js";
234
237
  import { filterEn } from "./translations/en/filterEn.js";
235
238
  import { filterExpertEn } from "./translations/en/filterExpertEn.js";
236
239
  import { flatParametersEn } from "./translations/en/flatParametersEn.js";
@@ -248,6 +251,7 @@ import { componentsEn } from "./translations/en/componentsEn.js";
248
251
  import { parametersEn } from "./translations/en/parameters.js";
249
252
  import { useUniqueNameValidationEn } from "./translations/en/use-unique-name-validation-en.js";
250
253
  import { cardErrorBoundaryFr } from "./translations/fr/cardErrorBoundaryFr.js";
254
+ import { businessErrorsFr } from "./translations/fr/businessErrorsFr.js";
251
255
  import { commonButtonFr } from "./translations/fr/commonButtonFr.js";
252
256
  import { csvFr } from "./translations/fr/csvFr.js";
253
257
  import { descriptionFr } from "./translations/fr/descriptionFr.js";
@@ -256,6 +260,7 @@ import { dndTableFr } from "./translations/fr/dndTableFr.js";
256
260
  import { elementSearchFr } from "./translations/fr/elementSearchFr.js";
257
261
  import { equipmentSearchFr } from "./translations/fr/equipmentSearchFr.js";
258
262
  import { equipmentsFr } from "./translations/fr/equipmentsFr.js";
263
+ import { errorsFr } from "./translations/fr/errorsFr.js";
259
264
  import { filterExpertFr } from "./translations/fr/filterExpertFr.js";
260
265
  import { filterFr } from "./translations/fr/filterFr.js";
261
266
  import { flatParametersFr } from "./translations/fr/flatParametersFr.js";
@@ -274,6 +279,7 @@ import { parametersFr } from "./translations/fr/parameters.js";
274
279
  import { useUniqueNameValidationFr } from "./translations/fr/use-unique-name-validation-fr.js";
275
280
  import * as yup from "yup";
276
281
  export {
282
+ ALL_EQUIPMENTS,
277
283
  AMPERE,
278
284
  AboutDialog,
279
285
  ActivableChip,
@@ -281,6 +287,7 @@ export {
281
287
  AnnouncementBanner,
282
288
  AnnouncementNotification,
283
289
  AnnouncementSeverity,
290
+ ArrayAction,
284
291
  ArrowsOutputIcon,
285
292
  AuthenticationRouter,
286
293
  default3 as AuthenticationRouterErrorDisplay,
@@ -325,6 +332,7 @@ export {
325
332
  CsvUploader,
326
333
  CustomAGGrid,
327
334
  CustomAgGridTable,
335
+ CustomError,
328
336
  CustomFormContext,
329
337
  CustomFormProvider,
330
338
  CustomMenuItem,
@@ -485,6 +493,7 @@ export {
485
493
  NAME,
486
494
  NO_ITEM_SELECTION_FOR_COPY,
487
495
  NadPositionsGenerationMode,
496
+ NetworkTimeoutError,
488
497
  NetworkVisualizationParametersInline,
489
498
  NetworkVisualizationTabValues,
490
499
  NetworkVisualizationsParametersEditionDialog,
@@ -654,8 +663,11 @@ export {
654
663
  alertThresholdMarks,
655
664
  areArrayElementsUnique,
656
665
  backendFetch,
666
+ backendFetchFile,
657
667
  backendFetchJson,
658
668
  backendFetchText,
669
+ businessErrorsEn,
670
+ businessErrorsFr,
659
671
  cardErrorBoundaryEn,
660
672
  cardErrorBoundaryFr,
661
673
  catchErrorHandler,
@@ -687,6 +699,8 @@ export {
687
699
  equipmentTypesForPredefinedPropertiesMapper,
688
700
  equipmentsEn,
689
701
  equipmentsFr,
702
+ errorsEn,
703
+ errorsFr,
690
704
  expertFilterSchema,
691
705
  explicitNamingFilterSchema,
692
706
  exportExpertRules,