Skip to content

Commit

Permalink
Revert renaming causing breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
adomi committed Feb 1, 2021
1 parent 05dca16 commit 811b167
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion demo-shell/src/app/components/files/files.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[currentFolderId]="'-recent-'"
locationFormat="/files"
[display]="'gallery'"
[preselectedNodes]="selectedNodes"
[preselectNodes]="selectedNodes"
[showHeader]="false"
[maxItems]="5"
(preview)="showFile($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
adf-highlight-selector=".adf-name-location-cell-name"
[showHeader]="false"
[node]="nodePaging"
[preselectedNodes]="preselectedNodes"
[preselectNodes]="preselectedNodes"
[maxItems]="pageSize"
[rowFilter]="_rowFilter"
[imageResolver]="imageResolver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1538,13 +1538,13 @@ describe('DocumentList', () => {
fixture.detectChanges();

documentList.node = mockNodePagingWithPreselectedNodes;
documentList.preselectedNodes = mockPreselectedNodes;
documentList.preselectNodes = mockPreselectedNodes;
documentList.reload();

fixture.detectChanges();
await fixture.whenStable();

expect(documentList.preselectedNodes.length).toBe(2);
expect(documentList.preselectNodes.length).toBe(2);
expect(nodeSelectedSpy).toHaveBeenCalled();
});

Expand All @@ -1553,13 +1553,13 @@ describe('DocumentList', () => {
fixture.detectChanges();

documentList.node = mockNodePagingWithPreselectedNodes;
documentList.preselectedNodes = mockPreselectedNodes;
documentList.preselectNodes = mockPreselectedNodes;
documentList.reload();

fixture.detectChanges();
await fixture.whenStable();

expect(documentList.preselectedNodes.length).toBe(2);
expect(documentList.preselectNodes.length).toBe(2);
expect(documentList.getPreselectedNodesBasedOnSelectionMode().length).toBe(1);
});

Expand All @@ -1568,13 +1568,13 @@ describe('DocumentList', () => {
fixture.detectChanges();

documentList.node = mockNodePagingWithPreselectedNodes;
documentList.preselectedNodes = mockPreselectedNodes;
documentList.preselectNodes = mockPreselectedNodes;
documentList.reload();

fixture.detectChanges();
await fixture.whenStable();

expect(documentList.preselectedNodes.length).toBe(2);
expect(documentList.preselectNodes.length).toBe(2);
expect(documentList.getPreselectedNodesBasedOnSelectionMode().length).toBe(2);
});

Expand All @@ -1585,8 +1585,8 @@ describe('DocumentList', () => {
spyOn(documentList.data, 'getPreselectedRows').and.returnValue(fakeDatatableRows);

documentList.selectionMode = 'multiple';
documentList.preselectedNodes = mockPreselectedNodes;
documentList.preselectNodes();
documentList.preselectNodes = mockPreselectedNodes;
documentList.onPreselectNodes();

fixture.detectChanges();
await fixture.whenStable();
Expand All @@ -1600,7 +1600,7 @@ describe('DocumentList', () => {
fixture.detectChanges();

documentList.node = mockNodePagingWithPreselectedNodes;
documentList.preselectedNodes = [];
documentList.preselectNodes = [];
documentList.reload();

fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
* is pre-selected in single selection mode.
*/
@Input()
preselectedNodes: NodeEntry[] = [];
preselectNodes: NodeEntry[] = [];

/** The Document list will show all the nodes contained in the NodePaging entity */
@Input()
Expand Down Expand Up @@ -488,7 +488,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
if (changes.node && changes.node.currentValue) {
const merge = this._pagination ? this._pagination.merge : false;
this.data.loadPage(changes.node.currentValue, merge, null, this.getPreselectedNodesBasedOnSelectionMode());
this.preselectNodes();
this.onPreselectNodes();
this.onDataReady(changes.node.currentValue);
} else if (changes.imageResolver) {
this.data.setImageResolver(changes.imageResolver.currentValue);
Expand All @@ -503,7 +503,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
if (this.data) {
this.data.loadPage(this.node, this._pagination.merge, null, this.getPreselectedNodesBasedOnSelectionMode());
}
this.preselectNodes();
this.onPreselectNodes();
this.syncPagination();
this.onDataReady(this.node);
} else {
Expand Down Expand Up @@ -696,7 +696,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
if (this.data) {
this.data.loadPage(nodePaging, this._pagination.merge, this.allowDropFiles, this.getPreselectedNodesBasedOnSelectionMode());
}
this.preselectNodes();
this.onPreselectNodes();
this.setLoadingState(false);
this.onDataReady(nodePaging);
}
Expand Down Expand Up @@ -920,10 +920,10 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}

getPreselectedNodesBasedOnSelectionMode(): NodeEntry[] {
return this.hasPreselectedNodes() ? (this.isSingleSelectionMode() ? [this.preselectedNodes[0]] : this.preselectedNodes) : [];
return this.hasPreselectedNodes() ? (this.isSingleSelectionMode() ? [this.preselectNodes[0]] : this.preselectNodes) : [];
}

preselectNodes() {
onPreselectNodes() {
if (this.data.hasPreselectedRows()) {
const preselectedNodes = [...this.isSingleSelectionMode() ? [this.data.getPreselectedRows()[0]] : this.data.getPreselectedRows()];
const selectedNodes = [...this.selection, ...preselectedNodes];
Expand All @@ -940,6 +940,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}

hasPreselectedNodes(): boolean {
return this.preselectedNodes?.length > 0;
return this.preselectNodes?.length > 0;
}
}

0 comments on commit 811b167

Please sign in to comment.