@gridsuite/commons-ui 0.94.0 → 0.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/checkBoxList/CheckBoxList.d.ts +1 -1
- package/dist/components/checkBoxList/CheckBoxList.js +3 -11
- package/dist/components/checkBoxList/CheckBoxListItem.d.ts +1 -1
- package/dist/components/checkBoxList/CheckBoxListItem.js +47 -14
- package/dist/components/checkBoxList/CheckBoxListItemContent.d.ts +2 -0
- package/dist/components/checkBoxList/CheckBoxListItemContent.js +45 -0
- package/dist/components/checkBoxList/CheckBoxListItems.d.ts +1 -1
- package/dist/components/checkBoxList/CheckBoxListItems.js +24 -20
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.d.ts +1 -1
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +46 -17
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.d.ts +2 -0
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.js +38 -0
- package/dist/components/checkBoxList/checkBoxList.type.d.ts +9 -11
- package/dist/components/customAGGrid/customAggrid.d.ts +11 -8
- package/dist/components/customAGGrid/customAggrid.js +51 -48
- package/dist/components/customAGGrid/customAggrid.style.d.ts +0 -5
- package/dist/components/customAGGrid/customAggrid.style.js +1 -7
- package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +0 -2
- package/dist/components/filter/HeaderFilterForm.js +0 -2
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.d.ts +4 -11
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +0 -23
- package/dist/components/topBar/TopBar.d.ts +3 -5
- package/dist/components/topBar/TopBar.js +2 -1
- package/dist/hooks/useLocalizedCountries.js +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/constants/index.d.ts +0 -1
- package/dist/utils/constants/index.js +0 -6
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -2
- package/dist/utils/langs.d.ts +5 -0
- package/dist/utils/{constants/browserConstants.js → langs.js} +1 -5
- package/dist/utils/styles.d.ts +3 -0
- package/dist/utils/styles.js +4 -0
- package/dist/utils/types/equipmentType.js +1 -1
- package/package.json +2 -1
- package/dist/components/checkBoxList/ClickableCheckBoxItem.d.ts +0 -2
- package/dist/components/checkBoxList/ClickableCheckBoxItem.js +0 -12
- package/dist/components/checkBoxList/ClickableRowItem.d.ts +0 -2
- package/dist/components/checkBoxList/ClickableRowItem.js +0 -51
- package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.d.ts +0 -2
- package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.js +0 -50
- package/dist/components/checkBoxList/DraggableClickableRowItem.d.ts +0 -2
- package/dist/components/checkBoxList/DraggableClickableRowItem.js +0 -77
- 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>({
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
5
|
-
import
|
|
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:
|
|
55
|
+
sx: mergeSx(styles.checkboxListItem, sx == null ? void 0 : sx.checkboxListItem),
|
|
22
56
|
onMouseEnter: () => setHover(getItemId(item)),
|
|
23
57
|
onMouseLeave: () => setHover(""),
|
|
24
|
-
disablePadding:
|
|
25
|
-
disableGutters: true,
|
|
58
|
+
disablePadding: true,
|
|
26
59
|
divider,
|
|
27
|
-
children:
|
|
28
|
-
|
|
60
|
+
children: onItemClick ? /* @__PURE__ */ jsx(
|
|
61
|
+
ListItemButton,
|
|
29
62
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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,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,
|
|
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
|
|
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
|
-
|
|
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__ */
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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 (
|
|
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 {
|
|
5
|
-
import
|
|
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:
|
|
47
|
+
sx: mergeSx(styles.checkboxListItem, sx == null ? void 0 : sx.checkboxListItem),
|
|
24
48
|
onMouseEnter: () => setHover(getItemId(item)),
|
|
25
49
|
onMouseLeave: () => setHover(""),
|
|
26
|
-
disablePadding:
|
|
27
|
-
disableGutters: true,
|
|
28
|
-
divider,
|
|
50
|
+
disablePadding: true,
|
|
29
51
|
ref: provided.innerRef,
|
|
30
52
|
...provided.draggableProps,
|
|
31
|
-
children:
|
|
32
|
-
|
|
53
|
+
children: (isItemClickable == null ? void 0 : isItemClickable(item)) ? /* @__PURE__ */ jsx(
|
|
54
|
+
ListItemButton,
|
|
33
55
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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,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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
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
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
};
|
|
@@ -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";
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { CustomAGGridProps } from '../../../customAGGrid';
|
|
2
|
+
export type CustomAgGridTableProps = Required<Pick<CustomAGGridProps, 'columnDefs' | 'defaultColDef' | 'pagination' | 'paginationPageSize' | 'alwaysShowVerticalScroll' | 'stopEditingWhenCellsLoseFocus'>> & Pick<CustomAGGridProps, 'rowSelection' | 'overrideLocales'> & {
|
|
3
3
|
name: string;
|
|
4
|
-
columnDefs: any;
|
|
5
4
|
makeDefaultRowData: any;
|
|
6
5
|
csvProps: unknown;
|
|
7
6
|
cssProps: unknown;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
paginationPageSize: number;
|
|
11
|
-
rowSelection?: AgGridReactProps['rowSelection'];
|
|
12
|
-
alwaysShowVerticalScroll: boolean;
|
|
13
|
-
stopEditingWhenCellsLoseFocus: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function CustomAgGridTable({ name, columnDefs, makeDefaultRowData, csvProps, cssProps, defaultColDef, pagination, paginationPageSize, rowSelection, alwaysShowVerticalScroll, stopEditingWhenCellsLoseFocus, ...props }: Readonly<CustomAgGridTableProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export declare function CustomAgGridTable({ name, makeDefaultRowData, csvProps, cssProps, rowSelection, ...props }: Readonly<CustomAgGridTableProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFormContext, useFieldArray } from "react-hook-form";
|
|
4
|
-
import "ag-grid-community/styles/ag-grid.css";
|
|
5
|
-
import "ag-grid-community/styles/ag-theme-alpine.css";
|
|
6
4
|
import { useTheme, Box } from "@mui/material";
|
|
7
|
-
import { useIntl } from "react-intl";
|
|
8
5
|
import { BottomRightButtons } from "./BottomRightButtons.js";
|
|
9
6
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
10
7
|
import { CustomAGGrid } from "../../../customAGGrid/customAggrid.js";
|
|
@@ -65,16 +62,10 @@ const style = (customProps) => ({
|
|
|
65
62
|
});
|
|
66
63
|
function CustomAgGridTable({
|
|
67
64
|
name,
|
|
68
|
-
columnDefs,
|
|
69
65
|
makeDefaultRowData,
|
|
70
66
|
csvProps,
|
|
71
67
|
cssProps,
|
|
72
|
-
defaultColDef,
|
|
73
|
-
pagination,
|
|
74
|
-
paginationPageSize,
|
|
75
68
|
rowSelection,
|
|
76
|
-
alwaysShowVerticalScroll,
|
|
77
|
-
stopEditingWhenCellsLoseFocus,
|
|
78
69
|
...props
|
|
79
70
|
}) {
|
|
80
71
|
var _a, _b;
|
|
@@ -136,14 +127,6 @@ function CustomAgGridTable({
|
|
|
136
127
|
append(makeDefaultRowData());
|
|
137
128
|
setNewRowAdded(true);
|
|
138
129
|
};
|
|
139
|
-
const intl = useIntl();
|
|
140
|
-
const getLocaleText = useCallback(
|
|
141
|
-
(params) => {
|
|
142
|
-
const key = `agGrid.${params.key}`;
|
|
143
|
-
return intl.messages[key] || params.defaultValue;
|
|
144
|
-
},
|
|
145
|
-
[intl]
|
|
146
|
-
);
|
|
147
130
|
const onGridReady = (params) => {
|
|
148
131
|
setGridApi(params);
|
|
149
132
|
};
|
|
@@ -175,13 +158,11 @@ function CustomAgGridTable({
|
|
|
175
158
|
{
|
|
176
159
|
rowData,
|
|
177
160
|
onGridReady,
|
|
178
|
-
getLocaleText,
|
|
179
161
|
cacheOverflowSize: 10,
|
|
180
162
|
rowSelection: rowSelection ?? "multiple",
|
|
181
163
|
rowDragEntireRow: true,
|
|
182
164
|
rowDragManaged: true,
|
|
183
165
|
onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
|
|
184
|
-
columnDefs,
|
|
185
166
|
detailRowAutoHeight: true,
|
|
186
167
|
onSelectionChanged: () => {
|
|
187
168
|
setSelectedRows(gridApi.api.getSelectedRows());
|
|
@@ -190,10 +171,6 @@ function CustomAgGridTable({
|
|
|
190
171
|
onCellEditingStopped,
|
|
191
172
|
onSortChanged,
|
|
192
173
|
getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
|
|
193
|
-
pagination,
|
|
194
|
-
paginationPageSize,
|
|
195
|
-
alwaysShowVerticalScroll,
|
|
196
|
-
stopEditingWhenCellsLoseFocus,
|
|
197
174
|
theme: "legacy",
|
|
198
175
|
...props
|
|
199
176
|
}
|
|
@@ -3,11 +3,9 @@ import { User } from 'oidc-client';
|
|
|
3
3
|
import { GridLogoProps } from './GridLogo';
|
|
4
4
|
import { AboutDialogProps } from './AboutDialog';
|
|
5
5
|
import { LogoutProps } from '../authentication/Logout';
|
|
6
|
-
import { Metadata } from '../../utils';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
export type GsLang = GsLangUser | typeof LANG_SYSTEM;
|
|
10
|
-
export type GsTheme = typeof LIGHT_THEME | typeof DARK_THEME;
|
|
6
|
+
import { Metadata } from '../../utils/types/metadata';
|
|
7
|
+
import { GsTheme } from '../../utils/styles';
|
|
8
|
+
import { GsLang } from '../../utils/langs';
|
|
11
9
|
export type TopBarProps = Omit<GridLogoProps, 'onClick'> & Omit<LogoutProps, 'disabled'> & Omit<AboutDialogProps, 'open' | 'onClose'> & {
|
|
12
10
|
onLogoClick: GridLogoProps['onClick'];
|
|
13
11
|
user?: User;
|
|
@@ -8,7 +8,8 @@ import { AboutDialog } from "./AboutDialog.js";
|
|
|
8
8
|
import { useStateBoolean } from "../../hooks/customStates/useStateBoolean.js";
|
|
9
9
|
import UserInformationDialog from "./UserInformationDialog.js";
|
|
10
10
|
import UserSettingsDialog from "./UserSettingsDialog.js";
|
|
11
|
-
import { LIGHT_THEME, DARK_THEME
|
|
11
|
+
import { LIGHT_THEME, DARK_THEME } from "../../utils/styles.js";
|
|
12
|
+
import { LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH } from "../../utils/langs.js";
|
|
12
13
|
import MessageBanner from "./MessageBanner.js";
|
|
13
14
|
const styles = {
|
|
14
15
|
grow: {
|
|
@@ -2,7 +2,7 @@ import { useState, useEffect, useMemo, useCallback } from "react";
|
|
|
2
2
|
import localizedCountries from "localized-countries";
|
|
3
3
|
import countriesFr from "localized-countries/data/fr";
|
|
4
4
|
import countriesEn from "localized-countries/data/en";
|
|
5
|
-
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "../utils/
|
|
5
|
+
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "../utils/langs.js";
|
|
6
6
|
const supportedLanguages = [LANG_FRENCH, LANG_ENGLISH];
|
|
7
7
|
const getSystemLanguage = () => {
|
|
8
8
|
const systemLanguage = navigator.language.split(/[-_]/)[0];
|
package/dist/index.js
CHANGED
|
@@ -126,16 +126,16 @@ import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefau
|
|
|
126
126
|
import { elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders } from "./services/directory.js";
|
|
127
127
|
import { exportFilter } from "./services/study.js";
|
|
128
128
|
import { equalsArray } from "./utils/algos.js";
|
|
129
|
-
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./utils/constants/browserConstants.js";
|
|
130
129
|
import { FetchStatus } from "./utils/constants/fetchStatus.js";
|
|
131
130
|
import { FieldConstants } from "./utils/constants/fieldConstants.js";
|
|
132
131
|
import { MAX_CHAR_DESCRIPTION } from "./utils/constants/uiConstants.js";
|
|
133
132
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./utils/constants/unitsConstants.js";
|
|
134
133
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
135
134
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
135
|
+
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./utils/langs.js";
|
|
136
136
|
import { getFileIcon } from "./utils/mapper/getFileIcon.js";
|
|
137
137
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
138
|
-
import { makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
|
|
138
|
+
import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
|
|
139
139
|
import { ElementType } from "./utils/types/elementType.js";
|
|
140
140
|
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";
|
|
141
141
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./utils/types/equipmentTypes.js";
|
|
@@ -4,7 +4,6 @@
|
|
|
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 './browserConstants';
|
|
8
7
|
export * from './fetchStatus';
|
|
9
8
|
export * from './fieldConstants';
|
|
10
9
|
export * from './uiConstants';
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./browserConstants.js";
|
|
2
1
|
import { FetchStatus } from "./fetchStatus.js";
|
|
3
2
|
import { FieldConstants } from "./fieldConstants.js";
|
|
4
3
|
import { MAX_CHAR_DESCRIPTION } from "./uiConstants.js";
|
|
5
4
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./unitsConstants.js";
|
|
6
5
|
export {
|
|
7
6
|
AMPERE,
|
|
8
|
-
DARK_THEME,
|
|
9
7
|
DEGREE,
|
|
10
8
|
FetchStatus,
|
|
11
9
|
FieldConstants,
|
|
12
10
|
KILO_AMPERE,
|
|
13
11
|
KILO_METER,
|
|
14
12
|
KILO_VOLT,
|
|
15
|
-
LANG_ENGLISH,
|
|
16
|
-
LANG_FRENCH,
|
|
17
|
-
LANG_SYSTEM,
|
|
18
|
-
LIGHT_THEME,
|
|
19
13
|
MAX_CHAR_DESCRIPTION,
|
|
20
14
|
MEGA_VAR,
|
|
21
15
|
MEGA_VOLT_AMPERE,
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { equalsArray } from "./algos.js";
|
|
2
|
-
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./constants/browserConstants.js";
|
|
3
2
|
import { FetchStatus } from "./constants/fetchStatus.js";
|
|
4
3
|
import { FieldConstants } from "./constants/fieldConstants.js";
|
|
5
4
|
import { MAX_CHAR_DESCRIPTION } from "./constants/uiConstants.js";
|
|
6
5
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./constants/unitsConstants.js";
|
|
7
6
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
8
7
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
8
|
+
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
|
|
9
9
|
import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
10
10
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
11
|
-
import { makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
|
|
11
|
+
import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
|
|
12
12
|
import { ElementType } from "./types/elementType.js";
|
|
13
13
|
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./types/equipmentType.js";
|
|
14
14
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./types/equipmentTypes.js";
|
package/dist/utils/styles.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
export declare const DARK_THEME = "Dark";
|
|
3
|
+
export declare const LIGHT_THEME = "Light";
|
|
4
|
+
export type GsTheme = typeof LIGHT_THEME | typeof DARK_THEME;
|
|
2
5
|
export declare const makeComposeClasses: (generateGlobalClass: (className: string) => string) => (classes: Record<string, string>, ruleName: string) => string;
|
|
3
6
|
export declare const toNestedGlobalSelectors: (styles: object, generateGlobalClass: (className: string) => string) => {
|
|
4
7
|
[k: string]: any;
|
package/dist/utils/styles.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const DARK_THEME = "Dark";
|
|
2
|
+
const LIGHT_THEME = "Light";
|
|
1
3
|
const makeComposeClasses = (generateGlobalClass) => (classes, ruleName) => [generateGlobalClass(ruleName), classes[ruleName]].filter((x) => x).join(" ");
|
|
2
4
|
const toNestedGlobalSelectors = (styles, generateGlobalClass) => Object.fromEntries(Object.entries(styles).map(([k, v]) => [`& .${generateGlobalClass(k)}`, v]));
|
|
3
5
|
const isSxProps = (sx) => {
|
|
@@ -5,6 +7,8 @@ const isSxProps = (sx) => {
|
|
|
5
7
|
};
|
|
6
8
|
const mergeSx = (...allSx) => allSx.filter(isSxProps).flat();
|
|
7
9
|
export {
|
|
10
|
+
DARK_THEME,
|
|
11
|
+
LIGHT_THEME,
|
|
8
12
|
makeComposeClasses,
|
|
9
13
|
mergeSx,
|
|
10
14
|
toNestedGlobalSelectors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridsuite/commons-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"description": "common react components for gridsuite applications",
|
|
5
5
|
"author": "gridsuite team",
|
|
6
6
|
"homepage": "https://github.com/gridsuite",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"licenses-check": "license-checker --summary --excludePrivatePackages --production --onlyAllow \"$( jq -r .onlyAllow[] license-checker-config.json | tr '\n' ';')\" --excludePackages \"$( jq -r .excludePackages[] license-checker-config.json | tr '\n' ';')\""
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@ag-grid-community/locale": "^33.1.0",
|
|
37
38
|
"@hello-pangea/dnd": "^18.0.1",
|
|
38
39
|
"@react-querybuilder/dnd": "^8.2.0",
|
|
39
40
|
"@react-querybuilder/material": "^8.2.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
function ClickableCheckBoxItem({ sx, label, ...props }) {
|
|
5
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6
|
-
/* @__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 }) }),
|
|
7
|
-
/* @__PURE__ */ jsx(ListItemText, { sx: { display: "flex" }, disableTypography: true, children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label }) })
|
|
8
|
-
] });
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
ClickableCheckBoxItem
|
|
12
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ListItemButton, ListItemIcon, Checkbox, ListItemText } from "@mui/material";
|
|
3
|
-
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
4
|
-
const styles = {
|
|
5
|
-
unclickableItem: {
|
|
6
|
-
"&:hover": {
|
|
7
|
-
backgroundColor: "transparent"
|
|
8
|
-
},
|
|
9
|
-
cursor: "inherit"
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
function ClickableRowItem({
|
|
13
|
-
sx,
|
|
14
|
-
disabled,
|
|
15
|
-
label,
|
|
16
|
-
onClick,
|
|
17
|
-
onItemClick,
|
|
18
|
-
isItemClickable = true,
|
|
19
|
-
...props
|
|
20
|
-
}) {
|
|
21
|
-
const onCheckboxClick = (event) => {
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
onClick();
|
|
24
|
-
};
|
|
25
|
-
const handleItemClick = () => isItemClickable && onItemClick();
|
|
26
|
-
return /* @__PURE__ */ jsxs(
|
|
27
|
-
ListItemButton,
|
|
28
|
-
{
|
|
29
|
-
disableTouchRipple: !isItemClickable,
|
|
30
|
-
sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkboxButton, ...!isItemClickable && styles.unclickableItem },
|
|
31
|
-
disabled,
|
|
32
|
-
onClick: handleItemClick,
|
|
33
|
-
children: [
|
|
34
|
-
/* @__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 }) }),
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
ListItemText,
|
|
37
|
-
{
|
|
38
|
-
sx: {
|
|
39
|
-
display: "flex"
|
|
40
|
-
},
|
|
41
|
-
disableTypography: true,
|
|
42
|
-
children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
export {
|
|
50
|
-
ClickableRowItem
|
|
51
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { DraggableClickableCheckBoxItemProps } from './checkBoxList.type';
|
|
2
|
-
export declare function DraggableClickableCheckBoxItem({ sx, disabled, provided, isHighlighted, label, ...props }: Readonly<DraggableClickableCheckBoxItemProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DragIndicator } from "@mui/icons-material";
|
|
3
|
-
import { IconButton, ListItemIcon, Checkbox, ListItemText } from "@mui/material";
|
|
4
|
-
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
5
|
-
const styles = {
|
|
6
|
-
dragIcon: (theme) => ({
|
|
7
|
-
padding: "unset",
|
|
8
|
-
border: theme.spacing(0),
|
|
9
|
-
borderRadius: theme.spacing(0),
|
|
10
|
-
zIndex: 90
|
|
11
|
-
})
|
|
12
|
-
};
|
|
13
|
-
function DraggableClickableCheckBoxItem({
|
|
14
|
-
sx,
|
|
15
|
-
disabled,
|
|
16
|
-
provided,
|
|
17
|
-
isHighlighted,
|
|
18
|
-
label,
|
|
19
|
-
...props
|
|
20
|
-
}) {
|
|
21
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
-
/* @__PURE__ */ jsx(
|
|
23
|
-
IconButton,
|
|
24
|
-
{
|
|
25
|
-
...provided.dragHandleProps,
|
|
26
|
-
size: "small",
|
|
27
|
-
sx: {
|
|
28
|
-
opacity: isHighlighted ? "1" : "0",
|
|
29
|
-
padding: "unset",
|
|
30
|
-
...styles.dragIcon
|
|
31
|
-
},
|
|
32
|
-
children: /* @__PURE__ */ jsx(DragIndicator, { spacing: 0 })
|
|
33
|
-
}
|
|
34
|
-
),
|
|
35
|
-
/* @__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 }) }),
|
|
36
|
-
/* @__PURE__ */ jsx(
|
|
37
|
-
ListItemText,
|
|
38
|
-
{
|
|
39
|
-
sx: {
|
|
40
|
-
display: "flex"
|
|
41
|
-
},
|
|
42
|
-
disableTypography: true,
|
|
43
|
-
children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
] });
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
DraggableClickableCheckBoxItem
|
|
50
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { DraggableClickableRowItemProps } from './checkBoxList.type';
|
|
2
|
-
export declare function DraggableClickableRowItem({ sx, disabled, onClick, provided, isHighlighted, label, onItemClick, isItemClickable, ...props }: Readonly<DraggableClickableRowItemProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DragIndicator } from "@mui/icons-material";
|
|
3
|
-
import { ListItemButton, IconButton, ListItemIcon, Checkbox, ListItemText } from "@mui/material";
|
|
4
|
-
import { OverflowableText } from "../overflowableText/OverflowableText.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
|
-
const styles = {
|
|
10
|
-
dragIcon: (theme) => ({
|
|
11
|
-
padding: "unset",
|
|
12
|
-
border: theme.spacing(0),
|
|
13
|
-
borderRadius: theme.spacing(0),
|
|
14
|
-
zIndex: 90
|
|
15
|
-
}),
|
|
16
|
-
unclickableItem: {
|
|
17
|
-
"&:hover": {
|
|
18
|
-
backgroundColor: "transparent"
|
|
19
|
-
},
|
|
20
|
-
cursor: "inherit"
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
function DraggableClickableRowItem({
|
|
24
|
-
sx,
|
|
25
|
-
disabled,
|
|
26
|
-
onClick,
|
|
27
|
-
provided,
|
|
28
|
-
isHighlighted,
|
|
29
|
-
label,
|
|
30
|
-
onItemClick,
|
|
31
|
-
isItemClickable = true,
|
|
32
|
-
...props
|
|
33
|
-
}) {
|
|
34
|
-
const onCheckboxClick = (event) => {
|
|
35
|
-
event.stopPropagation();
|
|
36
|
-
onClick();
|
|
37
|
-
};
|
|
38
|
-
const handleItemClick = () => isItemClickable && onItemClick();
|
|
39
|
-
return /* @__PURE__ */ jsxs(
|
|
40
|
-
ListItemButton,
|
|
41
|
-
{
|
|
42
|
-
disableTouchRipple: !isItemClickable,
|
|
43
|
-
sx: mergeSx({ paddingLeft: 0 }, sx == null ? void 0 : sx.checkboxButton, !isItemClickable ? styles.unclickableItem : void 0),
|
|
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(DragIndicator, { 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
|
-
);
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
DraggableClickableRowItem
|
|
77
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
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 declare const DARK_THEME = "Dark";
|
|
8
|
-
export declare const LIGHT_THEME = "Light";
|
|
9
|
-
export declare const LANG_SYSTEM = "sys";
|
|
10
|
-
export declare const LANG_ENGLISH = "en";
|
|
11
|
-
export declare const LANG_FRENCH = "fr";
|