Skip to content

Commit ad56eaa

Browse files
authored
fix(ui5-list): show busy ind over the list (#2684)
- Show busy indicator over the list (as specified in Fiori 3), not at the bottom (as it is prior to this change). - Fade background with opacity (0.72), closest to openui5 where we have calculated background - fade(@sapBackgroundColor, 72%) FIXES: #2568
1 parent bb7c952 commit ad56eaa

File tree

5 files changed

+61
-59
lines changed

5 files changed

+61
-59
lines changed

packages/main/src/List.hbs

+41-42
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,52 @@
22
class="ui5-list-root"
33
@focusin="{{_onfocusin}}"
44
@keydown="{{_onkeydown}}"
5-
@scroll="{{_onScroll}}"
65
>
7-
<!-- header -->
8-
{{#if header.length}}
9-
<slot name="header" />
10-
{{/if}}
11-
{{#if shouldRenderH1}}
12-
<header id="{{headerID}}" class="ui5-list-header">
13-
{{headerText}}
14-
</header>
15-
{{/if}}
6+
<div class="ui5-list-scroll-container" @scroll="{{_onScroll}}">
7+
<!-- header -->
8+
{{#if header.length}}
9+
<slot name="header" />
10+
{{/if}}
11+
{{#if shouldRenderH1}}
12+
<header id="{{headerID}}" class="ui5-list-header">
13+
{{headerText}}
14+
</header>
15+
{{/if}}
16+
17+
{{#if hasData}}
18+
<div id="{{_id}}-before" tabindex="0" class="ui5-list-focusarea"></div>
19+
{{/if}}
1620

17-
{{#if hasData}}
18-
<div id="{{_id}}-before" tabindex="0" class="ui5-list-focusarea"></div>
19-
{{/if}}
21+
<ul id="{{_id}}-listUl"
22+
class="ui5-list-ul"
23+
role="{{accRole}}"
24+
aria-label="{{ariaLabelТxt}}"
25+
aria-labelledby="{{ariaLabelledBy}}"
26+
aria-multiselectable="{{isMultiSelect}}"
27+
>
28+
<slot></slot>
2029

21-
<ul id="{{_id}}-listUl"
22-
class="ui5-list-ul"
23-
role="{{accRole}}"
24-
aria-label="{{ariaLabelТxt}}"
25-
aria-labelledby="{{ariaLabelledBy}}"
26-
aria-multiselectable="{{isMultiSelect}}"
27-
>
28-
<slot></slot>
30+
{{#if showNoDataText}}
31+
<li id="{{_id}}-nodata" class="ui5-list-nodata" tabindex="{{noDataTabIndex}}" style="list-style-type: none;">
32+
<div id="{{_id}}-nodata-text" class="ui5-list-nodata-text">
33+
{{noDataText}}
34+
</div>
35+
</li>
36+
{{/if}}
37+
</ul>
2938

30-
{{#if showNoDataText}}
31-
<li id="{{_id}}-nodata" class="ui5-list-nodata" tabindex="{{noDataTabIndex}}" style="list-style-type: none;">
32-
<div id="{{_id}}-nodata-text" class="ui5-list-nodata-text">
33-
{{noDataText}}
34-
</div>
35-
</li>
39+
{{#if footerText}}
40+
<footer id="{{_id}}-footer" class="ui5-list-footer">
41+
{{footerText}}
42+
</footer>
3643
{{/if}}
37-
</ul>
38-
39-
{{#if footerText}}
40-
<footer id="{{_id}}-footer" class="ui5-list-footer">
41-
{{footerText}}
42-
</footer>
43-
{{/if}}
4444

45-
{{#if showBusy}}
46-
<div class="ui5-list-busy-row">
47-
<ui5-busyindicator ?active="{{busy}}" size="Medium" class="ui5-list-busy-ind"></ui5-busyindicator>
48-
</div>
49-
{{/if}}
45+
{{#if hasData}}
46+
<div id="{{_id}}-after" tabindex="0" class="ui5-list-focusarea"></div>
47+
{{/if}}
48+
</div>
5049

51-
{{#if hasData}}
52-
<div id="{{_id}}-after" tabindex="0" class="ui5-list-focusarea"></div>
53-
{{/if}}
50+
<div class="ui5-list-busy-row">
51+
<ui5-busyindicator ?active="{{busy}}" size="Medium" class="ui5-list-busy-ind"></ui5-busyindicator>
52+
</div>
5453
</div>

packages/main/src/List.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import ListTemplate from "./generated/templates/ListTemplate.lit.js";
1515
// Styles
1616
import listCss from "./generated/themes/List.css.js";
1717

18-
const BUSYINDICATOR_HEIGHT = 48; // px
1918
const INFINITE_SCROLL_DEBOUNCE_RATE = 250; // ms
2019

2120
/**
@@ -389,10 +388,6 @@ class List extends UI5Element {
389388
return !this.hasData && this.noDataText;
390389
}
391390

392-
get showBusy() {
393-
return this.busy || this.infiniteScroll;
394-
}
395-
396391
get isMultiSelect() {
397392
return this.mode === ListMode.MultiSelect;
398393
}
@@ -763,7 +758,7 @@ class List extends UI5Element {
763758
}
764759
this.previousScrollPosition = scrollTop;
765760

766-
if (scrollHeight - BUSYINDICATOR_HEIGHT <= height + scrollTop) {
761+
if (scrollHeight <= height + scrollTop) {
767762
this.fireEvent("load-more");
768763
}
769764
}

packages/main/src/themes/List.css

+15-8
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,26 @@
1212
border-bottom: 0;
1313
}
1414

15+
:host([busy]) {
16+
opacity: 0.72;
17+
}
18+
19+
:host([busy]) .ui5-list-busy-row {
20+
position: absolute;
21+
top: 50%;
22+
left: 50%;
23+
}
24+
1525
.ui5-list-root {
1626
width: 100%;
1727
height: 100%;
1828
position: relative;
1929
box-sizing: border-box;
30+
}
31+
32+
.ui5-list-scroll-container {
2033
overflow: auto;
34+
height: 100%;
2135
}
2236

2337
.ui5-list-ul {
@@ -84,11 +98,4 @@
8498
overflow: hidden;
8599
text-overflow: ellipsis;
86100
white-space: nowrap;
87-
}
88-
89-
.ui5-list-busy-row {
90-
display: flex;
91-
align-items: center;
92-
height: var(--_ui5_list_busy_row_height);
93-
justify-content: center;
94-
}
101+
}

packages/main/test/pages/List.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,16 @@ <h3 id="infoLbl">Items 3/3</h3>
383383
var itemsLoadedTotal = 0;
384384
var itemsToLoad = 5;
385385
var loadedCount = 0;
386-
infiniteScrollEx.addEventListener("loadMore", function(e) {
386+
387+
infiniteScrollEx.addEventListener("ui5-load-more", function(e) {
387388
var el = infiniteScrollEx;
388389
el.busy = true;
389390

390391
setTimeout(function() {
391392
insertItems(el, 3);
392393
el.busy = false;
393394
result.textContent = (++loadedCount) + " times " + (itemsLoadedTotal += itemsToLoad);
394-
}, 200);
395+
}, 1000);
395396
});
396397

397398
</script>

packages/main/test/pages/List_test_page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ <h2 id="testHeader">Test aria</h2>
222222
})
223223

224224
btnTrigger.addEventListener("click", function(e) {
225-
var scrollableContiner = infiniteScrollEx.shadowRoot.querySelector(".ui5-list-root");
225+
var scrollableContiner = infiniteScrollEx.shadowRoot.querySelector(".ui5-list-scroll-container");
226226
scrollableContiner.scroll(0, scrollableContiner.scrollHeight);
227227
});
228228

0 commit comments

Comments
 (0)