mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[AAE-5124] Show counter only when attaching files (#7011)
* [AAE-5124] Show counter only when attaching files * Reset package-lock.json * Add another unit test * Fix unit test
This commit is contained in:
parent
3a558d701a
commit
c96b6ea36f
@ -45,6 +45,7 @@ Opens a [Content Node Selector](content-node-selector.component.md) in its own
|
|||||||
| showDropdownSiteList | `boolean` | | Toggle sites list dropdown rendering |
|
| showDropdownSiteList | `boolean` | | Toggle sites list dropdown rendering |
|
||||||
| showFilesInResult | `void` | | Shows the files and folders in the search result |
|
| showFilesInResult | `void` | | Shows the files and folders in the search result |
|
||||||
| showSearch | `boolean` | | Toggle search input rendering |
|
| showSearch | `boolean` | | Toggle search input rendering |
|
||||||
|
| showNodeCounter | `boolean` | false | Shows the node counter in the breadcrumb |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
</adf-search-panel>
|
</adf-search-panel>
|
||||||
<div class="adf-content-node-selector-document-list-container">
|
<div class="adf-content-node-selector-document-list-container">
|
||||||
<adf-toolbar>
|
<adf-toolbar>
|
||||||
<adf-toolbar-title [adf-node-counter]="getSelectedCount()">
|
<adf-toolbar-title>
|
||||||
<ng-container *ngIf="!showBreadcrumbs()">
|
<ng-container *ngIf="!showBreadcrumbs()">
|
||||||
<span role="heading" aria-level="3" class="adf-search-results-label">{{ 'NODE_SELECTOR.SEARCH_RESULTS' | translate }}</span>
|
<span role="heading" aria-level="3" class="adf-search-results-label">{{ 'NODE_SELECTOR.SEARCH_RESULTS' | translate }}</span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@ -57,6 +57,7 @@
|
|||||||
[root]="breadcrumbFolderTitle"
|
[root]="breadcrumbFolderTitle"
|
||||||
data-automation-id="content-node-selector-content-breadcrumb">
|
data-automation-id="content-node-selector-content-breadcrumb">
|
||||||
</adf-dropdown-breadcrumb>
|
</adf-dropdown-breadcrumb>
|
||||||
|
<ng-container *ngIf="showNodeCounter" [adf-node-counter]="getSelectedCount()"></ng-container>
|
||||||
</adf-toolbar-title>
|
</adf-toolbar-title>
|
||||||
</adf-toolbar>
|
</adf-toolbar>
|
||||||
|
|
||||||
|
@ -1387,6 +1387,12 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
|
|
||||||
expect(component.getSelectedCount()).toBe(0);
|
expect(component.getSelectedCount()).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not render component input if `showNodeCounter` is false', () => {
|
||||||
|
component.showNodeCounter = false;
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(fixture.debugElement.nativeElement.querySelector('adf-node-counter')).toBe(null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -76,6 +76,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private showSiteList = true;
|
private showSiteList = true;
|
||||||
private showSearchField = true;
|
private showSearchField = true;
|
||||||
|
private showCounter = false;
|
||||||
|
|
||||||
/** If true will restrict the search and breadcrumbs to the currentFolderId */
|
/** If true will restrict the search and breadcrumbs to the currentFolderId */
|
||||||
@Input()
|
@Input()
|
||||||
@ -200,6 +201,16 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Shows the node counter in the breadcrumb */
|
||||||
|
@Input()
|
||||||
|
set showNodeCounter(value: boolean) {
|
||||||
|
this.showCounter = value ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get showNodeCounter(): boolean {
|
||||||
|
return this.showCounter;
|
||||||
|
}
|
||||||
|
|
||||||
/** Emitted when the user has chosen an item. */
|
/** Emitted when the user has chosen an item. */
|
||||||
@Output()
|
@Output()
|
||||||
select: EventEmitter<Node[]> = new EventEmitter<Node[]>();
|
select: EventEmitter<Node[]> = new EventEmitter<Node[]>();
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
[showSearch]="data?.showSearch"
|
[showSearch]="data?.showSearch"
|
||||||
[showDropdownSiteList]="data?.showDropdownSiteList"
|
[showDropdownSiteList]="data?.showDropdownSiteList"
|
||||||
[showFilesInResult]="data?.showFilesInResult"
|
[showFilesInResult]="data?.showFilesInResult"
|
||||||
|
[showNodeCounter]="isCounterVisible()"
|
||||||
(currentFolder)="onCurrentFolder($event)"
|
(currentFolder)="onCurrentFolder($event)"
|
||||||
(folderLoaded)="onFolderLoaded()"
|
(folderLoaded)="onFolderLoaded()"
|
||||||
(select)="onSelect($event)"
|
(select)="onSelect($event)"
|
||||||
@ -35,7 +36,7 @@
|
|||||||
<mat-tab *ngIf="canPerformLocalUpload()"
|
<mat-tab *ngIf="canPerformLocalUpload()"
|
||||||
[disabled]="isNotAllowedToUpload()">
|
[disabled]="isNotAllowedToUpload()">
|
||||||
<adf-toolbar>
|
<adf-toolbar>
|
||||||
<adf-toolbar-title [adf-node-counter]="getSelectedCount()">
|
<adf-toolbar-title>
|
||||||
<adf-dropdown-breadcrumb
|
<adf-dropdown-breadcrumb
|
||||||
class="adf-content-node-selector-content-breadcrumb"
|
class="adf-content-node-selector-content-breadcrumb"
|
||||||
[folderNode]="breadcrumbFolderNode"
|
[folderNode]="breadcrumbFolderNode"
|
||||||
@ -43,6 +44,7 @@
|
|||||||
[readOnly]="true"
|
[readOnly]="true"
|
||||||
data-automation-id="content-node-selector-upload-breadcrumb"
|
data-automation-id="content-node-selector-upload-breadcrumb"
|
||||||
></adf-dropdown-breadcrumb>
|
></adf-dropdown-breadcrumb>
|
||||||
|
<ng-container *ngIf="isCounterVisible()" [adf-node-counter]="getSelectedCount()"></ng-container>
|
||||||
</adf-toolbar-title>
|
</adf-toolbar-title>
|
||||||
</adf-toolbar>
|
</adf-toolbar>
|
||||||
<ng-template mat-tab-label>
|
<ng-template mat-tab-label>
|
||||||
|
@ -446,5 +446,23 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
|
|
||||||
expect(component.getSelectedCount()).toBe(1);
|
expect(component.getSelectedCount()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show the counter depending on the action', () => {
|
||||||
|
component.action = 'ATTACH';
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(fixture.debugElement.nativeElement.querySelector('adf-node-counter')).not.toBe(null);
|
||||||
|
|
||||||
|
component.action = 'CHOOSE';
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(fixture.debugElement.nativeElement.querySelector('adf-node-counter')).not.toBe(null);
|
||||||
|
|
||||||
|
component.action = 'COPY';
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(fixture.debugElement.nativeElement.querySelector('adf-node-counter')).toBe(null);
|
||||||
|
|
||||||
|
component.action = 'MOVE';
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(fixture.debugElement.nativeElement.querySelector('adf-node-counter')).toBe(null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -111,6 +111,10 @@ export class ContentNodeSelectorComponent implements OnInit {
|
|||||||
return this.chosenNode?.length || 0;
|
return this.chosenNode?.length || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isCounterVisible(): boolean {
|
||||||
|
return this.action === 'ATTACH' || this.action === 'CHOOSE';
|
||||||
|
}
|
||||||
|
|
||||||
isMultipleSelection(): boolean {
|
isMultipleSelection(): boolean {
|
||||||
return this.data.selectionMode === 'multiple';
|
return this.data.selectionMode === 'multiple';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user