@centreon/ui 25.5.8 → 25.6.1
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/package.json +15 -6
- package/src/Dashboard/Dashboard.styles.ts +1 -1
- package/src/Dashboard/Layout.tsx +1 -1
- package/src/Graph/BarChart/BarChart.cypress.spec.tsx +0 -2
- package/src/Listing/ActionBar/Pagination.tsx +10 -23
- package/src/Listing/ActionBar/PaginationActions.tsx +1 -10
- package/src/Listing/Cell/DataCell.tsx +6 -6
- package/src/Listing/Cell/EllipsisTypography.tsx +10 -32
- package/src/Listing/Cell/index.tsx +37 -76
- package/src/Listing/Checkbox.tsx +8 -20
- package/src/Listing/Header/Cell/ListingHeaderCell.tsx +17 -14
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +5 -9
- package/src/Listing/Header/ListingHeader.tsx +2 -5
- package/src/Listing/Header/_internals/Label.tsx +1 -17
- package/src/Listing/Row/EmptyRow.tsx +2 -6
- package/src/Listing/Row/Row.tsx +7 -36
- package/src/Listing/index.stories.tsx +1 -0
- package/src/Listing/index.tsx +20 -22
- package/src/StoryBookThemeProvider/index.tsx +3 -1
- package/src/ThemeProvider/index.tsx +3 -1
- package/src/ThemeProvider/tailwindcss.css +202 -0
- package/src/components/Avatar/Avatar.stories.tsx +1 -0
- package/src/components/Button/Button.module.css +38 -0
- package/src/components/Button/Button.stories.tsx +25 -0
- package/src/components/Button/Button.tsx +2 -5
- package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -1
- package/src/components/Layout/AreaIndicator.tsx +4 -6
- package/src/Listing/Cell/DataCell.styles.ts +0 -27
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +0 -71
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +0 -26
- package/src/Listing/Header/ListingHeader.styles.ts +0 -16
- package/src/Listing/Listing.styles.ts +0 -78
- package/src/Listing/Row/EmptyRow.styles.ts +0 -14
- package/src/components/Button/Button.styles.ts +0 -44
- package/src/components/Layout/AreaIndicator.styles.ts +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.6.1",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update:deps": "pnpx npm-check-updates -i --format group",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
".": "./src/index.ts",
|
|
45
45
|
"./components": "./src/components/index.ts",
|
|
46
46
|
"./fonts/*": "./src/fonts/*",
|
|
47
|
-
"./test/testRenderer": "./test/testRenderer.tsx"
|
|
47
|
+
"./test/testRenderer": "./test/testRenderer.tsx",
|
|
48
|
+
"./tailwindcss": "./src/ThemeProvider/tailwindcss.css"
|
|
48
49
|
},
|
|
49
50
|
"files": [
|
|
50
51
|
"package.json",
|
|
@@ -57,6 +58,8 @@
|
|
|
57
58
|
"@cypress/webpack-dev-server": "^4.0.1",
|
|
58
59
|
"@faker-js/faker": "^9.5.1",
|
|
59
60
|
"@mdx-js/react": "^3.1.0",
|
|
61
|
+
"@rsbuild/core": "^1.3.21",
|
|
62
|
+
"@rsbuild/plugin-react": "^1.3.1",
|
|
60
63
|
"@simonsmith/cypress-image-snapshot": "^9.1.0",
|
|
61
64
|
"@storybook/addon-a11y": "^8.6.3",
|
|
62
65
|
"@storybook/addon-docs": "^8.6.3",
|
|
@@ -72,6 +75,9 @@
|
|
|
72
75
|
"@storybook/test": "^8.6.3",
|
|
73
76
|
"@storybook/test-runner": "^0.22.0",
|
|
74
77
|
"@storybook/theming": "^8.6.3",
|
|
78
|
+
"@tailwindcss/cli": "^4.1.7",
|
|
79
|
+
"@tailwindcss/postcss": "^4.1.7",
|
|
80
|
+
"@tailwindcss/vite": "^4.1.7",
|
|
75
81
|
"@testing-library/cypress": "^10.0.3",
|
|
76
82
|
"@testing-library/jest-dom": "^6.6.3",
|
|
77
83
|
"@testing-library/react": "^16.2.0",
|
|
@@ -95,19 +101,22 @@
|
|
|
95
101
|
"react-test-renderer": "^19.0.0",
|
|
96
102
|
"remark-gfm": "^4.0.1",
|
|
97
103
|
"speed-measure-vite-plugin": "^1.1.0",
|
|
98
|
-
"storybook": "^8.6.
|
|
104
|
+
"storybook": "^8.6.14",
|
|
99
105
|
"storybook-addon-mock": "^5.0.0",
|
|
100
106
|
"storybook-dark-mode": "^4.0.2",
|
|
107
|
+
"storybook-react-rsbuild": "^1.0.1",
|
|
101
108
|
"style-dictionary": "^4.3.3",
|
|
109
|
+
"tailwind": "^4.0.0",
|
|
110
|
+
"tailwindcss": "^4.1.7",
|
|
102
111
|
"ts-node": "^10.9.2",
|
|
103
112
|
"use-resize-observer": "^9.1.0",
|
|
104
|
-
"vite": "^6.
|
|
113
|
+
"vite": "^6.3.5",
|
|
105
114
|
"vite-plugin-istanbul": "^7.0.0",
|
|
106
115
|
"vite-plugin-svgr": "^4.3.0",
|
|
107
116
|
"vite-plugin-turbosnap": "^1.0.3"
|
|
108
117
|
},
|
|
109
118
|
"peerDependencies": {
|
|
110
|
-
"@centreon/ui-context": "
|
|
119
|
+
"@centreon/ui-context": "workspace:*"
|
|
111
120
|
},
|
|
112
121
|
"dependencies": {
|
|
113
122
|
"@lexical/html": "^0.27.0",
|
|
@@ -117,7 +126,7 @@
|
|
|
117
126
|
"@lexical/rich-text": "^0.27.0",
|
|
118
127
|
"@lexical/selection": "^0.27.0",
|
|
119
128
|
"@lexical/utils": "^0.27.0",
|
|
120
|
-
"@mui/material": "^
|
|
129
|
+
"@mui/material": "^7.1.0",
|
|
121
130
|
"@react-spring/web": "^9.7.5",
|
|
122
131
|
"@visx/clip-path": "^3.12.0",
|
|
123
132
|
"@visx/curve": "^3.12.0",
|
|
@@ -17,7 +17,7 @@ export const useDashboardLayoutStyles = makeStyles<boolean>()(
|
|
|
17
17
|
boxShadow: theme.shadows[3]
|
|
18
18
|
},
|
|
19
19
|
'& .react-grid-item.react-grid-placeholder': {
|
|
20
|
-
|
|
20
|
+
background: `${alpha(theme.palette.primary.main, 0.4)} !important`
|
|
21
21
|
},
|
|
22
22
|
'& .react-grid-item.resizing': {
|
|
23
23
|
boxShadow: theme.shadows[3]
|
package/src/Dashboard/Layout.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useSetAtom } from 'jotai';
|
|
4
4
|
import GridLayout, { Layout, WidthProvider } from 'react-grid-layout';
|
|
5
|
-
import 'react-grid-layout/css/styles.css';
|
|
6
5
|
|
|
7
6
|
import { ParentSize, useMemoComponent } from '..';
|
|
8
7
|
|
|
@@ -10,6 +9,7 @@ import { Box } from '@mui/material';
|
|
|
10
9
|
import { useDashboardLayoutStyles } from './Dashboard.styles';
|
|
11
10
|
import { isResizingItemAtom } from './atoms';
|
|
12
11
|
import { getColumnsFromScreenSize, getLayout, rowHeight } from './utils';
|
|
12
|
+
import 'react-grid-layout/css/styles.css';
|
|
13
13
|
|
|
14
14
|
const ReactGridLayout = WidthProvider(GridLayout);
|
|
15
15
|
|
|
@@ -250,8 +250,6 @@ describe('Bar chart', () => {
|
|
|
250
250
|
cy.contains('0.11 ms').should('be.visible');
|
|
251
251
|
|
|
252
252
|
cy.findByTestId('stacked-bar-3-0-0.16196').should('be.visible');
|
|
253
|
-
|
|
254
|
-
cy.makeSnapshot();
|
|
255
253
|
});
|
|
256
254
|
|
|
257
255
|
it('displays a tooltip with a single metric when a stacked bar is hovered and a prop is set', () => {
|
|
@@ -1,32 +1,19 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { equals } from 'ramda';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
4
|
|
|
6
5
|
import TablePagination from '@mui/material/TablePagination';
|
|
7
6
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<TablePagination
|
|
21
|
-
classes={{
|
|
22
|
-
toolbar: classes.toolbar
|
|
23
|
-
}}
|
|
24
|
-
component="div"
|
|
25
|
-
data-testid="Listing Pagination"
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
7
|
+
const Pagination = (props): JSX.Element => (
|
|
8
|
+
<TablePagination
|
|
9
|
+
classes={{
|
|
10
|
+
toolbar: 'pl-1 overflow-hidden h-8'
|
|
11
|
+
}}
|
|
12
|
+
component="div"
|
|
13
|
+
data-testid="Listing Pagination"
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
30
17
|
|
|
31
18
|
const MemoizedPagination = memo(
|
|
32
19
|
Pagination,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useTranslation } from 'react-i18next';
|
|
2
|
-
import { makeStyles } from 'tss-react/mui';
|
|
3
2
|
|
|
4
3
|
import FirstPageIcon from '@mui/icons-material/FirstPage';
|
|
5
4
|
import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
|
|
@@ -15,20 +14,12 @@ import {
|
|
|
15
14
|
labelPreviousPage
|
|
16
15
|
} from '../translatedLabels';
|
|
17
16
|
|
|
18
|
-
const useStyles = makeStyles()((theme) => ({
|
|
19
|
-
root: {
|
|
20
|
-
color: theme.palette.text.secondary,
|
|
21
|
-
flexShrink: 0
|
|
22
|
-
}
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
17
|
const PaginationActions = ({
|
|
26
18
|
onPageChange,
|
|
27
19
|
page,
|
|
28
20
|
rowsPerPage,
|
|
29
21
|
count
|
|
30
22
|
}: TablePaginationActionsProps): JSX.Element => {
|
|
31
|
-
const { classes } = useStyles();
|
|
32
23
|
const { t } = useTranslation();
|
|
33
24
|
|
|
34
25
|
const changeToFirstPage = (event): void => {
|
|
@@ -53,7 +44,7 @@ const PaginationActions = ({
|
|
|
53
44
|
};
|
|
54
45
|
|
|
55
46
|
return (
|
|
56
|
-
<div className=
|
|
47
|
+
<div className="shrink-0 text-text-secondary">
|
|
57
48
|
<IconButton
|
|
58
49
|
aria-label={t(labelFirstPage) || ''}
|
|
59
50
|
disabled={isFirstPage}
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
} from '../models';
|
|
15
15
|
import useStyleTable from '../useStyleTable';
|
|
16
16
|
|
|
17
|
-
import { useStyles } from './DataCell.styles';
|
|
18
17
|
import EllipsisTypography from './EllipsisTypography';
|
|
19
18
|
|
|
20
19
|
import Cell from '.';
|
|
@@ -46,7 +45,6 @@ const DataCell = ({
|
|
|
46
45
|
labelCollapse,
|
|
47
46
|
labelExpand
|
|
48
47
|
}: Props): JSX.Element | null => {
|
|
49
|
-
const { classes, cx } = useStyles();
|
|
50
48
|
const { dataStyle } = useStyleTable({ listingVariant });
|
|
51
49
|
|
|
52
50
|
const commonCellProps = {
|
|
@@ -78,12 +76,13 @@ const DataCell = ({
|
|
|
78
76
|
disableRowCondition={disableRowCondition(row)}
|
|
79
77
|
formattedString={formattedString}
|
|
80
78
|
isRowHovered={isRowHovered}
|
|
79
|
+
isRowHighlighted={isRowHighlighted}
|
|
81
80
|
/>
|
|
82
81
|
);
|
|
83
82
|
|
|
84
83
|
return (
|
|
85
84
|
<Cell
|
|
86
|
-
className=
|
|
85
|
+
className="flex items-center h-full overflow-hidden whitespace-nowrap"
|
|
87
86
|
isRowHighlighted={isRowHighlighted}
|
|
88
87
|
listingVariant={listingVariant}
|
|
89
88
|
style={{
|
|
@@ -110,7 +109,7 @@ const DataCell = ({
|
|
|
110
109
|
if (isCellHidden) {
|
|
111
110
|
return (
|
|
112
111
|
<Cell
|
|
113
|
-
className=
|
|
112
|
+
className="flex items-center h-full overflow-hidden whitespace-nowrap"
|
|
114
113
|
isRowHighlighted={isRowHighlighted}
|
|
115
114
|
listingVariant={listingVariant}
|
|
116
115
|
onClick={(e): void => {
|
|
@@ -127,7 +126,7 @@ const DataCell = ({
|
|
|
127
126
|
|
|
128
127
|
return (
|
|
129
128
|
<Cell
|
|
130
|
-
className={
|
|
129
|
+
className={`flex align-items h-full overflow-hidden whitespace-nowrap ${clickable && 'cursor-default'}`}
|
|
131
130
|
isRowHighlighted={isRowHighlighted}
|
|
132
131
|
listingVariant={listingVariant}
|
|
133
132
|
style={{
|
|
@@ -156,6 +155,7 @@ const DataCell = ({
|
|
|
156
155
|
disableRowCondition={disableRowCondition(row)}
|
|
157
156
|
formattedString={formattedString}
|
|
158
157
|
isRowHovered={isRowHovered}
|
|
158
|
+
isRowHighlighted={isRowHighlighted}
|
|
159
159
|
/>
|
|
160
160
|
);
|
|
161
161
|
}}
|
|
@@ -280,4 +280,4 @@ const MemoizedDataCell = memo<Props>(
|
|
|
280
280
|
);
|
|
281
281
|
|
|
282
282
|
export default MemoizedDataCell;
|
|
283
|
-
export {
|
|
283
|
+
export type { Props };
|
|
@@ -1,50 +1,28 @@
|
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
|
2
|
-
|
|
3
1
|
import { Typography } from '@mui/material';
|
|
4
2
|
|
|
5
3
|
import { TableStyleAtom as TableStyle } from '../models';
|
|
6
4
|
|
|
7
|
-
interface StylesProps {
|
|
8
|
-
body: TableStyle['body'];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const useStyles = makeStyles<StylesProps>()((theme, { body }) => ({
|
|
12
|
-
rowNotHovered: {
|
|
13
|
-
color: theme.palette.text.secondary
|
|
14
|
-
},
|
|
15
|
-
text: {
|
|
16
|
-
fontSize: body.fontSize,
|
|
17
|
-
overflow: 'hidden',
|
|
18
|
-
textOverflow: 'ellipsis',
|
|
19
|
-
whiteSpace: 'nowrap'
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
5
|
interface Ellipsis {
|
|
24
6
|
className?: string;
|
|
25
7
|
dataStyle: TableStyle;
|
|
26
8
|
disableRowCondition: boolean;
|
|
27
9
|
formattedString: string;
|
|
28
10
|
isRowHovered: boolean;
|
|
11
|
+
isRowHighlighted?: boolean;
|
|
29
12
|
}
|
|
30
13
|
const EllipsisTypography = ({
|
|
31
14
|
formattedString,
|
|
32
15
|
isRowHovered,
|
|
33
16
|
disableRowCondition,
|
|
34
17
|
className,
|
|
35
|
-
dataStyle
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
>
|
|
45
|
-
{formattedString}
|
|
46
|
-
</Typography>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
18
|
+
dataStyle,
|
|
19
|
+
isRowHighlighted
|
|
20
|
+
}: Ellipsis): JSX.Element => (
|
|
21
|
+
<Typography
|
|
22
|
+
className={`${className} text-[${dataStyle.body.fontSize}] truncate ${!isRowHighlighted && (!isRowHovered || disableRowCondition) && 'text-text-secondary'}`}
|
|
23
|
+
>
|
|
24
|
+
{formattedString}
|
|
25
|
+
</Typography>
|
|
26
|
+
);
|
|
49
27
|
|
|
50
28
|
export default EllipsisTypography;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useAtom } from 'jotai';
|
|
2
|
-
import { append, equals, includes, isNil,
|
|
2
|
+
import { append, equals, includes, isNil, reject } from 'ramda';
|
|
3
3
|
import { CSSObject } from 'tss-react';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
4
|
|
|
6
5
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
7
6
|
import {
|
|
@@ -9,7 +8,8 @@ import {
|
|
|
9
8
|
TableCellBaseProps,
|
|
10
9
|
TableCellProps,
|
|
11
10
|
Theme,
|
|
12
|
-
alpha
|
|
11
|
+
alpha,
|
|
12
|
+
useTheme
|
|
13
13
|
} from '@mui/material';
|
|
14
14
|
|
|
15
15
|
import { ListingVariant } from '@centreon/ui-context';
|
|
@@ -25,11 +25,6 @@ interface GetBackgroundColorProps extends Omit<Props, 'isRowHighlighted'> {
|
|
|
25
25
|
theme: Theme;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
interface StylesProps extends Props {
|
|
29
|
-
isRowHighlighted?: boolean;
|
|
30
|
-
listingVariant?: ListingVariant;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
28
|
interface GetRowHighlightStyleProps {
|
|
34
29
|
isRowHighlighted?: boolean;
|
|
35
30
|
theme: Theme;
|
|
@@ -78,54 +73,6 @@ const getRowTextColor = ({
|
|
|
78
73
|
}
|
|
79
74
|
};
|
|
80
75
|
|
|
81
|
-
const useStyles = makeStyles<StylesProps>()(
|
|
82
|
-
(
|
|
83
|
-
theme,
|
|
84
|
-
{
|
|
85
|
-
isRowHovered,
|
|
86
|
-
row,
|
|
87
|
-
rowColorConditions,
|
|
88
|
-
disableRowCondition,
|
|
89
|
-
isRowHighlighted,
|
|
90
|
-
listingVariant
|
|
91
|
-
}
|
|
92
|
-
) => ({
|
|
93
|
-
caret: {
|
|
94
|
-
transition: theme.transitions.create('transform', {
|
|
95
|
-
duration: theme.transitions.duration.short
|
|
96
|
-
})
|
|
97
|
-
},
|
|
98
|
-
caretLess: {
|
|
99
|
-
transform: 'rotate3d(0,0,1,0deg)'
|
|
100
|
-
},
|
|
101
|
-
caretMore: {
|
|
102
|
-
transform: 'rotate3d(0,0,1,180deg)'
|
|
103
|
-
},
|
|
104
|
-
root: {
|
|
105
|
-
alignItems: 'center',
|
|
106
|
-
backgroundColor: getBackgroundColor({
|
|
107
|
-
disableRowCondition,
|
|
108
|
-
isRowHovered,
|
|
109
|
-
row,
|
|
110
|
-
rowColorConditions,
|
|
111
|
-
theme
|
|
112
|
-
}),
|
|
113
|
-
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
114
|
-
display: 'flex',
|
|
115
|
-
'div:nth-of-type(n)': {
|
|
116
|
-
alignItems: 'center',
|
|
117
|
-
display: 'flex'
|
|
118
|
-
},
|
|
119
|
-
height: '100%',
|
|
120
|
-
overflow: 'hidden',
|
|
121
|
-
...getTextStyleByViewMode({ listingVariant, theme }),
|
|
122
|
-
p: getRowTextColor({ isRowHighlighted, disableRowCondition, row, theme }),
|
|
123
|
-
padding: theme.spacing(0, 1),
|
|
124
|
-
whiteSpace: 'nowrap'
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
);
|
|
128
|
-
|
|
129
76
|
interface Props
|
|
130
77
|
extends Pick<
|
|
131
78
|
DataCellProps,
|
|
@@ -160,15 +107,22 @@ const Cell = ({
|
|
|
160
107
|
subItemsRowProperty,
|
|
161
108
|
labelCollapse,
|
|
162
109
|
labelExpand,
|
|
110
|
+
disableRowCondition,
|
|
111
|
+
isRowHovered,
|
|
112
|
+
isRowHighlighted,
|
|
113
|
+
rowColorConditions,
|
|
114
|
+
listingVariant,
|
|
115
|
+
row,
|
|
116
|
+
style,
|
|
163
117
|
...props
|
|
164
118
|
}: Props): JSX.Element => {
|
|
165
|
-
const
|
|
119
|
+
const theme = useTheme();
|
|
166
120
|
|
|
167
121
|
const [subItemsPivots, setSubItemsPivots] = useAtom(subItemsPivotsAtom);
|
|
168
122
|
|
|
169
123
|
const { children } = props;
|
|
170
124
|
|
|
171
|
-
const rowId =
|
|
125
|
+
const rowId = row?.id;
|
|
172
126
|
|
|
173
127
|
const click = (e): void => {
|
|
174
128
|
e.preventDefault();
|
|
@@ -181,39 +135,46 @@ const Cell = ({
|
|
|
181
135
|
|
|
182
136
|
const isSubItemsExpanded = isPivotExistInTheList(rowId)(subItemsPivots);
|
|
183
137
|
|
|
184
|
-
const hasSubItems = subItemsRowProperty &&
|
|
138
|
+
const hasSubItems = subItemsRowProperty && row[subItemsRowProperty];
|
|
185
139
|
|
|
186
140
|
return (
|
|
187
141
|
<TableCell
|
|
142
|
+
style={{
|
|
143
|
+
backgroundColor: getBackgroundColor({
|
|
144
|
+
disableRowCondition,
|
|
145
|
+
isRowHovered,
|
|
146
|
+
row,
|
|
147
|
+
rowColorConditions,
|
|
148
|
+
theme
|
|
149
|
+
}),
|
|
150
|
+
...getTextStyleByViewMode({
|
|
151
|
+
listingVariant,
|
|
152
|
+
theme
|
|
153
|
+
}),
|
|
154
|
+
...getRowTextColor({
|
|
155
|
+
isRowHighlighted,
|
|
156
|
+
disableRowCondition,
|
|
157
|
+
row,
|
|
158
|
+
theme
|
|
159
|
+
}),
|
|
160
|
+
...style
|
|
161
|
+
}}
|
|
188
162
|
classes={{
|
|
189
|
-
root:
|
|
163
|
+
root: 'flex items-center h-full overflow-hidden border-b-1 border-divider px-2 whitespace-nowrap py-0'
|
|
190
164
|
}}
|
|
191
165
|
component={'div' as unknown as ElementType<TableCellBaseProps>}
|
|
192
|
-
{...
|
|
193
|
-
[
|
|
194
|
-
'isRowHovered',
|
|
195
|
-
'row',
|
|
196
|
-
'rowColorConditions',
|
|
197
|
-
'disableRowCondition',
|
|
198
|
-
'isRowHighlighted',
|
|
199
|
-
'listingVariant'
|
|
200
|
-
],
|
|
201
|
-
props
|
|
202
|
-
)}
|
|
166
|
+
{...props}
|
|
203
167
|
>
|
|
204
168
|
{displaySubItemsCaret && hasSubItems && (
|
|
205
169
|
<IconButton
|
|
206
170
|
ariaLabel={`${isSubItemsExpanded ? labelCollapse : labelExpand} ${
|
|
207
|
-
|
|
171
|
+
row.id
|
|
208
172
|
}`}
|
|
209
173
|
size="small"
|
|
210
174
|
onClick={click}
|
|
211
175
|
>
|
|
212
176
|
<ExpandMoreIcon
|
|
213
|
-
className={
|
|
214
|
-
classes.caret,
|
|
215
|
-
isSubItemsExpanded ? classes.caretMore : classes.caretLess
|
|
216
|
-
)}
|
|
177
|
+
className={`transition-transform ${isSubItemsExpanded ? 'rotate-z-180' : 'rotate-z-0'} transform-gpu`}
|
|
217
178
|
fontSize="small"
|
|
218
179
|
/>
|
|
219
180
|
</IconButton>
|
package/src/Listing/Checkbox.tsx
CHANGED
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
|
2
|
-
|
|
3
1
|
import { CheckboxProps, Checkbox as MuiCheckbox } from '@mui/material';
|
|
4
2
|
|
|
5
|
-
const useStyles = makeStyles()({
|
|
6
|
-
container: {
|
|
7
|
-
padding: 0
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
|
|
11
3
|
const Checkbox = ({
|
|
12
4
|
className,
|
|
13
5
|
...props
|
|
14
6
|
}: { className?: string } & Omit<
|
|
15
7
|
CheckboxProps,
|
|
16
8
|
'size' | 'color'
|
|
17
|
-
>): JSX.Element =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{...props}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
9
|
+
>): JSX.Element => (
|
|
10
|
+
<MuiCheckbox
|
|
11
|
+
className={`p-0 ${className}`}
|
|
12
|
+
color="primary"
|
|
13
|
+
size="small"
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
29
17
|
|
|
30
18
|
export default Checkbox;
|
|
@@ -12,7 +12,8 @@ import { Column } from '../../models';
|
|
|
12
12
|
import { DraggableIconButton } from '../_internals/DraggableIconButton';
|
|
13
13
|
import HeaderLabel from '../_internals/Label';
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import useStyleTable from '../../useStyleTable';
|
|
16
|
+
import { StylesProps } from './ListingHeaderCell.styles';
|
|
16
17
|
|
|
17
18
|
type Props = Pick<
|
|
18
19
|
ListingProps<unknown>,
|
|
@@ -39,11 +40,7 @@ const ListingHeaderCell = ({
|
|
|
39
40
|
listingVariant,
|
|
40
41
|
...props
|
|
41
42
|
}: Props): JSX.Element => {
|
|
42
|
-
const {
|
|
43
|
-
isDragging,
|
|
44
|
-
isInDragOverlay,
|
|
45
|
-
listingVariant
|
|
46
|
-
});
|
|
43
|
+
const { dataStyle } = useStyleTable({ listingVariant });
|
|
47
44
|
const columnLabel = column.shortLabel || column.label;
|
|
48
45
|
|
|
49
46
|
const columnSortField = column.sortField || column.id;
|
|
@@ -72,32 +69,38 @@ const ListingHeaderCell = ({
|
|
|
72
69
|
|
|
73
70
|
return (
|
|
74
71
|
<TableCell
|
|
75
|
-
className={
|
|
72
|
+
className={`bg-background-listing-header border-b-0 h-[inherit] py-0 px-2 ${isInDragOverlay && 'block opacity-70'}`}
|
|
76
73
|
component={'div' as unknown as React.ElementType<TableCellBaseProps>}
|
|
77
|
-
data-isdragging={isDragging}
|
|
78
|
-
data-isindragoverlay={isInDragOverlay}
|
|
79
74
|
ref={itemRef}
|
|
80
|
-
style={
|
|
75
|
+
style={{
|
|
76
|
+
...style,
|
|
77
|
+
height: dataStyle.header.height
|
|
78
|
+
}}
|
|
81
79
|
>
|
|
82
|
-
<div className=
|
|
80
|
+
<div className="flex items-center h-full justify-between text-white p-0">
|
|
83
81
|
{column.sortable ? (
|
|
84
82
|
<TableSortLabel
|
|
85
83
|
active={sortField === columnSortField}
|
|
86
84
|
aria-label={`Column ${column.label}`}
|
|
87
|
-
className=
|
|
85
|
+
className="text-white"
|
|
86
|
+
classes={{
|
|
87
|
+
icon: 'text-white'
|
|
88
|
+
}}
|
|
88
89
|
direction={sortOrder || 'desc'}
|
|
89
90
|
onClick={sort}
|
|
90
91
|
>
|
|
91
92
|
{headerContent}
|
|
92
93
|
</TableSortLabel>
|
|
93
94
|
) : (
|
|
94
|
-
<div className=
|
|
95
|
+
<div className="mr-4 inline-flex items-center select-none">
|
|
96
|
+
{headerContent}
|
|
97
|
+
</div>
|
|
95
98
|
)}
|
|
96
99
|
|
|
97
100
|
{columnConfiguration?.sortable && areColumnsEditable && (
|
|
98
101
|
<DraggableIconButton
|
|
99
102
|
{...props}
|
|
100
|
-
className={
|
|
103
|
+
className={`p-0 ${isDragging ? 'cursor-grabbing' : 'cursor-grab'} text-white opacity-0 hover:opacity-100 focus:opacity-100`}
|
|
101
104
|
columnLabel={columnLabel}
|
|
102
105
|
/>
|
|
103
106
|
)}
|
|
@@ -9,8 +9,6 @@ import { PredefinedRowSelection } from '../../models';
|
|
|
9
9
|
import { labelPredefinedRowsSelectionMenu } from '../../translatedLabels';
|
|
10
10
|
import PredefinedSelectionList from '../_internals/PredefinedSelectionList';
|
|
11
11
|
|
|
12
|
-
import { useStyles } from './SelectActionListingHeaderCell.styles';
|
|
13
|
-
|
|
14
12
|
export interface SelectActionListingHeaderCellProps {
|
|
15
13
|
onSelectAllClick: (event) => void;
|
|
16
14
|
onSelectRowsWithCondition: (condition) => void;
|
|
@@ -26,27 +24,25 @@ const SelectActionListingHeaderCell = ({
|
|
|
26
24
|
predefinedRowsSelection,
|
|
27
25
|
onSelectRowsWithCondition
|
|
28
26
|
}: SelectActionListingHeaderCellProps): JSX.Element => {
|
|
29
|
-
const { classes } = useStyles();
|
|
30
|
-
|
|
31
27
|
const hasRows = not(equals(rowCount, 0));
|
|
32
28
|
|
|
33
29
|
return (
|
|
34
30
|
<TableCell
|
|
35
|
-
className=
|
|
31
|
+
className="bg-background-listing-header h-full pt-0 pr-1 pb-0 pl-3 flex flex-row items-center leading=[inherit] justify-start border-b-0"
|
|
36
32
|
component={'div' as unknown as React.ElementType<TableCellBaseProps>}
|
|
37
33
|
>
|
|
38
34
|
<Checkbox
|
|
39
35
|
checked={hasRows && selectedRowCount === rowCount}
|
|
40
|
-
className=
|
|
36
|
+
className="text-white"
|
|
41
37
|
indeterminate={
|
|
42
38
|
hasRows && selectedRowCount > 0 && selectedRowCount < rowCount
|
|
43
39
|
}
|
|
44
|
-
|
|
40
|
+
slotProps={{ input: { 'aria-label': 'Select all' } }}
|
|
45
41
|
onChange={onSelectAllClick}
|
|
46
42
|
/>
|
|
47
43
|
{not(isEmpty(predefinedRowsSelection)) ? (
|
|
48
44
|
<PopoverMenu
|
|
49
|
-
className=
|
|
45
|
+
className="text-white"
|
|
50
46
|
icon={<ArrowDropDownIcon />}
|
|
51
47
|
title={labelPredefinedRowsSelectionMenu}
|
|
52
48
|
>
|
|
@@ -59,7 +55,7 @@ const SelectActionListingHeaderCell = ({
|
|
|
59
55
|
)}
|
|
60
56
|
</PopoverMenu>
|
|
61
57
|
) : (
|
|
62
|
-
<div className=
|
|
58
|
+
<div className="text-white" />
|
|
63
59
|
)}
|
|
64
60
|
</TableCell>
|
|
65
61
|
);
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
SelectActionListingHeaderCell,
|
|
17
17
|
SelectActionListingHeaderCellProps
|
|
18
18
|
} from './Cell/SelectActionListingHeaderCell';
|
|
19
|
-
import { useStyles } from './ListingHeader.styles';
|
|
20
19
|
|
|
21
20
|
type Props = Pick<
|
|
22
21
|
ListingProps<unknown>,
|
|
@@ -62,8 +61,6 @@ const ListingHeader = ({
|
|
|
62
61
|
predefinedRowsSelection,
|
|
63
62
|
onSelectRowsWithCondition
|
|
64
63
|
}: Props): JSX.Element => {
|
|
65
|
-
const { classes, cx } = useStyles();
|
|
66
|
-
|
|
67
64
|
const visibleColumns = getVisibleColumns({
|
|
68
65
|
columnConfiguration,
|
|
69
66
|
columns
|
|
@@ -105,8 +102,8 @@ const ListingHeader = ({
|
|
|
105
102
|
);
|
|
106
103
|
|
|
107
104
|
return (
|
|
108
|
-
<TableHead className=
|
|
109
|
-
<TableRow className=
|
|
105
|
+
<TableHead className="contents" component="div">
|
|
106
|
+
<TableRow className="contents" component="div">
|
|
110
107
|
{checkable && (
|
|
111
108
|
<SelectActionListingHeaderCell
|
|
112
109
|
predefinedRowsSelection={predefinedRowsSelection}
|