Merge branch 'master' into angular-14
This commit is contained in:
commit
8677e9dcd5
|
@ -36,10 +36,14 @@ export class LayoutService {
|
|||
* Add isSmallScreen: true on data of route config, if screen is small.
|
||||
*/
|
||||
private isSmallScreenSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
/**
|
||||
* Add hasQuickContact: false on data of route config, if the quick-contact fixed button is not needed.
|
||||
*/
|
||||
private hasQuickContactSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
|
||||
/**
|
||||
* Add activeMenuItem: string on data of route config, if page should activate a specific MenuItem and route url does not match.
|
||||
*/
|
||||
|
||||
private activeMenuItemSubject: BehaviorSubject<string> = new BehaviorSubject<string>("");
|
||||
|
||||
/**
|
||||
|
@ -100,6 +104,12 @@ export class LayoutService {
|
|||
this.setSmallScreen(true);
|
||||
} else {
|
||||
this.setSmallScreen(false);
|
||||
}
|
||||
if (data['hasQuickContact'] !== undefined &&
|
||||
data['hasQuickContact'] === false) {
|
||||
this.setHasQuickContact(false);
|
||||
} else {
|
||||
this.setHasQuickContact(true);
|
||||
}
|
||||
if (data['activeMenuItem'] !== undefined &&
|
||||
data['activeMenuItem'] !== null) {
|
||||
|
@ -168,6 +178,14 @@ export class LayoutService {
|
|||
this.isSmallScreenSubject.next(value);
|
||||
}
|
||||
|
||||
get hasQuickContact(): Observable<boolean> {
|
||||
return this.hasQuickContactSubject.asObservable();
|
||||
}
|
||||
|
||||
setHasQuickContact(value: boolean) {
|
||||
this.hasQuickContactSubject.next(value);
|
||||
}
|
||||
|
||||
get activeMenuItem(): string {
|
||||
return this.activeMenuItemSubject.getValue();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ declare var UIkit: any;
|
|||
<a (click)="currentAction='add'; saveWorkPreparation();"
|
||||
[class]="'uk-button uk-button-link uk-flex uk-flex-middle uk-flex-right@s uk-margin-right '+ ((showLoading || !isLoggedIn) ? 'uk-disabled ' : '') + (!isLoggedIn ? 'half-opacity' : '')">
|
||||
<icon *ngIf="!showLoading" name="add" ratio="1" flex="true"></icon>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
|
||||
<span class="uk-margin-small-left uk-flex uk-flex-middle">Add to 
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span>ORCID </span>
|
||||
|
@ -41,7 +41,7 @@ declare var UIkit: any;
|
|||
<a (click)="currentAction='delete'; deleteWorks();"
|
||||
[class]="'uk-button uk-button-link uk-flex uk-flex-middle uk-flex-right@s uk-margin-right '+ (showLoading ? 'uk-disabled' : '')">
|
||||
<icon *ngIf="!showLoading" name="delete" ratio="0.8" flex="true"></icon>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
|
||||
<span class="uk-margin-small-left uk-flex uk-flex-middle">Delete from 
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span>ORCID </span>
|
||||
|
@ -64,7 +64,7 @@ declare var UIkit: any;
|
|||
<icon *ngIf="hoverAdd" name="add" visuallyHidden="add"></icon>
|
||||
</a>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading
|
||||
[top_margin]="false"></loading></span>
|
||||
[top_margin]="false" [size]="'small'"></loading></span>
|
||||
</span>
|
||||
|
||||
<span *ngIf="putCodes && putCodes.length > 0"
|
||||
|
@ -78,7 +78,7 @@ declare var UIkit: any;
|
|||
<icon *ngIf="hoverDelete" name="delete_outline" class="uk-text-danger" visuallyHidden="delete"></icon>
|
||||
</a>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading
|
||||
[top_margin]="false"></loading></span>
|
||||
[top_margin]="false" [size]="'small'"></loading></span>
|
||||
</span>
|
||||
</ng-container>
|
||||
|
||||
|
@ -121,7 +121,7 @@ declare var UIkit: any;
|
|||
[class]="'uk-button uk-button-default action uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')">
|
||||
<icon *ngIf="!showLoading || currentAction!='get'" name="visibility" ratio="1" flex="true"></icon>
|
||||
|
||||
<span *ngIf="showLoading && currentAction=='get'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span *ngIf="showLoading && currentAction=='get'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
|
||||
<span class="uk-margin-small-left">View ORCID work</span>
|
||||
</a>
|
||||
</span>
|
||||
|
@ -133,7 +133,7 @@ declare var UIkit: any;
|
|||
<a (click)="currentAction='update'; updateWorkPreparation()"
|
||||
[class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')">
|
||||
<icon *ngIf="!showLoading || currentAction!='update'" name="refresh" ratio="1" flex="true"></icon>
|
||||
<span *ngIf="showLoading && currentAction=='update'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span *ngIf="showLoading && currentAction=='update'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
|
||||
<span class="uk-margin-small-left">Update ORCID work</span>
|
||||
</a>
|
||||
</span>
|
||||
|
@ -143,7 +143,7 @@ declare var UIkit: any;
|
|||
<a (click)="currentAction='add'; saveWorkPreparation();"
|
||||
[class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')">
|
||||
<icon *ngIf="!showLoading || currentAction!='add'" name="add" ratio="1" flex="true"></icon>
|
||||
<span *ngIf="showLoading && currentAction=='add'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span *ngIf="showLoading && currentAction=='add'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
|
||||
<span class="uk-margin-small-left">Add to ORCID</span>
|
||||
</a>
|
||||
</span>
|
||||
|
@ -153,7 +153,7 @@ declare var UIkit: any;
|
|||
<a (click)="currentAction='delete'; deleteWorks();"
|
||||
[class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')">
|
||||
<icon *ngIf="!showLoading || currentAction!='delete'" name="delete" ratio="1" flex="true"></icon>
|
||||
<span *ngIf="showLoading && currentAction=='delete'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span *ngIf="showLoading && currentAction=='delete'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
|
||||
<span class="uk-margin-small-left">Delete from ORCID</span>
|
||||
</a>
|
||||
</span>
|
||||
|
|
|
@ -18,7 +18,8 @@ import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive";
|
|||
selector: '[search-input]',
|
||||
template: `
|
||||
<div *ngIf="initialized" class="uk-flex uk-flex-right uk-width-1-1">
|
||||
<div #searchInput click-outside-or-esc (clickOutside)="click($event)" class="search-input" [class.collapsed]="hidden" [ngClass]="searchInputClass">
|
||||
<div #searchInput click-outside-or-esc (clickOutside)="click($event)" class="search-input" [class.focused]="input.focused"
|
||||
[class.collapsed]="hidden" [ngClass]="searchInputClass">
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<div class="uk-width-expand">
|
||||
<div #input [class.uk-hidden]="hidden" input [formInput]="searchControl" inputClass="search" [disabledIcon]="null"
|
||||
|
@ -30,7 +31,7 @@ import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive";
|
|||
<icon name="close" [flex]="true"></icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="uk-width-auto">
|
||||
<div class="uk-width-auto" [class.uk-flex-first]="iconPosition === 'left'">
|
||||
<div class="search-icon" [class.disabled]="disabled" (click)="search($event)">
|
||||
<icon name="search" [flex]="true" ratio="1.3"></icon>
|
||||
</div>
|
||||
|
@ -43,6 +44,7 @@ import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive";
|
|||
export class SearchInputComponent implements OnInit {
|
||||
@Input() disabled: boolean = false;
|
||||
@Input() searchInputClass: string = 'inner';
|
||||
@Input() iconPosition: 'left' | 'right' = 'right';
|
||||
@Input() searchControl: AbstractControl;
|
||||
@Input() value: string;
|
||||
@Output() valueChange = new EventEmitter<string>();
|
||||
|
|
|
@ -10,51 +10,55 @@ export class SmoothScroll {
|
|||
private readonly sub;
|
||||
private lastComponent;
|
||||
private currentComponent: string;
|
||||
private extraOffset: number = 0;
|
||||
|
||||
constructor(private router: Router) {
|
||||
if (typeof window !== "undefined") {
|
||||
this.sub = router.events.subscribe(event => {
|
||||
if (event instanceof ActivationStart) {
|
||||
this.extraOffset = event.snapshot.data.extraOffset?event.snapshot.data.extraOffset:0;
|
||||
if(event.snapshot.component instanceof Type) {
|
||||
this.currentComponent = event.snapshot.component.name;
|
||||
}
|
||||
} else if (event instanceof NavigationEnd) {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
const fragment = router.parseUrl(router.url).fragment;
|
||||
if (this.lastComponent !== this.currentComponent) {
|
||||
window.scrollTo({top: 0});
|
||||
}
|
||||
if (fragment) {
|
||||
let i = 0;
|
||||
this.interval = setInterval(() => {
|
||||
i++;
|
||||
const element = document.getElementById(fragment);
|
||||
if (element) {
|
||||
if (this.interval) {
|
||||
if(!this.router.getCurrentNavigation().extras?.state?.disableScroll) {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
const fragment = router.parseUrl(router.url).fragment;
|
||||
if (this.lastComponent !== this.currentComponent) {
|
||||
window.scrollTo({top: 0});
|
||||
}
|
||||
if (fragment) {
|
||||
let i = 0;
|
||||
this.interval = setInterval(() => {
|
||||
i++;
|
||||
const element = document.getElementById(fragment);
|
||||
if (element) {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
const yOffset = -100 - this.extraOffset;
|
||||
let position = 0;
|
||||
let interval = setInterval(() => {
|
||||
if (position !== element.getBoundingClientRect().top) {
|
||||
position = element.getBoundingClientRect().top;
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
window.scrollTo({top: y, behavior: 'smooth'});
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
if (i > 4 && this.interval) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
const yOffset = -100;
|
||||
let position = 0;
|
||||
let interval = setInterval(() => {
|
||||
if (position !== element.getBoundingClientRect().top) {
|
||||
position = element.getBoundingClientRect().top;
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
window.scrollTo({top: y, behavior: 'smooth'});
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
if (i > 4 && this.interval) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
setTimeout( () => {
|
||||
window.scrollTo({top: 0, behavior: 'smooth'});
|
||||
}, 0);
|
||||
}, 100);
|
||||
} else {
|
||||
setTimeout( () => {
|
||||
window.scrollTo({top: 0, behavior: 'smooth'});
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
this.lastComponent = this.currentComponent;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue