-
Notifications
You must be signed in to change notification settings - Fork 279
feat(ui5-busyindicator): initial implementation #416
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
309e793
wip busy indicator initial implementation
fifoosid 9300132
busy indicator implemented
fifoosid c478a2d
fix typo in file name
fifoosid 4c72151
remove onafterrendering
fifoosid 8a2ad52
rename property
fifoosid fa2f461
Merge branch 'master' into busy-indicator
fifoosid 780f365
adapt to framework changes
fifoosid 9712b88
test is added
fifoosid 1f48ef1
refactor template context
fifoosid 871135b
Merge branch 'master' into busy-indicator
fifoosid dfa04e7
remove hide property
fifoosid c078abd
change component tag
fifoosid ab4804f
Merge branch 'master' into busy-indicator
fifoosid 7c14b21
refactor tests & css
fifoosid f564fa3
simplify template context
fifoosid bc735e5
fix eslint
fifoosid 86db57a
Merge branch 'master' into busy-indicator
fifoosid 706a835
remove template context
fifoosid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="{{classes.main}}"> | ||
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import UI5Element from "@ui5/webcomponents-base/src/UI5Element.js"; | ||
import Bootstrap from "@ui5/webcomponents-base/src/Bootstrap.js"; | ||
import BusyIndicatorRenderer from "./build/compiled/BusyIndicatorRenderer.lit.js"; | ||
|
||
// Styles | ||
import busyIndicatorCss from "./themes/BusyIndicator.css.js"; | ||
|
||
// all themes should work via the convenience import (inlined now, switch to json when elements can be imported individyally) | ||
import "./ThemePropertiesProvider.js"; | ||
import BusyIndicatorType from "./types/BusyIndicatorType.js"; | ||
|
||
/** | ||
* @public | ||
*/ | ||
const metadata = { | ||
tag: "ui5-busyindicator", | ||
properties: /** @lends sap.ui.webcomponents.main.BusyIndicator.prototype */ { | ||
/** | ||
* Defines the size of the <code>ui5-busyindicator</code>. | ||
* </br></br> | ||
* <b>Note:</b> Available options are "Small", "Medium", "Large" | ||
* | ||
* @type {BusyIndicatorType} | ||
* @defaultvalue "Large" | ||
* @public | ||
*/ | ||
size: { type: BusyIndicatorType, defaultValue: BusyIndicatorType.Large }, | ||
}, | ||
}; | ||
|
||
/** | ||
* @class | ||
* | ||
* <h3 class="comment-api-title">Overview</h3> | ||
* | ||
* The <code>ui5-busyindicator</code> signals that some operation is going on and that the | ||
* user must wait. It does not block the current UI screen so other operations could be | ||
* triggered in parallel. | ||
* | ||
* <h3>Usage</h3> | ||
* For the <code>ui5-busyindicator</code> you can define the size of the indicator as well | ||
* as whether it is shown or hidden. In order to hide it, use the html attribute <code>hidden</code> or <code>display: none;</code> | ||
* | ||
* <h3>ES6 Module Import</h3> | ||
* | ||
* <code>import "@ui5/webcomponents/dist/BusyIndicator";</code> | ||
* | ||
* @constructor | ||
* @author SAP SE | ||
* @alias sap.ui.webcomponents.main.BusyIndicator | ||
* @extends UI5Element | ||
* @tagname ui5-busyindicator | ||
* @public | ||
*/ | ||
class BusyIndicator extends UI5Element { | ||
static get metadata() { | ||
return metadata; | ||
} | ||
|
||
static get styles() { | ||
return busyIndicatorCss; | ||
} | ||
|
||
static get renderer() { | ||
return BusyIndicatorRenderer; | ||
} | ||
|
||
get classes() { | ||
return { | ||
main: { | ||
"ui5-busyindicator-wrapper": true, | ||
[`ui5-busyindicator-${this.size.toLowerCase()}`]: true, | ||
}, | ||
}; | ||
} | ||
} | ||
|
||
Bootstrap.boot().then(_ => { | ||
BusyIndicator.define(); | ||
}); | ||
|
||
export default BusyIndicator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
:host(ui5-busyindicator) span[data-sap-ui-wc-root] { | ||
fifoosid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
display: inline-block; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
ui5-busyindicator span[data-sap-ui-wc-root] { | ||
display: inline-block; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.ui5-busyindicator-wrapper { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.ui5-busyindicator-circle { | ||
display: flex; | ||
background-color: var(--ui5-busyindicator-color); | ||
border-radius: 50%; | ||
} | ||
|
||
/* Belize specific */ | ||
.ui5-busyindicator-circle::before { | ||
content: ""; | ||
width: 100%; | ||
height: 100%; | ||
border-radius: 100%; | ||
} | ||
|
||
.ui5-busyindicator-small { | ||
width: 3rem; | ||
height: 1rem; | ||
} | ||
|
||
.ui5-busyindicator-medium { | ||
width: 5rem; | ||
height: 2rem; | ||
} | ||
|
||
.ui5-busyindicator-large { | ||
width: 8rem; | ||
height: 3rem; | ||
} | ||
|
||
.ui5-busyindicator-small > .ui5-busyindicator-circle { | ||
width: 0.125rem; | ||
height: 0.125rem; | ||
margin: 0 0.2rem; | ||
} | ||
|
||
.ui5-busyindicator-medium > .ui5-busyindicator-circle { | ||
width: 0.5rem; | ||
height: 0.5rem; | ||
margin: 0 0.4rem; | ||
} | ||
|
||
.ui5-busyindicator-large > .ui5-busyindicator-circle { | ||
width: 1rem; | ||
height: 1rem; | ||
margin: 0 .75rem; | ||
} | ||
|
||
.circle-animation-0 { | ||
animation: grow 1.6s infinite cubic-bezier(0.32, 0.06, 0.85, 1.11); | ||
} | ||
|
||
.circle-animation-1 { | ||
animation: grow 1.6s infinite cubic-bezier(0.32, 0.06, 0.85, 1.11); | ||
animation-delay: 200ms; | ||
} | ||
|
||
.circle-animation-2 { | ||
animation: grow 1.6s infinite cubic-bezier(0.32, 0.06, 0.85, 1.11); | ||
animation-delay: 400ms; | ||
} | ||
|
||
@keyframes grow { | ||
0%, 50%, 100% { | ||
-webkit-transform: scale(1.0); | ||
-moz-transform: scale(1.0); | ||
-ms-transform: scale(1.0); | ||
transform: scale(1.0); | ||
} | ||
|
||
25% { | ||
-webkit-transform: scale(2.5); | ||
-moz-transform: scale(2.5); | ||
-ms-transform: scale(2.5); | ||
transform: scale(2.5); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:root { | ||
--ui5-busyindicator-color: var(--sapUiContentIconColor); | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/main/src/themes/sap_belize/BusyIndicator-parameters.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import "../base/BusyIndicator-parameters.css"; | ||
|
||
:root { | ||
--ui5-busyindicator-color: var(--sapUiAccent6); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/main/src/themes/sap_belize_hcb/BusyIndicator-parameters.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "../base/BusyIndicator-parameters.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/main/src/themes/sap_fiori_3/BusyIndicator-parameters.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "../base/BusyIndicator-parameters.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import DataType from "@ui5/webcomponents-base/src/types/DataType.js"; | ||
|
||
/** | ||
* Different types of BusyIndicator. | ||
*/ | ||
const BusyIndicatorTypes = { | ||
/** | ||
* small size | ||
*/ | ||
Small: "Small", | ||
|
||
/** | ||
* medium size | ||
*/ | ||
Medium: "Medium", | ||
|
||
/** | ||
* large size | ||
*/ | ||
Large: "Large", | ||
}; | ||
|
||
class BusyIndicatorType extends DataType { | ||
static isValid(value) { | ||
return !!BusyIndicatorTypes[value]; | ||
} | ||
} | ||
|
||
BusyIndicatorType.generataTypeAcessors(BusyIndicatorTypes); | ||
|
||
export default BusyIndicatorType; |
29 changes: 29 additions & 0 deletions
29
packages/main/test/sap/ui/webcomponents/main/pages/BusyIndicator.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta charset="utf-8"> | ||
|
||
<title>Busy Indicator</title> | ||
<script> | ||
delete Document.prototype.adoptedStyleSheets | ||
</script> | ||
|
||
<script data-id="sap-ui-config" type="application/json"> | ||
{ | ||
"rtl": false, | ||
"compactSize": false | ||
} | ||
</script> | ||
|
||
<script src="../../../../../../webcomponentsjs/webcomponents-loader.js"></script> | ||
<script src="../../../../../../resources/sap/ui/webcomponents/main/bundle.esm.js" type="module"></script> | ||
<script nomodule src="../../../../../../resources/sap/ui/webcomponents/main/bundle.es5.js"> | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<ui5-busyindicator id="indicator1"></ui5-busyindicator> | ||
<ui5-busyindicator id="indicator2" hidden></ui5-busyindicator> | ||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
packages/main/test/sap/ui/webcomponents/main/samples/BusyIndicator.sample.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title><ui5-busyindicator></title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta charset="utf-8"> | ||
|
||
<link rel="stylesheet" href="../../../../../../www/home/core.css"> | ||
|
||
<script src="../../../../../../test-resources/playground/libs/google-code-prettify/prettify.js"></script> | ||
<link href="../../../../../../test-resources/playground/libs/google-code-prettify/sunburst.css" type="text/css" rel="stylesheet"> | ||
|
||
<link href="../../../../../../test-resources/playground/css/api.css" type="text/css" rel="stylesheet"> | ||
|
||
<script data-id="sap-ui-config" type="application/json"> | ||
{ | ||
"theme": "sap_fiori_3", | ||
"language": "EN" | ||
} | ||
</script> | ||
|
||
<script src="../../../../../../webcomponentsjs/webcomponents-loader.js"></script> | ||
<script src="../../../../../../resources/sap/ui/webcomponents/main/bundle.esm.js" | ||
type="module" | ||
> | ||
</script> | ||
|
||
<script nomodule src="../../../../../../resources/sap/ui/webcomponents/main/bundle.es5.js"> | ||
</script> | ||
|
||
<script defer src="../../../../../../www/samples/settings.js"></script> | ||
<script>delete Document.prototype.adoptedStyleSheets;</script> | ||
|
||
<style> | ||
.center { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
} | ||
</style> | ||
</head> | ||
<body class="sapUiBody example-wrapper"> | ||
|
||
<header> | ||
<div class="control-header">Busy Indicator</div> | ||
<div style="margin-bottom: 2rem; font-weight: 300; font-size: 1.1rem; color: #666666;"><ui5-busyindicator></div> | ||
</header> | ||
|
||
<section> | ||
<h3>Busy Indicator with different size</h3> | ||
<div class="snippet center"> | ||
<ui5-busyindicator size="Small"></ui5-busyindicator> | ||
<ui5-busyindicator size="Medium"></ui5-busyindicator> | ||
<ui5-busyindicator size="Large"></ui5-busyindicator> | ||
</div> | ||
<pre class="prettyprint lang-html"><xmp> | ||
<div> | ||
<ui5-busyindicator size="Small"></ui5-busyindicator> | ||
<ui5-busyindicator size="Medium"></ui5-busyindicator> | ||
<ui5-busyindicator size="Large"></ui5-busyindicator> | ||
</div> | ||
</xmp></pre> | ||
</section> | ||
|
||
<script> | ||
window.prettyPrint(); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.