mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 13:33:03 +00:00
html hybrid store/static var
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
AfterViewInit,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
@@ -112,38 +113,40 @@ import { INotification } from '../models/notification.model';
|
||||
|
||||
export class NotificationComponent implements OnInit, OnDestroy {
|
||||
|
||||
@Input() public timeOut: number;
|
||||
// @Input() public timeOut: number;
|
||||
// @Input() public showProgressBar: boolean;
|
||||
// @Input() public pauseOnHover: boolean;
|
||||
// @Input() public clickToClose: boolean;
|
||||
// @Input() public clickIconToClose: boolean;
|
||||
// @Input() public maxLength: number;
|
||||
// @Input() public theClass: string;
|
||||
@Input() public rtl: boolean;
|
||||
@Input() public animate: string;
|
||||
@Input() public position: number;
|
||||
// @Input() public rtl: boolean;
|
||||
// @Input() public animate: string;
|
||||
// @Input() public position: number;
|
||||
@Input() public item: INotification;
|
||||
|
||||
// Progress bar variables
|
||||
public title: any;
|
||||
public content: any;
|
||||
public html: any;
|
||||
|
||||
public titleIsTemplate = false;
|
||||
public contentIsTemplate = false;
|
||||
public htmlIsTemplate = false;
|
||||
|
||||
public progressWidth = 0;
|
||||
public safeSvg: SafeHtml;
|
||||
// public progressWidth = 0;
|
||||
|
||||
private stopTime = false;
|
||||
private timer: any;
|
||||
private steps: number;
|
||||
private speed: number;
|
||||
private count = 0;
|
||||
private start: any;
|
||||
|
||||
private start: any;
|
||||
private diff: any;
|
||||
private icon: string;
|
||||
|
||||
// 'fade' | 'fromTop' | 'fromRight' | 'fromBottom' | 'fromLeft' | 'rotate' | 'scale' = 'fromRight';
|
||||
public animate = 'rotate';
|
||||
|
||||
constructor(private notificationService: NotificationsService,
|
||||
private domSanitizer: DomSanitizer,
|
||||
@@ -152,70 +155,24 @@ export class NotificationComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// if (this.item.override) {
|
||||
// this.attachOverrides();
|
||||
// }
|
||||
//
|
||||
// if (this.animate) {
|
||||
// this.item.state = this.animate;
|
||||
// }
|
||||
this.animate = this.item.options.animate;
|
||||
|
||||
if (this.timeOut !== 0) {
|
||||
if (this.item.options.timeOut !== 0) {
|
||||
this.startTimeOut();
|
||||
}
|
||||
|
||||
this.contentType(this.item.title, 'title');
|
||||
this.contentType(this.item.content, 'content');
|
||||
this.contentType(this.item.html, 'html');
|
||||
|
||||
// this.safeSvg = this.domSanitizer.bypassSecurityTrustHtml(this.icon || this.item.icon);
|
||||
}
|
||||
|
||||
startTimeOut(): void {
|
||||
this.steps = this.timeOut / 10;
|
||||
this.speed = this.timeOut / this.steps;
|
||||
this.steps = this.item.options.timeOut / 10;
|
||||
this.speed = this.item.options.timeOut / this.steps;
|
||||
this.start = new Date().getTime();
|
||||
this.zone.runOutsideAngular(() => this.timer = setTimeout(this.instance, this.speed));
|
||||
}
|
||||
|
||||
onEnter(): void {
|
||||
// if (this.pauseOnHover) {
|
||||
// this.stopTime = true;
|
||||
// }
|
||||
}
|
||||
|
||||
onLeave(): void {
|
||||
// if (this.pauseOnHover) {
|
||||
// this.stopTime = false;
|
||||
// this.zone.runOutsideAngular(() => setTimeout(this.instance, (this.speed - this.diff)));
|
||||
// }
|
||||
}
|
||||
|
||||
// onClick($e: MouseEvent): void {
|
||||
// this.item.click!.emit($e);
|
||||
//
|
||||
// // if (this.clickToClose) {
|
||||
// // this.remove();
|
||||
// // }
|
||||
// }
|
||||
|
||||
// onClickIcon($e: MouseEvent): void {
|
||||
// this.item.clickIcon!.emit($e);
|
||||
//
|
||||
// // if (this.clickIconToClose) {
|
||||
// // this.remove();
|
||||
// // }
|
||||
// }
|
||||
|
||||
// Attach all the overrides
|
||||
// attachOverrides(): void {
|
||||
// Object.keys(this.item.override).forEach((a) => {
|
||||
// if (this.hasOwnProperty(a)) {
|
||||
// (this as any)[a] = this.item.override[a];
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
@@ -237,17 +194,14 @@ export class NotificationComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
|
||||
private remove() {
|
||||
// if (this.animate) {
|
||||
// this.item.state = this.animate + 'Out';
|
||||
// setTimeout(() => {
|
||||
// this.notificationService.set(this.item, false);
|
||||
// }, 310);
|
||||
// } else {
|
||||
// this.notificationService.set(this.item, false);
|
||||
// }
|
||||
|
||||
// this.notificationService.set(this.item, false);
|
||||
this.notificationService.remove(this.item);
|
||||
if (this.animate) {
|
||||
this.animate = this.animate + 'Out';
|
||||
setTimeout(() => {
|
||||
this.notificationService.remove(this.item);
|
||||
}, 310);
|
||||
} else {
|
||||
this.notificationService.remove(this.item);
|
||||
}
|
||||
}
|
||||
|
||||
private contentType(item: any, key: string) {
|
||||
|
Reference in New Issue
Block a user