Skip to content

Commit d430632

Browse files
authored
fix(ui5-li): fix visual deviations from Fiori 3 (#2314)
Changes: - info text is align centrally and it is align bottom if description attribute exists - title text is align centrally and it is align top if description attribute exists - item's height is changed to 5rem if description / image attribute exist - checkbox / radio button is positioned correctly Fixes #2297 Fixes #2218
1 parent ff245fa commit d430632

File tree

4 files changed

+119
-12
lines changed

4 files changed

+119
-12
lines changed

packages/main/src/ListItem.js

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ const metadata = {
7373
_mode: {
7474
type: ListMode,
7575
defaultValue: ListMode.None,
76-
noAttribute: true,
7776
},
7877
},
7978
events: /** @lends sap.ui.webcomponents.main.ListItem.prototype */ {

packages/main/src/themes/ListItem.css

+67-7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,22 @@
6161
height: 5rem;
6262
}
6363

64+
:host([has-title][image]) {
65+
height: 5rem;
66+
}
67+
68+
:host([image]) .ui5-li-content {
69+
height: 3rem;
70+
}
71+
72+
:host([description]) .ui5-li-root {
73+
padding: 1rem;
74+
}
75+
76+
:host([description]) .ui5-li-content {
77+
height: 3rem;
78+
}
79+
6480
:host([has-title][description]) .ui5-li-title {
6581
padding-bottom: 0.375rem;
6682
}
@@ -73,6 +89,12 @@
7389
line-height: normal;
7490
}
7591

92+
:host([description]) .ui5-li-title-wrapper {
93+
height: 100%;
94+
justify-content: space-between;
95+
padding: 0.125rem 0;
96+
}
97+
7698
.ui5-li-title {
7799
color: var(--sapTextColor);
78100
font-size: var(--_ui5_list_item_title_size);
@@ -100,13 +122,17 @@
100122
white-space: nowrap;
101123
}
102124

125+
:host([description]) .ui5-li-info {
126+
align-self: flex-end;
127+
}
128+
103129
.ui5-li-img {
104130
width: var(--_ui5_list_item_img_size);
105131
min-width: var(--_ui5_list_item_img_size);
106132
height: var(--_ui5_list_item_img_size);
107133
min-height: var(--_ui5_list_item_img_size);
108134
margin: var(--_ui5_list_item_img_margin);
109-
border-radius: 0;
135+
border-radius: 0.25rem;
110136
}
111137

112138
.ui5-li-icon {
@@ -116,12 +142,6 @@
116142
padding-right: 0.5rem;
117143
}
118144

119-
:host([description]) .ui5-li-img {
120-
width: 3rem;
121-
height: 3rem;
122-
border-radius: 0.25rem;
123-
}
124-
125145
.ui5-li-content {
126146
display: flex;
127147
align-items: center;
@@ -142,6 +162,31 @@
142162
flex-shrink: 0;
143163
}
144164

165+
:host([description]) .ui5-li-singlesel-radiobtn {
166+
align-self: flex-start;
167+
margin-top: var(--_ui5_list_item_selection_btn_margin_top);
168+
}
169+
170+
:host([description]) .ui5-li-multisel-cb {
171+
align-self: flex-start;
172+
margin-top: var(--_ui5_list_item_selection_btn_margin_top);
173+
}
174+
175+
:host([_mode="SingleSelectBegin"]) .ui5-li-root {
176+
padding-right: 1rem;
177+
padding-left: 0;
178+
}
179+
180+
:host([_mode="MultiSelect"]) .ui5-li-root {
181+
padding-right: 1rem;
182+
padding-left: 0;
183+
}
184+
185+
:host([_mode="SingleSelectEnd"]) .ui5-li-root {
186+
padding-right: 0;
187+
padding-left: 1rem;
188+
}
189+
145190
:host [ui5-checkbox].ui5-li-singlesel-radiobtn {
146191
margin-right: var(--_ui5_list_item_cb_margin_right);
147192
}
@@ -155,3 +200,18 @@
155200
:host [dir="rtl"] .ui5-li-img {
156201
margin: .5rem 0 .5rem 0.75rem;
157202
}
203+
204+
:host([_mode="SingleSelectBegin"]) [dir="rtl"].ui5-li-root {
205+
padding-right: 0;
206+
padding-left: 1rem;
207+
}
208+
209+
:host([_mode="MultiSelect"]) [dir="rtl"].ui5-li-root {
210+
padding-right: 0;
211+
padding-left: 1rem;
212+
}
213+
214+
:host([_mode="SingleSelectEnd"]) [dir="rtl"].ui5-li-root {
215+
padding-right: 1rem;
216+
padding-left: 0;
217+
}

