"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/shared/notifications/notification/notification.component.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

notification.component.ts  (dspace-angular-dspace-7.0):notification.component.ts  (dspace-angular-dspace-7.1)
import {of as observableOf, Observable } from 'rxjs'; import { Observable, of as observableOf } from 'rxjs';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
Input, Input,
NgZone, NgZone,
OnDestroy, OnDestroy,
OnInit, OnInit,
TemplateRef, TemplateRef,
ViewEncapsulation ViewEncapsulation
skipping to change at line 26 skipping to change at line 26
import { scaleEnter, scaleInState, scaleLeave, scaleOutState } from '../../anima tions/scale'; import { scaleEnter, scaleInState, scaleLeave, scaleOutState } from '../../anima tions/scale';
import { rotateEnter, rotateInState, rotateLeave, rotateOutState } from '../../a nimations/rotate'; import { rotateEnter, rotateInState, rotateLeave, rotateOutState } from '../../a nimations/rotate';
import { fromBottomEnter, fromBottomInState, fromBottomLeave, fromBottomOutState } from '../../animations/fromBottom'; import { fromBottomEnter, fromBottomInState, fromBottomLeave, fromBottomOutState } from '../../animations/fromBottom';
import { fromRightEnter, fromRightInState, fromRightLeave, fromRightOutState } f rom '../../animations/fromRight'; import { fromRightEnter, fromRightInState, fromRightLeave, fromRightOutState } f rom '../../animations/fromRight';
import { fromLeftEnter, fromLeftInState, fromLeftLeave, fromLeftOutState } from '../../animations/fromLeft'; import { fromLeftEnter, fromLeftInState, fromLeftLeave, fromLeftOutState } from '../../animations/fromLeft';
import { fromTopEnter, fromTopInState, fromTopLeave, fromTopOutState } from '../ ../animations/fromTop'; import { fromTopEnter, fromTopInState, fromTopLeave, fromTopOutState } from '../ ../animations/fromTop';
import { fadeInEnter, fadeInState, fadeOutLeave, fadeOutState } from '../../anim ations/fade'; import { fadeInEnter, fadeInState, fadeOutLeave, fadeOutState } from '../../anim ations/fade';
import { NotificationAnimationsStatus } from '../models/notification-animations- type'; import { NotificationAnimationsStatus } from '../models/notification-animations- type';
import { isNotEmpty } from '../../empty.util'; import { isNotEmpty } from '../../empty.util';
import { INotification } from '../models/notification.model'; import { INotification } from '../models/notification.model';
import { filter, first } from 'rxjs/operators';
@Component({ @Component({
selector: 'ds-notification', selector: 'ds-notification',
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
animations: [ animations: [
trigger('enterLeave', [ trigger('enterLeave', [
fadeInEnter, fadeInState, fadeOutLeave, fadeOutState, fadeInEnter, fadeInState, fadeOutLeave, fadeOutState,
fromBottomEnter, fromBottomInState, fromBottomLeave, fromBottomOutState, fromBottomEnter, fromBottomInState, fromBottomLeave, fromBottomOutState,
fromRightEnter, fromRightInState, fromRightLeave, fromRightOutState, fromRightEnter, fromRightInState, fromRightLeave, fromRightOutState,
fromLeftEnter, fromLeftInState, fromLeftLeave, fromLeftOutState, fromLeftEnter, fromLeftInState, fromLeftLeave, fromLeftOutState,
skipping to change at line 50 skipping to change at line 51
], ],
templateUrl: './notification.component.html', templateUrl: './notification.component.html',
styleUrls: ['./notification.component.scss'], styleUrls: ['./notification.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class NotificationComponent implements OnInit, OnDestroy { export class NotificationComponent implements OnInit, OnDestroy {
@Input() public notification = null as INotification; @Input() public notification = null as INotification;
/**
* Whether this notification's countdown should be paused
*/
@Input() public isPaused$: Observable<boolean> = observableOf(false);
// Progress bar variables // Progress bar variables
public title: Observable<string>; public title: Observable<string>;
public content: Observable<string>; public content: Observable<string>;
public html: any; public html: any;
public showProgressBar = false; public showProgressBar = false;
public titleIsTemplate = false; public titleIsTemplate = false;
public contentIsTemplate = false; public contentIsTemplate = false;
public htmlIsTemplate = false; public htmlIsTemplate = false;
public progressWidth = 0; public progressWidth = 0;
skipping to change at line 102 skipping to change at line 108
this.zone.runOutsideAngular(() => this.timer = setTimeout(this.instance, thi s.speed)); this.zone.runOutsideAngular(() => this.timer = setTimeout(this.instance, thi s.speed));
} }
ngOnDestroy(): void { ngOnDestroy(): void {
clearTimeout(this.timer); clearTimeout(this.timer);
} }
private instance = () => { private instance = () => {
this.diff = (new Date().getTime() - this.start) - (this.count * this.speed); this.diff = (new Date().getTime() - this.start) - (this.count * this.speed);
if (this.count++ === this.steps) { this.isPaused$.pipe(
this.remove(); filter(paused => !paused),
// this.item.timeoutEnd!.emit(); first(),
} else if (!this.stopTime) { ).subscribe(() => {
if (this.showProgressBar) { if (this.count++ === this.steps) {
this.progressWidth += 100 / this.steps; this.remove();
} } else if (!this.stopTime) {
if (this.showProgressBar) {
this.progressWidth += 100 / this.steps;
}
this.timer = setTimeout(this.instance, (this.speed - this.diff)); this.timer = setTimeout(this.instance, (this.speed - this.diff));
} }
this.zone.run(() => this.cdr.detectChanges()); this.zone.run(() => this.cdr.detectChanges());
});
} }
public remove() { public remove() {
if (this.animate) { if (this.animate) {
this.setAnimationOut(); this.setAnimationOut();
setTimeout(() => { setTimeout(() => {
this.notificationService.remove(this.notification); this.notificationService.remove(this.notification);
}, 1000); }, 1000);
} else { } else {
this.notificationService.remove(this.notification); this.notificationService.remove(this.notification);
 End of changes. 5 change blocks. 
11 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)