[ADF-3041] TaskList Component - Empty State issue. (#3345)

* [DW-635] Empty State Component

* [DW-635] Empty State Component

* [DW-635] Empty state Issue

* [DW-635] Use empty state component and custom empty directive

* [ADF-3041] Documentation for TaskList Component - Empty State issue.
This commit is contained in:
camorra-skk
2018-05-24 22:31:06 +05:30
committed by Eugenio Romano
parent 997713bca3
commit ed283c7386
8 changed files with 90 additions and 18 deletions

View File

@@ -21,11 +21,12 @@
</ng-template>
</loading-content-template>
<no-content-template>
<!--Add your custom empty template here-->
<ng-template>
<div class="no-content-message">
{{ 'ADF_TASK_LIST.LIST.MESSAGES.NONE' | translate }}
</div>
<adf-empty-content *ngIf="!emptyCustomContent"
icon="assessment"
[title]="'ADF_TASK_LIST.LIST.MESSAGES.NONE' | translate">
</adf-empty-content>
<ng-content select="adf-empty-custom-content"></ng-content>
</ng-template>
</no-content-template>
</adf-datatable>

View File

@@ -15,8 +15,9 @@
* limitations under the License.
*/
import { Component, SimpleChange, ViewChild } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Component, SimpleChange, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core';
import { DataRowEvent, ObjectDataRow, ObjectDataTableAdapter } from '@alfresco/adf-core';
import { TaskListService } from '../services/tasklist.service';
@@ -644,3 +645,40 @@ describe('CustomTaskListComponent', () => {
expect(component.taskList.data.getColumns().length).toEqual(3);
});
});
@Component({
template: `
<adf-tasklist>
<adf-empty-content-holder>
<p id="custom-id"></p>
</adf-empty-content-holder>
</adf-tasklist>
`
})
class EmptyTemplateComponent {
}
describe('Custom EmptyTemplateComponent', () => {
let component: EmptyTemplateComponent;
let fixture: ComponentFixture<EmptyTemplateComponent>;
setupTestBed({
imports: [ProcessTestingModule],
declarations: [EmptyTemplateComponent],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
});
beforeEach(() => {
fixture = TestBed.createComponent(EmptyTemplateComponent);
fixture.detectChanges();
component = fixture.componentInstance;
});
it('should render the custom template', async(() => {
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.debugElement.query(By.css('#custom-id'))).not.toBeNull();
expect(fixture.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
});
}));
});

View File

@@ -16,7 +16,7 @@
*/
import { DataColumn, DataRowEvent, DataTableAdapter, ObjectDataColumn,
ObjectDataRow, ObjectDataTableAdapter } from '@alfresco/adf-core';
ObjectDataRow, ObjectDataTableAdapter, EmptyCustomContentDirective } from '@alfresco/adf-core';
import {
AppConfigService, DataColumnListComponent, PaginationComponent, PaginatedComponent,
UserPreferencesService, UserPreferenceValues, PaginationModel } from '@alfresco/adf-core';
@@ -41,6 +41,7 @@ export class TaskListComponent implements OnChanges, AfterContentInit, Paginated
requestNode: TaskQueryRequestRepresentationModel;
@ContentChild(DataColumnListComponent) columnList: DataColumnListComponent;
@ContentChild(EmptyCustomContentDirective) emptyCustomContent: EmptyCustomContentDirective;
/** The id of the app. */
@Input()