-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* nilima added loading-indicator attempt-1 * feat: loading-indicator * feat: loading-indicator added overlay * element overlay implemented * thread resolved * Style added * Style added * Style added for small loader * thread resolved * node version updated --------- Co-authored-by: NilimaPradhan <[email protected]>
- Loading branch information
1 parent
5082bea
commit fea1299
Showing
12 changed files
with
837 additions
and
891 deletions.
There are no files selected for viewing
1,566 changes: 677 additions & 889 deletions
1,566
libs/portal-integration-angular/assets/output.css
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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
5 changes: 5 additions & 0 deletions
5
...ration-angular/src/lib/core/components/loading-indicator/loading-indicator.component.html
This file contains 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="full-overlay"> | ||
<div class="overlay"> | ||
<span class="loader"></span> | ||
</div> | ||
</div> |
20 changes: 20 additions & 0 deletions
20
...ration-angular/src/lib/core/components/loading-indicator/loading-indicator.component.scss
This file contains 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,20 @@ | ||
.full-overlay { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
height: 100%; | ||
width: 100%; | ||
z-index: 9999; | ||
} | ||
.overlay { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 99999; | ||
} |
9 changes: 9 additions & 0 deletions
9
...egration-angular/src/lib/core/components/loading-indicator/loading-indicator.component.ts
This file contains 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,9 @@ | ||
import { Component } from '@angular/core' | ||
|
||
@Component({ | ||
selector: 'ocx-loading-indicator', | ||
templateUrl: './loading-indicator.component.html', | ||
styleUrls: ['./loading-indicator.component.scss'], | ||
}) | ||
|
||
export class LoadingIndicatorComponent {} |
49 changes: 49 additions & 0 deletions
49
libs/portal-integration-angular/src/lib/core/directives/loading-indicator.directive.scss
This file contains 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,49 @@ | ||
$overlay-bg-color: rgba(0, 0, 0, 0.5); | ||
$loader-border-bottom-color: transparent; | ||
|
||
/* You can add global styles to this file, and also import other style files */ | ||
@keyframes rotation { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
.element-overlay { | ||
&::before { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: $overlay-bg-color; | ||
z-index: 1; | ||
} | ||
position: relative; | ||
width: 100%; | ||
cursor: default; | ||
pointer-events: none; | ||
} | ||
.loader { | ||
width: 28px; | ||
height: 28px; | ||
border: 3px solid var(--primary-color); | ||
border-bottom-color: $loader-border-bottom-color; | ||
border-radius: 50%; | ||
display: inline-block; | ||
box-sizing: border-box; | ||
animation: rotation 1s linear infinite; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
z-index: 2; | ||
&.loader-small { | ||
width: 20px; | ||
height: 20px; | ||
top: 20%; | ||
left: 45%; | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
libs/portal-integration-angular/src/lib/core/directives/loading-indicator.directive.ts
This file contains 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,62 @@ | ||
import { | ||
ComponentFactoryResolver, | ||
ComponentRef, | ||
Directive, | ||
ElementRef, | ||
Input, | ||
OnChanges, | ||
Renderer2, | ||
SimpleChanges, | ||
ViewContainerRef, | ||
} from '@angular/core' | ||
import { LoadingIndicatorComponent } from '../components/loading-indicator/loading-indicator.component' | ||
|
||
@Directive({ | ||
selector: '[ocxLoadingIndicator]', | ||
}) | ||
export class LoadingIndicatorDirective implements OnChanges { | ||
@Input() ocxLoadingIndicator = false | ||
@Input() overlayFullPage = false | ||
@Input() isLoaderSmall? = false | ||
|
||
private componentRef: ComponentRef<LoadingIndicatorComponent> | undefined | ||
|
||
constructor( | ||
private viewContainerRef: ViewContainerRef, | ||
private componentFactoryResolver: ComponentFactoryResolver, | ||
private el: ElementRef, | ||
private renderer: Renderer2 | ||
) {} | ||
|
||
ngOnChanges(changes: SimpleChanges) { | ||
if (changes['ocxLoadingIndicator'] || changes['overlayFullPage']) { | ||
this.toggleLoadingIndicator() | ||
} | ||
} | ||
|
||
private elementLoader() { | ||
this.renderer.addClass(this.el.nativeElement, 'element-overlay') | ||
const loaderElement = document.createElement('div') | ||
loaderElement.className = 'loader' | ||
if (this.isLoaderSmall) { | ||
loaderElement.className = 'loader loader-small' | ||
} | ||
this.renderer.appendChild(this.el.nativeElement, loaderElement) | ||
} | ||
|
||
private toggleLoadingIndicator() { | ||
if (this.ocxLoadingIndicator) { | ||
if (this.overlayFullPage == false) { | ||
this.elementLoader() | ||
} else { | ||
const factory = this.componentFactoryResolver.resolveComponentFactory(LoadingIndicatorComponent) | ||
this.componentRef = this.viewContainerRef.createComponent(factory) | ||
} | ||
} else { | ||
this.viewContainerRef.clear() | ||
if (this.componentRef) { | ||
this.componentRef.destroy() | ||
} | ||
} | ||
} | ||
} |
This file contains 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 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 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