@gridsuite/commons-ui 0.136.0 → 0.137.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 (97) hide show
  1. package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +4 -4
  2. package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +4 -4
  3. package/dist/components/dnd-table/dnd-table.js +1 -0
  4. package/dist/components/elementSearch/elementItem/EquipmentItem.js +2 -2
  5. package/dist/components/elementSearch/tagRenderer/TagRenderer.js +2 -2
  6. package/dist/components/filter/HeaderFilterForm.js +4 -4
  7. package/dist/components/filter/expert/expertFilterConstants.d.ts +2 -51
  8. package/dist/components/filter/expert/expertFilterUtils.js +4 -1
  9. package/dist/components/filter/utils/filterFormUtils.d.ts +2 -5
  10. package/dist/components/filter/utils/filterFormUtils.js +2 -5
  11. package/dist/components/index.js +4 -0
  12. package/dist/components/inputs/index.js +4 -0
  13. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +7 -4
  14. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +28 -45
  15. package/dist/components/inputs/reactHookForm/OverflowableChip.d.ts +4 -0
  16. package/dist/components/inputs/reactHookForm/OverflowableChip.js +25 -0
  17. package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.d.ts +5 -0
  18. package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.js +15 -0
  19. package/dist/components/inputs/reactHookForm/index.d.ts +2 -0
  20. package/dist/components/inputs/reactHookForm/index.js +4 -0
  21. package/dist/components/menus/custom-nested-menu.js +25 -1
  22. package/dist/components/overflowableText/OverflowableText.d.ts +1 -1
  23. package/dist/components/overflowableText/OverflowableText.js +8 -10
  24. package/dist/components/parameters/common/ProviderParam.js +4 -4
  25. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +4 -4
  26. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +4 -4
  27. package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +4 -4
  28. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +4 -4
  29. package/dist/components/parameters/common/widget/parameter-float.js +4 -4
  30. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +1 -1
  31. package/dist/components/parameters/common/widget/parameter-line-slider.js +4 -4
  32. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +4 -4
  33. package/dist/components/parameters/loadflow/load-flow-parameter-field.js +4 -4
  34. package/dist/components/parameters/loadflow/load-flow-parameters-content.js +4 -4
  35. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +4 -4
  36. package/dist/components/parameters/loadflow/load-flow-parameters-form.js +4 -4
  37. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +4 -4
  38. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +4 -4
  39. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +4 -4
  40. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +4 -4
  41. package/dist/components/parameters/network-visualizations/map-parameters.js +4 -4
  42. package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +4 -4
  43. package/dist/components/parameters/network-visualizations/network-visualizations-form.js +4 -4
  44. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +4 -4
  45. package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +4 -4
  46. package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +4 -4
  47. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +4 -4
  48. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +4 -4
  49. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +4 -4
  50. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +4 -4
  51. package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +4 -4
  52. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +4 -4
  53. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +4 -4
  54. package/dist/components/parameters/sensi/sensitivity-Flow-parameters.js +4 -4
  55. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +4 -4
  56. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +4 -4
  57. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +4 -4
  58. package/dist/components/parameters/sensi/sensitivity-parameters-selector.js +4 -4
  59. package/dist/components/parameters/sensi/sensitivity-table.js +4 -4
  60. package/dist/components/parameters/sensi/table-cell.js +1 -1
  61. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +4 -4
  62. package/dist/components/parameters/sensi/utils.js +4 -4
  63. package/dist/components/parameters/short-circuit/short-circuit-fields.js +4 -4
  64. package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +4 -4
  65. package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +4 -4
  66. package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +4 -4
  67. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +4 -4
  68. package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +4 -4
  69. package/dist/components/parameters/voltage-init/general-parameters.js +4 -4
  70. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -4
  71. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +4 -4
  72. package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.js +4 -4
  73. package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +4 -4
  74. package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +4 -4
  75. package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +4 -4
  76. package/dist/index.js +13 -2
  77. package/dist/translations/en/equipmentSearchEn.d.ts +0 -17
  78. package/dist/translations/en/equipmentSearchEn.js +1 -18
  79. package/dist/translations/en/equipmentShortEn.d.ts +28 -0
  80. package/dist/translations/en/equipmentShortEn.js +25 -0
  81. package/dist/translations/en/equipmentTagEn.d.ts +28 -0
  82. package/dist/translations/en/equipmentTagEn.js +25 -0
  83. package/dist/translations/en/index.d.ts +2 -0
  84. package/dist/translations/en/index.js +4 -0
  85. package/dist/translations/fr/equipmentSearchFr.d.ts +0 -17
  86. package/dist/translations/fr/equipmentSearchFr.js +1 -18
  87. package/dist/translations/fr/equipmentShortFr.d.ts +28 -0
  88. package/dist/translations/fr/equipmentShortFr.js +25 -0
  89. package/dist/translations/fr/equipmentTagFr.d.ts +28 -0
  90. package/dist/translations/fr/equipmentTagFr.js +25 -0
  91. package/dist/translations/fr/index.d.ts +2 -0
  92. package/dist/translations/fr/index.js +4 -0
  93. package/dist/utils/index.js +1 -2
  94. package/dist/utils/types/equipmentType.d.ts +7 -165
  95. package/dist/utils/types/equipmentType.js +90 -151
  96. package/dist/utils/types/index.js +1 -2
  97. package/package.json +1 -1
