Skip to content

Commit 6fbbb21

Browse files
authored
feat(ui5-list): introduce "growing" property (#2950)
Similar to the ui5-table, now the ui5-list provides growing property with 3 available options: Button, Scroll, None. As a side effect, it allows developers to set "max-height, overflow: auto" and the "load-more" still working as expected, fixing the referenced SF request #2882. Previously not possible as the List used to listen for the "scroll" of its internal container, which could not be influenced by these external styles. FIXES: #2882 BREAKING_CHANGES: The "infiniteScroll" property has been removed, use growing="Scroll" instead.
1 parent 1e328dc commit 6fbbb21

36 files changed

+587
-188
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Determines if the element is within the viewport.
3+
* @param el {HTMLElement}
4+
*/
5+
const isElementInView = el => {
6+
const rect = el.getBoundingClientRect();
7+
8+
return (
9+
rect.top >= 0 && rect.left >= 0
10+
&& rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)
11+
&& rect.right <= (window.innerWidth || document.documentElement.clientWidth)
12+
);
13+
};
14+
15+
export default isElementInView;

packages/main/src/List.hbs

+32-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@focusin="{{_onfocusin}}"
44
@keydown="{{_onkeydown}}"
55
>
6-
<div class="ui5-list-scroll-container" @scroll="{{_onScroll}}">
6+
<div class="ui5-list-scroll-container">
77
<!-- header -->
88
{{#if header.length}}
99
<slot name="header" />
@@ -36,6 +36,10 @@
3636
{{/if}}
3737
</ul>
3838

39+
{{#if growsWithButton}}
40+
{{> moreRow}}
41+
{{/if}}
42+
3943
{{#if footerText}}
4044
<footer id="{{_id}}-footer" class="ui5-list-footer">
4145
{{footerText}}
@@ -45,11 +49,37 @@
4549
{{#if hasData}}
4650
<div id="{{_id}}-after" tabindex="0" class="ui5-list-focusarea"></div>
4751
{{/if}}
52+
53+
<span tabindex="-1" aria-hidden="true" class="ui5-list-end-marker"></span>
4854
</div>
4955

5056
{{#if busy}}
5157
<div class="ui5-list-busy-row">
52-
<ui5-busyindicator active size="Medium" class="ui5-list-busy-ind"></ui5-busyindicator>
58+
<ui5-busyindicator
59+
active size="Medium"
60+
class="ui5-list-busy-ind"
61+
style="{{styles.busyInd}}"
62+
></ui5-busyindicator>
5363
</div>
5464
{{/if}}
5565
</div>
66+
67+
68+
{{#*inline "moreRow"}}
69+
<div load-more>
70+
<div
71+
tabindex="0"
72+
role="button"
73+
aria-labelledby="{{_id}}-showMore-text"
74+
?active="{{_loadMoreActive}}"
75+
@click="{{_onLoadMoreClick}}"
76+
@keydown="{{_onLoadMoreKeydown}}"
77+
@keyup="{{_onLoadMoreKeyup}}"
78+
@mousedown="{{_onLoadMoreMousedown}}"
79+
@mouseup="{{_onLoadMoreMouseup}}"
80+
load-more-inner
81+
>
82+
<span id="{{_id}}-showMore-text" load-more-text>{{_moreText}}</span>
83+
</div>
84+
</div>
85+
{{/inline}}

0 commit comments

Comments
 (0)