mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[ACA-3614] Add a way to not show info drawer header (#5848)
This commit is contained in:
parent
d7dc6d7230
commit
05a478e317
@ -23,7 +23,7 @@ with the following names:
|
|||||||
- info-drawer-content
|
- info-drawer-content
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<adf-info-drawer-layout>
|
<adf-info-drawer-layout [showHeader]="true">
|
||||||
<div info-drawer-title>File info</div>
|
<div info-drawer-title>File info</div>
|
||||||
|
|
||||||
<div info-drawer-buttons>
|
<div info-drawer-buttons>
|
||||||
@ -37,6 +37,13 @@ with the following names:
|
|||||||
</div>
|
</div>
|
||||||
</adf-info-drawer-layout>
|
</adf-info-drawer-layout>
|
||||||
```
|
```
|
||||||
|
## Class members
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
| Name | Type | Default value | Description |
|
||||||
|
| ---- | ---- | ------------- | ----------- |
|
||||||
|
| showHeader | `boolean` | true | The visibility of the header. |
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ The tabs are added using one or more `<adf-info-drawer-tab>` elements, which can
|
|||||||
have any content you like:
|
have any content you like:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<adf-info-drawer title="Activities" (currentTab)="getActiveTab($event)">
|
<adf-info-drawer [showHeader]="true" title="Activities" (currentTab)="getActiveTab($event)">
|
||||||
<div info-drawer-buttons>
|
<div info-drawer-buttons>
|
||||||
<mat-icon (click)="close()">clear</mat-icon>
|
<mat-icon (click)="close()">clear</mat-icon>
|
||||||
</div>
|
</div>
|
||||||
@ -51,6 +51,7 @@ have any content you like:
|
|||||||
| ---- | ---- | ------------- | ----------- |
|
| ---- | ---- | ------------- | ----------- |
|
||||||
| selectedIndex | `number` | 0 | The selected index tab. |
|
| selectedIndex | `number` | 0 | The selected index tab. |
|
||||||
| title | `string \| null` | null | The title of the info drawer (string or translation key). |
|
| title | `string \| null` | null | The title of the info drawer (string or translation key). |
|
||||||
|
| showHeader | `boolean` | true | The visibility of the header. |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="adf-info-drawer-layout-header">
|
<div *ngIf="showHeader" class="adf-info-drawer-layout-header">
|
||||||
<div class="adf-info-drawer-layout-header-title">
|
<div class="adf-info-drawer-layout-header-title">
|
||||||
<ng-content select="[info-drawer-title]"></ng-content>
|
<ng-content select="[info-drawer-title]"></ng-content>
|
||||||
</div>
|
</div>
|
||||||
@ -8,4 +8,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="adf-info-drawer-layout-content">
|
<div class="adf-info-drawer-layout-content">
|
||||||
<ng-content select="[info-drawer-content]"></ng-content>
|
<ng-content select="[info-drawer-content]"></ng-content>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Directive, ViewEncapsulation } from '@angular/core';
|
import { Component, Directive, Input, ViewEncapsulation } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-info-drawer-layout',
|
selector: 'adf-info-drawer-layout',
|
||||||
@ -24,7 +24,11 @@ import { Component, Directive, ViewEncapsulation } from '@angular/core';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { 'class': 'adf-info-drawer-layout' }
|
host: { 'class': 'adf-info-drawer-layout' }
|
||||||
})
|
})
|
||||||
export class InfoDrawerLayoutComponent {}
|
export class InfoDrawerLayoutComponent {
|
||||||
|
/** The visibility of the header. */
|
||||||
|
@Input()
|
||||||
|
showHeader: boolean = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directive selectors without adf- prefix will be deprecated on 3.0.0
|
* Directive selectors without adf- prefix will be deprecated on 3.0.0
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<adf-info-drawer-layout>
|
<adf-info-drawer-layout [showHeader]="showHeader">
|
||||||
<div role="heading" aria-level="1" *ngIf="title" info-drawer-title>{{ title | translate }}</div>
|
<div role="heading" aria-level="1" *ngIf="title" info-drawer-title>{{ title | translate }}</div>
|
||||||
<ng-content *ngIf="!title" info-drawer-title select="[info-drawer-title]"></ng-content>
|
<ng-content *ngIf="!title" info-drawer-title select="[info-drawer-title]"></ng-content>
|
||||||
|
|
||||||
|
@ -138,3 +138,50 @@ describe('Custom InfoDrawer', () => {
|
|||||||
expect(tab[0].nativeElement.innerText).toContain('tab-icon');
|
expect(tab[0].nativeElement.innerText).toContain('tab-icon');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
template: `
|
||||||
|
<adf-info-drawer [showHeader]="showHeader" title="Fake Visibility Info Drawer Title">
|
||||||
|
</adf-info-drawer>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
class VisibilityInfoDrawerComponent extends InfoDrawerComponent {
|
||||||
|
showHeader: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Header visibility InfoDrawer', () => {
|
||||||
|
let fixture: ComponentFixture<VisibilityInfoDrawerComponent>;
|
||||||
|
let component: VisibilityInfoDrawerComponent;
|
||||||
|
|
||||||
|
setupTestBed({
|
||||||
|
imports: [
|
||||||
|
TranslateModule.forRoot(),
|
||||||
|
CoreTestingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
VisibilityInfoDrawerComponent
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(VisibilityInfoDrawerComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show info drawer header by default', () => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
const title: any = fixture.debugElement.queryAll(By.css('[info-drawer-title]'));
|
||||||
|
expect(title.length).toBe(1);
|
||||||
|
expect(title[0].nativeElement.innerText).toBe('Fake Visibility Info Drawer Title');
|
||||||
|
expect(component.showHeader).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not show info drawer header when showHeader is false', () => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.showHeader = false;
|
||||||
|
fixture.detectChanges();
|
||||||
|
const title: any = fixture.debugElement.queryAll(By.css('[info-drawer-title]'));
|
||||||
|
expect(title.length).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -50,6 +50,10 @@ export class InfoDrawerComponent {
|
|||||||
@Input()
|
@Input()
|
||||||
selectedIndex: number = 0;
|
selectedIndex: number = 0;
|
||||||
|
|
||||||
|
/** The visibility of the header. */
|
||||||
|
@Input()
|
||||||
|
showHeader: boolean = true;
|
||||||
|
|
||||||
/** Emitted when the currently active tab changes. */
|
/** Emitted when the currently active tab changes. */
|
||||||
@Output()
|
@Output()
|
||||||
currentTab: EventEmitter<number> = new EventEmitter<number>();
|
currentTab: EventEmitter<number> = new EventEmitter<number>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user