mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
* Angular 9 compatibility: add explicit types to prevent automatic deep imports If you do not provide an explicit return type to a function then TypeScript will try to guess it and create a dynamic import type for the `.d.ts` files. Often the imports incorrectly point to a path deep within a package, rather than accessing the type via the correct public facing import. From Angular v9, using ivy, such deep imports cause compilation errors and will prevent this library from being used for ivy enabled applications. This commit fixes this problem for a component and a service that the adf-core library exports. * Angular 9 compatibility: import DOCUMENT from `@angular/common` In Angular 7 importing `DOCUMENT` from `platform-browser` was deprecated, and it was removed completely in Angular 8. * fix type afterlast alpha * fix type after last alpha * fix types demo shell
This commit is contained in:
parent
a4424d17fc
commit
210f1d8f59
@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, OnInit, Optional, OnDestroy } from '@angular/core';
|
||||
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||
import { NodePaging, Pagination, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { Pagination, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { UserPreferencesService, SearchService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { Subject } from 'rxjs';
|
||||
@ -33,7 +33,7 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
|
||||
queryParamName = 'q';
|
||||
searchedWord = '';
|
||||
data: NodePaging;
|
||||
data: ResultSetPaging;
|
||||
pagination: Pagination;
|
||||
isLoading = true;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { SearchService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NodePaging } from '@alfresco/js-api';
|
||||
import { ResultSetPaging } from '@alfresco/js-api';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
@ -42,7 +42,7 @@ export class ContentNodeSelectorService {
|
||||
* the rootNodeId is one of the supported aliases (e.g. '-my-', '-root-', '-mysites-', etc.)
|
||||
* and search is not supported for that alias, but can be performed on its corresponding nodes.
|
||||
*/
|
||||
public search(searchTerm: string, rootNodeId: string = null, skipCount: number = 0, maxItems: number = 25, extraNodeIds?: string[]): Observable<NodePaging> {
|
||||
public search(searchTerm: string, rootNodeId: string = null, skipCount: number = 0, maxItems: number = 25, extraNodeIds?: string[]): Observable<ResultSetPaging> {
|
||||
|
||||
let extraParentFiltering = '';
|
||||
|
||||
|
@ -20,7 +20,7 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ComponentFixture } from '@angular/core/testing';
|
||||
import { Component } from '@angular/core';
|
||||
import { DOCUMENT } from '@angular/platform-browser';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||
import { setupTestBed, CoreModule, SharedLinksApiService } from '@alfresco/adf-core';
|
||||
import { ContentNodeShareModule } from './content-node-share.module';
|
||||
|
@ -23,7 +23,7 @@ import { FacetFieldBucket } from '../../facet-field-bucket.interface';
|
||||
import { FacetField } from '../../facet-field.interface';
|
||||
import { SearchFilterList } from './models/search-filter-list.model';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { GenericBucket, GenericFacetResponse, ResultSetContext } from '@alfresco/js-api';
|
||||
import { GenericBucket, GenericFacetResponse, ResultSetContext, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
@ -78,7 +78,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
|
||||
if (this.queryBuilder) {
|
||||
this.queryBuilder.executed
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(resultSetPaging => {
|
||||
.subscribe((resultSetPaging: ResultSetPaging) => {
|
||||
this.onDataLoaded(resultSetPaging);
|
||||
this.searchService.dataLoaded.next(resultSetPaging);
|
||||
});
|
||||
@ -328,7 +328,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
}
|
||||
|
||||
private getCorrespondingFilterQuery (configFacetItem: FacetField, bucketLabel: string): string {
|
||||
private getCorrespondingFilterQuery(configFacetItem: FacetField, bucketLabel: string): string {
|
||||
let filterQuery = null;
|
||||
|
||||
if (configFacetItem.field && bucketLabel) {
|
||||
@ -397,7 +397,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
private getBucketFilterFunction (bucketList) {
|
||||
private getBucketFilterFunction(bucketList) {
|
||||
return (bucket: FacetFieldBucket): boolean => {
|
||||
if (bucket && bucketList.filterText) {
|
||||
const pattern = (bucketList.filterText || '').toLowerCase();
|
||||
|
@ -30,7 +30,7 @@ import {
|
||||
ViewEncapsulation,
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { NodePaging } from '@alfresco/js-api';
|
||||
import { NodePaging, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
|
||||
@ -165,9 +165,9 @@ export class SearchComponent implements AfterContentInit, OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
onSearchDataLoaded(nodePaging: NodePaging) {
|
||||
if (nodePaging) {
|
||||
this.results = nodePaging;
|
||||
onSearchDataLoaded(resultSetPaging: ResultSetPaging) {
|
||||
if (resultSetPaging) {
|
||||
this.results = <NodePaging> resultSetPaging;
|
||||
this.resultLoaded.emit(this.results);
|
||||
this.isOpen = true;
|
||||
this.setVisibility();
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { DOCUMENT } from '@angular/platform-browser';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { LogService } from '../services/log.service';
|
||||
import { NotificationService } from '../notifications/services/notification.service';
|
||||
|
||||
|
@ -35,7 +35,7 @@ import {
|
||||
AppConfigValues
|
||||
} from '../../app-config/app-config.service';
|
||||
import { OauthConfigModel } from '../../models/oauth-config.model';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@ -362,7 +362,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
event.target.value = event.target.value.trim();
|
||||
}
|
||||
|
||||
getBackgroundUrlImageUrl() {
|
||||
getBackgroundUrlImageUrl(): SafeStyle {
|
||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${this.backgroundImageUrl})`);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
import { Injectable, Inject, Renderer2, RendererFactory2 } from '@angular/core';
|
||||
import { Directionality, Direction } from '@angular/cdk/bidi';
|
||||
import { UserPreferencesService } from '../services/user-preferences.service';
|
||||
import { DOCUMENT } from '@angular/platform-browser';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NodePaging, QueryBody } from '@alfresco/js-api';
|
||||
import { NodePaging, QueryBody, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { Observable, Subject, from, throwError } from 'rxjs';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { SearchConfigurationService } from './search-configuration.service';
|
||||
@ -26,7 +26,7 @@ import { SearchConfigurationService } from './search-configuration.service';
|
||||
})
|
||||
export class SearchService {
|
||||
|
||||
dataLoaded: Subject<NodePaging> = new Subject();
|
||||
dataLoaded: Subject<ResultSetPaging> = new Subject();
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private searchConfigurationService: SearchConfigurationService) {
|
||||
@ -55,7 +55,7 @@ export class SearchService {
|
||||
* @param skipCount Number of higher-ranked items to skip over in the list
|
||||
* @returns List of search results
|
||||
*/
|
||||
search(searchTerm: string, maxResults: number, skipCount: number): Observable<NodePaging> {
|
||||
search(searchTerm: string, maxResults: number, skipCount: number): Observable<ResultSetPaging> {
|
||||
const searchQuery = Object.assign(this.searchConfigurationService.generateQueryBody(searchTerm, maxResults, skipCount));
|
||||
const promise = this.apiService.getInstance().search.searchApi.search(searchQuery);
|
||||
|
||||
@ -71,7 +71,7 @@ export class SearchService {
|
||||
* @param queryBody Object containing the search parameters
|
||||
* @returns List of search results
|
||||
*/
|
||||
searchByQueryBody(queryBody: QueryBody): Observable<NodePaging> {
|
||||
searchByQueryBody(queryBody: QueryBody): Observable<ResultSetPaging> {
|
||||
const promise = this.apiService.getInstance().search.searchApi.search(queryBody);
|
||||
|
||||
promise.then((nodePaging: NodePaging) => {
|
||||
|
@ -20,6 +20,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable, from, forkJoin, throwError } from 'rxjs';
|
||||
import { FilterProcessRepresentationModel } from '../models/filter-process.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { ResultListDataRepresentationUserProcessInstanceFilterRepresentation } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -190,7 +191,7 @@ export class ProcessFilterService {
|
||||
* @param appId ID of the target app
|
||||
* @returns List of filter details
|
||||
*/
|
||||
callApiProcessFilters(appId?: number) {
|
||||
callApiProcessFilters(appId?: number): Promise<ResultListDataRepresentationUserProcessInstanceFilterRepresentation> {
|
||||
if (appId) {
|
||||
return this.alfrescoApiService.getInstance().activiti.userFiltersApi.getUserProcessInstanceFilters({ appId: appId });
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user