Skip to content

feat(ui5-busyindicator): implement text property #1506

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 2 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
22 changes: 14 additions & 8 deletions packages/main/src/BusyIndicator.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<div class="ui5-busyindicator-root">

{{#if active}}
<div class="ui5-busyindicator-dynamic-content" tabindex="0" role="progressbar" aria-valuemin="0" aria-valuemax="100" title="{{ariaTitle}}">
<div class="ui5-busyindicator-circle circle-animation-0"></div>
<div class="ui5-busyindicator-circle circle-animation-1"></div>
<div class="ui5-busyindicator-circle circle-animation-2"></div>
</div>
{{/if}}
<div class="ui5-busyindicator-wrapper">
{{#if active}}
<div class="ui5-busyindicator-dynamic-content" tabindex="0" role="progressbar" aria-valuemin="0" aria-valuemax="100" title="{{ariaTitle}}">
<div class="ui5-busyindicator-circle circle-animation-0"></div>
<div class="ui5-busyindicator-circle circle-animation-1"></div>
<div class="ui5-busyindicator-circle circle-animation-2"></div>
</div>
{{/if}}
{{#if text.length}}
<ui5-label class="ui5-busyindicator-text">
{{text}}
</ui5-label>
{{/if}}
</div>

<slot></slot>
</div>
18 changes: 17 additions & 1 deletion packages/main/src/BusyIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
import BusyIndicatorSize from "./types/BusyIndicatorSize.js";
import Label from "./Label.js";

// Template
import BusyIndicatorTemplate from "./generated/templates/BusyIndicatorTemplate.lit.js";
Expand Down Expand Up @@ -30,6 +31,18 @@ const metadata = {
},
},
properties: /** @lends sap.ui.webcomponents.main.BusyIndicator.prototype */ {

/**
* Defines text to be displayed below the busy indicator. It can be used to inform the user of the current operation.
* @type {String}
* @public
* @defaultvalue ""
* @since 1.0.0-rc.7
*/
text: {
type: String,
},

/**
* Defines the size of the <code>ui5-busyindicator</code>.
* <br><br>
Expand Down Expand Up @@ -101,7 +114,10 @@ class BusyIndicator extends UI5Element {
}

static async onDefine() {
await fetchI18nBundle("@ui5/webcomponents");
await Promise.all([
fetchI18nBundle("@ui5/webcomponents"),
Label.define(),
]);
}

get ariaTitle() {
Expand Down
24 changes: 18 additions & 6 deletions packages/main/src/themes/BusyIndicator.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
display: inline-block;
}

:host(:not([active])) .ui5-busyindicator-wrapper{
display: none
}

:host([active]) {
color: var(--sapContent_IconColor);
pointer-events: none;
Expand All @@ -13,7 +17,7 @@

:host([size="Small"]) .ui5-busyindicator-root {
min-width: 1.5em;
min-height: .5rem;
min-height: 1.5rem;
}

:host([size="Small"]) .ui5-busyindicator-circle {
Expand All @@ -24,7 +28,7 @@
:host(:not([size])) .ui5-busyindicator-root,
:host([size="Medium"]) .ui5-busyindicator-root {
min-width: 3rem;
min-height: 1rem;
min-height: 2rem;
}

:host(:not([size])) .ui5-busyindicator-circle,
Expand All @@ -35,7 +39,7 @@

:host([size="Large"]) .ui5-busyindicator-root {
min-width: 6rem;
min-height: 2rem;
min-height: 3rem;
}

:host([size="Large"]) .ui5-busyindicator-circle {
Expand All @@ -51,6 +55,12 @@
background-color: inherit;
}

.ui5-busyindicator-wrapper {
position: absolute;
z-index: 99;
width: 100%;
}

.ui5-busyindicator-circle {
display: inline-block;
background-color: currentColor;
Expand All @@ -65,9 +75,6 @@
}

.ui5-busyindicator-dynamic-content {
position: absolute;
z-index: 99;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
Expand All @@ -89,6 +96,11 @@
animation-delay: 400ms;
}

.ui5-busyindicator-text {
width: 100%;
text-align: center;
}

@keyframes grow {
0%, 50%, 100% {
-webkit-transform: scale(0.5);
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/themes/Label.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}

:host(:not([wrap])) .ui5-label-root {
width: 100%;
font-weight: inherit;
display: inline-block;
white-space: nowrap;
Expand Down
20 changes: 13 additions & 7 deletions packages/main/test/pages/BusyIndicator.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@
</head>

<body style="background-color: var(--sapBackgroundColor);">
<ui5-title>Default (Large) ui5-busyindicator</ui5-title>
<ui5-busyindicator active></ui5-busyindicator>
<ui5-title>Large ui5-busyindicator</ui5-title>
<ui5-busyindicator active size="Large"></ui5-busyindicator>
<br/>
<br/>

<ui5-title>Medium ui5-busyindicator</ui5-title>
<ui5-title>Default Medium ui5-busyindicator</ui5-title>
<ui5-busyindicator size="Medium" active id="indicator1"></ui5-busyindicator>

<br />
<br />
<ui5-busyindicator size="Medium" active id="indicator2"></ui5-busyindicator>

<ui5-title>ui5-busyindicator with text</ui5-title>

<br />
<br />
<ui5-busyindicator active id="indicator2" text="Loading" style="width: 10rem; border: 1px solid red"></ui5-busyindicator>

<br />
<br />

Expand All @@ -44,7 +50,7 @@

<br />
<br />
<ui5-busyindicator size="Medium" active>
<ui5-busyindicator size="Medium" active text="Loading">
<ui5-checkbox text="Hello World"></ui5-checkbox>
</ui5-busyindicator>

Expand All @@ -54,15 +60,15 @@
<ui5-button id="fetch-btn" style="width: 120px;">Fetch List Data</ui5-button>
<br>
<br>
<ui5-busyindicator id="busy-container" style="width: 520px" size="Medium">
<ui5-busyindicator id="busy-container" style="width: 520px" size="Medium" text="Loading">
<ui5-list id="fetch-list" no-data-text="No Data" header-text="Available Items" style="width: 100%"></ui5-list>
</ui5-busyindicator>


<br>
<br>
<br>
<br>
<br>

<ui5-busyindicator size="Medium" active style="width: 500px; margin-left: 100px">
<ui5-list style="width: 100%; border: 1px solid black;">
Expand All @@ -72,7 +78,7 @@
</ui5-list>
</ui5-busyindicator>

<br>
<br>
<br>
<br>

Expand Down