[ADF-1344] New Custom Loading Content Directive for Datatable Component (#4156)

* [ADF-1344] New Custom Loading Content Directive for Datatable Component

* [ADF-1344] Add unit tests for directives on Document List

* [ADF-1344] Add directive prefix to context-menu directive

* [ADF-1344] Old directive selectors have been put back

* [ADF-1344] Add old selector for empty-content directive
This commit is contained in:
davidcanonieto
2019-01-25 12:15:28 +00:00
committed by Eugenio Romano
parent 5887fa1052
commit 1c25b50b1a
115 changed files with 604 additions and 489 deletions

View File

@@ -23,8 +23,11 @@ import {
} from '@angular/core';
import { TaskDetailsComponent } from './task-details.component';
/**
* Directive selectors without adf- prefix will be deprecated on 3.0.0
*/
@Directive({
selector: 'no-task-details-template'
selector: 'adf-no-task-details-template, no-task-details-template'
})
export class NoTaskDetailsTemplateDirective implements AfterContentInit {

View File

@@ -88,9 +88,9 @@
(success)="assignTaskToUser($event)"
(closeSearch)="onCloseSearch()"
[results]="peopleSearch">
<ng-container people-search-title>{{ 'ADF_TASK_LIST.DETAILS.LABELS.ADD_ASSIGNEE' | translate }}
<ng-container adf-people-search-title>{{ 'ADF_TASK_LIST.DETAILS.LABELS.ADD_ASSIGNEE' | translate }}
</ng-container>
<ng-container people-search-action-label>{{ 'ADF_TASK_LIST.PEOPLE.ADD_ASSIGNEE' | translate }}
<ng-container adf-people-search-action-label>{{ 'ADF_TASK_LIST.PEOPLE.ADD_ASSIGNEE' | translate }}
</ng-container>
</adf-people-search>
</div>

View File

@@ -12,25 +12,27 @@
(row-unselect)="onRowUnselect($event)"
(rowClick)="onRowClick($event)"
(row-keyup)="onRowKeyUp($event)">
<loading-content-template>
<adf-loading-content-template>
<ng-template>
<!--Add your custom loading template here-->
<mat-progress-spinner
class="adf-task-list-loading-margin"
[color]="'primary'"
[mode]="'indeterminate'">
*ngIf="!customLoadingContent"
class="adf-task-list-loading-margin"
[color]="'primary'"
[mode]="'indeterminate'">
</mat-progress-spinner>
<ng-content select="adf-custom-loading-content-template"></ng-content>
</ng-template>
</loading-content-template>
<no-content-template>
</adf-loading-content-template>
<adf-no-content-template>
<ng-template>
<adf-empty-content *ngIf="!emptyCustomContent"
<adf-empty-content *ngIf="!customEmptyContent"
icon="assignment"
[title]="'ADF_TASK_LIST.LIST.MESSAGES.TITLE' | translate"
[subtitle]="'ADF_TASK_LIST.LIST.MESSAGES.SUBTITLE' | translate">
</adf-empty-content>
<ng-content select="adf-empty-custom-content"></ng-content>
<ng-content select="adf-custom-empty-content-template"></ng-content>
</ng-template>
</no-content-template>
</adf-no-content-template>
</adf-datatable>
</ng-container>

View File

@@ -569,9 +569,9 @@ describe('CustomTaskListComponent', () => {
@Component({
template: `
<adf-tasklist [appId]="1">
<adf-empty-custom-content>
<adf-custom-empty-content-template>
<p id="custom-id">CUSTOM EMPTY</p>
</adf-empty-custom-content>
</adf-custom-empty-content-template>
</adf-tasklist>
`
})

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { DataRowEvent, DataTableAdapter, DataTableSchema, EmptyCustomContentDirective } from '@alfresco/adf-core';
import { DataRowEvent, DataTableAdapter, DataTableSchema, CustomEmptyContentTemplateDirective, CustomLoadingContentTemplateDirective } from '@alfresco/adf-core';
import {
AppConfigService, PaginationComponent, PaginatedComponent,
UserPreferencesService, UserPreferenceValues, PaginationModel } from '@alfresco/adf-core';
@@ -40,7 +40,11 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
static PRESET_KEY = 'adf-task-list.presets';
public FORMAT_DATE: string = 'll';
@ContentChild(EmptyCustomContentDirective) emptyCustomContent: EmptyCustomContentDirective;
@ContentChild(CustomEmptyContentTemplateDirective)
customEmptyContent: CustomEmptyContentTemplateDirective;
@ContentChild(CustomLoadingContentTemplateDirective)
customLoadingContent: CustomLoadingContentTemplateDirective;
requestNode: TaskQueryRequestRepresentationModel;