@gridsuite/commons-ui 0.94.0 → 0.96.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 (52) hide show
  1. package/dist/components/checkBoxList/CheckBoxList.d.ts +1 -1
  2. package/dist/components/checkBoxList/CheckBoxList.js +3 -11
  3. package/dist/components/checkBoxList/CheckBoxListItem.d.ts +1 -1
  4. package/dist/components/checkBoxList/CheckBoxListItem.js +47 -14
  5. package/dist/components/checkBoxList/CheckBoxListItemContent.d.ts +2 -0
  6. package/dist/components/checkBoxList/CheckBoxListItemContent.js +45 -0
  7. package/dist/components/checkBoxList/CheckBoxListItems.d.ts +1 -1
  8. package/dist/components/checkBoxList/CheckBoxListItems.js +24 -20
  9. package/dist/components/checkBoxList/DraggableCheckBoxListItem.d.ts +1 -1
  10. package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +46 -17
  11. package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.d.ts +2 -0
  12. package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.js +38 -0
  13. package/dist/components/checkBoxList/checkBoxList.type.d.ts +9 -11
  14. package/dist/components/customAGGrid/customAggrid.d.ts +11 -8
  15. package/dist/components/customAGGrid/customAggrid.js +51 -48
  16. package/dist/components/customAGGrid/customAggrid.style.d.ts +0 -5
  17. package/dist/components/customAGGrid/customAggrid.style.js +1 -7
  18. package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +0 -2
  19. package/dist/components/filter/HeaderFilterForm.js +0 -2
  20. package/dist/components/icons/LeftPanelCloseIcon.d.ts +7 -0
  21. package/dist/components/icons/LeftPanelCloseIcon.js +19 -0
  22. package/dist/components/icons/LeftPanelOpenIcon.d.ts +7 -0
  23. package/dist/components/icons/LeftPanelOpenIcon.js +19 -0
  24. package/dist/components/icons/index.d.ts +8 -0
  25. package/dist/components/icons/index.js +6 -0
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/components/index.js +4 -0
  28. package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.d.ts +4 -11
  29. package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +0 -23
  30. package/dist/components/topBar/TopBar.d.ts +3 -5
  31. package/dist/components/topBar/TopBar.js +2 -1
  32. package/dist/hooks/useLocalizedCountries.js +1 -1
  33. package/dist/index.js +6 -2
  34. package/dist/utils/constants/index.d.ts +0 -1
  35. package/dist/utils/constants/index.js +0 -6
  36. package/dist/utils/index.d.ts +1 -0
  37. package/dist/utils/index.js +2 -2
  38. package/dist/utils/langs.d.ts +5 -0
  39. package/dist/utils/{constants/browserConstants.js → langs.js} +1 -5
  40. package/dist/utils/styles.d.ts +3 -0
  41. package/dist/utils/styles.js +4 -0
  42. package/dist/utils/types/equipmentType.js +1 -1
  43. package/package.json +3 -1
  44. package/dist/components/checkBoxList/ClickableCheckBoxItem.d.ts +0 -2
  45. package/dist/components/checkBoxList/ClickableCheckBoxItem.js +0 -12
  46. package/dist/components/checkBoxList/ClickableRowItem.d.ts +0 -2
  47. package/dist/components/checkBoxList/ClickableRowItem.js +0 -51
  48. package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.d.ts +0 -2
  49. package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.js +0 -50
  50. package/dist/components/checkBoxList/DraggableClickableRowItem.d.ts +0 -2
  51. package/dist/components/checkBoxList/DraggableClickableRowItem.js +0 -77
  52. package/dist/utils/constants/browserConstants.d.ts +0 -11
@@ -1,2 +1,2 @@
1
1
  import { CheckboxListProps } from './checkBoxList.type';
