mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
Merge pull request #1249 from Alfresco/dev-pionnegru-ACA-2623
[ACA-2623] InfoDrawer toolbar action - focus InfoDrawer
This commit is contained in:
@@ -2,7 +2,11 @@
|
|||||||
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="!isLoading && !!displayNode">
|
<ng-container *ngIf="!isLoading && !!displayNode">
|
||||||
<adf-info-drawer [title]="'APP.INFO_DRAWER.TITLE'">
|
<adf-info-drawer
|
||||||
|
[title]="'APP.INFO_DRAWER.TITLE'"
|
||||||
|
cdkTrapFocus
|
||||||
|
cdkTrapFocusAutoCapture
|
||||||
|
>
|
||||||
<adf-info-drawer-tab
|
<adf-info-drawer-tab
|
||||||
*ngFor="let tab of tabs"
|
*ngFor="let tab of tabs"
|
||||||
[icon]="tab.icon"
|
[icon]="tab.icon"
|
||||||
|
@@ -26,7 +26,10 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|||||||
import { InfoDrawerComponent } from './info-drawer.component';
|
import { InfoDrawerComponent } from './info-drawer.component';
|
||||||
import { TestBed, ComponentFixture, async } from '@angular/core/testing';
|
import { TestBed, ComponentFixture, async } from '@angular/core/testing';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { SetInfoDrawerStateAction } from '@alfresco/aca-shared/store';
|
import {
|
||||||
|
SetInfoDrawerStateAction,
|
||||||
|
ToggleInfoDrawerAction
|
||||||
|
} from '@alfresco/aca-shared/store';
|
||||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { AppExtensionService } from '../../extensions/extension.service';
|
import { AppExtensionService } from '../../extensions/extension.service';
|
||||||
import { ContentApiService } from '@alfresco/aca-shared';
|
import { ContentApiService } from '@alfresco/aca-shared';
|
||||||
@@ -147,4 +150,20 @@ describe('InfoDrawerComponent', () => {
|
|||||||
expect(component.displayNode).toBe(response);
|
expect(component.displayNode).toBe(response);
|
||||||
expect(contentApiService.getNodeInfo).toHaveBeenCalled();
|
expect(contentApiService.getNodeInfo).toHaveBeenCalled();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should dispatch close panel on Esc keyboard event', () => {
|
||||||
|
const event = new KeyboardEvent('keydown', {
|
||||||
|
code: 'Escape',
|
||||||
|
key: 'Escape',
|
||||||
|
keyCode: 27
|
||||||
|
} as KeyboardEventInit);
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
fixture.debugElement.nativeElement.dispatchEvent(event);
|
||||||
|
|
||||||
|
expect(storeMock.dispatch).toHaveBeenCalledWith(
|
||||||
|
new ToggleInfoDrawerAction()
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -23,7 +23,14 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnChanges, OnInit, OnDestroy } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
HostListener,
|
||||||
|
Input,
|
||||||
|
OnChanges,
|
||||||
|
OnInit,
|
||||||
|
OnDestroy
|
||||||
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
MinimalNodeEntity,
|
MinimalNodeEntity,
|
||||||
MinimalNodeEntryEntity,
|
MinimalNodeEntryEntity,
|
||||||
@@ -33,7 +40,10 @@ import { ContentApiService } from '@alfresco/aca-shared';
|
|||||||
import { AppExtensionService } from '../../extensions/extension.service';
|
import { AppExtensionService } from '../../extensions/extension.service';
|
||||||
import { SidebarTabRef } from '@alfresco/adf-extensions';
|
import { SidebarTabRef } from '@alfresco/adf-extensions';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { SetInfoDrawerStateAction } from '@alfresco/aca-shared/store';
|
import {
|
||||||
|
SetInfoDrawerStateAction,
|
||||||
|
ToggleInfoDrawerAction
|
||||||
|
} from '@alfresco/aca-shared/store';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'aca-info-drawer',
|
selector: 'aca-info-drawer',
|
||||||
@@ -49,6 +59,11 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
displayNode: MinimalNodeEntryEntity | SiteEntry;
|
displayNode: MinimalNodeEntryEntity | SiteEntry;
|
||||||
tabs: Array<SidebarTabRef> = [];
|
tabs: Array<SidebarTabRef> = [];
|
||||||
|
|
||||||
|
@HostListener('keydown.escape', ['$event'])
|
||||||
|
onEscapeKeyboardEvent(event: KeyboardEvent): void {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private contentApi: ContentApiService,
|
private contentApi: ContentApiService,
|
||||||
@@ -76,6 +91,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private close() {
|
||||||
|
this.store.dispatch(new ToggleInfoDrawerAction());
|
||||||
|
}
|
||||||
|
|
||||||
private loadNodeInfo(nodeId: string) {
|
private loadNodeInfo(nodeId: string) {
|
||||||
if (nodeId) {
|
if (nodeId) {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
@@ -39,6 +39,7 @@ import { MetadataTabComponent } from './metadata-tab/metadata-tab.component';
|
|||||||
import { LibraryMetadataTabComponent } from './library-metadata-tab/library-metadata-tab.component';
|
import { LibraryMetadataTabComponent } from './library-metadata-tab/library-metadata-tab.component';
|
||||||
import { LibraryMetadataFormComponent } from './library-metadata-tab/library-metadata-form.component';
|
import { LibraryMetadataFormComponent } from './library-metadata-tab/library-metadata-form.component';
|
||||||
import { VersionsTabComponent } from './versions-tab/versions-tab.component';
|
import { VersionsTabComponent } from './versions-tab/versions-tab.component';
|
||||||
|
import { A11yModule } from '@angular/cdk/a11y';
|
||||||
|
|
||||||
export function components() {
|
export function components() {
|
||||||
return [
|
return [
|
||||||
@@ -59,7 +60,8 @@ export function components() {
|
|||||||
ExtensionsModule,
|
ExtensionsModule,
|
||||||
ContentMetadataModule,
|
ContentMetadataModule,
|
||||||
VersionManagerModule,
|
VersionManagerModule,
|
||||||
DirectivesModule
|
DirectivesModule,
|
||||||
|
A11yModule
|
||||||
],
|
],
|
||||||
declarations: [...components()],
|
declarations: [...components()],
|
||||||
exports: [...components()],
|
exports: [...components()],
|
||||||
|
Reference in New Issue
Block a user