diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index 0ed1f4ab9d..55207ffac8 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -35,7 +35,7 @@ create_new_folder @@ -166,7 +166,7 @@ @@ -531,7 +531,7 @@
- + {{'DOCUMENT_LIST.ALLOW_DROP_FILES' | translate}}
diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 977e563c45..be0cc6db3f 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -231,7 +231,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { } toggleAllowDropFiles() { - this.allowDropFiles = !this.allowDropFiles; this.documentList.reload(); } @@ -434,10 +433,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { this.currentFolderId = site.entry.guid; } - getDocumentListCurrentFolderId() { - return this.documentList.currentFolderId || DEFAULT_FOLDER_TO_SHOW; - } - hasSelection(selection: Array): boolean { return selection && selection.length > 0; } diff --git a/lib/content-services/document-list/components/document-list.component.ts b/lib/content-services/document-list/components/document-list.component.ts index ea43b3af33..0d8934feae 100644 --- a/lib/content-services/document-list/components/document-list.component.ts +++ b/lib/content-services/document-list/components/document-list.component.ts @@ -57,11 +57,6 @@ import { CustomResourcesService } from './../services/custom-resources.service'; import { NavigableComponentInterface } from '../../breadcrumb/navigable-component.interface'; import { RowFilter } from '../data/row-filter.model'; -export enum PaginationStrategy { - Finite, - Infinite -} - @Component({ selector: 'adf-document-list', styleUrls: ['./document-list.component.scss'], @@ -203,7 +198,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte this._rowFilter = rowFilter; if (this.data) { this.data.setFilter(this._rowFilter); - if (this.currentFolderId) { + if (this._currentFolderId) { this.reload(); } } @@ -217,9 +212,25 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte @Input() imageResolver: any | null = null; + _currentFolderId: string = null; + /** The ID of the folder node to display or a reserved string alias for special sources */ @Input() - currentFolderId: string = null; + set currentFolderId(currentFolderId: string) { + if (this._currentFolderId !== currentFolderId) { + this._currentFolderId = currentFolderId; + if (this.data) { + this.data.loadPage(null, false); + } + + this.resetNewFolderPagination(); + this.loadFolder(); + } + } + + get currentFolderId(): string { + return this._currentFolderId; + } /** The Document list will show all the nodes contained in the NodePaging entity */ @Input() @@ -391,7 +402,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte let columns = this.data.getColumns(); if (!columns || columns.length === 0) { - this.setupDefaultColumns(this.currentFolderId); + this.setupDefaultColumns(this._currentFolderId); } } @@ -413,16 +424,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } } - if (changes.currentFolderId && - changes.currentFolderId.currentValue && - changes.currentFolderId.currentValue !== changes.currentFolderId.previousValue) { - if (this.data) { - this.data.loadPage(null, false); - } - - this.resetNewFolderPagination(); - this.loadFolder(); - } else if (this.data) { + if (this.data) { if (changes.node && changes.node.currentValue) { let merge = this._pagination ? this._pagination.merge : false; @@ -528,15 +530,15 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte navigateTo(node: Node | string): boolean { if (typeof node === 'string') { this.resetNewFolderPagination(); - this.currentFolderId = node; + this._currentFolderId = node; this.folderChange.emit(new NodeEntryEvent( { id: node })); this.reload(); return true; } else { if (this.canNavigateFolder(node)) { this.resetNewFolderPagination(); - this.currentFolderId = this.getNodeFolderDestinationId(node); - this.folderChange.emit(new NodeEntryEvent( { id: this.currentFolderId })); + this._currentFolderId = this.getNodeFolderDestinationId(node); + this.folderChange.emit(new NodeEntryEvent( { id: this._currentFolderId })); this.reload(); return true; } @@ -554,7 +556,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } updateCustomSourceData(nodeId: string): void { - this.currentFolderId = nodeId; + this._currentFolderId = nodeId; } /** @@ -598,10 +600,10 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } if (!this.hasCustomLayout) { - this.setupDefaultColumns(this.currentFolderId); + this.setupDefaultColumns(this._currentFolderId); } - this.loadFolderByNodeId(this.currentFolderId); + this.loadFolderByNodeId(this._currentFolderId); } loadFolderByNodeId(nodeId: string) { diff --git a/lib/core/pagination/infinite-pagination.component.ts b/lib/core/pagination/infinite-pagination.component.ts index 4387cebedc..e4938e4308 100644 --- a/lib/core/pagination/infinite-pagination.component.ts +++ b/lib/core/pagination/infinite-pagination.component.ts @@ -88,9 +88,9 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio } onLoadMore() { - this.requestPaginationModel.skipCount += this.pageSize; - this.requestPaginationModel.merge = true; - this.requestPaginationModel.maxItems = this.pageSize; + this.requestPaginationModel.skipCount = 0; + this.requestPaginationModel.merge = false; + this.requestPaginationModel.maxItems += this.pageSize; this.loadMore.next(this.requestPaginationModel);