mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ACS-8782] list of frozen files under a hold (#10663)
* [ACS-8782] Added possibility to hide drag and drop hint from document list * [ACS-8782] Unit tests for changes in document list component * [ACS-8782] Added documentation for displayDragAndDropHint property * [ACS-8782] Corrected path
This commit is contained in:
parent
f39f104d45
commit
7bfe27dda9
@ -67,6 +67,7 @@ Displays the documents from a repository.
|
|||||||
| contextMenuActions | `boolean` | false | Toggles context menus for each row |
|
| contextMenuActions | `boolean` | false | Toggles context menus for each row |
|
||||||
| currentFolderId | `string` | null | The ID of the folder node to display or a reserved string alias for special sources |
|
| currentFolderId | `string` | null | The ID of the folder node to display or a reserved string alias for special sources |
|
||||||
| displayCheckboxesOnHover | `boolean` | false | Enables checkboxes in datatable rows being displayed on hover only. |
|
| displayCheckboxesOnHover | `boolean` | false | Enables checkboxes in datatable rows being displayed on hover only. |
|
||||||
|
| displayDragAndDropHint | `boolean` | true | Display drag and drop hint. |
|
||||||
| emptyFolderImageUrl | `string` | | Custom image for empty folder. Default value: './assets/images/empty_doc_lib.svg' |
|
| emptyFolderImageUrl | `string` | | Custom image for empty folder. Default value: './assets/images/empty_doc_lib.svg' |
|
||||||
| filterValue | `any` | | Initial value for filter. |
|
| filterValue | `any` | | Initial value for filter. |
|
||||||
| headerFilters | `boolean` | false | Toggles the header filters mode. |
|
| headerFilters | `boolean` | false | Toggles the header filters mode. |
|
||||||
|
@ -43,8 +43,10 @@
|
|||||||
<adf-empty-list *ngIf="!customNoContentTemplate">
|
<adf-empty-list *ngIf="!customNoContentTemplate">
|
||||||
<div class="adf-empty-list_template adf-empty-folder">
|
<div class="adf-empty-list_template adf-empty-folder">
|
||||||
<div class="adf-empty-folder-this-space-is-empty">{{'ADF-DOCUMENT-LIST.EMPTY.HEADER' | translate}}</div>
|
<div class="adf-empty-folder-this-space-is-empty">{{'ADF-DOCUMENT-LIST.EMPTY.HEADER' | translate}}</div>
|
||||||
<div class="adf-empty-folder-drag-drop">{{ 'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE' | translate }}</div>
|
<ng-container *ngIf="displayDragAndDropHint">
|
||||||
<div class="adf-empty-folder-any-files-here-to-add">{{ 'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.SUBTITLE' | translate }}</div>
|
<div class="adf-empty-folder-drag-drop">{{ 'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE' | translate }}</div>
|
||||||
|
<div class="adf-empty-folder-any-files-here-to-add">{{ 'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.SUBTITLE' | translate }}</div>
|
||||||
|
</ng-container>
|
||||||
<img [alt]="'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE' | translate" class="adf-empty-folder-image" [src]="emptyFolderImageUrl">
|
<img [alt]="'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE' | translate" class="adf-empty-folder-image" [src]="emptyFolderImageUrl">
|
||||||
</div>
|
</div>
|
||||||
</adf-empty-list>
|
</adf-empty-list>
|
||||||
|
@ -25,21 +25,13 @@ import {
|
|||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
ObjectDataTableAdapter,
|
ObjectDataTableAdapter,
|
||||||
ShowHeaderMode,
|
ShowHeaderMode,
|
||||||
ThumbnailService
|
ThumbnailService,
|
||||||
|
UnitTestingUtils
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { FavoritePaging, FavoritePagingList, Node, NodeEntry, NodePaging } from '@alfresco/js-api';
|
import { FavoritePaging, FavoritePagingList, Node, NodeEntry, NodePaging } from '@alfresco/js-api';
|
||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import {
|
import { Component, CUSTOM_ELEMENTS_SCHEMA, Injector, QueryList, runInInjectionContext, SimpleChange, SimpleChanges, ViewChild } from '@angular/core';
|
||||||
Component,
|
|
||||||
CUSTOM_ELEMENTS_SCHEMA,
|
|
||||||
Injector,
|
|
||||||
QueryList,
|
|
||||||
runInInjectionContext,
|
|
||||||
SimpleChange,
|
|
||||||
SimpleChanges,
|
|
||||||
ViewChild
|
|
||||||
} from '@angular/core';
|
|
||||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||||
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
|
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
@ -94,6 +86,12 @@ describe('DocumentList', () => {
|
|||||||
let spyFolderNode: any;
|
let spyFolderNode: any;
|
||||||
let authenticationService: AuthenticationService;
|
let authenticationService: AuthenticationService;
|
||||||
let injector: Injector;
|
let injector: Injector;
|
||||||
|
let unitTestingUtils: UnitTestingUtils;
|
||||||
|
|
||||||
|
const getEmptyFolderDragDropTitle = (): string => unitTestingUtils.getByCSS('.adf-empty-folder-drag-drop')?.nativeElement?.textContent;
|
||||||
|
|
||||||
|
const getEmptyFolderDragDropSubtitle = (): string =>
|
||||||
|
unitTestingUtils.getByCSS('.adf-empty-folder-any-files-here-to-add')?.nativeElement?.textContent;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@ -109,6 +107,7 @@ describe('DocumentList', () => {
|
|||||||
|
|
||||||
element = fixture.nativeElement;
|
element = fixture.nativeElement;
|
||||||
documentList = fixture.componentInstance;
|
documentList = fixture.componentInstance;
|
||||||
|
unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
|
||||||
|
|
||||||
documentListService = TestBed.inject(DocumentListService);
|
documentListService = TestBed.inject(DocumentListService);
|
||||||
customResourcesService = TestBed.inject(CustomResourcesService);
|
customResourcesService = TestBed.inject(CustomResourcesService);
|
||||||
@ -1139,7 +1138,7 @@ describe('DocumentList', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
runInInjectionContext(injector, () => {
|
runInInjectionContext(injector, () => {
|
||||||
documentList.dataTable = new DataTableComponent(null, null, matIconRegistryMock, domSanitizerMock);
|
documentList.dataTable = new DataTableComponent(null, null, matIconRegistryMock, domSanitizerMock);
|
||||||
})
|
});
|
||||||
expect(documentList.dataTable).toBeDefined();
|
expect(documentList.dataTable).toBeDefined();
|
||||||
expect(fixture.debugElement.query(By.css('adf-empty-list'))).not.toBeNull();
|
expect(fixture.debugElement.query(By.css('adf-empty-list'))).not.toBeNull();
|
||||||
});
|
});
|
||||||
@ -1160,7 +1159,7 @@ describe('DocumentList', () => {
|
|||||||
it('should empty folder NOT show the pagination', () => {
|
it('should empty folder NOT show the pagination', () => {
|
||||||
runInInjectionContext(injector, () => {
|
runInInjectionContext(injector, () => {
|
||||||
documentList.dataTable = new DataTableComponent(null, null, matIconRegistryMock, domSanitizerMock);
|
documentList.dataTable = new DataTableComponent(null, null, matIconRegistryMock, domSanitizerMock);
|
||||||
})
|
});
|
||||||
|
|
||||||
expect(documentList.isEmpty()).toBeTruthy();
|
expect(documentList.isEmpty()).toBeTruthy();
|
||||||
expect(element.querySelector('alfresco-pagination')).toBe(null);
|
expect(element.querySelector('alfresco-pagination')).toBe(null);
|
||||||
@ -1651,6 +1650,44 @@ describe('DocumentList', () => {
|
|||||||
expect(dialog.open).toHaveBeenCalledWith(FileAutoDownloadComponent, { disableClose: true, data: node });
|
expect(dialog.open).toHaveBeenCalledWith(FileAutoDownloadComponent, { disableClose: true, data: node });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should display drag and drop title by default', () => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(getEmptyFolderDragDropTitle()).toBe('ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display drag and drop title if displayDragAndDropHint is set to true', () => {
|
||||||
|
documentList.displayDragAndDropHint = true;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(getEmptyFolderDragDropTitle()).toBe('ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not display drag and drop title if displayDragAndDropHint is set to false', () => {
|
||||||
|
documentList.displayDragAndDropHint = false;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(getEmptyFolderDragDropTitle()).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display drag and drop subtitle by default', () => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(getEmptyFolderDragDropSubtitle()).toBe('ADF-DATATABLE.EMPTY.DRAG-AND-DROP.SUBTITLE');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display drag and drop subtitle if displayDragAndDropHint is set to true', () => {
|
||||||
|
documentList.displayDragAndDropHint = true;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(getEmptyFolderDragDropSubtitle()).toBe('ADF-DATATABLE.EMPTY.DRAG-AND-DROP.SUBTITLE');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not display drag and drop subtitle if displayDragAndDropHint is set to false', () => {
|
||||||
|
documentList.displayDragAndDropHint = false;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(getEmptyFolderDragDropSubtitle()).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
describe('Preselect nodes', () => {
|
describe('Preselect nodes', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(thumbnailService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_created.svg`);
|
spyOn(thumbnailService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_created.svg`);
|
||||||
|
@ -371,6 +371,10 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
|
|||||||
@Input()
|
@Input()
|
||||||
displayCheckboxesOnHover = false;
|
displayCheckboxesOnHover = false;
|
||||||
|
|
||||||
|
/** Display drag and drop hint. */
|
||||||
|
@Input()
|
||||||
|
displayDragAndDropHint = true;
|
||||||
|
|
||||||
/** Emitted when the user clicks a list node */
|
/** Emitted when the user clicks a list node */
|
||||||
@Output()
|
@Output()
|
||||||
nodeClick = new EventEmitter<NodeEntityEvent>();
|
nodeClick = new EventEmitter<NodeEntityEvent>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user