@gridsuite/commons-ui 0.65.1 → 0.65.3

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/authentication/AuthenticationRouter.d.ts +1 -27
  2. package/dist/components/authentication/AuthenticationRouter.js +14 -56
  3. package/dist/components/authentication/AuthenticationRouterErrorDisplay.d.ts +9 -0
  4. package/dist/components/authentication/AuthenticationRouterErrorDisplay.js +26 -0
  5. package/dist/components/authentication/alert/ErrorInLogoutAlert.d.ts +12 -0
  6. package/dist/components/authentication/alert/ErrorInLogoutAlert.js +14 -0
  7. package/dist/components/authentication/alert/ErrorInUserValidationAlert.d.ts +12 -0
  8. package/dist/components/authentication/alert/ErrorInUserValidationAlert.js +14 -0
  9. package/dist/components/authentication/alert/UnauthorizedAccessAlert.d.ts +11 -0
  10. package/dist/components/authentication/alert/UnauthorizedAccessAlert.js +13 -0
  11. package/dist/components/authentication/alert/index.d.ts +9 -0
  12. package/dist/components/authentication/alert/index.js +8 -0
  13. package/dist/components/authentication/authenticationType.d.ts +28 -0
  14. package/dist/components/authentication/authenticationType.js +1 -0
  15. package/dist/components/authentication/index.d.ts +5 -2
  16. package/dist/components/authentication/index.js +22 -7
  17. package/dist/components/authentication/utils/authService.js +1 -1
  18. package/dist/components/authentication/utils/index.d.ts +8 -0
  19. package/dist/components/authentication/utils/index.js +13 -0
  20. package/dist/components/authentication/utils/userManagerMock.d.ts +2 -2
  21. package/dist/components/authentication/utils/userManagerMock.js +1 -0
  22. package/dist/components/checkBoxList/CheckBoxListItem.d.ts +1 -1
  23. package/dist/components/checkBoxList/CheckBoxListItem.js +12 -3
  24. package/dist/components/checkBoxList/CheckBoxListItems.d.ts +1 -1
  25. package/dist/components/checkBoxList/CheckBoxListItems.js +11 -13
  26. package/dist/components/checkBoxList/ClickableCheckBoxItem.d.ts +2 -2
  27. package/dist/components/checkBoxList/ClickableRowItem.d.ts +2 -2
  28. package/dist/components/checkBoxList/ClickableRowItem.js +44 -14
  29. package/dist/components/checkBoxList/DraggableCheckBoxListItem.d.ts +1 -1
  30. package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +8 -3
  31. package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.d.ts +2 -2
  32. package/dist/components/checkBoxList/DraggableClickableRowItem.d.ts +2 -2
  33. package/dist/components/checkBoxList/DraggableClickableRowItem.js +53 -27
  34. package/dist/components/checkBoxList/checkBoxList.type.d.ts +35 -18
  35. package/dist/components/filter/constants/FilterConstants.d.ts +3 -6
  36. package/dist/components/filter/constants/FilterConstants.js +10 -1
  37. package/dist/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.d.ts +4 -11
  38. package/dist/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.js +6 -13
  39. package/dist/components/filter/expert/ExpertFilterEditionDialog.d.ts +3 -2
  40. package/dist/components/filter/expert/ExpertFilterEditionDialog.js +3 -4
  41. package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.d.ts +3 -2
  42. package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +3 -4
  43. package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +1 -1
  44. package/dist/components/filter/filter.type.d.ts +14 -0
  45. package/dist/components/filter/filter.type.js +1 -0
  46. package/dist/index.d.ts +2 -1
  47. package/dist/index.js +205 -189
  48. package/dist/utils/types/equipmentTypes.d.ts +0 -6
  49. package/dist/utils/types/equipmentTypes.js +1 -8
  50. package/package.json +1 -1
