@centreon/ui 23.10.1 → 23.10.3-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/README.md +44 -14
- package/package.json +41 -23
- package/public/README.md +39 -0
- package/src/@assets/README.md +5 -0
- package/src/@assets/brand/centreon-logo-one-line-dark.svg +1 -0
- package/src/@assets/brand/centreon-logo-one-line-light.svg +1 -0
- package/src/@types/globals.d.ts +9 -0
- package/src/@types/vite-env.d.ts +2 -0
- package/src/Dialog/Duplicate/index.test.tsx +1 -1
- package/src/FallbackPage/FallbackPage.tsx +2 -2
- package/src/Home.stories.mdx +1 -84
- package/src/Image/index.stories.tsx +2 -2
- package/src/Image/index.test.tsx +3 -3
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/index.stories.tsx +0 -3
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/index.stories.tsx +0 -2
- package/src/Listing/Cell/DataCell.styles.ts +24 -0
- package/src/Listing/Cell/DataCell.tsx +26 -63
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +71 -0
- package/src/Listing/Header/{SortableCell/Content.tsx → Cell/ListingHeaderCell.tsx} +16 -84
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +26 -0
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +70 -0
- package/src/Listing/Header/ListingHeader.styles.ts +16 -0
- package/src/Listing/Header/{index.tsx → ListingHeader.tsx} +25 -98
- package/src/Listing/Header/_internals/DraggableIconButton.tsx +35 -0
- package/src/Listing/Header/{PredefinedSelectionList.tsx → _internals/PredefinedSelectionList.tsx} +1 -1
- package/src/Listing/Header/index.ts +1 -0
- package/src/Listing/Listing.styles.ts +1 -2
- package/src/Listing/index.stories.tsx +29 -3
- package/src/Listing/index.test.tsx +1 -1
- package/src/Listing/index.tsx +4 -7
- package/src/Listing/useStyleTable.ts +1 -1
- package/src/Logo/CentreonLogo.tsx +2 -2
- package/src/Module/LicensedModule/LicenseCheck/index.stories.tsx +0 -2
- package/src/Panel/Section/index.test.tsx +1 -1
- package/src/ThemeProvider/index.tsx +30 -1
- package/src/WallpaperPage/index.stories.tsx +1 -1
- package/src/Wizard/ActionsBar.test.tsx +1 -1
- package/src/Wizard/index.test.tsx +1 -1
- package/src/__image_snapshots__/storyshots-test-js-image-story-shots-listing-with-editable-and-sortable-columns-1-snap.png +0 -0
- package/.storybook/main.js +0 -82
- package/.storybook/preview.tsx +0 -21
- package/cypress/support/commands.ts +0 -19
- package/cypress/support/component-index.html +0 -12
- package/cypress/support/component.tsx +0 -5
- package/cypress.config.ts +0 -5
- package/jest.config.js +0 -20
- package/setupTests.js +0 -86
- package/src/Listing/Header/SortableCell/DraggableIcon.tsx +0 -41
- package/src/storyshots.test.js +0 -52
- package/src/testRenderer.tsx +0 -56
- package/testRunner.js +0 -36
- package/tsconfig.json +0 -29
- package/types/declarations.d.ts +0 -9
- /package/{assets → public/brand}/centreon-logo-one-line-dark.svg +0 -0
- /package/{assets → public/brand}/centreon-logo-one-line-light.svg +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-bold-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-bold-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-bold-webfont.woff2 +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-light-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-light-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-light-webfont.woff2 +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-medium-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-medium-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-medium-webfont.woff2 +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-regular-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-regular-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-regular-webfont.woff2 +0 -0
- /package/{assets → src/@assets/images}/not-authorized-template-background-dark.svg +0 -0
- /package/{assets → src/@assets/images}/not-authorized-template-background-light.svg +0 -0
- /package/src/Listing/Header/{Label.tsx → _internals/Label.tsx} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
resetMocks,
|
|
8
8
|
mockResponse,
|
|
9
9
|
getFetchCall
|
|
10
|
-
} from '
|
|
10
|
+
} from '../../../../../test/testRenderer';
|
|
11
11
|
import buildListingEndpoint from '../../../../api/buildListingEndpoint';
|
|
12
12
|
import { ConditionsSearchParameter } from '../../../../api/buildListingEndpoint/models';
|
|
13
13
|
import TestQueryProvider from '../../../../api/TestQueryProvider';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { isNil, not } from 'ramda';
|
|
4
|
-
import withMock from 'storybook-addon-mock';
|
|
5
4
|
|
|
6
5
|
import { Tooltip, Typography } from '@mui/material';
|
|
7
6
|
|
|
@@ -15,7 +14,6 @@ import MultiDraggableAutocompleteField from './Multi';
|
|
|
15
14
|
import { ItemActionProps } from '.';
|
|
16
15
|
|
|
17
16
|
export default {
|
|
18
|
-
decorators: [withMock],
|
|
19
17
|
title: 'InputField/Autocomplete/Draggable'
|
|
20
18
|
};
|
|
21
19
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
const useStyles = makeStyles()((theme) => ({
|
|
4
|
+
cell: {
|
|
5
|
+
alignItems: 'center',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
height: '100%',
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
whiteSpace: 'nowrap'
|
|
10
|
+
},
|
|
11
|
+
componentColumn: {
|
|
12
|
+
width: theme.spacing(2.75)
|
|
13
|
+
},
|
|
14
|
+
rowNotHovered: {
|
|
15
|
+
color: theme.palette.text.secondary
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
textOverflow: 'ellipsis',
|
|
20
|
+
whiteSpace: 'nowrap'
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export { useStyles };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { equals, props } from 'ramda';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
4
|
|
|
6
5
|
import { Tooltip } from '@mui/material';
|
|
7
6
|
|
|
8
7
|
import { ListingVariant } from '@centreon/ui-context';
|
|
9
8
|
|
|
10
|
-
import DraggableIcon from '../Header/SortableCell/DraggableIcon';
|
|
11
9
|
import {
|
|
12
10
|
Column,
|
|
13
11
|
ColumnType,
|
|
@@ -17,11 +15,11 @@ import {
|
|
|
17
15
|
import useStyleTable from '../useStyleTable';
|
|
18
16
|
|
|
19
17
|
import EllipsisTypography from './EllipsisTypography';
|
|
18
|
+
import { useStyles } from './DataCell.styles';
|
|
20
19
|
|
|
21
20
|
import Cell from '.';
|
|
22
21
|
|
|
23
22
|
interface Props {
|
|
24
|
-
areColumnsEditable: boolean;
|
|
25
23
|
column: Column;
|
|
26
24
|
disableRowCondition: (row) => boolean;
|
|
27
25
|
getHighlightRowCondition?: (row) => boolean;
|
|
@@ -32,31 +30,6 @@ interface Props {
|
|
|
32
30
|
viewMode?: ListingVariant;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
const useStyles = makeStyles()((theme) => ({
|
|
36
|
-
cell: {
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
backgroundColor: 'transparent',
|
|
39
|
-
display: 'flex',
|
|
40
|
-
height: '100%',
|
|
41
|
-
overflow: 'hidden',
|
|
42
|
-
whiteSpace: 'nowrap'
|
|
43
|
-
},
|
|
44
|
-
componentColumn: {
|
|
45
|
-
width: theme.spacing(2.75)
|
|
46
|
-
},
|
|
47
|
-
headerCell: {
|
|
48
|
-
padding: theme.spacing(0, 0, 0, 1)
|
|
49
|
-
},
|
|
50
|
-
rowNotHovered: {
|
|
51
|
-
color: theme.palette.text.secondary
|
|
52
|
-
},
|
|
53
|
-
text: {
|
|
54
|
-
overflow: 'hidden',
|
|
55
|
-
textOverflow: 'ellipsis',
|
|
56
|
-
whiteSpace: 'nowrap'
|
|
57
|
-
}
|
|
58
|
-
}));
|
|
59
|
-
|
|
60
33
|
const DataCell = ({
|
|
61
34
|
row,
|
|
62
35
|
column,
|
|
@@ -65,14 +38,12 @@ const DataCell = ({
|
|
|
65
38
|
rowColorConditions,
|
|
66
39
|
disableRowCondition,
|
|
67
40
|
viewMode,
|
|
68
|
-
getHighlightRowCondition
|
|
69
|
-
areColumnsEditable
|
|
41
|
+
getHighlightRowCondition
|
|
70
42
|
}: Props): JSX.Element | null => {
|
|
71
|
-
const { dataStyle } = useStyleTable({ viewMode });
|
|
72
43
|
const { classes } = useStyles();
|
|
44
|
+
const { dataStyle } = useStyleTable({ viewMode });
|
|
73
45
|
|
|
74
46
|
const commonCellProps = {
|
|
75
|
-
align: 'left' as const,
|
|
76
47
|
disableRowCondition,
|
|
77
48
|
isRowHovered,
|
|
78
49
|
row,
|
|
@@ -102,6 +73,7 @@ const DataCell = ({
|
|
|
102
73
|
|
|
103
74
|
return (
|
|
104
75
|
<Cell
|
|
76
|
+
className={classes.cell}
|
|
105
77
|
isRowHighlighted={isRowHighlighted}
|
|
106
78
|
style={{
|
|
107
79
|
gridColumn
|
|
@@ -112,10 +84,7 @@ const DataCell = ({
|
|
|
112
84
|
{isTruncated && (
|
|
113
85
|
<Tooltip title={formattedString}>{typography}</Tooltip>
|
|
114
86
|
)}
|
|
115
|
-
|
|
116
|
-
{areColumnsEditable && <DraggableIcon />}
|
|
117
|
-
{!isTruncated && typography}
|
|
118
|
-
</>
|
|
87
|
+
{!isTruncated && typography}
|
|
119
88
|
</Cell>
|
|
120
89
|
);
|
|
121
90
|
},
|
|
@@ -133,6 +102,7 @@ const DataCell = ({
|
|
|
133
102
|
|
|
134
103
|
return (
|
|
135
104
|
<Cell
|
|
105
|
+
className={classes.cell}
|
|
136
106
|
isRowHighlighted={isRowHighlighted}
|
|
137
107
|
viewMode={viewMode}
|
|
138
108
|
onClick={(e): void => {
|
|
@@ -144,31 +114,25 @@ const DataCell = ({
|
|
|
144
114
|
}}
|
|
145
115
|
{...commonCellProps}
|
|
146
116
|
>
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
/>
|
|
167
|
-
);
|
|
168
|
-
}}
|
|
169
|
-
row={row}
|
|
170
|
-
/>
|
|
171
|
-
</>
|
|
117
|
+
<Component
|
|
118
|
+
isHovered={isRowHovered}
|
|
119
|
+
isSelected={isRowSelected}
|
|
120
|
+
renderEllipsisTypography={({
|
|
121
|
+
className,
|
|
122
|
+
formattedString
|
|
123
|
+
}): JSX.Element => {
|
|
124
|
+
return (
|
|
125
|
+
<EllipsisTypography
|
|
126
|
+
className={className}
|
|
127
|
+
dataStyle={dataStyle}
|
|
128
|
+
disableRowCondition={disableRowCondition(row)}
|
|
129
|
+
formattedString={formattedString}
|
|
130
|
+
isRowHovered={isRowHovered}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
}}
|
|
134
|
+
row={row}
|
|
135
|
+
/>
|
|
172
136
|
</Cell>
|
|
173
137
|
);
|
|
174
138
|
}
|
|
@@ -280,8 +244,7 @@ const MemoizedDataCell = memo<Props>(
|
|
|
280
244
|
nextProps.disableRowCondition(nextProps.row)
|
|
281
245
|
) &&
|
|
282
246
|
equals(previousIsRowHighlighted, nextIsRowHighlighted) &&
|
|
283
|
-
equals(prevProps.viewMode, nextProps.viewMode) &&
|
|
284
|
-
equals(prevProps.areColumnsEditable, nextProps.areColumnsEditable)
|
|
247
|
+
equals(prevProps.viewMode, nextProps.viewMode) // &&
|
|
285
248
|
);
|
|
286
249
|
}
|
|
287
250
|
);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
import { ListingVariant } from '@centreon/ui-context';
|
|
4
|
+
|
|
5
|
+
import { getTextStyleByViewMode } from '../../useStyleTable';
|
|
6
|
+
|
|
7
|
+
interface StylesProps {
|
|
8
|
+
isDragging?: boolean;
|
|
9
|
+
isInDragOverlay?: boolean;
|
|
10
|
+
viewMode?: ListingVariant;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const useStyles = makeStyles<StylesProps>()(
|
|
14
|
+
(theme, { isDragging, isInDragOverlay, viewMode }) => ({
|
|
15
|
+
active: {
|
|
16
|
+
'&, &:hover, &:focus': {
|
|
17
|
+
color: theme.palette.common.white
|
|
18
|
+
},
|
|
19
|
+
'&.Mui-active': {
|
|
20
|
+
'& .MuiTableSortLabel-icon': {
|
|
21
|
+
color: theme.palette.common.white
|
|
22
|
+
},
|
|
23
|
+
color: theme.palette.common.white
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
content: {
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
borderRadius: isDragging && isInDragOverlay ? theme.spacing(0.5) : 0,
|
|
29
|
+
color: theme.palette.common.white,
|
|
30
|
+
display: 'flex',
|
|
31
|
+
height: '100%',
|
|
32
|
+
justifyContent: 'space-between'
|
|
33
|
+
},
|
|
34
|
+
dragHandle: {
|
|
35
|
+
'&, &.Mui-focus, &:focus': {
|
|
36
|
+
color: theme.palette.common.white
|
|
37
|
+
},
|
|
38
|
+
color: theme.palette.common.white,
|
|
39
|
+
|
|
40
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
41
|
+
opacity: 0,
|
|
42
|
+
padding: 0
|
|
43
|
+
},
|
|
44
|
+
simpleHeaderCellContent: {
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
display: 'inline-flex',
|
|
47
|
+
marginRight: theme.spacing(2),
|
|
48
|
+
userSelect: 'none'
|
|
49
|
+
},
|
|
50
|
+
tableCell: {
|
|
51
|
+
backgroundColor: isInDragOverlay
|
|
52
|
+
? 'transparent'
|
|
53
|
+
: theme.palette.background.listingHeader,
|
|
54
|
+
borderBottom: 'none',
|
|
55
|
+
height: 'inherit',
|
|
56
|
+
padding: theme.spacing(0, 1),
|
|
57
|
+
...getTextStyleByViewMode({ theme, viewMode }),
|
|
58
|
+
'&:hover, &:focus-within, &[data-isdragging=true]': {
|
|
59
|
+
'& .dragHandle': {
|
|
60
|
+
opacity: 1
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
'&[data-isindragoverlay=true]': {
|
|
64
|
+
display: 'block',
|
|
65
|
+
opacity: 0.7
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
export { useStyles, StylesProps };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import { always, and, equals, ifElse, isNil } from 'ramda';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
4
|
|
|
6
5
|
import {
|
|
7
6
|
TableCell,
|
|
@@ -10,64 +9,12 @@ import {
|
|
|
10
9
|
Tooltip
|
|
11
10
|
} from '@mui/material';
|
|
12
11
|
|
|
13
|
-
import { ListingVariant } from '@centreon/ui-context';
|
|
14
|
-
|
|
15
12
|
import { Props as ListingProps } from '../..';
|
|
16
13
|
import { Column } from '../../models';
|
|
17
|
-
import HeaderLabel from '../Label';
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
import DraggableIcon from './DraggableIcon';
|
|
21
|
-
|
|
22
|
-
type StylesProps = Pick<Props, 'isDragging' | 'isInDragOverlay' | 'viewMode'>;
|
|
14
|
+
import HeaderLabel from '../_internals/Label';
|
|
15
|
+
import { DraggableIconButton } from '../_internals/DraggableIconButton';
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
(theme, { isDragging, isInDragOverlay, viewMode }) => ({
|
|
26
|
-
active: {
|
|
27
|
-
'&.Mui-active': {
|
|
28
|
-
'& .MuiTableSortLabel-icon': {
|
|
29
|
-
color: theme.palette.common.white
|
|
30
|
-
},
|
|
31
|
-
color: theme.palette.common.white
|
|
32
|
-
},
|
|
33
|
-
'&:hover': {
|
|
34
|
-
'& .MuiTableSortLabel-icon': {
|
|
35
|
-
opacity: 1
|
|
36
|
-
},
|
|
37
|
-
color: theme.palette.common.white
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
content: {
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
borderRadius: isDragging && isInDragOverlay ? theme.spacing(0.5) : 0,
|
|
43
|
-
color: theme.palette.common.white,
|
|
44
|
-
display: 'flex',
|
|
45
|
-
height: '100%'
|
|
46
|
-
},
|
|
47
|
-
dragHandle: {
|
|
48
|
-
'&, &.Mui-focus, &:focus': {
|
|
49
|
-
outline: 'none'
|
|
50
|
-
},
|
|
51
|
-
alignSelf: 'center',
|
|
52
|
-
cursor: isDragging ? 'grabbing' : 'grab',
|
|
53
|
-
display: 'flex'
|
|
54
|
-
},
|
|
55
|
-
simpleHeaderCellContent: {
|
|
56
|
-
alignItems: 'center',
|
|
57
|
-
display: 'inline-flex',
|
|
58
|
-
marginRight: theme.spacing(2)
|
|
59
|
-
},
|
|
60
|
-
tableCell: {
|
|
61
|
-
backgroundColor: isInDragOverlay
|
|
62
|
-
? 'transparent'
|
|
63
|
-
: theme.palette.background.listingHeader,
|
|
64
|
-
borderBottom: 'none',
|
|
65
|
-
height: 'inherit',
|
|
66
|
-
padding: theme.spacing(0, 1),
|
|
67
|
-
...getTextStyleByViewMode({ theme, viewMode })
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
);
|
|
17
|
+
import { StylesProps, useStyles } from './ListingHeaderCell.styles';
|
|
71
18
|
|
|
72
19
|
type Props = Pick<
|
|
73
20
|
ListingProps<unknown>,
|
|
@@ -76,14 +23,11 @@ type Props = Pick<
|
|
|
76
23
|
areColumnsEditable: boolean;
|
|
77
24
|
className: string;
|
|
78
25
|
column: Column;
|
|
79
|
-
isDragging?: boolean;
|
|
80
|
-
isInDragOverlay?: boolean;
|
|
81
26
|
itemRef: React.RefObject<HTMLDivElement>;
|
|
82
27
|
style;
|
|
83
|
-
|
|
84
|
-
};
|
|
28
|
+
} & StylesProps;
|
|
85
29
|
|
|
86
|
-
const
|
|
30
|
+
const ListingHeaderCell = ({
|
|
87
31
|
column,
|
|
88
32
|
columnConfiguration,
|
|
89
33
|
sortField,
|
|
@@ -102,8 +46,6 @@ const SortableHeaderCellContent = ({
|
|
|
102
46
|
isInDragOverlay,
|
|
103
47
|
viewMode
|
|
104
48
|
});
|
|
105
|
-
const [cellHovered, setCellHovered] = React.useState(false);
|
|
106
|
-
|
|
107
49
|
const columnLabel = column.shortLabel || column.label;
|
|
108
50
|
|
|
109
51
|
const columnSortField = column.sortField || column.id;
|
|
@@ -122,14 +64,6 @@ const SortableHeaderCellContent = ({
|
|
|
122
64
|
});
|
|
123
65
|
};
|
|
124
66
|
|
|
125
|
-
const mouseOver = (): void => {
|
|
126
|
-
setCellHovered(true);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const mouseOut = (): void => {
|
|
130
|
-
setCellHovered(false);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
67
|
const headerContent = (
|
|
134
68
|
<Tooltip placement="top" title={getTooltipLabel(column.shortLabel)}>
|
|
135
69
|
<HeaderLabel>{columnLabel}</HeaderLabel>
|
|
@@ -140,22 +74,12 @@ const SortableHeaderCellContent = ({
|
|
|
140
74
|
<TableCell
|
|
141
75
|
className={classes.tableCell}
|
|
142
76
|
component={'div' as unknown as React.ElementType<TableCellBaseProps>}
|
|
77
|
+
data-isdragging={isDragging}
|
|
78
|
+
data-isindragoverlay={isInDragOverlay}
|
|
143
79
|
ref={itemRef}
|
|
144
80
|
style={style}
|
|
145
|
-
onMouseOut={mouseOut}
|
|
146
|
-
onMouseOver={mouseOver}
|
|
147
81
|
>
|
|
148
82
|
<div className={classes.content}>
|
|
149
|
-
{columnConfiguration?.sortable && areColumnsEditable && (
|
|
150
|
-
<DraggableIcon
|
|
151
|
-
visible={cellHovered}
|
|
152
|
-
{...props}
|
|
153
|
-
isInteractive
|
|
154
|
-
className={cx(classes.dragHandle)}
|
|
155
|
-
columnLabel={columnLabel}
|
|
156
|
-
/>
|
|
157
|
-
)}
|
|
158
|
-
|
|
159
83
|
{column.sortable ? (
|
|
160
84
|
<TableSortLabel
|
|
161
85
|
active={sortField === columnSortField}
|
|
@@ -169,9 +93,17 @@ const SortableHeaderCellContent = ({
|
|
|
169
93
|
) : (
|
|
170
94
|
<div className={classes.simpleHeaderCellContent}>{headerContent}</div>
|
|
171
95
|
)}
|
|
96
|
+
|
|
97
|
+
{columnConfiguration?.sortable && areColumnsEditable && (
|
|
98
|
+
<DraggableIconButton
|
|
99
|
+
{...props}
|
|
100
|
+
className={cx(classes.dragHandle, 'dragHandle')}
|
|
101
|
+
columnLabel={columnLabel}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
172
104
|
</div>
|
|
173
105
|
</TableCell>
|
|
174
106
|
);
|
|
175
107
|
};
|
|
176
108
|
|
|
177
|
-
export default
|
|
109
|
+
export default ListingHeaderCell;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
const useStyles = makeStyles()((theme) => ({
|
|
4
|
+
checkbox: {
|
|
5
|
+
'&.Mui-checked': {
|
|
6
|
+
color: theme.palette.common.white
|
|
7
|
+
},
|
|
8
|
+
'&.MuiCheckbox-indeterminate': {
|
|
9
|
+
color: theme.palette.common.white
|
|
10
|
+
},
|
|
11
|
+
color: theme.palette.common.white
|
|
12
|
+
},
|
|
13
|
+
checkboxHeaderCell: {
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
backgroundColor: theme.palette.background.listingHeader,
|
|
16
|
+
borderBottom: 'none',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
justifyContent: 'start',
|
|
19
|
+
lineHeight: 'inherit'
|
|
20
|
+
},
|
|
21
|
+
predefinedRowsMenu: {
|
|
22
|
+
color: theme.palette.common.white
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
export { useStyles };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { equals, isEmpty, not } from 'ramda';
|
|
4
|
+
|
|
5
|
+
import { TableCell, TableCellBaseProps } from '@mui/material';
|
|
6
|
+
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
7
|
+
|
|
8
|
+
import Checkbox from '../../Checkbox';
|
|
9
|
+
import PopoverMenu from '../../../PopoverMenu';
|
|
10
|
+
import { labelPredefinedRowsSelectionMenu } from '../../translatedLabels';
|
|
11
|
+
import PredefinedSelectionList from '../_internals/PredefinedSelectionList';
|
|
12
|
+
import { PredefinedRowSelection } from '../../models';
|
|
13
|
+
|
|
14
|
+
import { useStyles } from './SelectActionListingHeaderCell.styles';
|
|
15
|
+
|
|
16
|
+
export interface SelectActionListingHeaderCellProps {
|
|
17
|
+
onSelectAllClick: (event) => void;
|
|
18
|
+
onSelectRowsWithCondition: (condition) => void;
|
|
19
|
+
predefinedRowsSelection: Array<PredefinedRowSelection>;
|
|
20
|
+
rowCount: number;
|
|
21
|
+
selectedRowCount: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const SelectActionListingHeaderCell = ({
|
|
25
|
+
rowCount,
|
|
26
|
+
onSelectAllClick,
|
|
27
|
+
selectedRowCount,
|
|
28
|
+
predefinedRowsSelection,
|
|
29
|
+
onSelectRowsWithCondition
|
|
30
|
+
}: SelectActionListingHeaderCellProps): JSX.Element => {
|
|
31
|
+
const { classes } = useStyles();
|
|
32
|
+
|
|
33
|
+
const hasRows = not(equals(rowCount, 0));
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<TableCell
|
|
37
|
+
className={classes.checkboxHeaderCell}
|
|
38
|
+
component={'div' as unknown as React.ElementType<TableCellBaseProps>}
|
|
39
|
+
>
|
|
40
|
+
<Checkbox
|
|
41
|
+
checked={hasRows && selectedRowCount === rowCount}
|
|
42
|
+
className={classes.checkbox}
|
|
43
|
+
indeterminate={
|
|
44
|
+
hasRows && selectedRowCount > 0 && selectedRowCount < rowCount
|
|
45
|
+
}
|
|
46
|
+
inputProps={{ 'aria-label': 'Select all' }}
|
|
47
|
+
onChange={onSelectAllClick}
|
|
48
|
+
/>
|
|
49
|
+
{not(isEmpty(predefinedRowsSelection)) ? (
|
|
50
|
+
<PopoverMenu
|
|
51
|
+
className={classes.predefinedRowsMenu}
|
|
52
|
+
icon={<ArrowDropDownIcon />}
|
|
53
|
+
title={labelPredefinedRowsSelectionMenu}
|
|
54
|
+
>
|
|
55
|
+
{({ close }): JSX.Element => (
|
|
56
|
+
<PredefinedSelectionList
|
|
57
|
+
close={close}
|
|
58
|
+
predefinedRowsSelection={predefinedRowsSelection}
|
|
59
|
+
onSelectRowsWithCondition={onSelectRowsWithCondition}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
</PopoverMenu>
|
|
63
|
+
) : (
|
|
64
|
+
<div className={classes.predefinedRowsMenu} />
|
|
65
|
+
)}
|
|
66
|
+
</TableCell>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { SelectActionListingHeaderCell };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
|
|
3
|
+
const useStyles = makeStyles()((theme) => ({
|
|
4
|
+
headerLabelDragging: {
|
|
5
|
+
cursor: 'grabbing'
|
|
6
|
+
},
|
|
7
|
+
root: {
|
|
8
|
+
height: '100%',
|
|
9
|
+
padding: theme.spacing(0, 1)
|
|
10
|
+
},
|
|
11
|
+
row: {
|
|
12
|
+
display: 'contents'
|
|
13
|
+
}
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
export { useStyles };
|