diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.html b/demo-shell/src/app/components/app-layout/app-layout.component.html
index 2e260db3a8..efaf339436 100644
--- a/demo-shell/src/app/components/app-layout/app-layout.component.html
+++ b/demo-shell/src/app/components/app-layout/app-layout.component.html
@@ -23,7 +23,7 @@
-
+
{{'APP_LAYOUT.HOME' | translate }}
{{'APP_LAYOUT.CONTENT_SERVICES' | translate }}
diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.scss b/demo-shell/src/app/components/app-layout/app-layout.component.scss
index 2ab4f638e7..3f81063ac4 100644
--- a/demo-shell/src/app/components/app-layout/app-layout.component.scss
+++ b/demo-shell/src/app/components/app-layout/app-layout.component.scss
@@ -20,10 +20,6 @@
}
}
- .adf-search-bar-overflow {
- overflow: hidden;
- }
-
&-user-profile {
margin-right: 10px;
}
@@ -58,16 +54,9 @@
.adf-userinfo-name {
display: none;
}
-
- .adf-search-bar-overflow {
- padding-right: 4px;
- }
}
@media screen and ($mat-xsmall) {
- .adf-search-bar-overflow {
- padding-right: 16px;
- }
}
}
diff --git a/demo-shell/src/app/components/search/search-bar.component.html b/demo-shell/src/app/components/search/search-bar.component.html
index 80b3863b5e..81df2e9ae0 100644
--- a/demo-shell/src/app/components/search/search-bar.component.html
+++ b/demo-shell/src/app/components/search/search-bar.component.html
@@ -2,7 +2,3 @@
(optionClicked)="onItemClicked($event)"
(submit)="onSearchSubmit($event)">
-
-
-
-
diff --git a/demo-shell/src/app/components/search/search-bar.component.ts b/demo-shell/src/app/components/search/search-bar.component.ts
index 9e3735a928..a9f7a4862d 100644
--- a/demo-shell/src/app/components/search/search-bar.component.ts
+++ b/demo-shell/src/app/components/search/search-bar.component.ts
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-import { Component, EventEmitter, Output, Input } from '@angular/core';
+import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { MinimalNodeEntity } from 'alfresco-js-api';
-import { AuthenticationService } from '@alfresco/adf-core';
@Component({
selector: 'adf-search-bar',
@@ -27,23 +26,7 @@ import { AuthenticationService } from '@alfresco/adf-core';
})
export class SearchBarComponent {
- @Input()
- expandable: boolean = true;
-
- @Output()
- expand = new EventEmitter();
-
- fileNodeId: string;
- fileShowed: boolean = false;
- searchTerm: string = '';
- subscriptAnimationState: string;
-
- constructor(public router: Router,
- public authService: AuthenticationService) {
- }
-
- isLoggedIn(): boolean {
- return this.authService.isLoggedIn();
+ constructor(public router: Router) {
}
/**
@@ -52,19 +35,18 @@ export class SearchBarComponent {
* @param event Parameters relating to the search
*/
onSearchSubmit(event: KeyboardEvent) {
- let value = (event.target as HTMLInputElement).value;
- this.router.navigate(['/search', {
- q: value
- }]);
- }
+ const value = (event.target as HTMLInputElement).value;
+ this.router.navigate(['/search', {
+ q: value
+ }]);
+ }
- onItemClicked(event: MinimalNodeEntity) {
- if (event.entry.isFile) {
- this.fileNodeId = event.entry.id;
- this.fileShowed = true;
- } else if (event.entry.isFolder) {
- this.router.navigate(['/files', event.entry.id]);
- }
- }
+ onItemClicked(event: MinimalNodeEntity) {
+ if (event.entry.isFile) {
+ this.router.navigate(['/files', event.entry.id, 'view']);
+ } else if (event.entry.isFolder) {
+ this.router.navigate(['/files', event.entry.id]);
+ }
+ }
}
diff --git a/lib/content-services/search/components/search-control.component.html b/lib/content-services/search/components/search-control.component.html
index f5db53e433..01333d2da4 100644
--- a/lib/content-services/search/components/search-control.component.html
+++ b/lib/content-services/search/components/search-control.component.html
@@ -1,26 +1,27 @@
-
-
- search
-
-
-
-
+
-
- {{ item?.entry.name }}
-
-
-
- {{item?.entry.createdByUser.displayName}}
+
+ {{ item?.entry.name }}
+
+
+
+
+ {{item?.entry.createdByUser.displayName}}
active',
animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)')),
transition('active => inactive',
animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)'))
])
- ]
+ ],
+ encapsulation: ViewEncapsulation.None,
+ host: { class: 'adf-search-control' }
})
export class SearchControlComponent implements OnInit, OnDestroy {
@@ -77,7 +79,7 @@ export class SearchControlComponent implements OnInit, OnDestroy {
private focusSubject = new Subject();
constructor(public authService: AuthenticationService,
- private thumbnailService: ThumbnailService) {
+ private thumbnailService: ThumbnailService) {
this.toggleSearch.asObservable().debounceTime(100).subscribe(() => {
if (this.expandable) {
@@ -96,8 +98,15 @@ export class SearchControlComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
- this.focusSubject.unsubscribe();
- this.toggleSearch.unsubscribe();
+ if (this.focusSubject) {
+ this.focusSubject.unsubscribe();
+ this.focusSubject = null;
+ }
+
+ if (this.toggleSearch) {
+ this.toggleSearch.unsubscribe();
+ this.toggleSearch = null;
+ }
}
isLoggedIn(): boolean {
@@ -118,55 +127,57 @@ export class SearchControlComponent implements OnInit, OnDestroy {
}
getMimeTypeIcon(node: MinimalNodeEntity): string {
- let mimeType;
+ let mimeType;
- if (node.entry.content && node.entry.content.mimeType) {
- mimeType = node.entry.content.mimeType;
- }
- if (node.entry.isFolder) {
- mimeType = 'folder';
- }
+ if (node.entry.content && node.entry.content.mimeType) {
+ mimeType = node.entry.content.mimeType;
+ }
+ if (node.entry.isFolder) {
+ mimeType = 'folder';
+ }
- return this.thumbnailService.getMimeTypeIcon(mimeType);
- }
+ return this.thumbnailService.getMimeTypeIcon(mimeType);
+ }
- isSearchBarActive() {
- return this.subscriptAnimationState === 'active' && this.liveSearchEnabled;
- }
+ isSearchBarActive() {
+ return this.subscriptAnimationState === 'active' && this.liveSearchEnabled;
+ }
- toggleSearchBar() {
- this.toggleSearch.next();
- }
+ toggleSearchBar() {
+ if (this.toggleSearch) {
+ this.toggleSearch.next();
+ }
+ }
- elementClicked(item: any) {
- if (item.entry) {
- this.optionClicked.next(item);
- this.toggleSearchBar();
- }
- }
+ elementClicked(item: any) {
+ if (item.entry) {
+ this.optionClicked.next(item);
+ this.toggleSearchBar();
+ }
+ }
- onFocus($event): void {
- this.focusSubject.next($event);
- }
+ onFocus($event): void {
+ this.focusSubject.next($event);
+ }
- onBlur($event): void {
- this.focusSubject.next($event);
- }
+ onBlur($event): void {
+ this.focusSubject.next($event);
+ }
- activateToolbar($event) {
- if ( !this.isSearchBarActive() ) {
- this.toggleSearchBar();
- }
- }
+ activateToolbar($event) {
+ if (!this.isSearchBarActive()) {
+ this.toggleSearchBar();
+ }
+ }
- private setupFocusEventHandlers() {
- let focusEvents: Observable = this.focusSubject.asObservable()
- .distinctUntilChanged().debounceTime(50);
- focusEvents.filter(($event: any) => {
- return this.isSearchBarActive() && ($event.type === 'blur' || $event.type === 'focusout');
- }).subscribe(() => {
- this.toggleSearchBar();
- });
- }
+ private setupFocusEventHandlers() {
+ let focusEvents: Observable = this.focusSubject.asObservable()
+ .distinctUntilChanged().debounceTime(50);
+ focusEvents.filter(($event: any) => {
+ return this.isSearchBarActive() && ($event.type === 'blur' || $event.type === 'focusout');
+ }).subscribe(() => {
+ this.toggleSearchBar();
+ });
+ }
}
diff --git a/lib/content-services/search/components/search-trigger.directive.ts b/lib/content-services/search/components/search-trigger.directive.ts
index 0b0fcb22cd..9eb94c13e5 100644
--- a/lib/content-services/search/components/search-trigger.directive.ts
+++ b/lib/content-services/search/components/search-trigger.directive.ts
@@ -79,7 +79,10 @@ export class SearchTriggerDirective implements ControlValueAccessor, OnDestroy {
@Optional() @Inject(DOCUMENT) private document: any) { }
ngOnDestroy() {
- this.escapeEventStream.unsubscribe();
+ if (this.escapeEventStream) {
+ this.escapeEventStream.unsubscribe();
+ this.escapeEventStream = null;
+ }
if ( this.closingActionsSubscription ) {
this.closingActionsSubscription.unsubscribe();
}