import { Component , OnInit } from '@angular/core' ; import { BreakpointObserver , Breakpoints } from '@angular/cdk/layout' ; import { MinimalNodeEntity } from '@alfresco/js-api' ; import { ContentManagementService } from '../../services/content-management.service' ; import { PageComponent } from '../page.component' ; import { Store } from '@ngrx/store' ; import { AppStore } from '@alfresco/aca-shared/store' ; import { UploadService } from '@alfresco/adf-core' ; import { debounceTime } from 'rxjs/operators' ; import { Router } from '@angular/router' ; import { AppExtensionService } from '@alfresco/aca-shared' ; import { DocumentListPresetRef } from '@alfresco/adf-extensions' ; @ Component ( { templateUrl : './recent-files.component.html' } ) export class RecentFilesComponent extends PageComponent implements OnInit { isSmallScreen = false ; columns : DocumentListPresetRef [ ] = [ ] ; constructor ( store , extensions , content , private uploadService , private breakpointObserver , private router ) { super ( store , extensions , content ) ; } ngOnInit ( ) { super . ngOnInit ( ) ; this . subscriptions = this . subscriptions . concat ( [ this . uploadService . fileUploadComplete . pipe ( debounceTime ( 300 ) ) . subscribe ( ( ) => this . onFileUploadedEvent ( ) ) , this . uploadService . fileUploadDeleted . pipe ( debounceTime ( 300 ) ) . subscribe ( ( ) => this . onFileUploadedEvent ( ) ) , this . breakpointObserver . observe ( [ Breakpoints . HandsetPortrait , Breakpoints . HandsetLandscape ] ) . subscribe ( ( result ) => { this . isSmallScreen = result . matches ; } ) ] ) ; this . columns = this . extensions . documentListPresets . recent || [ ] ; } onNodeDoubleClick ( node ) { if ( node && node . entry ) { this . showPreview ( node , { location : this . router . url } ) ; } } handleNodeClick ( event ) { this . onNodeDoubleClick ( ( event as CustomEvent ) . detail ?. node ) ; } private onFileUploadedEvent ( ) { this . reload ( ) ; } }