[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

@@ -19,7 +19,7 @@
</div>
<ng-template #noApps>
<div class="adf-app-list-empty">
<ng-content select="adf-empty-custom-content" *ngIf="hasEmptyCustomContentTemplate; else defaultEmptyTemplate"
<ng-content select="adf-custom-empty-content" *ngIf="hasEmptyCustomContentTemplate; else defaultEmptyTemplate"
class="adf-custom-empty-template">
</ng-content>

View File

@@ -171,10 +171,10 @@ describe('AppListCloudComponent', () => {
@Component({
template: `
<adf-cloud-app-list>
<adf-empty-custom-content>
<adf-custom-empty-content>
<mat-icon>apps</mat-icon>
<p id="custom-id">No Apps Found</p>
</adf-empty-custom-content>
</adf-custom-empty-content>
</adf-cloud-app-list>
`
})

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { EmptyCustomContentDirective } from '@alfresco/adf-core';
import { CustomEmptyContentTemplateDirective } from '@alfresco/adf-core';
import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output, ContentChild } from '@angular/core';
import { Observable } from 'rxjs';
import { AppsProcessCloudService } from '../services/apps-process-cloud.service';
@@ -32,8 +32,8 @@
public static LAYOUT_GRID: string = 'GRID';
public static RUNNING_STATUS: string = 'RUNNING';
@ContentChild(EmptyCustomContentDirective)
emptyCustomContent: EmptyCustomContentDirective;
@ContentChild(CustomEmptyContentTemplateDirective)
emptyCustomContent: CustomEmptyContentTemplateDirective;
/** (**required**) Defines the layout of the apps. There are two possible
* values, "GRID" and "LIST".

View File

@@ -6,23 +6,25 @@
[multiselect]="multiselect"
(rowClick)="onRowClick($event)"
(row-keyup)="onRowKeyUp($event)">
<loading-content-template>
<adf-loading-content-template>
<ng-template>
<mat-progress-spinner
*ngIf="!customLoadingContent"
class="adf-cloud-process-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"
icon="assessment"
[title]="'ADF_CLOUD_PROCESS_LIST.MESSAGES.TITLE' | translate"
[subtitle]="'ADF_CLOUD_PROCESS_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>

View File

@@ -47,12 +47,12 @@ class CustomTaskListComponent {
@Component({
template: `
<adf-cloud-process-list>
<adf-empty-custom-content>
<p id="custom-id">TEST</p>
</adf-empty-custom-content>
</adf-cloud-process-list>
`
<adf-cloud-process-list>
<adf-custom-empty-content-template>
<p id="custom-id">TEST</p>
</adf-custom-empty-content-template>
</adf-cloud-process-list>
`
})
class EmptyTemplateComponent {

View File

@@ -17,9 +17,9 @@
import { Component, ViewEncapsulation, OnChanges, AfterContentInit, ContentChild, Output, EventEmitter, SimpleChanges, SimpleChange, Input } from '@angular/core';
import { DataTableSchema, PaginatedComponent,
EmptyCustomContentDirective, AppConfigService,
CustomEmptyContentTemplateDirective, AppConfigService,
UserPreferencesService, PaginationModel,
UserPreferenceValues, DataRowEvent } from '@alfresco/adf-core';
UserPreferenceValues, DataRowEvent, CustomLoadingContentTemplateDirective } from '@alfresco/adf-core';
import { ProcessListCloudService } from '../services/process-list-cloud.service';
import { BehaviorSubject } from 'rxjs';
import { processCloudPresetsDefaultModel } from '../models/process-cloud-preset.model';
@@ -36,8 +36,11 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
static PRESET_KEY = 'adf-cloud-process-list.presets';
@ContentChild(EmptyCustomContentDirective)
emptyCustomContent: EmptyCustomContentDirective;
@ContentChild(CustomEmptyContentTemplateDirective)
emptyCustomContent: CustomEmptyContentTemplateDirective;
@ContentChild(CustomLoadingContentTemplateDirective)
customLoadingContent: CustomLoadingContentTemplateDirective;
/** The name of the application. */
@Input()

View File

@@ -10,7 +10,7 @@
(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-cloud-task-list-loading-margin"
@@ -18,16 +18,16 @@
[mode]="'indeterminate'">
</mat-progress-spinner>
</ng-template>
</loading-content-template>
<no-content-template>
</adf-loading-content-template>
<adf-no-content-template>
<ng-template>
<adf-empty-content *ngIf="!emptyCustomContent"
icon="assignment"
[title]="'ADF_CLOUD_TASK_LIST.LIST.MESSAGES.TITLE' | translate"
[subtitle]="'ADF_CLOUD_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"></ng-content>
</ng-template>
</no-content-template>
</adf-no-content-template>
</adf-datatable>
</ng-container>

View File

@@ -19,7 +19,7 @@ import { Component, ViewEncapsulation, OnChanges, Input, SimpleChanges, Output,
import { AppConfigService, UserPreferencesService,
DataTableSchema, UserPreferenceValues,
PaginatedComponent, PaginationModel,
DataRowEvent, EmptyCustomContentDirective } from '@alfresco/adf-core';
DataRowEvent, CustomEmptyContentTemplateDirective } from '@alfresco/adf-core';
import { taskPresetsCloudDefaultModel } from '../models/task-preset-cloud.model';
import { TaskQueryCloudRequestModel } from '../models/filter-cloud-model';
import { BehaviorSubject } from 'rxjs';
@@ -38,8 +38,8 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
static PRESET_KEY = 'adf-cloud-task-list.presets';
@ContentChild(EmptyCustomContentDirective)
emptyCustomContent: EmptyCustomContentDirective;
@ContentChild(CustomEmptyContentTemplateDirective)
emptyCustomContent: CustomEmptyContentTemplateDirective;
/** The name of the application. */
@Input()