[ACA-2368] UI Issues while editing Metadata in the Preview Page (#1369)

* [ACA-2368] UI Issues while editing Metadata in the Preview Page #1091

* [ACA-2368] UI Issues while editing Metadata in the Preview Page #1091

* * comments fixed
This commit is contained in:
dhrn
2020-04-06 14:58:04 +05:30
committed by GitHub
parent 8d710d627a
commit 38a889f7e5
3 changed files with 37 additions and 20 deletions

View File

@@ -28,8 +28,8 @@ import {
HostListener, HostListener,
Input, Input,
OnChanges, OnChanges,
OnInit, OnDestroy,
OnDestroy OnInit
} from '@angular/core'; } from '@angular/core';
import { import {
MinimalNodeEntity, MinimalNodeEntity,

View File

@@ -3,7 +3,7 @@
[ngClass]="{ [ngClass]="{
'right_side--hide': !showRightSide 'right_side--hide': !showRightSide
}" }"
[displayName]="fileName" [fileName]="fileName"
[maxRetries]="'viewer.maxRetries' | adfAppConfig" [maxRetries]="'viewer.maxRetries' | adfAppConfig"
[nodeId]="nodeId" [nodeId]="nodeId"
[allowNavigate]="navigateMultiple" [allowNavigate]="navigateMultiple"

View File

@@ -36,7 +36,13 @@ import {
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions'; import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
import { MinimalNodeEntryEntity, SearchRequest } from '@alfresco/js-api'; import { MinimalNodeEntryEntity, SearchRequest } from '@alfresco/js-api';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import {
Component,
HostListener,
OnDestroy,
OnInit,
ViewEncapsulation
} from '@angular/core';
import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router'; import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router';
import { import {
UserPreferencesService, UserPreferencesService,
@@ -50,6 +56,7 @@ import { from, Observable, Subject } from 'rxjs';
import { takeUntil, debounceTime } from 'rxjs/operators'; import { takeUntil, debounceTime } from 'rxjs/operators';
import { AppExtensionService } from '../../extensions/extension.service'; import { AppExtensionService } from '../../extensions/extension.service';
import { Actions, ofType } from '@ngrx/effects'; import { Actions, ofType } from '@ngrx/effects';
@Component({ @Component({
selector: 'app-viewer', selector: 'app-viewer',
templateUrl: './viewer.component.html', templateUrl: './viewer.component.html',
@@ -58,10 +65,9 @@ import { Actions, ofType } from '@ngrx/effects';
host: { class: 'app-viewer' } host: { class: 'app-viewer' }
}) })
export class AppViewerComponent implements OnInit, OnDestroy { export class AppViewerComponent implements OnInit, OnDestroy {
private navigationPath: string;
onDestroy$ = new Subject<boolean>(); onDestroy$ = new Subject<boolean>();
fileName: string;
folderId: string = null; folderId: string = null;
nodeId: string = null; nodeId: string = null;
node: MinimalNodeEntryEntity; node: MinimalNodeEntryEntity;
@@ -108,8 +114,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
'-TYPE:"lnk:link"' '-TYPE:"lnk:link"'
]; ];
fileName: string; private navigationPath: string;
private previewLocation: string; private previewLocation: string;
private containersSkipNavigation = [ private containersSkipNavigation = [
'adf-viewer__sidebar', 'adf-viewer__sidebar',
@@ -405,6 +410,30 @@ export class AppViewerComponent implements OnInit, OnDestroy {
return []; return [];
} }
/**
* Get the root field name from the property path.
* Example: 'property1.some.child.property' => 'property1'
* @param path Property path
*/
getRootField(path: string) {
if (path) {
return path.split('.')[0];
}
return path;
}
@HostListener('document:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
const key = event.keyCode;
const rightArrow = 39;
const leftArrow = 37;
if (key === rightArrow || key === leftArrow) {
event.preventDefault();
event.stopImmediatePropagation();
}
}
private sort(items: any[], key: string, direction: string) { private sort(items: any[], key: string, direction: string) {
const options: Intl.CollatorOptions = {}; const options: Intl.CollatorOptions = {};
@@ -435,18 +464,6 @@ export class AppViewerComponent implements OnInit, OnDestroy {
}); });
} }
/**
* Get the root field name from the property path.
* Example: 'property1.some.child.property' => 'property1'
* @param path Property path
*/
getRootField(path: string) {
if (path) {
return path.split('.')[0];
}
return path;
}
private navigateToFileLocation() { private navigateToFileLocation() {
const location = this.getFileLocation(); const location = this.getFileLocation();
this.router.navigateByUrl(location); this.router.navigateByUrl(location);