@centreon/ui 23.10.63 → 23.10.64
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 +1 -1
- package/src/Button/Icon/index.tsx +10 -1
- package/src/Listing/ActionBar/index.tsx +14 -7
- package/src/Listing/Cell/DataCell.tsx +7 -7
- package/src/Listing/Cell/index.tsx +5 -5
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +3 -3
- package/src/Listing/Header/Cell/ListingHeaderCell.tsx +2 -2
- package/src/Listing/Header/ListingHeader.tsx +4 -4
- package/src/Listing/Listing.styles.ts +1 -1
- package/src/Listing/Row/Row.tsx +3 -3
- package/src/Listing/index.stories.tsx +5 -5
- package/src/Listing/index.tsx +15 -12
- package/src/Listing/tableAtoms.ts +14 -11
- package/src/Listing/useStyleTable.ts +8 -8
- package/src/SortableItems/SortableItem.tsx +2 -1
package/package.json
CHANGED
|
@@ -11,6 +11,9 @@ import { getNormalizedId } from '../../utils';
|
|
|
11
11
|
const useStyles = makeStyles()((theme) => ({
|
|
12
12
|
button: {
|
|
13
13
|
padding: theme.spacing(0.25)
|
|
14
|
+
},
|
|
15
|
+
tooltip: {
|
|
16
|
+
background: theme.palette.background.tooltip
|
|
14
17
|
}
|
|
15
18
|
}));
|
|
16
19
|
|
|
@@ -19,6 +22,7 @@ type Props = {
|
|
|
19
22
|
className?: string;
|
|
20
23
|
onClick: (event) => void;
|
|
21
24
|
title?: string;
|
|
25
|
+
tooltipClassName?: string;
|
|
22
26
|
tooltipPlacement?:
|
|
23
27
|
| 'bottom'
|
|
24
28
|
| 'left'
|
|
@@ -39,12 +43,17 @@ const IconButton = ({
|
|
|
39
43
|
ariaLabel,
|
|
40
44
|
className,
|
|
41
45
|
tooltipPlacement,
|
|
46
|
+
tooltipClassName,
|
|
42
47
|
...props
|
|
43
48
|
}: Props): JSX.Element => {
|
|
44
49
|
const { classes, cx } = useStyles();
|
|
45
50
|
|
|
46
51
|
return (
|
|
47
|
-
<Tooltip
|
|
52
|
+
<Tooltip
|
|
53
|
+
classes={{ tooltip: cx(classes.tooltip, tooltipClassName) }}
|
|
54
|
+
placement={tooltipPlacement}
|
|
55
|
+
title={title}
|
|
56
|
+
>
|
|
48
57
|
<span aria-label={undefined}>
|
|
49
58
|
<MuiIconButton
|
|
50
59
|
aria-label={ariaLabel}
|
|
@@ -86,7 +86,7 @@ type Props = Pick<
|
|
|
86
86
|
| 'moveTablePagination'
|
|
87
87
|
| 'widthToMoveTablePagination'
|
|
88
88
|
| 'customPaginationClassName'
|
|
89
|
-
| '
|
|
89
|
+
| 'listingVariant'
|
|
90
90
|
| 'viewerModeConfiguration'
|
|
91
91
|
>;
|
|
92
92
|
|
|
@@ -107,7 +107,8 @@ const MemoListingActionBar = ({
|
|
|
107
107
|
widthToMoveTablePagination = 550,
|
|
108
108
|
actionsBarMemoProps = [],
|
|
109
109
|
viewerModeConfiguration,
|
|
110
|
-
|
|
110
|
+
listingVariant,
|
|
111
|
+
visualizationActions
|
|
111
112
|
}: Props): JSX.Element => {
|
|
112
113
|
const marginWidthTableListing = 30;
|
|
113
114
|
const { classes, cx } = useStyles({
|
|
@@ -136,6 +137,7 @@ const MemoListingActionBar = ({
|
|
|
136
137
|
<div className={classes.actions}>
|
|
137
138
|
<div>{actions}</div>
|
|
138
139
|
</div>
|
|
140
|
+
{visualizationActions && <div>{visualizationActions}</div>}
|
|
139
141
|
<div className={classes.subContainer}>
|
|
140
142
|
{!isEmpty(viewerModeConfiguration) &&
|
|
141
143
|
!isNil(viewerModeConfiguration) && (
|
|
@@ -159,7 +161,10 @@ const MemoListingActionBar = ({
|
|
|
159
161
|
viewerModeConfiguration?.customStyle
|
|
160
162
|
?.customStyleViewerModeIcon,
|
|
161
163
|
{
|
|
162
|
-
[classes.mode]: equals(
|
|
164
|
+
[classes.mode]: equals(
|
|
165
|
+
listingVariant,
|
|
166
|
+
ListingVariant.extended
|
|
167
|
+
)
|
|
163
168
|
}
|
|
164
169
|
)}
|
|
165
170
|
>
|
|
@@ -210,7 +215,7 @@ const MemoListingActionBar = ({
|
|
|
210
215
|
currentPage,
|
|
211
216
|
moveTablePagination,
|
|
212
217
|
widthToMoveTablePagination,
|
|
213
|
-
|
|
218
|
+
listingVariant,
|
|
214
219
|
themeMode,
|
|
215
220
|
limit,
|
|
216
221
|
pick(
|
|
@@ -240,8 +245,9 @@ const ListingActionBar = ({
|
|
|
240
245
|
moveTablePagination,
|
|
241
246
|
widthToMoveTablePagination,
|
|
242
247
|
customPaginationClassName,
|
|
243
|
-
|
|
244
|
-
viewerModeConfiguration
|
|
248
|
+
listingVariant,
|
|
249
|
+
viewerModeConfiguration,
|
|
250
|
+
visualizationActions
|
|
245
251
|
}: Props): JSX.Element | null => {
|
|
246
252
|
if (
|
|
247
253
|
not(paginated) &&
|
|
@@ -260,11 +266,12 @@ const ListingActionBar = ({
|
|
|
260
266
|
currentPage={currentPage}
|
|
261
267
|
customPaginationClassName={customPaginationClassName}
|
|
262
268
|
limit={limit}
|
|
269
|
+
listingVariant={listingVariant}
|
|
263
270
|
moveTablePagination={moveTablePagination}
|
|
264
271
|
paginated={paginated}
|
|
265
272
|
totalRows={totalRows}
|
|
266
|
-
viewMode={viewMode}
|
|
267
273
|
viewerModeConfiguration={viewerModeConfiguration}
|
|
274
|
+
visualizationActions={visualizationActions}
|
|
268
275
|
widthToMoveTablePagination={widthToMoveTablePagination}
|
|
269
276
|
onLimitChange={onLimitChange}
|
|
270
277
|
onPaginate={onPaginate}
|
|
@@ -27,10 +27,10 @@ interface Props {
|
|
|
27
27
|
isRowSelected: boolean;
|
|
28
28
|
labelCollapse?: string;
|
|
29
29
|
labelExpand?: string;
|
|
30
|
+
listingVariant?: ListingVariant;
|
|
30
31
|
row?;
|
|
31
32
|
rowColorConditions?: Array<RowColorCondition>;
|
|
32
33
|
subItemsRowProperty?: string;
|
|
33
|
-
viewMode?: ListingVariant;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const DataCell = ({
|
|
@@ -40,14 +40,14 @@ const DataCell = ({
|
|
|
40
40
|
isRowHovered,
|
|
41
41
|
rowColorConditions,
|
|
42
42
|
disableRowCondition,
|
|
43
|
-
|
|
43
|
+
listingVariant,
|
|
44
44
|
getHighlightRowCondition,
|
|
45
45
|
subItemsRowProperty,
|
|
46
46
|
labelCollapse,
|
|
47
47
|
labelExpand
|
|
48
48
|
}: Props): JSX.Element | null => {
|
|
49
49
|
const { classes } = useStyles();
|
|
50
|
-
const { dataStyle } = useStyleTable({
|
|
50
|
+
const { dataStyle } = useStyleTable({ listingVariant });
|
|
51
51
|
|
|
52
52
|
const commonCellProps = {
|
|
53
53
|
disableRowCondition,
|
|
@@ -85,10 +85,10 @@ const DataCell = ({
|
|
|
85
85
|
<Cell
|
|
86
86
|
className={classes.cell}
|
|
87
87
|
isRowHighlighted={isRowHighlighted}
|
|
88
|
+
listingVariant={listingVariant}
|
|
88
89
|
style={{
|
|
89
90
|
gridColumn
|
|
90
91
|
}}
|
|
91
|
-
viewMode={viewMode}
|
|
92
92
|
{...commonCellProps}
|
|
93
93
|
>
|
|
94
94
|
{isTruncated && (
|
|
@@ -114,7 +114,7 @@ const DataCell = ({
|
|
|
114
114
|
<Cell
|
|
115
115
|
className={classes.cell}
|
|
116
116
|
isRowHighlighted={isRowHighlighted}
|
|
117
|
-
|
|
117
|
+
listingVariant={listingVariant}
|
|
118
118
|
onClick={(e): void => {
|
|
119
119
|
if (!clickable && !column.displaySubItemsCaret) {
|
|
120
120
|
return;
|
|
@@ -222,7 +222,7 @@ const MemoizedDataCell = memo<Props>(
|
|
|
222
222
|
|
|
223
223
|
// Explicitely prevent the component from rendering.
|
|
224
224
|
if (nextRenderComponentCondition === false) {
|
|
225
|
-
return equals(prevProps.
|
|
225
|
+
return equals(prevProps.listingVariant, nextProps.listingVariant);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
const previousRowProps = previousRowMemoProps
|
|
@@ -255,7 +255,7 @@ const MemoizedDataCell = memo<Props>(
|
|
|
255
255
|
nextProps.disableRowCondition(nextProps.row)
|
|
256
256
|
) &&
|
|
257
257
|
equals(previousIsRowHighlighted, nextIsRowHighlighted) &&
|
|
258
|
-
equals(prevProps.
|
|
258
|
+
equals(prevProps.listingVariant, nextProps.listingVariant) &&
|
|
259
259
|
equals(prevProps.subItemsRowProperty, nextProps.subItemsRowProperty)
|
|
260
260
|
);
|
|
261
261
|
}
|
|
@@ -54,7 +54,7 @@ const getBackgroundColor = ({
|
|
|
54
54
|
|
|
55
55
|
interface StylesProps extends Props {
|
|
56
56
|
isRowHighlighted?: boolean;
|
|
57
|
-
|
|
57
|
+
listingVariant?: ListingVariant;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
interface GetRowHighlightStyleProps {
|
|
@@ -81,7 +81,7 @@ const useStyles = makeStyles<StylesProps>()(
|
|
|
81
81
|
rowColorConditions,
|
|
82
82
|
disableRowCondition,
|
|
83
83
|
isRowHighlighted,
|
|
84
|
-
|
|
84
|
+
listingVariant
|
|
85
85
|
}
|
|
86
86
|
) => ({
|
|
87
87
|
caret: {
|
|
@@ -115,7 +115,7 @@ const useStyles = makeStyles<StylesProps>()(
|
|
|
115
115
|
},
|
|
116
116
|
height: '100%',
|
|
117
117
|
overflow: 'hidden',
|
|
118
|
-
...getTextStyleByViewMode({
|
|
118
|
+
...getTextStyleByViewMode({ listingVariant, theme }),
|
|
119
119
|
p: getRowHighlightStyle({ isRowHighlighted, theme }),
|
|
120
120
|
padding: theme.spacing(0, 1),
|
|
121
121
|
whiteSpace: 'nowrap'
|
|
@@ -133,8 +133,8 @@ interface Props
|
|
|
133
133
|
isRowHighlighted?: boolean;
|
|
134
134
|
labelCollapse?: string;
|
|
135
135
|
labelExpand?: string;
|
|
136
|
+
listingVariant?: ListingVariant;
|
|
136
137
|
subItemsRowProperty?: string;
|
|
137
|
-
viewMode?: ListingVariant;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
const isPivotExistInTheList = (
|
|
@@ -193,7 +193,7 @@ const Cell = ({
|
|
|
193
193
|
'rowColorConditions',
|
|
194
194
|
'disableRowCondition',
|
|
195
195
|
'isRowHighlighted',
|
|
196
|
-
'
|
|
196
|
+
'listingVariant'
|
|
197
197
|
],
|
|
198
198
|
props
|
|
199
199
|
)}
|
|
@@ -7,11 +7,11 @@ import { getTextStyleByViewMode } from '../../useStyleTable';
|
|
|
7
7
|
interface StylesProps {
|
|
8
8
|
isDragging?: boolean;
|
|
9
9
|
isInDragOverlay?: boolean;
|
|
10
|
-
|
|
10
|
+
listingVariant?: ListingVariant;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const useStyles = makeStyles<StylesProps>()(
|
|
14
|
-
(theme, { isDragging, isInDragOverlay,
|
|
14
|
+
(theme, { isDragging, isInDragOverlay, listingVariant }) => ({
|
|
15
15
|
active: {
|
|
16
16
|
'&, &:hover, &:focus': {
|
|
17
17
|
color: theme.palette.common.white
|
|
@@ -54,7 +54,7 @@ const useStyles = makeStyles<StylesProps>()(
|
|
|
54
54
|
borderBottom: 'none',
|
|
55
55
|
height: 'inherit',
|
|
56
56
|
padding: theme.spacing(0, 1),
|
|
57
|
-
...getTextStyleByViewMode({
|
|
57
|
+
...getTextStyleByViewMode({ listingVariant, theme }),
|
|
58
58
|
'&:hover, &:focus-within, &[data-isdragging=true]': {
|
|
59
59
|
'& .dragHandle': {
|
|
60
60
|
opacity: 1
|
|
@@ -38,13 +38,13 @@ const ListingHeaderCell = ({
|
|
|
38
38
|
style,
|
|
39
39
|
isInDragOverlay,
|
|
40
40
|
areColumnsEditable,
|
|
41
|
-
|
|
41
|
+
listingVariant,
|
|
42
42
|
...props
|
|
43
43
|
}: Props): JSX.Element => {
|
|
44
44
|
const { classes, cx } = useStyles({
|
|
45
45
|
isDragging,
|
|
46
46
|
isInDragOverlay,
|
|
47
|
-
|
|
47
|
+
listingVariant
|
|
48
48
|
});
|
|
49
49
|
const columnLabel = column.shortLabel || column.label;
|
|
50
50
|
|
|
@@ -31,9 +31,9 @@ type Props = Pick<
|
|
|
31
31
|
| 'totalRows'
|
|
32
32
|
> & {
|
|
33
33
|
areColumnsEditable: boolean;
|
|
34
|
+
listingVariant?: ListingVariant;
|
|
34
35
|
memoProps: Array<unknown>;
|
|
35
36
|
rowCount: number;
|
|
36
|
-
viewMode?: ListingVariant;
|
|
37
37
|
} & SelectActionListingHeaderCellProps;
|
|
38
38
|
|
|
39
39
|
interface ContentProps extends Pick<Props, 'sortField' | 'sortOrder'> {
|
|
@@ -57,7 +57,7 @@ const ListingHeader = ({
|
|
|
57
57
|
checkable,
|
|
58
58
|
memoProps,
|
|
59
59
|
areColumnsEditable,
|
|
60
|
-
|
|
60
|
+
listingVariant,
|
|
61
61
|
onSelectAllClick,
|
|
62
62
|
selectedRowCount,
|
|
63
63
|
predefinedRowsSelection,
|
|
@@ -92,10 +92,10 @@ const ListingHeader = ({
|
|
|
92
92
|
isDragging={isDragging}
|
|
93
93
|
isInDragOverlay={isInDragOverlay}
|
|
94
94
|
itemRef={itemRef}
|
|
95
|
+
listingVariant={listingVariant}
|
|
95
96
|
sortField={sortField}
|
|
96
97
|
sortOrder={sortOrder}
|
|
97
98
|
style={style}
|
|
98
|
-
viewMode={viewMode}
|
|
99
99
|
onSort={onSort}
|
|
100
100
|
{...listeners}
|
|
101
101
|
{...attributes}
|
|
@@ -160,7 +160,7 @@ const MemoizedListingHeader = React.memo<Props>(
|
|
|
160
160
|
equals(prevProps.columnConfiguration, nextProps.columnConfiguration) &&
|
|
161
161
|
equals(prevProps.memoProps, nextProps.memoProps) &&
|
|
162
162
|
equals(prevProps.areColumnsEditable, nextProps.areColumnsEditable) &&
|
|
163
|
-
equals(prevProps.
|
|
163
|
+
equals(prevProps.listingVariant, nextProps.listingVariant)
|
|
164
164
|
);
|
|
165
165
|
|
|
166
166
|
export { MemoizedListingHeader as ListingHeader };
|
package/src/Listing/Row/Row.tsx
CHANGED
|
@@ -46,11 +46,11 @@ type Props = {
|
|
|
46
46
|
isShiftKeyDown: boolean;
|
|
47
47
|
lastSelectionIndex: number | null;
|
|
48
48
|
limit: number;
|
|
49
|
+
listingVariant?: ListingVariant;
|
|
49
50
|
row;
|
|
50
51
|
rowColorConditions: Array<RowColorCondition>;
|
|
51
52
|
shiftKeyDownRowPivot: number | null;
|
|
52
53
|
subItemsPivots: Array<number | string>;
|
|
53
|
-
viewMode?: ListingVariant;
|
|
54
54
|
visibleColumns: Array<Column>;
|
|
55
55
|
} & TableRowProps;
|
|
56
56
|
|
|
@@ -116,7 +116,7 @@ const Row = memo<RowProps>(
|
|
|
116
116
|
isShiftKeyDown: prevIsShiftKeyDown,
|
|
117
117
|
shiftKeyDownRowPivot: prevShiftKeyDownRowPivot,
|
|
118
118
|
lastSelectionIndex: prevLastSelectionIndex,
|
|
119
|
-
|
|
119
|
+
listingVariant: prevViewMode
|
|
120
120
|
} = prevProps;
|
|
121
121
|
const {
|
|
122
122
|
row: nextRow,
|
|
@@ -127,7 +127,7 @@ const Row = memo<RowProps>(
|
|
|
127
127
|
shiftKeyDownRowPivot: nextShiftKeyDownRowPivot,
|
|
128
128
|
lastSelectionIndex: nextLastSelectionIndex,
|
|
129
129
|
limit: nextLimit,
|
|
130
|
-
|
|
130
|
+
listingVariant: nextViewMode
|
|
131
131
|
} = nextProps;
|
|
132
132
|
|
|
133
133
|
if (
|
|
@@ -177,17 +177,17 @@ const StoryTemplate = ({
|
|
|
177
177
|
export const normal = (): JSX.Element => <StoryTemplate />;
|
|
178
178
|
|
|
179
179
|
export const WithSpecifiedViewMode = (): JSX.Element => {
|
|
180
|
-
const [
|
|
181
|
-
const
|
|
180
|
+
const [listingVariant, setListingVariant] = useState(ListingVariant.extended);
|
|
181
|
+
const newListingVariant = equals(listingVariant, ListingVariant.compact)
|
|
182
182
|
? ListingVariant.extended
|
|
183
183
|
: ListingVariant.compact;
|
|
184
184
|
|
|
185
185
|
return (
|
|
186
186
|
<StoryTemplate
|
|
187
|
-
|
|
187
|
+
listingVariant={listingVariant}
|
|
188
188
|
viewerModeConfiguration={{
|
|
189
|
-
onClick: () =>
|
|
190
|
-
title:
|
|
189
|
+
onClick: () => setListingVariant(newListingVariant),
|
|
190
|
+
title: listingVariant
|
|
191
191
|
}}
|
|
192
192
|
/>
|
|
193
193
|
);
|
package/src/Listing/index.tsx
CHANGED
|
@@ -102,6 +102,7 @@ export interface Props<TRow> {
|
|
|
102
102
|
headerMemoProps?: Array<unknown>;
|
|
103
103
|
innerScrollDisabled?: boolean;
|
|
104
104
|
limit?: number;
|
|
105
|
+
listingVariant?: ListingVariant;
|
|
105
106
|
loading?: boolean;
|
|
106
107
|
moveTablePagination?: boolean;
|
|
107
108
|
onLimitChange?: (limit) => void;
|
|
@@ -126,8 +127,8 @@ export interface Props<TRow> {
|
|
|
126
127
|
rowProperty: string;
|
|
127
128
|
};
|
|
128
129
|
totalRows?: number;
|
|
129
|
-
viewMode?: ListingVariant;
|
|
130
130
|
viewerModeConfiguration?: ViewerModeConfiguration;
|
|
131
|
+
visualizationActions?: JSX.Element;
|
|
131
132
|
widthToMoveTablePagination?: number;
|
|
132
133
|
}
|
|
133
134
|
|
|
@@ -139,6 +140,7 @@ export const performanceRowsLimit = 60;
|
|
|
139
140
|
|
|
140
141
|
const Listing = <TRow extends { id: RowId }>({
|
|
141
142
|
limit = 10,
|
|
143
|
+
visualizationActions,
|
|
142
144
|
columns,
|
|
143
145
|
columnConfiguration = defaultColumnConfiguration,
|
|
144
146
|
customPaginationClassName,
|
|
@@ -168,7 +170,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
168
170
|
predefinedRowsSelection = [],
|
|
169
171
|
actionsBarMemoProps = [],
|
|
170
172
|
moveTablePagination,
|
|
171
|
-
|
|
173
|
+
listingVariant = ListingVariant.compact,
|
|
172
174
|
widthToMoveTablePagination,
|
|
173
175
|
getHighlightRowCondition,
|
|
174
176
|
viewerModeConfiguration,
|
|
@@ -187,7 +189,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
187
189
|
const { dataStyle, getGridTemplateColumn } = useStyleTable({
|
|
188
190
|
checkable,
|
|
189
191
|
currentVisibleColumns,
|
|
190
|
-
|
|
192
|
+
listingVariant
|
|
191
193
|
});
|
|
192
194
|
|
|
193
195
|
const { t } = useTranslation();
|
|
@@ -230,8 +232,8 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
230
232
|
dataStyle,
|
|
231
233
|
getGridTemplateColumn,
|
|
232
234
|
limit,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
listingVariant,
|
|
236
|
+
rows: rowsToDisplay
|
|
235
237
|
});
|
|
236
238
|
|
|
237
239
|
useResizeObserver({
|
|
@@ -501,11 +503,12 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
501
503
|
currentPage={currentPage}
|
|
502
504
|
customPaginationClassName={customPaginationClassName}
|
|
503
505
|
limit={limit}
|
|
506
|
+
listingVariant={listingVariant}
|
|
504
507
|
moveTablePagination={moveTablePagination}
|
|
505
508
|
paginated={paginated}
|
|
506
509
|
totalRows={totalRows}
|
|
507
|
-
viewMode={viewMode}
|
|
508
510
|
viewerModeConfiguration={viewerModeConfiguration}
|
|
511
|
+
visualizationActions={visualizationActions}
|
|
509
512
|
widthToMoveTablePagination={widthToMoveTablePagination}
|
|
510
513
|
onLimitChange={changeLimit}
|
|
511
514
|
onPaginate={onPaginate}
|
|
@@ -532,13 +535,13 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
532
535
|
checkable={checkable}
|
|
533
536
|
columnConfiguration={columnConfiguration}
|
|
534
537
|
columns={columns}
|
|
538
|
+
listingVariant={listingVariant}
|
|
535
539
|
memoProps={headerMemoProps}
|
|
536
540
|
predefinedRowsSelection={predefinedRowsSelection}
|
|
537
541
|
rowCount={limit - emptyRows}
|
|
538
542
|
selectedRowCount={selectedRows.length}
|
|
539
543
|
sortField={sortField}
|
|
540
544
|
sortOrder={sortOrder}
|
|
541
|
-
viewMode={viewMode}
|
|
542
545
|
onSelectAllClick={selectAllRows}
|
|
543
546
|
onSelectColumns={onSelectColumns}
|
|
544
547
|
onSelectRowsWithCondition={onSelectRowsWithCondition}
|
|
@@ -573,12 +576,12 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
573
576
|
}
|
|
574
577
|
lastSelectionIndex={lastSelectionIndex}
|
|
575
578
|
limit={limit}
|
|
579
|
+
listingVariant={listingVariant}
|
|
576
580
|
row={row}
|
|
577
581
|
rowColorConditions={rowColorConditions}
|
|
578
582
|
shiftKeyDownRowPivot={shiftKeyDownRowPivot}
|
|
579
583
|
subItemsPivots={subItemsPivots}
|
|
580
584
|
tabIndex={-1}
|
|
581
|
-
viewMode={viewMode}
|
|
582
585
|
visibleColumns={visibleColumns}
|
|
583
586
|
onClick={(): void => {
|
|
584
587
|
onRowClick(row);
|
|
@@ -628,10 +631,10 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
628
631
|
key={`${getId(row)}-${column.id}`}
|
|
629
632
|
labelCollapse={subItems.labelCollapse}
|
|
630
633
|
labelExpand={subItems.labelExpand}
|
|
634
|
+
listingVariant={listingVariant}
|
|
631
635
|
row={row}
|
|
632
636
|
rowColorConditions={rowColorConditions}
|
|
633
637
|
subItemsRowProperty={subItems?.rowProperty}
|
|
634
|
-
viewMode={viewMode}
|
|
635
638
|
/>
|
|
636
639
|
))}
|
|
637
640
|
</ListingRow>
|
|
@@ -674,7 +677,7 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
674
677
|
columnConfiguration,
|
|
675
678
|
moveTablePagination,
|
|
676
679
|
widthToMoveTablePagination,
|
|
677
|
-
|
|
680
|
+
listingVariant,
|
|
678
681
|
...props
|
|
679
682
|
}: MemoizedListingProps<TRow>): JSX.Element =>
|
|
680
683
|
useMemoComponent({
|
|
@@ -686,6 +689,7 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
686
689
|
currentPage={currentPage}
|
|
687
690
|
innerScrollDisabled={innerScrollDisabled}
|
|
688
691
|
limit={limit}
|
|
692
|
+
listingVariant={listingVariant}
|
|
689
693
|
loading={loading}
|
|
690
694
|
moveTablePagination={moveTablePagination}
|
|
691
695
|
paginated={paginated}
|
|
@@ -695,7 +699,6 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
695
699
|
sortField={sortField}
|
|
696
700
|
sortOrder={sortOrder}
|
|
697
701
|
totalRows={totalRows}
|
|
698
|
-
viewMode={viewMode}
|
|
699
702
|
widthToMoveTablePagination={widthToMoveTablePagination}
|
|
700
703
|
{...props}
|
|
701
704
|
/>
|
|
@@ -719,7 +722,7 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
719
722
|
sortOrder,
|
|
720
723
|
sortField,
|
|
721
724
|
innerScrollDisabled,
|
|
722
|
-
|
|
725
|
+
listingVariant
|
|
723
726
|
]
|
|
724
727
|
});
|
|
725
728
|
|
|
@@ -32,16 +32,19 @@ export const tableStyleAtom = atom<TableStyleAtom>({
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
export const tableStyleDerivedAtom = atom(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
export const tableStyleDerivedAtom = atom(
|
|
36
|
+
null,
|
|
37
|
+
(get, set, { listingVariant }) => {
|
|
38
|
+
const tableStyle = get(tableStyleAtom);
|
|
39
|
+
|
|
40
|
+
const isExtendedMode = equals(listingVariant, ListingVariant.extended);
|
|
41
|
+
|
|
42
|
+
set(tableStyleAtom, {
|
|
43
|
+
...tableStyle,
|
|
44
|
+
body: isExtendedMode ? extendedTableBody : compactTableBody,
|
|
45
|
+
header: isExtendedMode ? extendedTableHeader : compactTableHeader
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
);
|
|
46
49
|
|
|
47
50
|
export const subItemsPivotsAtom = atom<Array<number | string>>([]);
|
|
@@ -14,7 +14,7 @@ import { tableStyleAtom, tableStyleDerivedAtom } from './tableAtoms';
|
|
|
14
14
|
interface TableStyle {
|
|
15
15
|
checkable?: boolean;
|
|
16
16
|
currentVisibleColumns?: Array<Column>;
|
|
17
|
-
|
|
17
|
+
listingVariant?: ListingVariant;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
interface TableStyleState {
|
|
@@ -27,23 +27,23 @@ const isCompactMode = equals<ListingVariant | undefined>(
|
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
interface GetTextStyleProps {
|
|
30
|
+
listingVariant?: ListingVariant;
|
|
30
31
|
theme: Theme;
|
|
31
|
-
viewMode?: ListingVariant;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export const getTextStyleByViewMode = ({
|
|
35
|
-
|
|
35
|
+
listingVariant,
|
|
36
36
|
theme
|
|
37
37
|
}: GetTextStyleProps): CSSObject =>
|
|
38
38
|
pick(
|
|
39
39
|
['color', 'fontSize', 'lineHeight'],
|
|
40
|
-
theme.typography[isCompactMode(
|
|
40
|
+
theme.typography[isCompactMode(listingVariant) ? 'body2' : 'body1']
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
const useStyleTable = ({
|
|
44
44
|
checkable,
|
|
45
45
|
currentVisibleColumns,
|
|
46
|
-
|
|
46
|
+
listingVariant
|
|
47
47
|
}: TableStyle): TableStyleState => {
|
|
48
48
|
const dataStyle = useAtomValue(tableStyleAtom);
|
|
49
49
|
|
|
@@ -69,10 +69,10 @@ const useStyleTable = ({
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
useEffect(() => {
|
|
72
|
-
if (
|
|
73
|
-
updateStyleTable({
|
|
72
|
+
if (listingVariant) {
|
|
73
|
+
updateStyleTable({ listingVariant });
|
|
74
74
|
}
|
|
75
|
-
}, [
|
|
75
|
+
}, [listingVariant]);
|
|
76
76
|
|
|
77
77
|
return {
|
|
78
78
|
dataStyle,
|