Files and search component fix with routing support (#2191)

This commit is contained in:
Popovics András
2017-08-09 18:32:23 +01:00
committed by Mario Romano
parent 5ad4fe171a
commit e6ae21a0bc
7 changed files with 42 additions and 12 deletions

View File

@@ -88,20 +88,22 @@ results page will be shown.
### Properties
| Name | Type | Optional | Default | Description |
| --- | --- | --- | --- | --- |
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| searchTerm | string | | Search term to use when executing the search. Updating this value will run a new search and update the results |
| rootNodeId | string | "-root-" | NodeRef or node name where the search should start. |
| resultType | string | | Node type to filter search results by, e.g. 'cm:content', 'cm:folder' if you want only the files. |
| maxResults | number | 20 | Maximum number of results to show in the search. |
| maxResults | number | 20 | Maximum number of results to show in the search. |
| resultSort | string | | Criteria to sort search results by, must be one of "name" , "modifiedAt" or "createdAt" |
| navigationMode | string | "dblclick" | Event used to initiate a navigation action to a specific result, one of "click" or "dblclick" |
| navigationMode | string | "dblclick" | Event used to initiate a navigation action to a specific result, one of "click" or "dblclick" |
| navigate | boolean | true | Allow documentlist to navigate or not. For more information see documentlist component's documentation |
### Events
| Name | Description |
| --- | --- |
| preview | Emitted when user acts upon files with either single or double click (depends on `navigation-mode`), recommended for Viewer components integration |
| nodeDbClick | Emitted when user acts upon files or folders with double click **only when `navigation-mode` is set to false**, giving more freedom then just simply previewing the file |
| resultsLoad | Emitted when search results have fully loaded |
## Build from sources

View File

@@ -8,7 +8,9 @@
[creationMenuActions]="false"
[contentActions]="true"
[navigationMode]="navigationMode"
[navigate]="navigate"
[enablePagination]="false"
(nodeDblClick)="onDoubleClick($event)"
(preview)="onPreviewFile($event)">
<empty-folder-content>
<ng-template>

View File

@@ -49,6 +49,9 @@ export class SearchComponent implements OnChanges, OnInit {
@Input()
navigationMode: string = SearchComponent.DOUBLE_CLICK_NAVIGATION; // click|dblclick
@Input()
navigate: boolean = true;
@Input()
emptyFolderImageUrl: string = require('../assets/images/empty_doc_lib.svg');
@@ -58,6 +61,9 @@ export class SearchComponent implements OnChanges, OnInit {
@Output()
preview: EventEmitter<any> = new EventEmitter<any>();
@Output()
nodeDbClick: EventEmitter<any> = new EventEmitter<any>();
pagination: Pagination;
errorMessage;
queryParamName = 'q';
@@ -93,11 +99,15 @@ export class SearchComponent implements OnChanges, OnInit {
}
}
onDoubleClick($event: any) {
if (!this.navigate && $event.value) {
this.nodeDbClick.emit({ value: $event.value });
}
}
onPreviewFile(event: any) {
if (event.value) {
this.preview.emit({
value: event.value
});
this.preview.emit({ value: event.value });
}
}