mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
update libs (#365)
* update libs * update libs * upgrade to latest search components
This commit is contained in:
committed by
Cilibiu Bogdan
parent
b78f97c79d
commit
2176d1eab7
@@ -14,8 +14,14 @@
|
||||
<adf-search-filter #searchFilter></adf-search-filter>
|
||||
|
||||
<div class="adf-search-results__content">
|
||||
<div class="adf-search-results__sorting">
|
||||
<adf-search-sorting-picker></adf-search-sorting-picker>
|
||||
</div>
|
||||
<adf-document-list
|
||||
#documentList
|
||||
[showHeader]="false"
|
||||
[sortingMode]="'server'"
|
||||
[sorting]="sorting"
|
||||
[attr.class]="documentList.isEmpty() ? 'adf-document-list--empty' : ''"
|
||||
[node]="data">
|
||||
</adf-document-list>
|
||||
|
@@ -17,6 +17,10 @@
|
||||
border-left: 1px solid #eee;
|
||||
}
|
||||
|
||||
&__sorting {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.adf-search-filter {
|
||||
min-width: 260px;
|
||||
padding: 5px;
|
||||
|
@@ -27,6 +27,7 @@ import { Component, OnInit, Optional, ViewChild } from '@angular/core';
|
||||
import { NodePaging, Pagination } from 'alfresco-js-api';
|
||||
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||
import { SearchQueryBuilderService, SearchComponent as AdfSearchComponent } from '@alfresco/adf-content-services';
|
||||
import { SearchConfigurationService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
@@ -43,10 +44,12 @@ export class SearchComponent implements OnInit {
|
||||
data: NodePaging;
|
||||
maxItems = 5;
|
||||
skipCount = 0;
|
||||
sorting = ['name', 'asc'];
|
||||
|
||||
constructor(
|
||||
public router: Router,
|
||||
private queryBuilder: SearchQueryBuilderService,
|
||||
private searchConfiguration: SearchConfigurationService,
|
||||
@Optional() private route: ActivatedRoute) {
|
||||
queryBuilder.paging = {
|
||||
skipCount: 0,
|
||||
@@ -55,11 +58,21 @@ export class SearchComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sorting = this.getSorting();
|
||||
|
||||
this.queryBuilder.updated.subscribe(() => {
|
||||
this.sorting = this.getSorting();
|
||||
});
|
||||
|
||||
if (this.route) {
|
||||
this.route.params.forEach((params: Params) => {
|
||||
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
|
||||
this.queryBuilder.queryFragments['queryName'] = `cm:name:'${this.searchedWord}'`;
|
||||
this.queryBuilder.update();
|
||||
if (this.searchedWord) {
|
||||
const queryBody = this.searchConfiguration.generateQueryBody(this.searchedWord, 0, 100);
|
||||
|
||||
this.queryBuilder.userQuery = queryBody.query.query;
|
||||
this.queryBuilder.update();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -78,4 +91,14 @@ export class SearchComponent implements OnInit {
|
||||
};
|
||||
this.queryBuilder.update();
|
||||
}
|
||||
|
||||
private getSorting(): string[] {
|
||||
const primary = this.queryBuilder.getPrimarySorting();
|
||||
|
||||
if (primary) {
|
||||
return [primary.key, primary.ascending ? 'asc' : 'desc'];
|
||||
}
|
||||
|
||||
return ['name', 'asc'];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user