1
- import { MessageStrip } from '@ui5/webcomponents-react' ;
1
+ import { Button , MessageStrip } from '@ui5/webcomponents-react' ;
2
+ import { ThemingParameters } from '@ui5/webcomponents-react-base' ;
3
+ import { Fragment , useState } from 'react' ;
2
4
import versionInfo from '../../config/version-info.json' ;
5
+ import iconArrowRight from '@ui5/webcomponents-icons/dist/slim-arrow-right.js' ;
6
+ import iconArrowDown from '@ui5/webcomponents-icons/dist/slim-arrow-down.js' ;
3
7
4
- const allWCRVersions = Object . values ( versionInfo ) ;
8
+ const allWCRVersions : string [ ] = Object . values ( versionInfo ) ;
5
9
6
10
export function VersionTable ( ) {
11
+ const [ expanded , setExpanded ] = useState ( false ) ;
7
12
return (
8
13
< >
9
14
< MessageStrip hideCloseButton >
@@ -34,7 +39,8 @@ export function VersionTable() {
34
39
const nextVersion = allWCRVersions [ currentWCRIndex + 1 ] ;
35
40
const currentMajor = parseInt ( wcrVersion . split ( '.' ) [ 0 ] ) ;
36
41
const currentMinor = parseInt ( wcrVersion . split ( '.' ) [ 1 ] ) ;
37
- const wcrVersions = [ `~${ wcrVersion } ` ] ;
42
+ const lastV1 = currentMajor === 1 && currentMinor === 27 ;
43
+ const wcrVersions = [ lastV1 ? wcrVersion : `~${ wcrVersion } ` ] ;
38
44
if ( nextVersion ) {
39
45
let minor = parseInt ( nextVersion . split ( '.' ) [ 1 ] ) ;
40
46
for ( let i = currentMinor + 1 ; i < minor ; i ++ ) {
@@ -43,13 +49,64 @@ export function VersionTable() {
43
49
}
44
50
45
51
return (
46
- < tr key = { wcrVersion } >
47
- < td >
48
- { lastEntry ? '>= ' : '' }
49
- { wcrVersions . join ( ', ' ) }
50
- </ td >
51
- < td > ~{ wcVersion } </ td >
52
- </ tr >
52
+ < Fragment key = { wcrVersion } >
53
+ { wcrVersion === '1.0.1' && (
54
+ < tr >
55
+ < td colSpan = { 2 } >
56
+ < Button
57
+ data-ui5-compact-size
58
+ icon = { expanded ? iconArrowDown : iconArrowRight }
59
+ design = "Transparent"
60
+ onClick = { ( ) => {
61
+ setExpanded ( ( prev ) => ! prev ) ;
62
+ } }
63
+ />
64
+ < span
65
+ style = { {
66
+ fontSize : ThemingParameters . sapFontLargeSize ,
67
+ fontFamily : ThemingParameters . sapFontBoldFamily ,
68
+ marginInlineStart : '0.5rem'
69
+ } }
70
+ >
71
+ Version 1
72
+ </ span >
73
+ </ td >
74
+ </ tr >
75
+ ) }
76
+ { currentMajor === 1 && expanded && (
77
+ < tr >
78
+ < td >
79
+ { lastV1 ? '^' : '' }
80
+ { wcrVersions . join ( ', ' ) }
81
+ </ td >
82
+ < td > ~{ wcVersion } </ td >
83
+ </ tr >
84
+ ) }
85
+ { wcrVersion === '2.0.0' && (
86
+ < tr >
87
+ < td colSpan = { 2 } >
88
+ < span
89
+ style = { {
90
+ fontSize : ThemingParameters . sapFontLargeSize ,
91
+ fontFamily : ThemingParameters . sapFontBoldFamily ,
92
+ marginInlineEnd : '0.5rem'
93
+ } }
94
+ >
95
+ Version 2
96
+ </ span >
97
+ </ td >
98
+ </ tr >
99
+ ) }
100
+ { currentMajor === 2 && (
101
+ < tr >
102
+ < td >
103
+ { lastEntry ? '>= ' : '' }
104
+ { wcrVersions . join ( ', ' ) }
105
+ </ td >
106
+ < td > ~{ wcVersion } </ td >
107
+ </ tr >
108
+ ) }
109
+ </ Fragment >
53
110
) ;
54
111
} ) }
55
112
</ tbody >
0 commit comments