@@ -5,6 +5,7 @@ import { Grid, Button, Typography, Box, CircularProgress } from "@mui/material";
5
5
  import { useForm } from "react-hook-form";
6
6
  import { yupResolver } from "@hookform/resolvers/yup";
7
7
  import "../../../utils/yupConfig.js";
8
+ import "../../overflowableText/OverflowableText.js";
8
9
  import "../../../utils/types/equipmentType.js";
9
10
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
10
11
  import { MAX_CHAR_DESCRIPTION } from "../../../utils/constants/uiConstants.js";
@@ -17,11 +18,7 @@ import "localized-countries/data/en";
17
18
  import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
18
19
  import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
19
20
  import * as yup from "yup";
20
- import "../../overflowableText/OverflowableText.js";
21
21
  import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
22
- import "react-querybuilder";
23
- import "uuid";
24
- import "../../filter/expert/expertFilterConstants.js";
25
22
  import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
26
23
  import "../../customAGGrid/customAggrid.js";
27
24
  import "ag-grid-community";
@@ -32,8 +29,11 @@ import "../../inputs/reactHookForm/numbers/RangeInput.js";
32
29
  import { DescriptionField } from "../../inputs/reactHookForm/text/DescriptionField.js";
33
30
  import { UniqueNameInput } from "../../inputs/reactHookForm/text/UniqueNameInput.js";
34
31
  import "@react-querybuilder/material";
32
+ import "../../filter/expert/expertFilterConstants.js";
35
33
  import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
34
+ import "uuid";
36
35
  import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
36
+ import "react-querybuilder";
37
37
  import { CustomMuiDialog } from "../customMuiDialog/CustomMuiDialog.js";
38
38
  import { initializeDirectory } from "./utils.js";
