@centreon/ui 25.3.4 → 25.4.0-MON-191119-npm-develop.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/package.json +25 -11
- package/public/mockServiceWorker.js +8 -31
- package/src/Button/Save/index.stories.tsx +1 -0
- package/src/Checkbox/Checkbox.tsx +3 -1
- package/src/Checkbox/CheckboxGroup/index.tsx +6 -1
- package/src/Colors/index.tsx +1 -1
- package/src/Dashboard/Dashboard.styles.ts +1 -1
- package/src/Dashboard/Layout.tsx +1 -1
- package/src/Dialog/UnsavedChanges/index.stories.tsx +1 -0
- package/src/Form/CollapsibleGroup.tsx +13 -13
- package/src/Form/Form.cypress.spec.tsx +137 -2
- package/src/Form/Form.stories.tsx +11 -31
- package/src/Form/Form.tsx +2 -0
- package/src/Form/Inputs/Checkbox.tsx +3 -2
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +6 -1
- package/src/Form/Inputs/Grid.tsx +18 -29
- package/src/Form/Inputs/SubGroupDivider.tsx +7 -0
- package/src/Form/Inputs/Text.tsx +1 -0
- package/src/Form/Inputs/index.tsx +31 -24
- package/src/Form/Inputs/models.ts +8 -1
- package/src/Form/Section/FormSection.tsx +34 -0
- package/src/Form/Section/PanelTabs.tsx +13 -0
- package/src/Form/Section/navigateToSection.ts +9 -0
- package/src/Form/storiesData.tsx +14 -4
- package/src/Graph/BarChart/BarChart.cypress.spec.tsx +46 -6
- package/src/Graph/BarChart/BarChart.stories.tsx +60 -0
- package/src/Graph/BarChart/BarChart.tsx +56 -32
- package/src/Graph/BarChart/BarGroup.tsx +22 -32
- package/src/Graph/BarChart/MemoizedGroup.tsx +8 -11
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +145 -32
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +2 -2
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +7 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +18 -45
- package/src/Graph/Chart/BasicComponents/Lines/index.tsx +42 -28
- package/src/Graph/Chart/Chart.cypress.spec.tsx +85 -15
- package/src/Graph/Chart/Chart.stories.tsx +84 -1
- package/src/Graph/Chart/Chart.tsx +17 -4
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +8 -2
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +10 -3
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +19 -2
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +2 -4
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/index.tsx +14 -3
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/models.ts +3 -0
- package/src/Graph/Chart/InteractiveComponents/ZoomPreview/useZoomPreview.ts +12 -10
- package/src/Graph/Chart/InteractiveComponents/index.tsx +63 -5
- package/src/Graph/Chart/Legend/index.tsx +26 -2
- package/src/Graph/Chart/index.tsx +45 -45
- package/src/Graph/Chart/models.ts +8 -0
- package/src/Graph/Chart/useChartData.ts +14 -2
- package/src/Graph/Gauge/Gauge.tsx +18 -14
- package/src/Graph/Gauge/ResponsiveGauge.tsx +10 -6
- package/src/Graph/Gauge/useResizeObserver.ts +68 -0
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +18 -16
- package/src/Graph/SingleBar/ThresholdLine.tsx +4 -4
- package/src/Graph/SingleBar/models.ts +1 -0
- package/src/Graph/Text/Text.styles.ts +2 -2
- package/src/Graph/Text/Text.tsx +23 -10
- package/src/Graph/Timeline/ResponsiveTimeline.tsx +4 -0
- package/src/Graph/Timeline/Timeline.tsx +21 -4
- package/src/Graph/Tree/Links.tsx +2 -2
- package/src/Graph/Tree/Tree.tsx +2 -2
- package/src/Graph/Tree/constants.ts +1 -1
- package/src/Graph/common/BaseChart/BaseChart.tsx +6 -1
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +5 -4
- package/src/Graph/common/BaseChart/Header/index.tsx +3 -1
- package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +13 -9
- package/src/Graph/common/timeSeries/index.test.ts +20 -0
- package/src/Graph/common/timeSeries/index.ts +225 -44
- package/src/Graph/common/timeSeries/models.ts +6 -2
- package/src/Graph/common/utils.ts +45 -12
- package/src/Graph/index.ts +3 -1
- package/src/Graph/mockedData/dataWithMissingPoint.json +74 -0
- package/src/Graph/mockedData/pingServiceWithStackedKeys.json +205 -0
- package/src/Icon/RegexIcon.tsx +20 -0
- package/src/Icon/index.ts +1 -0
- package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +68 -14
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +49 -14
- package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +78 -0
- package/src/InputField/Select/Autocomplete/Multi/Multi.styles.ts +26 -0
- package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +124 -0
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -117
- package/src/InputField/Select/Autocomplete/index.tsx +28 -17
- package/src/InputField/Select/Option.tsx +3 -3
- package/src/InputField/Select/index.tsx +4 -0
- package/src/InputField/Text/index.tsx +4 -2
- package/src/InputField/translatedLabels.ts +4 -0
- package/src/Listing/ActionBar/Pagination.tsx +10 -23
- package/src/Listing/ActionBar/PaginationActions.tsx +1 -10
- package/src/Listing/ActionBar/index.tsx +1 -1
- 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 +26 -26
- package/src/Listing/useStyleTable.ts +58 -32
- package/src/ListingPage/index.stories.tsx +1 -0
- package/src/Module/index.tsx +8 -2
- package/src/MultiSelectEntries/index.stories.tsx +1 -0
- package/src/MultiSelectEntries/index.tsx +1 -1
- package/src/Pagination/Pagination.cypress.spec.tsx +137 -0
- package/src/Pagination/Pagination.stories.tsx +46 -0
- package/src/Pagination/Pagination.styles.ts +56 -0
- package/src/Pagination/Pagination.tsx +146 -0
- package/src/Pagination/index.ts +3 -0
- package/src/Pagination/utils.ts +7 -0
- package/src/SortableItems/index.stories.tsx +2 -2
- package/src/StoryBookThemeProvider/index.tsx +3 -1
- package/src/ThemeProvider/base.css +49 -0
- package/src/ThemeProvider/index.tsx +21 -47
- package/src/ThemeProvider/palettes.ts +3 -1
- package/src/ThemeProvider/tailwindcss.css +230 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +9 -11
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +1 -0
- package/src/TimePeriods/DateTimePickerInput.tsx +3 -1
- package/src/api/models.ts +9 -0
- package/src/api/useGraphQuery/index.ts +108 -12
- 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/CrudPage.stories.tsx +1 -0
- package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
- package/src/components/DataTable/DataTable.stories.tsx +1 -0
- package/src/components/DataTable/EmptyState/DataTableEmptyState.stories.tsx +1 -0
- package/src/components/DataTable/EmptyState/DataTableEmptyState.styles.ts +3 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -1
- package/src/components/DataTable/Item/DataTableItem.stories.tsx +1 -0
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +1 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +4 -3
- package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +15 -10
- package/src/components/Form/FormActions.tsx +21 -12
- package/src/components/Layout/AreaIndicator.tsx +4 -6
- package/src/components/Layout/PageLayout/PageLayout.stories.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayout.tsx +9 -3
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +5 -3
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +5 -3
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -3
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +17 -17
- package/src/components/Menu/Button/MenuButton.tsx +6 -6
- package/src/components/Menu/MenuDivider.tsx +1 -5
- package/src/components/Menu/MenuItem.tsx +1 -5
- package/src/components/Menu/MenuItems.tsx +5 -4
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +1 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +4 -1
- package/src/components/Modal/Modal.stories.tsx +21 -0
- package/src/components/Modal/Modal.styles.ts +1 -19
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/components/Modal/ModalBody.tsx +6 -4
- package/src/components/Modal/ModalHeader.tsx +9 -5
- package/src/components/Modal/modal.module.css +16 -0
- package/src/components/Tabs/Tab.styles.ts +0 -6
- package/src/components/Tabs/Tabs.tsx +37 -15
- package/src/index.ts +3 -0
- package/src/queryParameters/url/index.ts +7 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/useLocale/index.ts +9 -0
- package/src/utils/useLocale/useLocale.cypress.spec.tsx +38 -0
- package/src/utils/useLocaleDateTimeFormat/index.ts +4 -2
- package/src/utils/usePluralizedTranslation.ts +2 -3
- 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/src/components/Menu/Button/MenuButton.styles.ts +0 -27
- package/src/components/Menu/Menu.styles.ts +0 -68
|
@@ -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}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
|
2
|
-
|
|
3
1
|
import { Typography, TypographyProps } from '@mui/material';
|
|
4
2
|
import { ReactNode } from 'react';
|
|
5
3
|
|
|
6
|
-
const useStyles = makeStyles()(() => ({
|
|
7
|
-
root: {
|
|
8
|
-
fontWeight: 'bold'
|
|
9
|
-
}
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
4
|
interface Props {
|
|
13
5
|
children: ReactNode;
|
|
14
6
|
}
|
|
@@ -17,16 +9,8 @@ const HeaderLabel = ({
|
|
|
17
9
|
children,
|
|
18
10
|
className
|
|
19
11
|
}: Props & Pick<TypographyProps, 'className'>): JSX.Element => {
|
|
20
|
-
const { classes } = useStyles();
|
|
21
|
-
|
|
22
12
|
return (
|
|
23
|
-
<Typography
|
|
24
|
-
className={className}
|
|
25
|
-
classes={{
|
|
26
|
-
root: classes.root
|
|
27
|
-
}}
|
|
28
|
-
variant="body2"
|
|
29
|
-
>
|
|
13
|
+
<Typography className={`font-bold ${className}`} variant="body2">
|
|
30
14
|
{children}
|
|
31
15
|
</Typography>
|
|
32
16
|
);
|
|
@@ -4,20 +4,16 @@ import { TableRow } from '@mui/material';
|
|
|
4
4
|
|
|
5
5
|
import Cell from '../Cell';
|
|
6
6
|
|
|
7
|
-
import { useStyles } from './EmptyRow.styles';
|
|
8
|
-
|
|
9
7
|
interface EmptyRowProps {
|
|
10
8
|
children: ReactNode;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
const EmptyRow = ({ children }: EmptyRowProps): JSX.Element => {
|
|
14
|
-
const { classes } = useStyles();
|
|
15
|
-
|
|
16
12
|
return (
|
|
17
|
-
<TableRow className=
|
|
13
|
+
<TableRow className="contents" component="div" tabIndex={-1}>
|
|
18
14
|
<Cell
|
|
19
15
|
align="center"
|
|
20
|
-
className=
|
|
16
|
+
className="col-span-full flex justify-center"
|
|
21
17
|
disableRowCondition={(): boolean => false}
|
|
22
18
|
isRowHovered={false}
|
|
23
19
|
>
|
package/src/Listing/Row/Row.tsx
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { memo, useEffect, useRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { equals, gte, lt, not, pluck } from 'ramda';
|
|
6
|
-
import { makeStyles } from 'tss-react/mui';
|
|
7
6
|
|
|
8
7
|
import { TableRow, TableRowProps, useTheme } from '@mui/material';
|
|
9
8
|
|
|
@@ -14,27 +13,6 @@ import { useViewportIntersection } from '../../utils/useViewportIntersection';
|
|
|
14
13
|
import { performanceRowsLimit } from '../index';
|
|
15
14
|
import { Column, ColumnConfiguration, RowColorCondition } from '../models';
|
|
16
15
|
|
|
17
|
-
const useStyles = makeStyles()((theme) => {
|
|
18
|
-
return {
|
|
19
|
-
intersectionRow: {
|
|
20
|
-
display: 'contents',
|
|
21
|
-
width: '100%'
|
|
22
|
-
},
|
|
23
|
-
row: {
|
|
24
|
-
cursor: 'pointer',
|
|
25
|
-
display: 'contents',
|
|
26
|
-
width: '100%'
|
|
27
|
-
},
|
|
28
|
-
skeleton: {
|
|
29
|
-
height: theme.spacing(2.5),
|
|
30
|
-
width: '100%'
|
|
31
|
-
},
|
|
32
|
-
skeletonContainer: {
|
|
33
|
-
padding: theme.spacing(0.5)
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
|
|
38
16
|
type Props = {
|
|
39
17
|
checkable: boolean;
|
|
40
18
|
children;
|
|
@@ -70,22 +48,20 @@ const Row = memo<RowProps>(
|
|
|
70
48
|
checkable,
|
|
71
49
|
limit
|
|
72
50
|
}: RowProps): JSX.Element => {
|
|
73
|
-
const { classes } = useStyles();
|
|
74
|
-
|
|
75
51
|
if (not(isInViewport) && gte(limit, performanceRowsLimit)) {
|
|
76
52
|
return (
|
|
77
|
-
<div
|
|
53
|
+
<div className="contents">
|
|
78
54
|
{checkable && (
|
|
79
|
-
<div className=
|
|
55
|
+
<div className="p-1">
|
|
80
56
|
<div>
|
|
81
|
-
<LoadingSkeleton className=
|
|
57
|
+
<LoadingSkeleton className="w-full" />
|
|
82
58
|
</div>
|
|
83
59
|
</div>
|
|
84
60
|
)}
|
|
85
61
|
{visibleColumns.map(({ id }) => (
|
|
86
|
-
<div className=
|
|
62
|
+
<div className="p-1" key={`loading_${id}`}>
|
|
87
63
|
<div>
|
|
88
|
-
<LoadingSkeleton className=
|
|
64
|
+
<LoadingSkeleton className="w-full" />
|
|
89
65
|
</div>
|
|
90
66
|
</div>
|
|
91
67
|
))}
|
|
@@ -95,7 +71,7 @@ const Row = memo<RowProps>(
|
|
|
95
71
|
|
|
96
72
|
return (
|
|
97
73
|
<TableRow
|
|
98
|
-
className=
|
|
74
|
+
className="cursor-pointer contents w-full"
|
|
99
75
|
component="div"
|
|
100
76
|
tabIndex={tabIndex}
|
|
101
77
|
onClick={onClick}
|
|
@@ -203,7 +179,6 @@ const IntersectionRow = ({ isHovered, ...rest }: Props): JSX.Element => {
|
|
|
203
179
|
root: rowRef.current?.parentElement?.parentElement?.parentElement,
|
|
204
180
|
rootMargin: `${theme.spacing(20)} 0px ${theme.spacing(20)} 0px`
|
|
205
181
|
});
|
|
206
|
-
const { classes } = useStyles();
|
|
207
182
|
|
|
208
183
|
const getFirstCellElement = (): ChildNode | null | undefined =>
|
|
209
184
|
rowRef.current?.firstChild?.firstChild?.firstChild;
|
|
@@ -213,11 +188,7 @@ const IntersectionRow = ({ isHovered, ...rest }: Props): JSX.Element => {
|
|
|
213
188
|
}, [getFirstCellElement()]);
|
|
214
189
|
|
|
215
190
|
return (
|
|
216
|
-
<div
|
|
217
|
-
className={classes.intersectionRow}
|
|
218
|
-
data-is-hovered={isHovered}
|
|
219
|
-
ref={rowRef}
|
|
220
|
-
>
|
|
191
|
+
<div className="contents w-full" data-is-hovered={isHovered} ref={rowRef}>
|
|
221
192
|
<Row {...rest} isHovered={isHovered} isInViewport={isInViewport} />
|
|
222
193
|
</div>
|
|
223
194
|
);
|
package/src/Listing/index.tsx
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable react/no-array-index-key */
|
|
2
|
-
|
|
3
1
|
import { useAtomValue } from 'jotai';
|
|
4
2
|
import {
|
|
5
3
|
concat,
|
|
@@ -49,7 +47,6 @@ import DataCell from './Cell/DataCell';
|
|
|
49
47
|
import Checkbox from './Checkbox';
|
|
50
48
|
import { EmptyResult } from './EmptyResult/EmptyResult';
|
|
51
49
|
import { ListingHeader } from './Header';
|
|
52
|
-
import { useListingStyles } from './Listing.styles';
|
|
53
50
|
import ListingRow from './Row/Row';
|
|
54
51
|
import { SkeletonLoader } from './Row/SkeletonLoaderRows';
|
|
55
52
|
import {
|
|
@@ -62,7 +59,7 @@ import {
|
|
|
62
59
|
} from './models';
|
|
63
60
|
import { subItemsPivotsAtom } from './tableAtoms';
|
|
64
61
|
import { labelNoResultFound as defaultLabelNoResultFound } from './translatedLabels';
|
|
65
|
-
import useStyleTable from './useStyleTable';
|
|
62
|
+
import useStyleTable, { useColumnStyle } from './useStyleTable';
|
|
66
63
|
|
|
67
64
|
const subItemPrefixKey = 'listing';
|
|
68
65
|
|
|
@@ -207,11 +204,13 @@ const Listing = <
|
|
|
207
204
|
columnConfiguration,
|
|
208
205
|
columns
|
|
209
206
|
});
|
|
210
|
-
const { dataStyle
|
|
211
|
-
checkable,
|
|
212
|
-
currentVisibleColumns,
|
|
207
|
+
const { dataStyle } = useStyleTable({
|
|
213
208
|
listingVariant
|
|
214
209
|
});
|
|
210
|
+
const gridTemplateColumn = useColumnStyle({
|
|
211
|
+
checkable,
|
|
212
|
+
currentVisibleColumns
|
|
213
|
+
});
|
|
215
214
|
|
|
216
215
|
const { t } = useTranslation();
|
|
217
216
|
|
|
@@ -288,14 +287,6 @@ const Listing = <
|
|
|
288
287
|
},
|
|
289
288
|
[allSubItemIds]
|
|
290
289
|
);
|
|
291
|
-
|
|
292
|
-
const { classes } = useListingStyles({
|
|
293
|
-
dataStyle,
|
|
294
|
-
getGridTemplateColumn,
|
|
295
|
-
isResponsive,
|
|
296
|
-
rows: rowsToDisplay
|
|
297
|
-
});
|
|
298
|
-
|
|
299
290
|
const { isShiftKeyDown } = useKeyObserver();
|
|
300
291
|
|
|
301
292
|
const haveSameId = (row: TRow, rowToCompare: TRow): boolean =>
|
|
@@ -517,20 +508,20 @@ const Listing = <
|
|
|
517
508
|
const areColumnsEditable = not(isNil(onSelectColumns));
|
|
518
509
|
|
|
519
510
|
return (
|
|
520
|
-
<div className=
|
|
511
|
+
<div className="h-full w-full overflow-hidden">
|
|
521
512
|
{loading && rows.length > 0 && (
|
|
522
|
-
<LinearProgress className=
|
|
513
|
+
<LinearProgress className="w-full h-[3px]" />
|
|
523
514
|
)}
|
|
524
515
|
{(!loading || (loading && rows.length < 1)) && (
|
|
525
|
-
<div className=
|
|
516
|
+
<div className="w-full h-[3px]" />
|
|
526
517
|
)}
|
|
527
518
|
<div
|
|
528
|
-
className=
|
|
519
|
+
className="bg-[none] flex flex-col h-full w-full"
|
|
529
520
|
ref={containerRef as RefObject<HTMLDivElement>}
|
|
530
521
|
>
|
|
531
522
|
{isActionBarVisible && (
|
|
532
523
|
<div
|
|
533
|
-
className=
|
|
524
|
+
className="flex items-center"
|
|
534
525
|
ref={actionBarRef as RefObject<HTMLDivElement>}
|
|
535
526
|
>
|
|
536
527
|
<ListingActionBar
|
|
@@ -564,7 +555,7 @@ const Listing = <
|
|
|
564
555
|
>
|
|
565
556
|
{({ height }) => (
|
|
566
557
|
<Box
|
|
567
|
-
className=
|
|
558
|
+
className="border-b-[none] overflow-auto"
|
|
568
559
|
component="div"
|
|
569
560
|
style={{
|
|
570
561
|
height: innerScrollDisabled ? '100%' : `calc(${height}px - 4px)`
|
|
@@ -575,7 +566,13 @@ const Listing = <
|
|
|
575
566
|
) : (
|
|
576
567
|
<Table
|
|
577
568
|
stickyHeader
|
|
578
|
-
className=
|
|
569
|
+
className="grid items-center relative"
|
|
570
|
+
style={{
|
|
571
|
+
gridTemplateColumns: gridTemplateColumn,
|
|
572
|
+
gridTemplateRows: `${dataStyle.header.height}px repeat(${
|
|
573
|
+
rowsToDisplay.length || 1
|
|
574
|
+
}, ${isResponsive ? 'auto' : `${dataStyle.body.height}px`})`
|
|
575
|
+
}}
|
|
579
576
|
component="div"
|
|
580
577
|
size="small"
|
|
581
578
|
>
|
|
@@ -598,7 +595,7 @@ const Listing = <
|
|
|
598
595
|
/>
|
|
599
596
|
|
|
600
597
|
<TableBody
|
|
601
|
-
className=
|
|
598
|
+
className="contents relative"
|
|
602
599
|
component="div"
|
|
603
600
|
onMouseLeave={clearHoveredRow}
|
|
604
601
|
>
|
|
@@ -649,7 +646,7 @@ const Listing = <
|
|
|
649
646
|
(!isSubItem || subItems.canCheckSubItems ? (
|
|
650
647
|
<Cell
|
|
651
648
|
align="left"
|
|
652
|
-
className=
|
|
649
|
+
className="justify-start"
|
|
653
650
|
disableRowCondition={disableRowCondition}
|
|
654
651
|
isRowHovered={isRowHovered}
|
|
655
652
|
row={row}
|
|
@@ -662,9 +659,12 @@ const Listing = <
|
|
|
662
659
|
disableRowCheckCondition(row) ||
|
|
663
660
|
disableRowCondition(row)
|
|
664
661
|
}
|
|
665
|
-
|
|
666
|
-
|
|
662
|
+
slotProps={{
|
|
663
|
+
input: {
|
|
664
|
+
'aria-label': `Select row ${getId(row)}`
|
|
665
|
+
}
|
|
667
666
|
}}
|
|
667
|
+
className="pl-1"
|
|
668
668
|
/>
|
|
669
669
|
</Cell>
|
|
670
670
|
) : (
|