@@ -6,7 +6,14 @@ import { clsx } from 'clsx';
6
6
import type { ReactElement , ReactNode } from 'react' ;
7
7
import React , { Children , forwardRef , Fragment , isValidElement , useCallback , useEffect , useState } from 'react' ;
8
8
import { createUseStyles } from 'react-jss' ;
9
- import { ButtonDesign , FlexBoxDirection , TitleLevel , ValueState , WrappingType } from '../../enums/index.js' ;
9
+ import {
10
+ ButtonDesign ,
11
+ FlexBoxDirection ,
12
+ GlobalStyleClasses ,
13
+ TitleLevel ,
14
+ ValueState ,
15
+ WrappingType
16
+ } from '../../enums/index.js' ;
10
17
import { ALL , LIST_NO_DATA } from '../../i18n/i18n-defaults.js' ;
11
18
import type { CommonProps } from '../../interfaces/index.js' ;
12
19
import { MessageViewContext } from '../../internal/MessageViewContext.js' ;
@@ -115,7 +122,7 @@ const useStyles = createUseStyles(
115
122
'&[data-key="Success"]:not([pressed])' : { color : ThemingParameters . sapPositiveElementColor } ,
116
123
'&[data-key="Information"]:not([pressed])' : { color : ThemingParameters . sapInformativeElementColor }
117
124
} ,
118
- detailsContainer : {
125
+ details : {
119
126
padding : '1rem'
120
127
} ,
121
128
detailsIcon : {
@@ -136,6 +143,12 @@ const useStyles = createUseStyles(
136
143
lineHeight : 1.4 ,
137
144
color : ThemingParameters . sapTextColor ,
138
145
marginBlockEnd : '1rem'
146
+ } ,
147
+ messagesContainer : {
148
+ height : '100%'
149
+ } ,
150
+ detailsContainer : {
151
+ height : '100%'
139
152
}
140
153
} ,
141
154
{ name : 'MessageView' }
@@ -188,7 +201,12 @@ const MessageView = forwardRef<MessageViewDomRef, MessageViewPropTypes>((props,
188
201
setListFilter ( e . detail . selectedItem . dataset . key ) ;
189
202
} ;
190
203
191
- const outerClasses = clsx ( classes . container , className , selectedMessage && classes . showDetails ) ;
204
+ const outerClasses = clsx (
205
+ classes . container ,
206
+ GlobalStyleClasses . sapScrollBar ,
207
+ className ,
208
+ selectedMessage && classes . showDetails
209
+ ) ;
192
210
193
211
return (
194
212
< div ref = { componentRef } { ...rest } className = { outerClasses } >
@@ -197,49 +215,53 @@ const MessageView = forwardRef<MessageViewDomRef, MessageViewPropTypes>((props,
197
215
selectMessage : setSelectedMessage
198
216
} }
199
217
>
200
- < div style = { { visibility : selectedMessage ? 'hidden' : 'visible' } } >
201
- { filledTypes > 1 && (
202
- < Bar
203
- startContent = {
204
- < SegmentedButton onSelectionChange = { handleListFilterChange } >
205
- < SegmentedButtonItem data-key = "All" pressed = { listFilter === 'All' } >
206
- { i18nBundle . getText ( ALL ) }
207
- </ SegmentedButtonItem >
208
- { /* @ts -expect-error: The key can't be typed, it's always `string`, but since the `ValueState` enum only contains strings it's fine to use here*/ }
209
- { Object . entries ( messageTypes ) . map ( ( [ valueState , count ] : [ ValueState , number ] ) => {
210
- if ( count === 0 ) {
211
- return null ;
212
- }
213
- return (
214
- < SegmentedButtonItem
215
- key = { valueState }
216
- data-key = { valueState }
217
- pressed = { listFilter === valueState }
218
- icon = { getIconNameForType ( valueState ) }
219
- className = { classes . button }
220
- >
221
- { count }
218
+ < div style = { { visibility : selectedMessage ? 'hidden' : 'visible' } } className = { classes . messagesContainer } >
219
+ { ! selectedMessage && (
220
+ < >
221
+ { filledTypes > 1 && (
222
+ < Bar
223
+ startContent = {
224
+ < SegmentedButton onSelectionChange = { handleListFilterChange } >
225
+ < SegmentedButtonItem data-key = "All" pressed = { listFilter === 'All' } >
226
+ { i18nBundle . getText ( ALL ) }
222
227
</ SegmentedButtonItem >
223
- ) ;
224
- } ) }
225
- </ SegmentedButton >
226
- }
227
- />
228
+ { /* @ts -expect-error: The key can't be typed, it's always `string`, but since the `ValueState` enum only contains strings it's fine to use here*/ }
229
+ { Object . entries ( messageTypes ) . map ( ( [ valueState , count ] : [ ValueState , number ] ) => {
230
+ if ( count === 0 ) {
231
+ return null ;
232
+ }
233
+ return (
234
+ < SegmentedButtonItem
235
+ key = { valueState }
236
+ data-key = { valueState }
237
+ pressed = { listFilter === valueState }
238
+ icon = { getIconNameForType ( valueState ) }
239
+ className = { classes . button }
240
+ >
241
+ { count }
242
+ </ SegmentedButtonItem >
243
+ ) ;
244
+ } ) }
245
+ </ SegmentedButton >
246
+ }
247
+ />
248
+ ) }
249
+ < List onItemClick = { onItemSelect } noDataText = { i18nBundle . getText ( LIST_NO_DATA ) } >
250
+ { groupItems
251
+ ? groupedMessages . map ( ( [ groupName , items ] ) => {
252
+ return (
253
+ < Fragment key = { groupName } >
254
+ { groupName && < GroupHeaderListItem > { groupName } </ GroupHeaderListItem > }
255
+ { items }
256
+ </ Fragment >
257
+ ) ;
258
+ } )
259
+ : filteredChildren }
260
+ </ List >
261
+ </ >
228
262
) }
229
- < List onItemClick = { onItemSelect } noDataText = { i18nBundle . getText ( LIST_NO_DATA ) } >
230
- { groupItems
231
- ? groupedMessages . map ( ( [ groupName , items ] ) => {
232
- return (
233
- < Fragment key = { groupName } >
234
- { groupName && < GroupHeaderListItem > { groupName } </ GroupHeaderListItem > }
235
- { items }
236
- </ Fragment >
237
- ) ;
238
- } )
239
- : filteredChildren }
240
- </ List >
241
263
</ div >
242
- < div >
264
+ < div className = { classes . detailsContainer } >
243
265
{ childrenArray . length > 0 ? (
244
266
< >
245
267
{ showDetailsPageHeader && selectedMessage && (
@@ -250,7 +272,7 @@ const MessageView = forwardRef<MessageViewDomRef, MessageViewPropTypes>((props,
250
272
/>
251
273
) }
252
274
{ selectedMessage && (
253
- < FlexBox className = { classes . detailsContainer } >
275
+ < FlexBox className = { classes . details } >
254
276
< Icon
255
277
data-type = { selectedMessage . type }
256
278
name = { getIconNameForType ( selectedMessage . type ) }
0 commit comments