@@ -11,7 +11,8 @@ function DraggableCheckBoxListItem({
11
11
  isDragDisable,
12
12
  provided,
13
13
  divider,
14
- isCheckboxClickableOnly,
14
+ onItemClick,
15
+ isItemClickable,
15
16
  ...props
16
17
  }) {
17
18
  const [hover, setHover] = useState("");
@@ -22,16 +23,17 @@ function DraggableCheckBoxListItem({
22
23
  sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkboxListItem },
23
24
  onMouseEnter: () => setHover(getItemId(item)),
24
25
  onMouseLeave: () => setHover(""),
25
- disablePadding: !isCheckboxClickableOnly,
26
+ disablePadding: !!onItemClick,
26
27
  disableGutters: true,
27
28
  divider,
28
29
  ref: provided.innerRef,
29
30
  ...provided.draggableProps,
30
- children: isCheckboxClickableOnly ? /* @__PURE__ */ jsx(
31
+ children: !onItemClick ? /* @__PURE__ */ jsx(
31
32
  DraggableClickableCheckBoxItem,
32
33
  {
33
34
  provided,
34
35
  isHighlighted: hover === getItemId(item) && !isDragDisable,
36
+ sx,
35
37
  ...props
36
38
  }
37
39
  ) : /* @__PURE__ */ jsx(
@@ -39,6 +41,9 @@ function DraggableCheckBoxListItem({
39
41
  {
40
42
  provided,
41
43
  isHighlighted: hover === getItemId(item) && !isDragDisable,
44
+ onItemClick: () => onItemClick(item),
45
+ isItemClickable: isItemClickable == null ? void 0 : isItemClickable(item),
46
+ sx,
42
47
  ...props
43
48
  }
44
49
  )
@@ -1,4 +1,4 @@
1
- import { DraggableClickableItemProps } from './checkBoxList.type';
1
+ import { DraggableClickableCheckBoxItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function DraggableClickableCheckBoxItem({ sx, disabled, provided, isHighlighted, label, ...props }: DraggableClickableItemProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DraggableClickableCheckBoxItem({ sx, disabled, provided, isHighlighted, label, ...props }: Readonly<DraggableClickableCheckBoxItemProps>): import("react/jsx-runtime").JSX.Element;
4
4
  export default DraggableClickableCheckBoxItem;
@@ -1,4 +1,4 @@
1
- import { DraggableClickableItemProps } from './checkBoxList.type';
1
+ import { DraggableClickableRowItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function DraggableClickableRowItem({ sx, disabled, onClick, provided, isHighlighted, label, ...props }: DraggableClickableItemProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DraggableClickableRowItem({ sx, disabled, onClick, provided, isHighlighted, label, onItemClick, isItemClickable, ...props }: Readonly<DraggableClickableRowItemProps>): import("react/jsx-runtime").JSX.Element;
4
4
  export default DraggableClickableRowItem;
@@ -8,7 +8,13 @@ const styles = {
8
8
  border: theme.spacing(0),
9
9
  borderRadius: theme.spacing(0),
10
10
  zIndex: 90
11
- })
11
+ }),
12
+ unclickableItem: {
13
+ "&:hover": {
14
+ backgroundColor: "transparent"
15
+ },
16
+ cursor: "inherit"
17
+ }
12
18
  };
13
19
  function DraggableClickableRowItem({
14
20
  sx,
@@ -17,34 +23,54 @@ function DraggableClickableRowItem({
17
23
  provided,
18
24
  isHighlighted,
19
25
  label,
26
+ onItemClick,
27
+ isItemClickable = true,
20
28
  ...props
21
29
  }) {
22
- return /* @__PURE__ */ jsxs(ListItemButton, { sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkboxButton }, disabled, onClick, children: [
23
- /* @__PURE__ */ jsx(
24
- IconButton,
25
- {
26
- ...provided.dragHandleProps,
27
- size: "small",
28
- sx: {
29
- opacity: isHighlighted ? "1" : "0",
30
- padding: "unset",
31
- ...styles.dragIcon
32
- },
33
- children: /* @__PURE__ */ jsx(DragIndicatorIcon, { spacing: 0 })
34
- }
35
- ),
36
- /* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkBoxIcon }, children: /* @__PURE__ */ jsx(Checkbox, { disableRipple: true, sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkbox }, ...props }) }),
37
- /* @__PURE__ */ jsx(
38
- ListItemText,
39
- {
40
- sx: {
41
- display: "flex"
42
- },
43
- disableTypography: true,
44
- children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
45
- }
46
- )
47
- ] });
30
+ const onCheckboxClick = (event) => {
31
+ event.stopPropagation();
32
+ onClick();
33
+ };
34
+ const handleItemClick = () => isItemClickable && onItemClick();
35
+ return /* @__PURE__ */ jsxs(
36
+ ListItemButton,
37
+ {
38
+ disableTouchRipple: !isItemClickable,
39
+ sx: {
40
+ paddingLeft: 0,
41
+ ...sx == null ? void 0 : sx.checkboxButton,
42
+ ...!isItemClickable && styles.unclickableItem
43
+ },
44
+ disabled,
45
+ onClick: handleItemClick,
46
+ children: [
47
+ /* @__PURE__ */ jsx(
48
+ IconButton,
49
+ {
50
+ ...provided.dragHandleProps,
51
+ size: "small",
52
+ sx: {
53
+ opacity: isHighlighted ? "1" : "0",
54
+ padding: "unset",
55
+ ...styles.dragIcon
56
+ },
57
+ children: /* @__PURE__ */ jsx(DragIndicatorIcon, { spacing: 0 })
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkBoxIcon }, children: /* @__PURE__ */ jsx(Checkbox, { disableRipple: true, sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkbox }, onClick: onCheckboxClick, ...props }) }),
61
+ /* @__PURE__ */ jsx(
62
+ ListItemText,
63
+ {
64
+ sx: {
65
+ display: "flex"
66
+ },
67
+ disableTypography: true,
68
+ children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
69
+ }
70
+ )
71
+ ]
72
+ }
73
+ );
48
74
  }
49
75
  export {
50
76
  DraggableClickableRowItem,
@@ -1,19 +1,26 @@
1
+ import { Theme } from '@mui/material';
1
2
  import { SxProps } from '@mui/system';
2
3
  import { DraggableProvided, DragStart, DropResult } from 'react-beautiful-dnd';
3
4
  import { default as React } from 'react';
4
5
 
5
- export interface CheckBoxListItemSxProps {
6
- checkBoxIcon?: SxProps;
7
- label?: SxProps;
8
- checkboxListItem?: SxProps;
9
- checkboxButton?: SxProps;
10
- checkbox?: SxProps;
11
- dragAndDropContainer?: SxProps;
12
- checkboxList?: SxProps;
13
- }
6
+ export type CheckBoxListItemSx = {
7
+ checkBoxIcon?: SxProps<Theme>;
8
+ label?: SxProps<Theme>;
9
+ checkboxListItem?: SxProps<Theme>;
10
+ checkboxButton?: SxProps<Theme>;
11
+ checkbox?: SxProps<Theme>;
12
+ };
13
+ export type CheckBoxListSx = {
14
+ dragAndDropContainer?: SxProps<Theme>;
15
+ checkboxList?: SxProps<Theme>;
16
+ };
17
+ export type CheckBoxListItemSxMethod<T> = (item: T) => CheckBoxListItemSx;
18
+ type CheckBoxListItemSxProps<T> = CheckBoxListSx & {
19
+ items: CheckBoxListItemSx | CheckBoxListItemSxMethod<T>;
20
+ };
14
21
  export interface CheckBoxListItemProps<T> {
15
22
  item: T;
16
- sx?: CheckBoxListItemSxProps;
23
+ sx?: CheckBoxListItemSx;
17
24
  label: string;
18
25
  onClick: () => void;
19
26
  secondaryAction?: (item: T, hover: string) => React.ReactElement | null;
@@ -21,7 +28,8 @@ export interface CheckBoxListItemProps<T> {
21
28
  disabled?: boolean;
22
29
  divider?: boolean;
23
30
  checked: boolean;
24
- isCheckboxClickableOnly?: boolean;
31
+ onItemClick?: (item: T) => void;
32
+ isItemClickable?: (item: T) => boolean;
25
33
  }
26
34
  export interface DraggableCheckBoxListItemProps<T> extends CheckBoxListItemProps<T> {
27
35
  isDragDisable?: boolean;
@@ -33,29 +41,38 @@ export interface CheckBoxListItemsProps<T> {
33
41
  onSelectionChange?: (selectedItems: T[]) => void;
34
42
  getItemId: (item: T) => string;
35
43
  getItemLabel?: (item: T) => string;
36
- secondaryAction?: (item: T) => React.ReactElement | null;
37
- enableSecondaryActionOnHover?: boolean;
44
+ secondaryAction?: (item: T, hover: boolean) => React.ReactElement | null;
38
45
  isDisabled?: (item: T) => boolean;
39
46
  addSelectAllCheckbox?: boolean;
40
47
  selectAllCheckBoxLabel?: string;
41
- sx?: CheckBoxListItemSxProps;
48
+ sx?: CheckBoxListItemSxProps<T>;
42
49
  isDndDragAndDropActive?: boolean;
43
50
  isDragDisable?: boolean;
44
51
  divider?: boolean;
45
- isCheckboxClickableOnly?: boolean;
52
+ onItemClick?: (item: T) => void;
53
+ isItemClickable?: (item: T) => boolean;
46
54
  }
47
55
  export interface CheckboxListProps<T> extends CheckBoxListItemsProps<T> {
48
56
  onDragStart?: (dragStart: DragStart) => void;
49
57
  onDragEnd?: (dropResult: DropResult) => void;
50
58
  }
51
- export interface ClickableItemProps {
52
- sx?: CheckBoxListItemSxProps;
59
+ export interface ClickableCheckBoxItemProps {
60
+ sx?: CheckBoxListItemSx;
53
61
  label: string;
54
62
  onClick: () => void;
55
63
  disabled?: boolean;
56
64
  checked: boolean;
57
65
  }
58
- export interface DraggableClickableItemProps extends ClickableItemProps {
66
+ export interface DraggableClickableCheckBoxItemProps extends ClickableCheckBoxItemProps {
59
67
  provided: DraggableProvided;
60
68
  isHighlighted: boolean;
61
69
  }
70
+ interface ClickableItem {
71
+ onItemClick: () => void;
72
+ isItemClickable?: boolean;
73
+ }
74
+ export interface ClickableRowItemProps extends ClickableCheckBoxItemProps, ClickableItem {
75
+ }
76
+ export interface DraggableClickableRowItemProps extends DraggableClickableCheckBoxItemProps, ClickableItem {
77
+ }
78
+ export {};
@@ -1,9 +1,5 @@
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
- */
1
+ import { SelectionForCopy } from '../filter.type';
2
+
7
3
  export declare const DISTRIBUTION_KEY = "distributionKey";
8
4
  export declare const FilterType: {
9
5
  CRITERIA_BASED: {
@@ -19,3 +15,4 @@ export declare const FilterType: {
19
15
  label: string;
20
16
  };
21
17
  };
18
+ export declare const NO_SELECTION_FOR_COPY: SelectionForCopy;
@@ -4,7 +4,16 @@ const FilterType = {
4
4
  EXPLICIT_NAMING: { id: "IDENTIFIER_LIST", label: "filter.explicitNaming" },
5
5
  EXPERT: { id: "EXPERT", label: "filter.expert" }
6
6
  };
7
+ const NO_SELECTION_FOR_COPY = {
8
+ sourceItemUuid: null,
9
+ nameItem: null,
10
+ descriptionItem: null,
11
+ parentDirectoryUuid: null,
12
+ typeItem: null,
13
+ specificTypeItem: null
14
+ };
7
15
  export {
8
16
  DISTRIBUTION_KEY,
9
- FilterType
17
+ FilterType,
18
+ NO_SELECTION_FOR_COPY
10
19
  };
@@ -1,14 +1,7 @@
1
+ import { SelectionForCopy } from '../filter.type';
1
2
  import { ElementExistsType } from '../../../utils/types/elementType';
2
3
  import { UUID } from 'crypto';
3
- import { Dispatch, SetStateAction } from 'react';
4
4
 
5
- export type SelectionCopy = {
6
- sourceItemUuid: UUID | null;
7
- name: string | null;
8
- description: string | null;
9
- parentDirectoryUuid: UUID | null;
10
- };
11
- export declare const noSelectionForCopy: SelectionCopy;
12
5
  export interface CriteriaBasedFilterEditionDialogProps {
13
6
  id: string;
14
7
  name: string;
@@ -17,11 +10,11 @@ export interface CriteriaBasedFilterEditionDialogProps {
17
10
  onClose: () => void;
18
11
  broadcastChannel: BroadcastChannel;
19
12
  getFilterById: (id: string) => Promise<any>;
20
- selectionForCopy: SelectionCopy;
21
- setSelelectionForCopy: (selection: SelectionCopy) => Dispatch<SetStateAction<SelectionCopy>>;
13
+ selectionForCopy: SelectionForCopy;
14
+ setSelectionForCopy: (selection: SelectionForCopy) => void;
22
15
  activeDirectory?: UUID;
23
16
  elementExists?: ElementExistsType;
24
17
  language?: string;
25
18
  }
26
- declare function CriteriaBasedFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, getFilterById, selectionForCopy, setSelelectionForCopy, activeDirectory, elementExists, language, }: Readonly<CriteriaBasedFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
19
+ declare function CriteriaBasedFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, getFilterById, selectionForCopy, setSelectionForCopy, activeDirectory, elementExists, language, }: Readonly<CriteriaBasedFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
27
20
  export default CriteriaBasedFilterEditionDialog;
@@ -8,17 +8,11 @@ import CustomMuiDialog from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
8
8
  import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
9
9
  import { criteriaBasedFilterSchema } from "./CriteriaBasedFilterForm.js";
10
10
  import "../../../utils/yupConfig.js";
11
- import { FilterType } from "../constants/FilterConstants.js";
11
+ import { FilterType, NO_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
12
12
  import FetchStatus from "../../../utils/constants/fetchStatus.js";
13
13
  import { saveFilter } from "../../../services/explore.js";
14
14
  import FilterForm from "../FilterForm.js";
15
15
  import * as yup from "yup";
16
- const noSelectionForCopy = {
17
- sourceItemUuid: null,
18
- name: null,
19
- description: null,
20
- parentDirectoryUuid: null
21
- };
22
16
  const formSchema = yup.object().shape({
23
17
  [FieldConstants.NAME]: yup.string().trim().required("nameEmpty"),
24
18
  [FieldConstants.FILTER_TYPE]: yup.string().required(),
@@ -34,7 +28,7 @@ function CriteriaBasedFilterEditionDialog({
34
28
  broadcastChannel,
35
29
  getFilterById,
36
30
  selectionForCopy,
37
- setSelelectionForCopy,
31
+ setSelectionForCopy,
38
32
  activeDirectory,
39
33
  elementExists,
40
34
  language
@@ -74,9 +68,9 @@ function CriteriaBasedFilterEditionDialog({
74
68
  (filterForm) => {
75
69
  saveFilter(frontToBackTweak(id, filterForm), filterForm[FieldConstants.NAME]).then(() => {
76
70
  if (selectionForCopy.sourceItemUuid === id) {
77
- setSelelectionForCopy(noSelectionForCopy);
71
+ setSelectionForCopy(NO_SELECTION_FOR_COPY);
78
72
  broadcastChannel.postMessage({
79
- noSelectionForCopy
73
+ NO_SELECTION_FOR_COPY
80
74
  });
81
75
  }
82
76
  }).catch((error) => {
@@ -85,7 +79,7 @@ function CriteriaBasedFilterEditionDialog({
85
79
  });
86
80
  });
87
81
  },
88
- [broadcastChannel, id, selectionForCopy.sourceItemUuid, snackError, setSelelectionForCopy]
82
+ [broadcastChannel, id, selectionForCopy.sourceItemUuid, snackError, setSelectionForCopy]
89
83
  );
90
84
  const isDataReady = dataFetchStatus === FetchStatus.FETCH_SUCCESS;
91
85
  return /* @__PURE__ */ jsx(
@@ -106,6 +100,5 @@ function CriteriaBasedFilterEditionDialog({
106
100
  );
107
101
  }
108
102
  export {
109
- CriteriaBasedFilterEditionDialog as default,
110
- noSelectionForCopy
103
+ CriteriaBasedFilterEditionDialog as default
111
104
  };
@@ -1,3 +1,4 @@
1
+ import { SelectionForCopy } from '../filter.type';
1
2
  import { ElementExistsType } from '../../../utils/types/elementType';
2
3
  import { UUID } from 'crypto';
3
4
 
@@ -8,11 +9,11 @@ export interface ExpertFilterEditionDialogProps {
8
9
  open: boolean;
9
10
  onClose: () => void;
10
11
  broadcastChannel: BroadcastChannel;
11
- selectionForCopy: any;
12
+ selectionForCopy: SelectionForCopy;
12
13
  getFilterById: (id: string) => Promise<{
13
14
  [prop: string]: any;
14
15
  }>;
15
- setSelectionForCopy: (selection: any) => void;
16
+ setSelectionForCopy: (selection: SelectionForCopy) => void;
16
17
  activeDirectory?: UUID;
17
18
  elementExists?: ElementExistsType;
18
19
  language?: string;
@@ -3,7 +3,6 @@ import { useState, useEffect, useCallback } from "react";
3
3
  import { useForm } from "react-hook-form";
4
4
  import { yupResolver } from "@hookform/resolvers/yup";
5
5
  import FieldConstants from "../../../utils/constants/fieldConstants.js";
6
- import { noSelectionForCopy } from "../../../utils/types/equipmentTypes.js";
7
6
  import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
8
7
  import CustomMuiDialog from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
9
8
  import "../../../utils/yupConfig.js";
@@ -11,7 +10,7 @@ import FilterForm from "../FilterForm.js";
11
10
  import { expertFilterSchema, EXPERT_FILTER_QUERY } from "./ExpertFilterForm.js";
12
11
  import { saveExpertFilter } from "../utils/filterApi.js";
13
12
  import { importExpertRules } from "./expertFilterUtils.js";
14
- import { FilterType } from "../constants/FilterConstants.js";
13
+ import { FilterType, NO_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
15
14
  import FetchStatus from "../../../utils/constants/fetchStatus.js";
16
15
  import * as yup from "yup";
17
16
  const formSchema = yup.object().shape({
@@ -85,9 +84,9 @@ function ExpertFilterEditionDialog({
85
84
  }
86
85
  );
87
86
  if (selectionForCopy.sourceItemUuid === id) {
88
- setSelectionForCopy(noSelectionForCopy);
87
+ setSelectionForCopy(NO_SELECTION_FOR_COPY);
89
88
  broadcastChannel.postMessage({
90
- noSelectionForCopy
89
+ NO_SELECTION_FOR_COPY
91
90
  });
92
91
  }
93
92
  },
@@ -1,3 +1,4 @@
1
+ import { SelectionForCopy } from '../filter.type';
1
2
  import { ElementExistsType } from '../../../utils/types/elementType';
2
3
  import { UUID } from 'crypto';
3
4
 
@@ -8,8 +9,8 @@ export interface ExplicitNamingFilterEditionDialogProps {
8
9
  open: boolean;
9
10
  onClose: () => void;
10
11
  broadcastChannel: BroadcastChannel;
11
- selectionForCopy: any;
12
- setSelectionForCopy: (selection: any) => void;
12
+ selectionForCopy: SelectionForCopy;
13
+ setSelectionForCopy: (selection: SelectionForCopy) => void;
13
14
  getFilterById: (id: string) => Promise<any>;
14
15
  activeDirectory?: UUID;
15
16
  elementExists?: ElementExistsType;
@@ -11,8 +11,7 @@ import "../../../utils/yupConfig.js";
11
11
  import { explicitNamingFilterSchema, FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterForm.js";
12
12
  import FieldConstants from "../../../utils/constants/fieldConstants.js";
13
13
  import FilterForm from "../FilterForm.js";
14
- import { noSelectionForCopy } from "../../../utils/types/equipmentTypes.js";
15
- import { FilterType } from "../constants/FilterConstants.js";
14
+ import { FilterType, NO_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
16
15
  import FetchStatus from "../../../utils/constants/fetchStatus.js";
17
16
  import * as yup from "yup";
18
17
  const formSchema = yup.object().shape({
@@ -88,9 +87,9 @@ function ExplicitNamingFilterEditionDialog({
88
87
  onClose
89
88
  );
90
89
  if (selectionForCopy.sourceItemUuid === id) {
91
- setSelectionForCopy(noSelectionForCopy);
90
+ setSelectionForCopy(NO_SELECTION_FOR_COPY);
92
91
  broadcastChannel.postMessage({
93
- noSelectionForCopy
92
+ NO_SELECTION_FOR_COPY
94
93
  });
95
94
  }
96
95
  },
@@ -163,7 +163,7 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
163
163
  Input: SelectInput,
164
164
  name: FieldConstants.EQUIPMENT_TYPE,
165
165
  options: Object.values(FILTER_EQUIPMENTS),
166
- disabled: sourceFilterForExplicitNamingConversion,
166
+ disabled: !!sourceFilterForExplicitNamingConversion,
167
167
  label: "equipmentType",
168
168
  shouldOpenPopup: openConfirmationPopup,
169
169
  resetOnConfirmation: handleResetOnConfirmation,
@@ -0,0 +1,14 @@
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 SelectionForCopy = {
8
+ sourceItemUuid: string | null;
9
+ typeItem: string | null;
10
+ nameItem: string | null;
11
+ descriptionItem: string | null;
12
+ parentDirectoryUuid: string | null;
13
+ specificTypeItem: string | null;
14
+ };
package/dist/index.d.ts CHANGED
@@ -41,7 +41,8 @@ export type { BottomRightButtonsProps } from './components/inputs/reactHookForm/
41
41
  export { default as CustomAgGridTable } from './components/inputs/reactHookForm/agGridTable/CustomAgGridTable';
42
42
  export type { CustomAgGridTableProps } from './components/inputs/reactHookForm/agGridTable/CustomAgGridTable';
43
43
  export { ROW_DRAGGING_SELECTION_COLUMN_DEF } from './components/inputs/reactHookForm/agGridTable/CustomAgGridTable';
44
- export { Line, Generator, Load, Battery, SVC, DanglingLine, LCC, VSC, Hvdc, BusBar, TwoWindingTransfo, ThreeWindingTransfo, ShuntCompensator, VoltageLevel, Substation, noSelectionForCopy, } from './utils/types/equipmentTypes';
44
+ export { Line, Generator, Load, Battery, SVC, DanglingLine, LCC, VSC, Hvdc, BusBar, TwoWindingTransfo, ThreeWindingTransfo, ShuntCompensator, VoltageLevel, Substation, } from './utils/types/equipmentTypes';
45
+ export { NO_SELECTION_FOR_COPY as noSelectionForCopy } from './components/filter/constants/FilterConstants';
45
46
  export { default as FieldConstants } from './utils/constants/fieldConstants';
46
47
  export { fields as EXPERT_FILTER_FIELDS } from './components/filter/expert/expertFilterConstants';
47
48
  export { default as CustomReactQueryBuilder } from './components/inputs/reactQueryBuilder/CustomReactQueryBuilder';