39
39
  var OperationType = /* @__PURE__ */ ((OperationType2) => {
@@ -2,6 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Dialog, DialogTitle, DialogContent, TextField, DialogActions, Button } from "@mui/material";
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { useState } from "react";
5
+ import "../overflowableText/OverflowableText.js";
5
6
  import "react-hook-form";
6
7
  import "../../utils/types/equipmentType.js";
7
8
  import "../../utils/conversionUtils.js";
@@ -14,11 +15,7 @@ import "notistack";
14
15
  import "../inputs/reactHookForm/provider/CustomFormProvider.js";
15
16
  import { CancelButton } from "../inputs/reactHookForm/utils/CancelButton.js";
16
17
  import "yup";
17
- import "../overflowableText/OverflowableText.js";
18
18
  import "../treeViewFinder/TreeViewFinder.js";
19
- import "react-querybuilder";
20
- import "uuid";
21
- import "../filter/expert/expertFilterConstants.js";
22
19
  import "../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
23
20
  import "../customAGGrid/customAggrid.js";
24
21
  import "ag-grid-community";
@@ -26,8 +23,11 @@ import "react-papaparse";
26
23
  import "react-csv-downloader";
27
24
  import "../inputs/reactHookForm/numbers/RangeInput.js";
28
25
  import "@react-querybuilder/material";
26
+ import "../filter/expert/expertFilterConstants.js";
29
27
  import "../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
28
+ import "uuid";
30
29
  import "../inputs/reactQueryBuilder/PropertyValueEditor.js";
30
+ import "react-querybuilder";
31
31
  function DndTableAddRowsDialog({ open, handleAddButton, onClose }) {
32
32
  const [rowNumber, setRowNumber] = useState(1);
33
33
  const handleClose = () => {
@@ -9,6 +9,7 @@ import { MAX_ROWS_NUMBER, SELECTED, DndColumnType } from "./dnd-table.type.js";
9
9
  import { DndTableBottomLeftButtons } from "./dnd-table-bottom-left-buttons.js";
10
10
  import { DndTableBottomRightButtons } from "./dnd-table-bottom-right-buttons.js";
11
11
  import { DndTableAddRowsDialog } from "./dnd-table-add-rows-dialog.js";
12
+ import "../overflowableText/OverflowableText.js";
12
13
  import { ChipItemsInput } from "../inputs/reactHookForm/chip-items-input.js";
13
14
  import { DirectoryItemsInput } from "../inputs/reactHookForm/DirectoryItemsInput.js";
14
15
  import { RawReadOnlyInput } from "../inputs/reactHookForm/RawReadOnlyInput.js";
@@ -4,7 +4,7 @@ import parse from "autosuggest-highlight/parse";
4
4
  import clsx from "clsx";
5
5
  import { FormattedMessage } from "react-intl";
6
6
  import { Box } from "@mui/material";
7
- import { EQUIPMENT_TYPE } from "../../../utils/types/equipmentType.js";
7
+ import { ALL_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
8
8
  import { TagRenderer } from "../tagRenderer/TagRenderer.js";
9
9
  import { OverflowableText } from "../../overflowableText/OverflowableText.js";
10
10
  import { mergeSx } from "../../../utils/styles.js";
@@ -27,7 +27,7 @@ function EquipmentItem({
27
27
  component: "span",
28
28
  className: clsx(props.classes?.equipmentTag, props.classes?.equipmentTypeTag),
29
29
  sx: mergeSx(props.styles?.equipmentTag, props.styles?.equipmentTypeTag),
30
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: EQUIPMENT_TYPE[element.type]?.tagLabel })
30
+ children: /* @__PURE__ */ jsx(FormattedMessage, { id: ALL_EQUIPMENTS[element.type]?.tagLabel })
31
31
  }
32
32
  ),
33
33
  /* @__PURE__ */ jsx(
@@ -1,10 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
3
  import { OverflowableText } from "../../overflowableText/OverflowableText.js";
4
- import { EQUIPMENT_TYPE } from "../../../utils/types/equipmentType.js";
4
+ import { EquipmentType } from "../../../utils/types/equipmentType.js";
5
5
  import { mergeSx } from "../../../utils/styles.js";
6
6
  function TagRenderer({ element, ...props }) {
7
- if (element.type !== EQUIPMENT_TYPE.SUBSTATION?.name && element.type !== EQUIPMENT_TYPE.VOLTAGE_LEVEL?.name) {
7
+ if (element.type !== EquipmentType.SUBSTATION && element.type !== EquipmentType.VOLTAGE_LEVEL) {
8
8
  return /* @__PURE__ */ jsx(
9
9
  OverflowableText,
10
10
  {
@@ -8,6 +8,7 @@ import { ElementType } from "../../utils/types/elementType.js";
8
8
  import "../../utils/types/equipmentType.js";
9
9
  import "../../utils/yupConfig.js";
10
10
  import "react-intl";
11
+ import "../overflowableText/OverflowableText.js";
11
12
  import "react";
12
13
  import "react-hook-form";
13
14
  import "localized-countries";
@@ -16,11 +17,7 @@ import "localized-countries/data/en";
16
17
  import "notistack";
17
18
  import "../inputs/reactHookForm/provider/CustomFormProvider.js";
18
19
  import * as yup from "yup";
19
- import "../overflowableText/OverflowableText.js";
20
20
  import "../treeViewFinder/TreeViewFinder.js";
21
- import "react-querybuilder";
22
- import "uuid";
23
- import "./expert/expertFilterConstants.js";
24
21
  import "../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
25
22
  import "../customAGGrid/customAggrid.js";
26
23
  import "ag-grid-community";
@@ -30,8 +27,11 @@ import "../inputs/reactHookForm/numbers/RangeInput.js";
30
27
  import { DescriptionField } from "../inputs/reactHookForm/text/DescriptionField.js";
31
28
  import { UniqueNameInput } from "../inputs/reactHookForm/text/UniqueNameInput.js";
32
29
  import "@react-querybuilder/material";
30
+ import "./expert/expertFilterConstants.js";
33
31
  import "../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
32
+ import "uuid";
34
33
  import "../inputs/reactQueryBuilder/PropertyValueEditor.js";
34
+ import "react-querybuilder";
35
35
  const filterStyles = {
36
36
  textField: {
37
37
  minWidth: "250px",
@@ -1,7 +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
+ import { ALL_EQUIPMENTS } from '../../../utils';
5
5
  export declare enum RULES {
6
6
  EMPTY_RULE = "emptyRule",
7
7
  EMPTY_GROUP = "emptyGroup",
@@ -9,56 +9,7 @@ export declare enum RULES {
9
9
  BETWEEN_RULE = "betweenRule"
10
10
  }
11
11
  export declare const EXPERT_FILTER_QUERY = "rules";
12
- export declare const EXPERT_FILTER_EQUIPMENTS: {
13
- SUBSTATION: {
14
- id: EquipmentType;
15
- label: string;
16
- };
17
- VOLTAGE_LEVEL: {
18
- id: EquipmentType;
19
- label: string;
20
- };
21
- LINE: {
22
- id: EquipmentType;
23
- label: string;
24
- };
25
- TWO_WINDINGS_TRANSFORMER: {
26
- id: EquipmentType;
27
- label: string;
28
- };
29
- THREE_WINDINGS_TRANSFORMER: {
30
- id: EquipmentType;
31
- label: string;
32
- };
33
- GENERATOR: {
34
- id: EquipmentType;
35
- label: string;
36
- };
37
- BATTERY: {
38
- id: EquipmentType;
39
- label: string;
40
- };
41
- LOAD: {
42
- id: EquipmentType;
43
- label: string;
44
- };
45
- SHUNT_COMPENSATOR: {
46
- id: EquipmentType;
47
- label: string;
48
- };
49
- STATIC_VAR_COMPENSATOR: {
50
- id: EquipmentType;
51
- label: string;
52
- };
53
- HVDC_LINE: {
54
- id: EquipmentType;
55
- label: string;
56
- };
57
- DANGLING_LINE: {
58
- id: EquipmentType;
59
- label: string;
60
- };
61
- };
12
+ export declare const EXPERT_FILTER_EQUIPMENTS: typeof ALL_EQUIPMENTS;
62
13
  export declare const ENERGY_SOURCE_OPTIONS: {
63
14
  name: string;
64
15
  label: string;
@@ -188,7 +188,10 @@ function importExpertRules(query) {
188
188
  }
189
189
  return rule.values.sort();
190
190
  }
191
- return convertInputValue(rule.field, parseFloat(rule.value));
191
+ if (rule.dataType === DataType.NUMBER) {
192
+ return convertInputValue(rule.field, rule.value);
193
+ }
194
+ return rule.value;
192
195
  }
193
196
  function transformRule(rule) {
194
197
  return {
@@ -1,10 +1,7 @@
1
- import { EquipmentType } from '../../../utils';
1
+ import { ALL_EQUIPMENTS, EquipmentType } from '../../../utils';
2
2
  export type ContingencyListEquipment = {
3
3
  id: string;
4
4
  label: string;
5
5
  };
6
6
  export declare const CONTINGENCY_LIST_EQUIPMENTS: Record<EquipmentType.BUSBAR_SECTION | EquipmentType.LINE | EquipmentType.TWO_WINDINGS_TRANSFORMER | EquipmentType.THREE_WINDINGS_TRANSFORMER | EquipmentType.GENERATOR | EquipmentType.BATTERY | EquipmentType.LOAD | EquipmentType.SHUNT_COMPENSATOR | EquipmentType.STATIC_VAR_COMPENSATOR | EquipmentType.HVDC_LINE | EquipmentType.DANGLING_LINE, ContingencyListEquipment>;
7
- export declare const FILTER_EQUIPMENTS: Partial<Record<EquipmentType, {
8
- id: EquipmentType;
9
- label: string;
10
- }>>;
7
+ export declare const FILTER_EQUIPMENTS: typeof ALL_EQUIPMENTS;
@@ -1,7 +1,7 @@
1
1
  import "../../../utils/conversionUtils.js";
2
2
  import "react/jsx-runtime";
3
3
  import "@mui/icons-material";
4
- import { EquipmentType, BASE_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
4
+ import { EquipmentType, ALL_EQUIPMENTS, BASE_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
5
5
  import "../../../utils/yupConfig.js";
6
6
  const CONTINGENCY_LIST_EQUIPMENTS = {
7
7
  BUSBAR_SECTION: {
@@ -51,10 +51,7 @@ const CONTINGENCY_LIST_EQUIPMENTS = {
51
51
  };
52
52
  const FILTER_EQUIPMENTS = {
53
53
  ...BASE_EQUIPMENTS,
54
- [EquipmentType.HVDC_LINE]: {
55
- id: EquipmentType.HVDC_LINE,
56
- label: "Hvdc"
57
- }
54
+ [EquipmentType.HVDC_LINE]: ALL_EQUIPMENTS[EquipmentType.HVDC_LINE]
58
55
  };
59
56
  export {
60
57
  CONTINGENCY_LIST_EQUIPMENTS,
@@ -54,6 +54,8 @@ import "react/jsx-runtime";
54
54
  import "@mui/material";
55
55
  import "react-intl";
56
56
  import { SelectClearable } from "./inputs/SelectClearable.js";
57
+ import { OverflowableChip } from "./inputs/reactHookForm/OverflowableChip.js";
58
+ import { OverflowableChipWithHelperText } from "./inputs/reactHookForm/OverflowableChipWithHelperText.js";
57
59
  import { ChipItemsInput } from "./inputs/reactHookForm/chip-items-input.js";
58
60
  import { DirectoryItemsInput } from "./inputs/reactHookForm/DirectoryItemsInput.js";
59
61
  import { RawReadOnlyInput } from "./inputs/reactHookForm/RawReadOnlyInput.js";
@@ -347,6 +349,8 @@ export {
347
349
  NumericEditor,
348
350
  OPERATOR_OPTIONS,
349
351
  OperatorType,
352
+ OverflowableChip,
353
+ OverflowableChipWithHelperText,
350
354
  OverflowableText,
351
355
  PARAM_CENTER_LABEL,
352
356
  PARAM_COMPONENT_LIBRARY,
@@ -1,4 +1,6 @@
1
1
  import { SelectClearable } from "./SelectClearable.js";
2
+ import { OverflowableChip } from "./reactHookForm/OverflowableChip.js";
3
+ import { OverflowableChipWithHelperText } from "./reactHookForm/OverflowableChipWithHelperText.js";
2
4
  import { ChipItemsInput } from "./reactHookForm/chip-items-input.js";
3
5
  import { DirectoryItemsInput } from "./reactHookForm/DirectoryItemsInput.js";
4
6
  import { RawReadOnlyInput } from "./reactHookForm/RawReadOnlyInput.js";
@@ -93,6 +95,8 @@ export {
93
95
  MultipleAutocompleteInput,
94
96
  NAME,
95
97
  NumericEditor,
98
+ OverflowableChip,
99
+ OverflowableChipWithHelperText,
96
100
  PropertyValueEditor,
97
101
  RadioInput,
98
102
  RangeInput,
@@ -1,5 +1,7 @@
1
+ import { ComponentType } from 'react';
1
2
  import { ArrayAction, ElementAttributes } from '../../../utils';
2
- export interface DirectoryItemsInputProps {
3
+ import { OverflowableChipProps } from './OverflowableChip';
4
+ export interface DirectoryItemsInputProps<CP extends OverflowableChipProps = OverflowableChipProps> {
3
5
  label: string | undefined;
4
6
  name: string;
5
7
  elementType: string;
@@ -12,10 +14,11 @@ export interface DirectoryItemsInputProps {
12
14
  disable?: boolean;
13
15
  allowMultiSelect?: boolean;
14
16
  labelRequiredFromContext?: boolean;
15
- equipmentColorsMap?: Map<string, string>;
17
+ ChipComponent?: ComponentType<CP>;
18
+ chipProps?: Partial<CP>;
16
19
  }
17
- export declare function DirectoryItemsInput({ label, name, elementType, // Used to specify type of element (Filter, Contingency list, ...)
20
+ export declare function DirectoryItemsInput<CP extends OverflowableChipProps = OverflowableChipProps>({ label, name, elementType, // Used to specify type of element (Filter, Contingency list, ...)
18
21
  equipmentTypes, // Mostly used for filters, it allows the user to get elements of specific equipment only
19
22
  itemFilter, // Used to further filter the results displayed according to specific requirement
20
23
  titleId, // title of directory item selector dialogue
21
- hideErrorMessage, onRowChanged, onChange, disable, allowMultiSelect, labelRequiredFromContext, equipmentColorsMap, }: Readonly<DirectoryItemsInputProps>): import("react/jsx-runtime").JSX.Element;
24
+ hideErrorMessage, onRowChanged, onChange, disable, allowMultiSelect, labelRequiredFromContext, ChipComponent, chipProps, }: Readonly<DirectoryItemsInputProps<CP>>): import("react/jsx-runtime").JSX.Element;
@@ -1,30 +1,29 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { FormControl, Box, Chip, FormHelperText, Grid, Tooltip, IconButton } from "@mui/material";
2
+ import { FormControl, Grid, Tooltip, IconButton } from "@mui/material";
3
3
  import { Folder } from "@mui/icons-material";
4
4
  import { useState, useMemo, useCallback, useEffect } from "react";
5
5
  import { useFieldArray, useWatch, useController } from "react-hook-form";
6
- import { useIntl, FormattedMessage } from "react-intl";
7
- import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
6
+ import { useIntl } from "react-intl";
8
7
  import { FieldLabel } from "./utils/FieldLabel.js";
9
8
  import { isFieldRequired } from "./utils/functions.js";
10
9
  import "./provider/CustomFormProvider.js";
11
10
  import { useCustomFormContext } from "./provider/useCustomFormContext.js";
12
11
  import { ErrorInput } from "./errorManagement/ErrorInput.js";
13
12
  import { MidFormError } from "./errorManagement/MidFormError.js";
14
- import "../../../utils/types/equipmentType.js";
13
+ import { ALL_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
15
14
  import { fetchDirectoryElementPath } from "../../../services/directory.js";
16
15
  import "localized-countries";
17
16
  import "localized-countries/data/fr";
18
17
  import "localized-countries/data/en";
19
18
  import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
20
- import { OverflowableText } from "../../overflowableText/OverflowableText.js";
21
19
  import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
22
20
  import "../../../utils/conversionUtils.js";
23
21
  import { mergeSx } from "../../../utils/styles.js";
24
22
  import { ArrayAction } from "../../../utils/types/types.js";
25
23
  import "../../../utils/yupConfig.js";
26
24
  import { NAME } from "./constants.js";
27
- import { getFilterEquipmentTypeLabel } from "../../filter/expert/expertFilterUtils.js";
25
+ import { OverflowableChip } from "./OverflowableChip.js";
26
+ import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
28
27
  const styles = {
29
28
  formDirectoryElements1: {
30
29
  display: "flex",
@@ -69,7 +68,8 @@ function DirectoryItemsInput({
69
68
  disable = false,
70
69
  allowMultiSelect = true,
71
70
  labelRequiredFromContext = true,
72
- equipmentColorsMap
71
+ ChipComponent = OverflowableChip,
72
+ chipProps
73
73
  }) {
74
74
  const { snackError } = useSnackMessage();
75
75
  const intl = useIntl();
@@ -187,45 +187,28 @@ function DirectoryItemsInput({
187
187
  ),
188
188
  elements?.length > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.formDirectoryElements2, children: elements.map((item, index) => {
189
189
  const elementName = watchedElements?.[index]?.[NAME] ?? getValues(`${name}.${index}.${NAME}`) ?? item?.[NAME];
190
- return /* @__PURE__ */ jsxs(
191
- Box,
190
+ const equipmentTypeTagLabel = item?.specificMetadata?.equipmentType && ALL_EQUIPMENTS[item.specificMetadata.equipmentType]?.shortLabel || "";
191
+ const { sx: chipSx, ...otherChipProps } = chipProps ?? {};
192
+ return /* @__PURE__ */ jsx(
193
+ ChipComponent,
192
194
  {
193
- sx: { display: "flex", alignItems: "center", flexDirection: "column", gap: 1 },
194
- children: [
195
- /* @__PURE__ */ jsx(
196
- Chip,
197
- {
198
- size: "small",
199
- sx: mergeSx(
200
- {
201
- backgroundColor: item?.specificMetadata?.equipmentType && equipmentColorsMap?.get(item?.specificMetadata?.equipmentType)
202
- },
203
- !elementName ? (theme) => ({
204
- backgroundColor: theme.palette.error.light,
205
- borderColor: theme.palette.error.main,
206
- color: theme.palette.error.contrastText
207
- }) : void 0
208
- ),
209
- onDelete: () => removeElements(index),
210
- onClick: () => handleChipClick(index),
211
- label: /* @__PURE__ */ jsx(
212
- OverflowableText,
213
- {
214
- text: elementName ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${name}.${index}.${NAME}` }) : intl.formatMessage({ id: "elementNotFound" }),
215
- sx: { width: "100%" }
216
- }
217
- )
218
- }
219
- ),
220
- equipmentColorsMap && /* @__PURE__ */ jsx(FormHelperText, { children: item?.specificMetadata?.equipmentType ? /* @__PURE__ */ jsx(
221
- FormattedMessage,
222
- {
223
- id: getFilterEquipmentTypeLabel(
224
- item.specificMetadata.equipmentType
225
- )
226
- }
227
- ) : "" })
228
- ]
195
+ onDelete: () => removeElements(index),
196
+ onClick: () => handleChipClick(index),
197
+ label: elementName ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${name}.${index}.${NAME}` }) : intl.formatMessage({ id: "elementNotFound" }),
198
+ ...equipmentTypeTagLabel && {
199
+ helperText: intl.formatMessage({
200
+ id: equipmentTypeTagLabel
201
+ })
202
+ },
203
+ sx: mergeSx(
204
+ !elementName ? (theme) => ({
205
+ backgroundColor: theme.palette.error.light,
206
+ borderColor: theme.palette.error.main,
207
+ color: theme.palette.error.contrastText
208
+ }) : void 0,
209
+ chipSx
210
+ ),
211
+ ...otherChipProps
229
212
  },
230
213
  item.id
231
214
  );
@@ -0,0 +1,4 @@
1
+ import { ChipProps } from '@mui/material';
2
+ export interface OverflowableChipProps extends ChipProps {
3
+ }
4
+ export declare function OverflowableChip({ label, ...otherProps }: Readonly<OverflowableChipProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Chip, Box } from "@mui/material";
3
+ import { OverflowableText } from "../../overflowableText/OverflowableText.js";
4
+ function OverflowableChip({ label, ...otherProps }) {
5
+ return /* @__PURE__ */ jsx(
6
+ Chip,
7
+ {
8
+ size: "small",
9
+ label: /* @__PURE__ */ jsx(Box, { sx: { display: "flex" }, children: /* @__PURE__ */ jsx(
10
+ OverflowableText,
11
+ {
12
+ text: label,
13
+ sx: {
14
+ maxWidth: "20ch",
15
+ mx: "auto"
16
+ }
17
+ }
18
+ ) }),
19
+ ...otherProps
20
+ }
21
+ );
22
+ }
23
+ export {
24
+ OverflowableChip
25
+ };
@@ -0,0 +1,5 @@
1
+ import { OverflowableChipProps } from './OverflowableChip';
2
+ export interface OverflowableChipWithHelperTextProps extends OverflowableChipProps {
3
+ helperText?: string;
4
+ }
5
+ export declare function OverflowableChipWithHelperText({ helperText, ...otherProps }: Readonly<OverflowableChipWithHelperTextProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Box, FormHelperText } from "@mui/material";
3
+ import { OverflowableChip } from "./OverflowableChip.js";
4
+ function OverflowableChipWithHelperText({
5
+ helperText,
6
+ ...otherProps
7
+ }) {
8
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "left", flexDirection: "column" }, children: [
9
+ /* @__PURE__ */ jsx(OverflowableChip, { ...otherProps }),
10
+ helperText && /* @__PURE__ */ jsx(FormHelperText, { sx: { paddingLeft: 1.5, fontSize: "x-small" }, children: helperText })
11
+ ] });
12
+ }
13
+ export {
14
+ OverflowableChipWithHelperText
15
+ };
@@ -4,6 +4,8 @@
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 './OverflowableChip';
8
+ export * from './OverflowableChipWithHelperText';
7
9
  export * from './chip-items-input';
8
10
  export * from './DirectoryItemsInput';
9
11
  export * from './RawReadOnlyInput';
@@ -1,3 +1,5 @@
1
+ import { OverflowableChip } from "./OverflowableChip.js";
2
+ import { OverflowableChipWithHelperText } from "./OverflowableChipWithHelperText.js";
1
3
  import { ChipItemsInput } from "./chip-items-input.js";
2
4
  import { DirectoryItemsInput } from "./DirectoryItemsInput.js";
3
5
  import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
@@ -67,6 +69,8 @@ export {
67
69
  MultipleAutocompleteInput,
68
70
  NAME,
69
71
  NumericEditor,
72
+ OverflowableChip,
73
+ OverflowableChipWithHelperText,
70
74
  RadioInput,
71
75
  RangeInput,
72
76
  RangeType,
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useState } from "react";
2
+ import { useState, useRef } from "react";
3
3
  import { NestedMenuItem } from "mui-nested-menu";
4
4
  import { Box, MenuItem } from "@mui/material";
5
5
  import { mergeSx } from "../../utils/styles.js";
@@ -19,11 +19,35 @@ const styles = {
19
19
  };
20
20
  function CustomNestedMenuItem({ sx, children, ...other }) {
21
21
  const [subMenuActive, setSubMenuActive] = useState(false);
22
+ const [shouldLiftLeft, setShouldLiftLeft] = useState(false);
23
+ const containerRef = useRef(null);
24
+ const calculatePosition = () => {
25
+ if (!containerRef.current) return;
26
+ const rect = containerRef.current.getBoundingClientRect();
27
+ const estimatedWidth = rect.width;
28
+ const spaceRight = window.innerWidth - rect.right;
29
+ setShouldLiftLeft(estimatedWidth > spaceRight);
30
+ };
31
+ const handleMouseEnter = () => {
32
+ calculatePosition();
33
+ };
22
34
  return /* @__PURE__ */ jsx(
23
35
  NestedMenuItem,
24
36
  {
25
37
  ...other,
26
38
  parentMenuOpen: true,
39
+ ref: containerRef,
40
+ onMouseEnter: handleMouseEnter,
41
+ MenuProps: {
42
+ anchorOrigin: {
43
+ vertical: "top",
44
+ horizontal: shouldLiftLeft ? "left" : "right"
45
+ },
46
+ transformOrigin: {
47
+ vertical: "top",
48
+ horizontal: shouldLiftLeft ? "right" : "left"
49
+ }
50
+ },
27
51
  sx: mergeSx(subMenuActive ? styles.highlightedParentLine : styles.highlightedLine, sx),
28
52
  children: /* @__PURE__ */ jsx(Box, { onMouseEnter: () => setSubMenuActive(true), onMouseLeave: () => setSubMenuActive(false), children })
29
53
  }
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BoxProps } from '@mui/material';
3
3
  import { Style } from 'node:util';
4
- import { SxStyle } from '../../utils/styles';
4
+ import { SxStyle } from '../../utils';
5
5
  export interface OverflowableTextProps extends BoxProps {
6
6
  text?: ReactNode;
7
7
  maxLineCount?: number;
@@ -1,6 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useRef, useMemo, useState, useCallback, useLayoutEffect } from "react";
3
3
  import { styled, Tooltip, Box } from "@mui/material";
4
+ import "../../utils/conversionUtils.js";
5
+ import "@mui/icons-material";
6
+ import { mergeSx } from "../../utils/styles.js";
7
+ import "../../utils/types/equipmentType.js";
8
+ import "../../utils/yupConfig.js";
4
9
  const overflowStyle = {
5
10
  overflow: {
6
11
  display: "inline-block",
@@ -32,6 +37,7 @@ const OverflowableText = styled(
32
37
  tooltipSx,
33
38
  className,
34
39
  children,
40
+ sx,
35
41
  ...props
36
42
  }) => {
37
43
  const element = useRef();
@@ -65,22 +71,14 @@ const OverflowableText = styled(
65
71
  slotProps: { tooltip: { sx: finalTooltipSx } }
66
72
  }
67
73
  };
74
+ const boxSx = mergeSx(isMultiLine ? multilineOverflowStyle(maxLineCount) : overflowStyle.overflow, sx);
68
75
  return /* @__PURE__ */ jsx(
69
76
  Tooltip,
70
77
  {
71
78
  title: text || "",
72
79
  disableHoverListener: !overflowed,
73
80
  ...tooltipStyleProps,
74
- children: /* @__PURE__ */ jsx(
75
- Box,
76
- {
77
- ...props,
78
- ref: element,
79
- className,
80
- sx: isMultiLine ? multilineOverflowStyle(maxLineCount) : overflowStyle.overflow,
81
- children: children || text
82
- }
83
- )
81
+ children: /* @__PURE__ */ jsx(Box, { ref: element, className, sx: boxSx, ...props, children: children || text })
84
82
  }
85
83
  );
86
84
  }
@@ -3,6 +3,7 @@ import { Grid } from "@mui/material";
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { LineSeparator } from "./line-separator.js";
5
5
  import { parametersStyles } from "../parameters-style.js";
6
+ import "../../overflowableText/OverflowableText.js";
6
7
  import "react";
7
8
  import "react-hook-form";
8
9
  import "../../../utils/types/equipmentType.js";
@@ -15,11 +16,7 @@ import "localized-countries/data/en";
15
16
  import "notistack";
16
17
  import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
17
18
  import "yup";
18
- import "../../overflowableText/OverflowableText.js";
19
19
  import "../../treeViewFinder/TreeViewFinder.js";
20
- import "react-querybuilder";
21
- import "uuid";
22
- import "../../filter/expert/expertFilterConstants.js";
23
20
  import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
24
21
  import "../../customAGGrid/customAggrid.js";
25
22
  import "ag-grid-community";
@@ -28,8 +25,11 @@ import "react-csv-downloader";
28
25
  import "../../inputs/reactHookForm/numbers/RangeInput.js";
29
26
  import { MuiSelectInput } from "../../inputs/reactHookForm/selectInputs/MuiSelectInput.js";
30
27
  import "@react-querybuilder/material";
28
+ import "../../filter/expert/expertFilterConstants.js";
31
29
  import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
30
+ import "uuid";
32
31
  import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
32
+ import "react-querybuilder";
33
33
  import { PROVIDER } from "./constant.js";
34
34
  const styles = {
35
35
  providerParam: {