mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
updated angular/rxjs to v6 successfully
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { combineLatest as observableCombineLatest, BehaviorSubject, Observable } from 'rxjs';
|
||||
|
||||
import {combineLatest as observableCombineLatest, BehaviorSubject , Observable } from 'rxjs';
|
||||
|
||||
import {startWith, distinctUntilChanged, map } from 'rxjs/operators';
|
||||
import { startWith, distinctUntilChanged, map } from 'rxjs/operators';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
@@ -26,7 +25,7 @@ import { PaginationComponentOptions } from '../pagination/pagination-component-o
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
encapsulation: ViewEncapsulation.Emulated,
|
||||
selector: 'ds-object-grid',
|
||||
styleUrls: [ './object-grid.component.scss' ],
|
||||
styleUrls: ['./object-grid.component.scss'],
|
||||
templateUrl: './object-grid.component.html',
|
||||
animations: [fadeIn]
|
||||
})
|
||||
@@ -38,9 +37,11 @@ export class ObjectGridComponent implements OnInit {
|
||||
@Input() hideGear = false;
|
||||
@Input() hidePagerWhenSinglePage = true;
|
||||
private _objects$: BehaviorSubject<RemoteData<PaginatedList<ListableObject>>>;
|
||||
|
||||
@Input() set objects(objects: RemoteData<PaginatedList<ListableObject>>) {
|
||||
this._objects$.next(objects);
|
||||
}
|
||||
|
||||
get objects() {
|
||||
return this._objects$.getValue();
|
||||
}
|
||||
@@ -111,26 +112,25 @@ export class ObjectGridComponent implements OnInit {
|
||||
|
||||
this.columns$ = observableCombineLatest(
|
||||
nbColumns$,
|
||||
this._objects$,
|
||||
(nbColumns, objects) => {
|
||||
if (hasValue(objects) && hasValue(objects.payload) && hasValue(objects.payload.page)) {
|
||||
const page = objects.payload.page;
|
||||
this._objects$).pipe(map(([nbColumns, objects]) => {
|
||||
if (hasValue(objects) && hasValue(objects.payload) && hasValue(objects.payload.page)) {
|
||||
const page = objects.payload.page;
|
||||
|
||||
const result = [];
|
||||
const result = [];
|
||||
|
||||
page.forEach((obj: ListableObject, i: number) => {
|
||||
const colNb = i % nbColumns;
|
||||
let col = result[colNb];
|
||||
if (hasNoValue(col)) {
|
||||
col = [];
|
||||
}
|
||||
result[colNb] = [...col, obj];
|
||||
});
|
||||
return result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
page.forEach((obj: ListableObject, i: number) => {
|
||||
const colNb = i % nbColumns;
|
||||
let col = result[colNb];
|
||||
if (hasNoValue(col)) {
|
||||
col = [];
|
||||
}
|
||||
result[colNb] = [...col, obj];
|
||||
});
|
||||
return result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
onPageChange(event) {
|
||||
|
Reference in New Issue
Block a user