2
- export declare function CheckBoxList<T>({ isDndDragAndDropActive, onDragStart, onDragEnd, isDragDisable, sx, ...props }: CheckboxListProps<T>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function CheckBoxList<T>({ isDndActive, onDragStart, onDragEnd, isDragDisable, sx, ...props }: CheckboxListProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,7 @@ import { Box } from "@mui/material";
4
4
  import { DragDropContext, Droppable } from "@hello-pangea/dnd";
5
5
  import { CheckBoxListItems } from "./CheckBoxListItems.js";
6
6
  function CheckBoxList({
7
- isDndDragAndDropActive = false,
7
+ isDndActive = false,
8
8
  onDragStart,
9
9
  onDragEnd,
10
10
  isDragDisable = false,
@@ -12,16 +12,8 @@ function CheckBoxList({
12
12
  ...props
13
13
  }) {
14
14
  const [isDragging, setIsDragging] = useState(false);
15
- const checkBoxField = /* @__PURE__ */ jsx(
16
- CheckBoxListItems,
17
- {
18
- isDndDragAndDropActive,
19
- isDragDisable: isDragDisable || isDragging,
20
- sx,
21
- ...props
22
- }
23
- );
24
- return isDndDragAndDropActive ? /* @__PURE__ */ jsx(
15
+ const checkBoxField = /* @__PURE__ */ jsx(CheckBoxListItems, { isDndActive, isDragDisable: isDragDisable || isDragging, sx, ...props });
16
+ return isDndActive ? /* @__PURE__ */ jsx(
25
17
  DragDropContext,
26
18
  {
27
19
  onDragEnd: (dropResult) => {
@@ -1,2 +1,2 @@
1
1
  import { CheckBoxListItemProps } from './checkBoxList.type';
2
- export declare function CheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, divider, onItemClick, isItemClickable, ...props }: Readonly<CheckBoxListItemProps<T>>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function CheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, divider, onItemClick, isItemClickable, disabled, ...props }: Readonly<CheckBoxListItemProps<T>>): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,29 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { ListItem } from "@mui/material";
4
- import { ClickableCheckBoxItem } from "./ClickableCheckBoxItem.js";
5
- import { ClickableRowItem } from "./ClickableRowItem.js";
2
+ import { useState, useCallback } from "react";
3
+ import { ListItem, ListItemButton } from "@mui/material";
4
+ import { CheckBoxListItemContent } from "./CheckBoxListItemContent.js";
5
+ import "../../utils/conversionUtils.js";
6
+ import "@mui/icons-material";
7
+ import { mergeSx } from "../../utils/styles.js";
8
+ import "../../utils/types/equipmentType.js";
9
+ import "../../utils/yupConfig.js";
10
+ const styles = {
11
+ checkboxListItem: {
12
+ alignItems: "flex-start",
13
+ // this is the only way to unset the absolute positionning of the secondary action
14
+ "& .MuiListItemSecondaryAction-root": {
15
+ marginTop: "1px",
16
+ position: "relative",
17
+ top: 0,
18
+ right: 0,
19
+ transform: "none"
20
+ },
21
+ // this is the only way to unset a 48px right padding when ListItemButton is hovered
22
+ "& .MuiListItemButton-root": {
23
+ paddingRight: "0px"
24
+ }
25
+ }
26
+ };
6
27
  function CheckBoxListItem({
7
28
  item,
8
29
  sx,
@@ -11,28 +32,40 @@ function CheckBoxListItem({
11
32
  divider,
12
33
  onItemClick,
13
34
  isItemClickable,
35
+ disabled,
14
36
  ...props
15
37
  }) {
16
38
  const [hover, setHover] = useState("");
39
+ const handleItemClick = useCallback(() => {
40
+ if (!onItemClick) {
41
+ return;
42
+ }
43
+ if (isItemClickable) {
44
+ if (isItemClickable(item)) {
45
+ onItemClick(item);
46
+ }
47
+ return;
48
+ }
49
+ onItemClick(item);
50
+ }, [isItemClickable, item, onItemClick]);
17
51
  return /* @__PURE__ */ jsx(
18
52
  ListItem,
19
53
  {
20
54
  secondaryAction: secondaryAction == null ? void 0 : secondaryAction(item, hover),
21
- sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkboxListItem },
55
+ sx: mergeSx(styles.checkboxListItem, sx == null ? void 0 : sx.checkboxListItem),
22
56
  onMouseEnter: () => setHover(getItemId(item)),
23
57
  onMouseLeave: () => setHover(""),
24
- disablePadding: !!onItemClick,
25
- disableGutters: true,
58
+ disablePadding: true,
26
59
  divider,
27
- children: !onItemClick ? /* @__PURE__ */ jsx(ClickableCheckBoxItem, { sx, ...props }) : /* @__PURE__ */ jsx(
28
- ClickableRowItem,
60
+ children: onItemClick ? /* @__PURE__ */ jsx(
61
+ ListItemButton,
29
62
  {
30
- isItemClickable: isItemClickable == null ? void 0 : isItemClickable(item),
31
- onItemClick: () => onItemClick(item),
32
- sx,
33
- ...props
63
+ sx: mergeSx({ alignItems: "flex-start", padding: "unset" }, sx == null ? void 0 : sx.checkboxButton),
64
+ disabled,
65
+ onClick: handleItemClick,
66
+ children: /* @__PURE__ */ jsx(CheckBoxListItemContent, { sx, ...props })
34
67
  }
35
- )
68
+ ) : /* @__PURE__ */ jsx(CheckBoxListItemContent, { sx, ...props })
36
69
  }
37
70
  );
38
71
  }
@@ -0,0 +1,2 @@
1
+ import { CheckBoxListItemContentProps } from './checkBoxList.type';
2
+ export declare function CheckBoxListItemContent({ sx, label, secondary, onClick, ...props }: Readonly<CheckBoxListItemContentProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { ListItemIcon, Checkbox, ListItemText } from "@mui/material";
3
+ import { OverflowableText } from "../overflowableText/OverflowableText.js";
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";
9
+ function CheckBoxListItemContent({
10
+ sx,
11
+ label,
12
+ secondary,
13
+ onClick,
14
+ ...props
15
+ }) {
16
+ const onCheckboxClick = (event) => {
17
+ event.stopPropagation();
18
+ onClick();
19
+ };
20
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ /* @__PURE__ */ jsx(ListItemIcon, { sx: mergeSx({ marginTop: "0px" }, sx == null ? void 0 : sx.checkBoxIcon), children: /* @__PURE__ */ jsx(Checkbox, { sx: sx == null ? void 0 : sx.checkbox, disableRipple: true, onClick: onCheckboxClick, ...props }) }),
22
+ /* @__PURE__ */ jsx(
23
+ ListItemText,
24
+ {
25
+ sx: mergeSx(
26
+ {
27
+ display: "flex",
28
+ flexDirection: "column",
29
+ alignItems: "flex-start",
30
+ paddingTop: "0px",
31
+ // this is to align text with default padding/margin of the checkbox
32
+ marginTop: "9px"
33
+ },
34
+ sx == null ? void 0 : sx.listItemText
35
+ ),
36
+ disableTypography: true,
37
+ secondary,
38
+ children: /* @__PURE__ */ jsx(OverflowableText, { sx: mergeSx({ width: "100%" }, sx == null ? void 0 : sx.label), text: label })
39
+ }
40
+ )
41
+ ] });
42
+ }
43
+ export {
44
+ CheckBoxListItemContent
45
+ };
@@ -1,2 +1,2 @@
1
1
  import { CheckBoxListItemsProps } from './checkBoxList.type';
2
- export declare function CheckBoxListItems<T>({ items, selectedItems, onSelectionChange, getItemId, sx, secondaryAction, addSelectAllCheckbox, selectAllCheckBoxLabel, getItemLabel, isDisabled, isDndDragAndDropActive, isDragDisable, divider, onItemClick, isItemClickable, ...props }: Readonly<CheckBoxListItemsProps<T>>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function CheckBoxListItems<T>({ items, selectedItems, onSelectionChange, getItemId, sx, secondaryAction, addSelectAllCheckbox, selectAllCheckBoxLabel, getItemLabel, getItemLabelSecondary, isDisabled, isDndActive, isDragDisable, divider, onItemClick, isItemClickable, ...props }: Readonly<CheckBoxListItemsProps<T>>): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useMemo } from "react";
3
- import { List, ListItem, ListItemButton, ListItemIcon, Checkbox, ListItemText } from "@mui/material";
3
+ import { List, ListItem, ListItemButton } from "@mui/material";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  import { Draggable } from "@hello-pangea/dnd";
6
6
  import { CheckBoxListItem } from "./CheckBoxListItem.js";
7
- import { OverflowableText } from "../overflowableText/OverflowableText.js";
8
7
  import { DraggableCheckBoxListItem } from "./DraggableCheckBoxListItem.js";
8
+ import { CheckBoxListItemContent } from "./CheckBoxListItemContent.js";
9
9
  function CheckBoxListItems({
10
10
  items,
11
11
  selectedItems,
@@ -16,8 +16,9 @@ function CheckBoxListItems({
16
16
  addSelectAllCheckbox,
17
17
  selectAllCheckBoxLabel,
18
18
  getItemLabel,
19
+ getItemLabelSecondary,
19
20
  isDisabled,
20
- isDndDragAndDropActive,
21
+ isDndActive,
21
22
  isDragDisable,
22
23
  divider,
23
24
  onItemClick,
@@ -82,30 +83,31 @@ function CheckBoxListItems({
82
83
  borderBottom: "2px solid"
83
84
  }
84
85
  },
85
- children: /* @__PURE__ */ jsxs(ListItemButton, { onClick: toggleSelectAll, sx: { paddingLeft: 0 }, children: [
86
- /* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0 }, children: /* @__PURE__ */ jsx(
87
- Checkbox,
88
- {
89
- sx: { paddingLeft: 0 },
90
- checked: selectedItems.length !== 0,
91
- indeterminate: selectedItems.length > 0 && selectedItems.length !== items.length
92
- }
93
- ) }),
94
- /* @__PURE__ */ jsx(ListItemText, { sx: { display: "flex" }, disableTypography: true, children: /* @__PURE__ */ jsx(
95
- OverflowableText,
96
- {
97
- text: /* @__PURE__ */ jsx(FormattedMessage, { id: selectAllLabel, defaultMessage: selectAllLabel })
98
- }
99
- ) })
100
- ] })
86
+ children: /* @__PURE__ */ jsx(
87
+ ListItemButton,
88
+ {
89
+ onClick: toggleSelectAll,
90
+ sx: { alignItems: "flex-start", paddingLeft: isDndActive ? "24px" : 0 },
91
+ children: /* @__PURE__ */ jsx(
92
+ CheckBoxListItemContent,
93
+ {
94
+ onClick: toggleSelectAll,
95
+ checked: selectedItems.length !== 0,
96
+ indeterminate: selectedItems.length > 0 && selectedItems.length !== items.length,
97
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: selectAllLabel, defaultMessage: selectAllLabel })
98
+ }
99
+ )
100
+ }
101
+ )
101
102
  }
102
103
  ),
103
104
  items == null ? void 0 : items.map((item, index) => {
104
105
  const label = getItemLabel ? getItemLabel(item) : getItemId(item);
106
+ const secondary = getItemLabelSecondary ? getItemLabelSecondary(item) : null;
105
107
  const disabled = isDisabled ? isDisabled(item) : false;
106
108
  const addDivider = divider && index < items.length - 1;
107
109
  const calculatedItemSx = typeof (sx == null ? void 0 : sx.items) === "function" ? sx == null ? void 0 : sx.items(item) : sx == null ? void 0 : sx.items;
108
- if (isDndDragAndDropActive) {
110
+ if (isDndActive) {
109
111
  return /* @__PURE__ */ jsx(
110
112
  Draggable,
111
113
  {
@@ -118,6 +120,7 @@ function CheckBoxListItems({
118
120
  item,
119
121
  checked: isChecked(item),
120
122
  label,
123
+ secondary,
121
124
  onClick: () => toggleSelection(getItemId(item)),
122
125
  sx: calculatedItemSx,
123
126
  disabled,
@@ -141,6 +144,7 @@ function CheckBoxListItems({
141
144
  item,
142
145
  checked: isChecked(item),
143
146
  label,
147
+ secondary,
144
148
  onClick: () => toggleSelection(getItemId(item)),
145
149
  disabled,
146
150
  getItemId,
@@ -1,2 +1,2 @@
1
1
  import { DraggableCheckBoxListItemProps } from './checkBoxList.type';
2
- export declare function DraggableCheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, isDragDisable, provided, divider, onItemClick, isItemClickable, ...props }: Readonly<DraggableCheckBoxListItemProps<T>>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function DraggableCheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, isDragDisable, provided, divider, onItemClick, isItemClickable, disabled, ...props }: Readonly<DraggableCheckBoxListItemProps<T>>): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,30 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { ListItem } from "@mui/material";
4
- import { DraggableClickableCheckBoxItem } from "./DraggableClickableCheckBoxItem.js";
5
- import { DraggableClickableRowItem } from "./DraggableClickableRowItem.js";
2
+ import { useState, useCallback } from "react";
3
+ import { ListItem, ListItemButton } from "@mui/material";
4
+ import { DraggableCheckBoxListItemContent } from "./DraggableCheckBoxListItemContent.js";
5
+ import "../../utils/conversionUtils.js";
6
+ import "@mui/icons-material";
7
+ import { mergeSx } from "../../utils/styles.js";
8
+ import "../../utils/types/equipmentType.js";
9
+ import "../../utils/yupConfig.js";
10
+ const styles = {
11
+ checkboxListItem: {
12
+ // this is to align ListItem children and its secondary action
13
+ alignItems: "flex-start",
14
+ // this is the only way to unset the absolute positionning of the secondary action
15
+ "& .MuiListItemSecondaryAction-root": {
16
+ marginTop: "1px",
17
+ position: "relative",
18
+ top: 0,
19
+ right: 0,
20
+ transform: "none"
21
+ },
22
+ // this is the only way to unset a 48px right padding when ListItemButton is hovered
23
+ "& .MuiListItemButton-root": {
24
+ paddingRight: "0px"
25
+ }
26
+ }
27
+ };
6
28
  function DraggableCheckBoxListItem({
7
29
  item,
8
30
  sx,
@@ -13,36 +35,43 @@ function DraggableCheckBoxListItem({
13
35
  divider,
14
36
  onItemClick,
15
37
  isItemClickable,
38
+ disabled,
16
39
  ...props
17
40
  }) {
18
41
  const [hover, setHover] = useState("");
42
+ const handleItemClick = useCallback(() => onItemClick == null ? void 0 : onItemClick(item), [item, onItemClick]);
19
43
  return /* @__PURE__ */ jsx(
20
44
  ListItem,
21
45
  {
22
46
  secondaryAction: secondaryAction == null ? void 0 : secondaryAction(item, hover),
23
- sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkboxListItem },
47
+ sx: mergeSx(styles.checkboxListItem, sx == null ? void 0 : sx.checkboxListItem),
24
48
  onMouseEnter: () => setHover(getItemId(item)),
25
49
  onMouseLeave: () => setHover(""),
26
- disablePadding: !!onItemClick,
27
- disableGutters: true,
28
- divider,
50
+ disablePadding: true,
29
51
  ref: provided.innerRef,
30
52
  ...provided.draggableProps,
31
- children: !onItemClick ? /* @__PURE__ */ jsx(
32
- DraggableClickableCheckBoxItem,
53
+ children: (isItemClickable == null ? void 0 : isItemClickable(item)) ? /* @__PURE__ */ jsx(
54
+ ListItemButton,
33
55
  {
34
- provided,
35
- isHighlighted: hover === getItemId(item) && !isDragDisable,
36
- sx,
37
- ...props
56
+ sx: mergeSx({ alignItems: "flex-start", paddingTop: "0px" }, sx == null ? void 0 : sx.checkboxButton),
57
+ disabled,
58
+ onClick: handleItemClick,
59
+ disableGutters: true,
60
+ children: /* @__PURE__ */ jsx(
61
+ DraggableCheckBoxListItemContent,
62
+ {
63
+ provided,
64
+ isHighlighted: hover === getItemId(item) && !isDragDisable,
65
+ sx,
66
+ ...props
67
+ }
68
+ )
38
69
  }
39
70
  ) : /* @__PURE__ */ jsx(
40
- DraggableClickableRowItem,
71
+ DraggableCheckBoxListItemContent,
41
72
  {
42
73
  provided,
43
74
  isHighlighted: hover === getItemId(item) && !isDragDisable,
44
- onItemClick: () => onItemClick(item),
45
- isItemClickable: isItemClickable == null ? void 0 : isItemClickable(item),
46
75
  sx,
47
76
  ...props
48
77
  }
@@ -0,0 +1,2 @@
1
+ import { DraggableCheckBoxListItemContentProps } from './checkBoxList.type';
2
+ export declare function DraggableCheckBoxListItemContent({ provided, isHighlighted, sx, ...props }: Readonly<DraggableCheckBoxListItemContentProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { DragIndicator } from "@mui/icons-material";
3
+ import { IconButton } from "@mui/material";
4
+ import { CheckBoxListItemContent } from "./CheckBoxListItemContent.js";
5
+ import "../../utils/conversionUtils.js";
6
+ import { mergeSx } from "../../utils/styles.js";
7
+ import "../../utils/types/equipmentType.js";
8
+ import "../../utils/yupConfig.js";
9
+ function DraggableCheckBoxListItemContent({
10
+ provided,
11
+ isHighlighted,
12
+ sx,
13
+ ...props
14
+ }) {
15
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
16
+ /* @__PURE__ */ jsx(
17
+ IconButton,
18
+ {
19
+ ...provided.dragHandleProps,
20
+ size: "small",
21
+ sx: mergeSx(
22
+ {
23
+ display: isHighlighted ? "block" : "none",
24
+ padding: "unset",
25
+ marginTop: "9px"
26
+ // this is to align drag button to the checkbox and label
27
+ },
28
+ sx == null ? void 0 : sx.dragButton
29
+ ),
30
+ children: /* @__PURE__ */ jsx(DragIndicator, {})
31
+ }
32
+ ),
33
+ /* @__PURE__ */ jsx(CheckBoxListItemContent, { sx, ...props })
34
+ ] });
35
+ }
36
+ export {
37
+ DraggableCheckBoxListItemContent
38
+ };
@@ -3,10 +3,12 @@ import { DraggableProvided, DragStart, DropResult } from '@hello-pangea/dnd';
3
3
  import { SxProps, Theme } from '@mui/material';
4
4
  export type CheckBoxListItemSx = {
5
5
  checkBoxIcon?: SxProps<Theme>;
6
+ listItemText?: SxProps<Theme>;
6
7
  label?: SxProps<Theme>;
7
8
  checkboxListItem?: SxProps<Theme>;
8
9
  checkboxButton?: SxProps<Theme>;
9
10
  checkbox?: SxProps<Theme>;
11
+ dragButton?: SxProps<Theme>;
10
12
  };
11
13
  export type CheckBoxListSx = {
12
14
  dragAndDropContainer?: SxProps<Theme>;
@@ -20,6 +22,7 @@ export interface CheckBoxListItemProps<T> {
20
22
  item: T;
21
23
  sx?: CheckBoxListItemSx;
22
24
  label: ReactNode;
25
+ secondary?: ReactNode;
23
26
  onClick: () => void;
24
27
  secondaryAction?: (item: T, hover: string) => ReactElement | null;
25
28
  getItemId: (item: T) => string;
@@ -39,12 +42,13 @@ export interface CheckBoxListItemsProps<T> {
39
42
  onSelectionChange?: (selectedItems: T[]) => void;
40
43
  getItemId: (item: T) => string;
41
44
  getItemLabel?: (item: T) => ReactNode;
45
+ getItemLabelSecondary?: (item: T) => ReactNode;
42
46
  secondaryAction?: (item: T, hover: boolean) => ReactElement | null;
43
47
  isDisabled?: (item: T) => boolean;
44
48
  addSelectAllCheckbox?: boolean;
45
49
  selectAllCheckBoxLabel?: string;
46
50
  sx?: CheckBoxListItemSxProps<T>;
47
- isDndDragAndDropActive?: boolean;
51
+ isDndActive?: boolean;
48
52
  isDragDisable?: boolean;
49
53
  divider?: boolean;
50
54
  onItemClick?: (item: T) => void;
@@ -54,23 +58,17 @@ export interface CheckboxListProps<T> extends CheckBoxListItemsProps<T> {
54
58
  onDragStart?: (dragStart: DragStart) => void;
55
59
  onDragEnd?: (dropResult: DropResult) => void;
56
60
  }
57
- export interface ClickableCheckBoxItemProps {
61
+ export interface CheckBoxListItemContentProps {
58
62
  sx?: CheckBoxListItemSx;
59
63
  label: ReactNode;
64
+ secondary?: ReactNode;
60
65
  onClick: () => void;
61
66
  disabled?: boolean;
62
67
  checked: boolean;
68
+ indeterminate?: boolean;
63
69
  }
64
- export interface DraggableClickableCheckBoxItemProps extends ClickableCheckBoxItemProps {
70
+ export interface DraggableCheckBoxListItemContentProps extends CheckBoxListItemContentProps {
65
71
  provided: DraggableProvided;
66
72
  isHighlighted: boolean;
67
73
  }
68
- interface ClickableItem {
69
- onItemClick: () => void;
70
- isItemClickable?: boolean;
71
- }
72
- export interface ClickableRowItemProps extends ClickableCheckBoxItemProps, ClickableItem {
73
- }
74
- export interface DraggableClickableRowItemProps extends DraggableClickableCheckBoxItemProps, ClickableItem {
75
- }
76
74
  export {};
@@ -1,9 +1,12 @@
1
- import { default as React } from 'react';
2
1
  import { AgGridReact, AgGridReactProps } from 'ag-grid-react';
3
- interface CustomAGGGridStyleProps {
4
- shouldHidePinnedHeaderRightBorder?: boolean;
5
- }
6
- export interface CustomAGGridProps extends AgGridReactProps, CustomAGGGridStyleProps {
7
- }
8
- export declare const CustomAGGrid: React.ForwardRefExoticComponent<CustomAGGridProps & React.RefAttributes<AgGridReact<any>>>;
9
- export {};
2
+ import { AG_GRID_LOCALE_EN } from '@ag-grid-community/locale';
3
+ import { BoxProps } from '@mui/material';
4
+ import { GsLangUser } from '../../utils/langs';
5
+ export type AgGridLocale = Partial<Record<keyof typeof AG_GRID_LOCALE_EN, string>>;
6
+ export type AgGridLocales = Record<GsLangUser, AgGridLocale>;
7
+ export type CustomAGGridProps<TData = any> = Omit<AgGridReactProps<TData>, 'localeText' | 'getLocaleText'> & Pick<BoxProps, 'sx'> & {
8
+ overrideLocales?: AgGridLocales;
9
+ };
10
+ export declare const CustomAGGrid: import('react').ForwardRefExoticComponent<Omit<AgGridReactProps<any>, "localeText" | "getLocaleText"> & Pick<BoxProps, "sx"> & {
11
+ overrideLocales?: AgGridLocales;
12
+ } & import('react').RefAttributes<AgGridReact<any>>>;
@@ -1,60 +1,63 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import React, { useCallback } from "react";
2
+ import { forwardRef, useMemo } from "react";
3
3
  import { AgGridReact } from "ag-grid-react";
4
- import { useIntl } from "react-intl";
5
4
  import "ag-grid-community/styles/ag-grid.css";
6
5
  import "ag-grid-community/styles/ag-theme-alpine.css";
6
+ import { AG_GRID_LOCALE_EN, AG_GRID_LOCALE_FR } from "@ag-grid-community/locale";
7
+ import { useIntl } from "react-intl";
7
8
  import { useTheme, Box } from "@mui/material";
8
9
  import { mergeSx } from "../../utils/styles.js";
9
10
  import { CUSTOM_AGGRID_THEME, styles } from "./customAggrid.style.js";
10
- const onColumnResized = (params) => {
11
- var _a;
12
- const { column, finished } = params;
13
- const colDefinedMinWidth = (_a = column == null ? void 0 : column.getColDef()) == null ? void 0 : _a.minWidth;
14
- if (column && colDefinedMinWidth && finished) {
15
- const newWidth = column == null ? void 0 : column.getActualWidth();
16
- if (newWidth < colDefinedMinWidth) {
17
- params.api.setColumnWidths([{ key: column, newWidth: colDefinedMinWidth }], finished, params.source);
18
- }
19
- }
20
- };
21
- const CustomAGGrid = React.forwardRef((props, ref) => {
22
- const { shouldHidePinnedHeaderRightBorder = false, ...agGridReactProps } = props;
23
- const theme = useTheme();
11
+ import { LANG_ENGLISH, LANG_FRENCH } from "../../utils/langs.js";
12
+ function useAgGridLocale(overrideLocales) {
24
13
  const intl = useIntl();
25
- const GRID_PREFIX = "grid.";
26
- const getLocaleText = useCallback(
27
- (params) => {
28
- const key = GRID_PREFIX + params.key;
29
- return intl.formatMessage({
30
- id: key,
31
- defaultMessage: params.defaultValue
32
- });
33
- },
34
- [intl]
35
- );
36
- return /* @__PURE__ */ jsx(
37
- Box,
38
- {
39
- sx: mergeSx(
40
- styles.grid,
41
- shouldHidePinnedHeaderRightBorder ? styles.noBorderRight : void 0
42
- ),
43
- className: `${theme.aggrid.theme} ${CUSTOM_AGGRID_THEME}`,
44
- children: /* @__PURE__ */ jsx(
45
- AgGridReact,
46
- {
47
- ref,
48
- getLocaleText,
49
- onColumnResized,
50
- enableCellTextSelection: true,
51
- theme: "legacy",
52
- ...agGridReactProps
53
- }
54
- )
14
+ return useMemo(() => {
15
+ switch ((intl.locale || intl.defaultLocale).toLowerCase().substring(0, 2)) {
16
+ case LANG_FRENCH:
17
+ return {
18
+ ...AG_GRID_LOCALE_FR,
19
+ thousandSeparator: " ",
20
+ decimalSeparator: ",",
21
+ ...overrideLocales == null ? void 0 : overrideLocales[LANG_FRENCH]
22
+ };
23
+ case LANG_ENGLISH:
24
+ default:
25
+ return { ...AG_GRID_LOCALE_EN, ...overrideLocales == null ? void 0 : overrideLocales[LANG_ENGLISH] };
26
+ }
27
+ }, [intl.defaultLocale, intl.locale, overrideLocales]);
28
+ }
29
+ function onColumnResized({ api, column, finished, source }) {
30
+ if (column) {
31
+ const colDefinedMinWidth = column.getColDef().minWidth;
32
+ if (colDefinedMinWidth && finished && column.getActualWidth() < colDefinedMinWidth) {
33
+ api.setColumnWidths([{ key: column, newWidth: colDefinedMinWidth }], finished, source);
55
34
  }
56
- );
57
- });
35
+ }
36
+ }
37
+ const CustomAGGrid = forwardRef(
38
+ ({ overrideLocales, sx, ...agGridReactProps }, ref) => {
39
+ const theme = useTheme();
40
+ return /* @__PURE__ */ jsx(
41
+ Box,
42
+ {
43
+ component: "div",
44
+ sx: mergeSx(styles.grid, sx),
45
+ className: `${theme.aggrid.theme} ${CUSTOM_AGGRID_THEME}`,
46
+ children: /* @__PURE__ */ jsx(
47
+ AgGridReact,
48
+ {
49
+ ref,
50
+ localeText: useAgGridLocale(overrideLocales),
51
+ onColumnResized,
52
+ enableCellTextSelection: true,
53
+ theme: "legacy",
54
+ ...agGridReactProps
55
+ }
56
+ )
57
+ }
58
+ );
59
+ }
60
+ );
58
61
  export {
59
62
  CustomAGGrid
60
63
  };
@@ -24,9 +24,4 @@ export declare const styles: {
24
24
  border: "none !important";
25
25
  };
26
26
  };
27
- readonly noBorderRight: {
28
- readonly '& .ag-pinned-left-header': {
29
- readonly borderRight: "none";
30
- };
31
- };
32
27
  };
@@ -27,13 +27,7 @@ const styles = {
27
27
  "& .ag-cell-focus, .ag-cell": {
28
28
  border: "none !important"
29
29
  }
30
- }),
31
- noBorderRight: {
32
- // hides right border for header of "Edit" column due to column being pinned
33
- "& .ag-pinned-left-header": {
34
- borderRight: "none"
35
- }
36
- }
30
+ })
37
31
  };
38
32
  export {
39
33
  CUSTOM_AGGRID_THEME,
@@ -13,8 +13,6 @@ import "../../overflowableText/OverflowableText.js";
13
13
  import { DirectoryItemSelector } from "../../directoryItemSelector/DirectoryItemSelector.js";
14
14
  import { fetchDirectoryElementPath } from "../../../services/directory.js";
15
15
  import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
16
- import "ag-grid-community/styles/ag-grid.css";
17
- import "ag-grid-community/styles/ag-theme-alpine.css";
18
16
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
19
17
  import "../../customAGGrid/customAggrid.js";
20
18
  import "ag-grid-community";
@@ -16,8 +16,6 @@ import "notistack";
16
16
  import "../overflowableText/OverflowableText.js";
17
17
  import "../treeViewFinder/TreeViewFinder.js";
18
18
  import "../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
19
- import "ag-grid-community/styles/ag-grid.css";
20
- import "ag-grid-community/styles/ag-theme-alpine.css";
21
19
  import "../customAGGrid/customAggrid.js";
22
20
  import "ag-grid-community";
23
21
  import "react-papaparse";