@netgrif/components-core
Version:
Netgrif Application engine frontend core Angular library
116 lines (115 loc) • 5.71 kB
TypeScript
import { OnDestroy } from '@angular/core';
import { SearchService } from '../search-service/search.service';
import { AbstractHeaderService } from '../../header/abstract-header-service';
import { HeaderType } from '../../header/models/header-type';
import { SearchChangeDescription } from '../../header/models/user-changes/search-change-description';
import { HeaderColumnType } from '../../header/models/header-column';
import { CategoryFactory } from '../category-factory/category-factory';
import { Category } from '../models/category/category';
import { Predicate } from '../models/predicate/predicate';
import { ProcessService } from '../../process/process.service';
import { TranslateService } from '@ngx-translate/core';
import { LoggerService } from '../../logger/services/logger.service';
import { Subscription } from 'rxjs';
import * as i0 from "@angular/core";
/**
* Holds the Id of the predicate in the {@link SearchService}
*/
interface PredicateId {
predicateId: number;
}
/**
* Holds the information necessary for the configuration of a {@link Category} class to generate
* a predicate for a Meta header field
*/
interface MetaGeneratorConfiguration {
type: HeaderColumnType.META;
fieldIdentifier: string;
userInput: Array<any>;
}
/**
* Holds the information necessary for the configuration of a {@link Category} class to generate
* a predicate for a Data header field
*/
interface DataGeneratorConfiguration {
type: HeaderColumnType.IMMEDIATE;
fieldType: string;
fieldTitle: string;
userInput: Array<any>;
}
type HeaderConfiguration = PredicateId & (MetaGeneratorConfiguration | DataGeneratorConfiguration);
/**
* Acts as an intermediary between the {@link AbstractHeaderService} instances of various types and the {@link SearchService}
*/
export declare class HeaderSearchService implements OnDestroy {
protected _categoryFactory: CategoryFactory;
protected _processService: ProcessService;
protected _translate: TranslateService;
protected _logger: LoggerService;
protected _searchService: SearchService;
protected _headerService: AbstractHeaderService;
protected _columnToConfiguration: Map<number, HeaderConfiguration>;
protected _typeToCategory: Map<string, Category<any>>;
protected _headerSub: Subscription;
protected _searchSub: Subscription;
constructor(_categoryFactory: CategoryFactory, _processService: ProcessService, _translate: TranslateService, _logger: LoggerService, _searchService: SearchService);
ngOnDestroy(): void;
set headerService(headerService: AbstractHeaderService);
/**
* {@link HeaderSearchService} can only be initialized if it successfully injected a {@link SearchService}
* and a {@link AbstractHeaderService} instance of any of the supported types was set into it.
*
* Currently only task and case header searching is supported.
*/
protected initializeHeaderSearch(): void;
/**
* Pushes all the predicates from the headers into the search interface and clears the header inputs
*/
protected processModeChange(): void;
/**
* Transforms the {@link HeaderChange} object into a search predicate
*/
protected processSearchChange(headerType: HeaderType, changeDescription: SearchChangeDescription): void;
/**
* Processes the change object and resolves it into the appropriate case search predicate change
* @param changeDescription the change object that should be resolved
*/
protected processCaseSearch(changeDescription: SearchChangeDescription): void;
/**
* Processes the change object of a case meta header and resolves it into the appropriate case search predicate change
* @param changeDescription the change object that should be resolved
*/
protected processCaseMetaSearch(changeDescription: SearchChangeDescription): void;
/**
* Processes the change object of a case immediate data header and resolves it into the appropriate case search predicate change
* @param changeDescription the change object that should be resolved
*/
protected processCaseDataSearch(changeDescription: SearchChangeDescription): void;
/**
* @param changeDescription information about the search header change
* @returns whether the input was cleared
*/
protected emptyInput(changeDescription: SearchChangeDescription): boolean;
/**
* Updates a Predicate for a given column.
* Removes an existing predicate for this column if it exists and adds the new Predicate.
* @param column the index of the header column
* @param predicate the Predicate that should be added
* @param configuration data necessary for the configuration of the {@link Category} that generates the added predicate
*/
protected addPredicate(column: number, predicate: Predicate, configuration: MetaGeneratorConfiguration | DataGeneratorConfiguration): void;
/**
* Removes a predicate that corresponds to the provided column
* @param column the index of the column that cleared it's search
* @param clearInput whether the corresponding header search input should be cleared
*/
protected removePredicate(column: number, clearInput?: boolean): void;
/**
* @param removedId the id of the removed {@link Predicate}
* @param clearInput whether the corresponding header search input should be cleared
*/
protected handlePredicateRemoval(removedId: number, clearInput?: boolean): void;
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderSearchService, [null, null, null, null, { optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<HeaderSearchService>;
}
export {};