Skip to content

feat(ui5-list): introduce "growing" property #2950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/base/src/util/isElementInView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Determines if the element is within the viewport.
* @param el {HTMLElement}
*/
const isElementInView = el => {
const rect = el.getBoundingClientRect();

return (
rect.top >= 0 && rect.left >= 0
&& rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)
&& rect.right <= (window.innerWidth || document.documentElement.clientWidth)
);
};

export default isElementInView;
34 changes: 32 additions & 2 deletions packages/main/src/List.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@focusin="{{_onfocusin}}"
@keydown="{{_onkeydown}}"
>
<div class="ui5-list-scroll-container" @scroll="{{_onScroll}}">
<div class="ui5-list-scroll-container">
<!-- header -->
{{#if header.length}}
<slot name="header" />
Expand Down Expand Up @@ -36,6 +36,10 @@
{{/if}}
</ul>

{{#if growsWithButton}}
{{> moreRow}}
{{/if}}

{{#if footerText}}
<footer id="{{_id}}-footer" class="ui5-list-footer">
{{footerText}}
Expand All @@ -45,11 +49,37 @@
{{#if hasData}}
<div id="{{_id}}-after" tabindex="0" class="ui5-list-focusarea"></div>
{{/if}}

<span tabindex="-1" aria-hidden="true" class="ui5-list-end-marker"></span>
</div>

{{#if busy}}
<div class="ui5-list-busy-row">
<ui5-busyindicator active size="Medium" class="ui5-list-busy-ind"></ui5-busyindicator>
<ui5-busyindicator
active size="Medium"
class="ui5-list-busy-ind"
style="{{styles.busyInd}}"
></ui5-busyindicator>
</div>
{{/if}}
</div>


{{#*inline "moreRow"}}
<div load-more>
<div
tabindex="0"
role="button"
aria-labelledby="{{_id}}-showMore-text"
?active="{{_loadMoreActive}}"
@click="{{_onLoadMoreClick}}"
@keydown="{{_onLoadMoreKeydown}}"
@keyup="{{_onLoadMoreKeyup}}"
@mousedown="{{_onLoadMoreMousedown}}"
@mouseup="{{_onLoadMoreMouseup}}"
load-more-inner
>
<span id="{{_id}}-showMore-text" load-more-text>{{_moreText}}</span>
</div>
</div>
{{/inline}}
Loading