mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
fix infinite pagination delete, difficult to handle the delta in case of delete better to reload the whole list for infinite pagination
This commit is contained in:
parent
0d6c1bedfa
commit
836caf5253
@ -35,7 +35,7 @@
|
|||||||
<adf-upload-drag-area fxFlex="1 1 auto"
|
<adf-upload-drag-area fxFlex="1 1 auto"
|
||||||
[disabled]="disableDragArea"
|
[disabled]="disableDragArea"
|
||||||
[acceptedFilesType]="getFileFiltering()"
|
[acceptedFilesType]="getFileFiltering()"
|
||||||
[rootFolderId]="getDocumentListCurrentFolderId()"
|
[rootFolderId]="currentFolderId"
|
||||||
[versioning]="versioning"
|
[versioning]="versioning"
|
||||||
[adf-node-permission]="'create'"
|
[adf-node-permission]="'create'"
|
||||||
[adf-nodes]="disableDragArea ? getCurrentDocumentListNode() : []"
|
[adf-nodes]="disableDragArea ? getCurrentDocumentListNode() : []"
|
||||||
@ -77,7 +77,7 @@
|
|||||||
title="{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}"
|
title="{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}"
|
||||||
(error)="openSnackMessage($event)"
|
(error)="openSnackMessage($event)"
|
||||||
(success)="documentList.reload()"
|
(success)="documentList.reload()"
|
||||||
[adf-create-folder]="getDocumentListCurrentFolderId()"
|
[adf-create-folder]="currentFolderId"
|
||||||
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}">
|
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}">
|
||||||
<mat-icon>create_new_folder</mat-icon>
|
<mat-icon>create_new_folder</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
@ -166,7 +166,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button mat-menu-item
|
<button mat-menu-item
|
||||||
(error)="openSnackMessage($event)"
|
(error)="openSnackMessage($event)"
|
||||||
[adf-create-folder]="getDocumentListCurrentFolderId()">
|
[adf-create-folder]="currentFolderId">
|
||||||
<mat-icon>create_new_folder</mat-icon>
|
<mat-icon>create_new_folder</mat-icon>
|
||||||
<span>{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}</span>
|
<span>{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}</span>
|
||||||
</button>
|
</button>
|
||||||
@ -531,7 +531,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<mat-slide-toggle id="adf-document-list-enable-drop-files" [color]="'primary'" (click)="toggleAllowDropFiles()" >
|
<mat-slide-toggle id="adf-document-list-enable-drop-files" [color]="'primary'" [(ngModel)]="allowDropFiles" (click)="toggleAllowDropFiles()" >
|
||||||
{{'DOCUMENT_LIST.ALLOW_DROP_FILES' | translate}}
|
{{'DOCUMENT_LIST.ALLOW_DROP_FILES' | translate}}
|
||||||
</mat-slide-toggle>
|
</mat-slide-toggle>
|
||||||
</section>
|
</section>
|
||||||
|
@ -231,7 +231,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleAllowDropFiles() {
|
toggleAllowDropFiles() {
|
||||||
this.allowDropFiles = !this.allowDropFiles;
|
|
||||||
this.documentList.reload();
|
this.documentList.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,10 +433,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.currentFolderId = site.entry.guid;
|
this.currentFolderId = site.entry.guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocumentListCurrentFolderId() {
|
|
||||||
return this.documentList.currentFolderId || DEFAULT_FOLDER_TO_SHOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
hasSelection(selection: Array<MinimalNodeEntity>): boolean {
|
hasSelection(selection: Array<MinimalNodeEntity>): boolean {
|
||||||
return selection && selection.length > 0;
|
return selection && selection.length > 0;
|
||||||
}
|
}
|
||||||
|
@ -57,11 +57,6 @@ import { CustomResourcesService } from './../services/custom-resources.service';
|
|||||||
import { NavigableComponentInterface } from '../../breadcrumb/navigable-component.interface';
|
import { NavigableComponentInterface } from '../../breadcrumb/navigable-component.interface';
|
||||||
import { RowFilter } from '../data/row-filter.model';
|
import { RowFilter } from '../data/row-filter.model';
|
||||||
|
|
||||||
export enum PaginationStrategy {
|
|
||||||
Finite,
|
|
||||||
Infinite
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-document-list',
|
selector: 'adf-document-list',
|
||||||
styleUrls: ['./document-list.component.scss'],
|
styleUrls: ['./document-list.component.scss'],
|
||||||
@ -203,7 +198,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
this._rowFilter = rowFilter;
|
this._rowFilter = rowFilter;
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
this.data.setFilter(this._rowFilter);
|
this.data.setFilter(this._rowFilter);
|
||||||
if (this.currentFolderId) {
|
if (this._currentFolderId) {
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,9 +212,25 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
@Input()
|
@Input()
|
||||||
imageResolver: any | null = null;
|
imageResolver: any | null = null;
|
||||||
|
|
||||||
|
_currentFolderId: string = null;
|
||||||
|
|
||||||
/** The ID of the folder node to display or a reserved string alias for special sources */
|
/** The ID of the folder node to display or a reserved string alias for special sources */
|
||||||
@Input()
|
@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 */
|
/** The Document list will show all the nodes contained in the NodePaging entity */
|
||||||
@Input()
|
@Input()
|
||||||
@ -391,7 +402,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
|
|
||||||
let columns = this.data.getColumns();
|
let columns = this.data.getColumns();
|
||||||
if (!columns || columns.length === 0) {
|
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 &&
|
if (this.data) {
|
||||||
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 (changes.node && changes.node.currentValue) {
|
if (changes.node && changes.node.currentValue) {
|
||||||
let merge = this._pagination ? this._pagination.merge : false;
|
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 {
|
navigateTo(node: Node | string): boolean {
|
||||||
if (typeof node === 'string') {
|
if (typeof node === 'string') {
|
||||||
this.resetNewFolderPagination();
|
this.resetNewFolderPagination();
|
||||||
this.currentFolderId = node;
|
this._currentFolderId = node;
|
||||||
this.folderChange.emit(new NodeEntryEvent(<Node> { id: node }));
|
this.folderChange.emit(new NodeEntryEvent(<Node> { id: node }));
|
||||||
this.reload();
|
this.reload();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (this.canNavigateFolder(node)) {
|
if (this.canNavigateFolder(node)) {
|
||||||
this.resetNewFolderPagination();
|
this.resetNewFolderPagination();
|
||||||
this.currentFolderId = this.getNodeFolderDestinationId(node);
|
this._currentFolderId = this.getNodeFolderDestinationId(node);
|
||||||
this.folderChange.emit(new NodeEntryEvent(<Node> { id: this.currentFolderId }));
|
this.folderChange.emit(new NodeEntryEvent(<Node> { id: this._currentFolderId }));
|
||||||
this.reload();
|
this.reload();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -554,7 +556,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateCustomSourceData(nodeId: string): void {
|
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) {
|
if (!this.hasCustomLayout) {
|
||||||
this.setupDefaultColumns(this.currentFolderId);
|
this.setupDefaultColumns(this._currentFolderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadFolderByNodeId(this.currentFolderId);
|
this.loadFolderByNodeId(this._currentFolderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadFolderByNodeId(nodeId: string) {
|
loadFolderByNodeId(nodeId: string) {
|
||||||
|
@ -88,9 +88,9 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
onLoadMore() {
|
onLoadMore() {
|
||||||
this.requestPaginationModel.skipCount += this.pageSize;
|
this.requestPaginationModel.skipCount = 0;
|
||||||
this.requestPaginationModel.merge = true;
|
this.requestPaginationModel.merge = false;
|
||||||
this.requestPaginationModel.maxItems = this.pageSize;
|
this.requestPaginationModel.maxItems += this.pageSize;
|
||||||
|
|
||||||
this.loadMore.next(this.requestPaginationModel);
|
this.loadMore.next(this.requestPaginationModel);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user