packages/main/src/themes/base/sizes-parameters.css

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
--_ui5_checkbox_root_side_padding: .6875rem;
66
--_ui5_checkbox_icon_size: 1rem;
77
--_ui5_custom_list_item_height: 3rem;
8-
--_ui5_custom_list_item_rb_min_width: 3rem;
8+
--_ui5_custom_list_item_rb_min_width: 2.75rem;
99
--_ui5_day_picker_item_width: 2.25rem;
1010
--_ui5_day_picker_item_height: 2.875rem;
1111
--_ui5_day_picker_empty_height: 3rem;
@@ -23,10 +23,11 @@
2323
--_ui5_list_no_data_height: 3rem;
2424
--_ui5_list_item_cb_margin_right: 0;
2525
--_ui5_list_item_title_size: var(--sapMFontLargeSize);
26-
--_ui5_list_item_img_size: 2rem;
26+
--_ui5_list_item_img_size: 3rem;
2727
--_ui5_list_item_img_margin: 0.5rem 0.75rem 0.5rem 0rem;
2828
--_ui5_list_item_base_height: 2.75rem;
2929
--_ui5_list_item_icon_size: 1.125rem;
30+
--_ui5_list_item_selection_btn_margin_top: calc(-1 * var(--_ui5_checkbox_wrapper_padding));
3031
--_ui5_list_busy_row_height: 3rem;
3132
--_ui5_month_picker_item_height: 3rem;
3233
--_ui5_year_picker_item_height: 3rem;
@@ -129,10 +130,10 @@
129130
--_ui5_list_no_data_height: 2rem;
130131
--_ui5_list_item_cb_margin_right: .5rem;
131132
--_ui5_list_item_title_size: var(--sapFontSize);
132-
--_ui5_list_item_img_size: 1.75rem;
133133
--_ui5_list_item_img_margin: 0.55rem 0.75rem 0.5rem 0rem;
134134
--_ui5_list_item_base_height: 2rem;
135135
--_ui5_list_item_icon_size: 1rem;
136+
--_ui5_list_item_selection_btn_margin_top: calc(-1 * var(--_ui5_checkbox_wrapper_padding));
136137
--_ui5_list_busy_row_height: 2rem;
137138

138139
--_ui5_month_picker_item_height: 2rem;

packages/main/test/pages/List.html

+48-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
</head>
1515

1616
<body style="background-color: var(--sapBackgroundColor);">
17-
1817
<ui5-title>List "infinite-scroll"</ui5-title>
1918
<label style="font-size:2rem;">new items loaded:</label><label id="result" style="font-size:2rem;"> 0 times: 0</label>
2019
<ui5-list id="infiniteScrollEx" style="height: 300px" infinite-scroll>
@@ -222,6 +221,37 @@ <h3 id="infoLbl">Items 3/3</h3>
222221
</ui5-li-custom>
223222
</ui5-list>
224223

224+
<br />
225+
Change mode:
226+
<ui5-select id="select">
227+
<ui5-option selected>None</ui5-option>
228+
<ui5-option>SingleSelect</ui5-option>
229+
<ui5-option>SingleSelectBegin</ui5-option>
230+
<ui5-option>SingleSelectEnd</ui5-option>
231+
<ui5-option>MultiSelect</ui5-option>
232+
<ui5-option>Delete</ui5-option>
233+
</ui5-select>
234+
<ui5-list id="myList6" header-text="visualization of different combinations of icon / title / description / info / image - (Current mode: None)">
235+
<ui5-li-custom>
236+
<div style="width: 100%; height: 3rem; display: flex; align-items: center; justify-content: space-between">
237+
<ui5-button>Press me</ui5-button>
238+
<ui5-link>Go to SAP</ui5-link>
239+
</div>
240+
</ui5-li-custom>
241+
<ui5-li>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
242+
<ui5-li description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
243+
<ui5-li info-state="Error" info="Lorem ipsum">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
244+
<ui5-li info-state="Error" info="Lorem ipsum" description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
245+
<ui5-li icon="home">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
246+
<ui5-li icon="home" description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
247+
<ui5-li icon="home" info-state="Error" info="Lorem ipsum">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
248+
<ui5-li icon="home" info-state="Error" info="Lorem ipsum" description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
249+
<ui5-li image="./img/woman_avatar_5.png">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
250+
<ui5-li image="./img/woman_avatar_5.png" description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
251+
<ui5-li image="./img/woman_avatar_5.png" info-state="Error" info="Lorem ipsum">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
252+
<ui5-li image="./img/woman_avatar_5.png" info-state="Error" info="Lorem ipsum" description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</ui5-li>
253+
</ui5-list>
254+
225255
<script>
226256
'use strict';
227257

@@ -238,11 +268,28 @@ <h3 id="infoLbl">Items 3/3</h3>
238268
var lblSelectionChange = document.getElementById('selectionChange');
239269
var lblItemPress2 = document.getElementById('itemPress2');
240270
var lblSelectionChange2 = document.getElementById('selectionChange2');
271+
var visualizationList = document.getElementById('myList6');
272+
var select = document.getElementById('select');
273+
var modes = {
274+
"None": undefined,
275+
"SingleSelect": "SingleSelect",
276+
"SingleSelectBegin": "SingleSelectBegin",
277+
"SingleSelectEnd": "SingleSelectEnd",
278+
"MultiSelect": "MultiSelect",
279+
"Delete": "Delete"
280+
}
241281
var items = ["<ui5-li id='arg'>Argentina</ui5-li>", "<ui5-li id='bg'>Bulgaria</ui5-li>", "<ui5-li id='ch'>China</ui5-li>"];
242282
var info = {
243283
0: "0/3", 1: "1/3", 2: "2/3", 3: "3/3"
244284
};
245285

286+
select.addEventListener("ui5-change", function (event) {
287+
var value = event.detail.selectedOption.textContent;
288+
289+
visualizationList.mode = modes[value];
290+
visualizationList.headerText = visualizationList.headerText.replace(/\(.+\)/, `(Current mode: ${value})`);
291+
});
292+
246293
var getItems = function getItems(items) {
247294
return items.map(function (item) {
248295
return '<ui5-li id="' + item.id + '">' + item.textContent + '</ui5-li>';

0 commit comments

Comments
 (0)