@netgrif/components-core
Version:
Netgrif Application engine frontend core Angular library
68 lines (67 loc) • 4.1 kB
TypeScript
import { OnDestroy, OnInit, Type } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { Category } from '../models/category/category';
import { SearchAutocompleteOption } from '../models/category/search-autocomplete-option';
import { ElementaryPredicate } from '../models/predicate/elementary-predicate';
import { LoggerService } from '../../logger/services/logger.service';
import { MatSelect } from '@angular/material/select';
import { EditableElementaryPredicate } from '../models/predicate/editable-elementary-predicate';
import { AdvancedSearchComponentInitializationService } from '../advanced-search-component-initialization-service/advanced-search-component-initialization.service';
import { CategoryFactory } from '../category-factory/category-factory';
import * as i0 from "@angular/core";
/**
* Is responsible for the interactive creation of a single {@link ElementaryPredicate} object instance.
*/
export declare abstract class AbstractSearchPredicateComponent implements OnInit, OnDestroy {
private _naeSearchCategories;
protected _logger: LoggerService;
protected _initializationService: AdvancedSearchComponentInitializationService;
protected _categoryFactory: CategoryFactory;
/**
* Whether the contents displayed in this component can be edited by the user or not.
*
* Defaults to `true`
*/
editable: boolean;
predicate: EditableElementaryPredicate;
predicateId: number;
remove$: Subject<number>;
/**
* Optional generator with prefilled values. Can be used to add prefilled predicate components to the search GUI.
*/
generator: Category<any> | undefined;
protected _selectedCategory: Category<any>;
protected _predicateChange: Subscription;
protected _searchCategories: Array<Category<any>>;
protected constructor(_naeSearchCategories: Array<Type<Category<any>>>, _logger: LoggerService, _initializationService: AdvancedSearchComponentInitializationService, _categoryFactory: CategoryFactory);
ngOnInit(): void;
ngOnDestroy(): void;
get searchCategories(): Array<Category<any>>;
set categoryInput(input: MatSelect);
get selectedCategory(): Category<any>;
set selectedCategory(newCategory: Category<any>);
/**
* Lambda that is used to preserve `this` reference in HTML binding.
*
* See [_renderSelection()]{@link AbstractSearchPredicateComponent#_renderSelection} for information about the transform function.
* @param option the {@link SearchAutocompleteOption} object that was selected in the autocomplete list.
*/
renderSelection: (option: SearchAutocompleteOption<unknown>) => string;
remove(): void;
categoryChanged(newCategory: Category<any>): void;
clearCategorySelection(): void;
/**
* Transforms a {@link SearchAutocompleteOption} object into it's name.
* Used for displaying user selection in the input field, when an autocomplete option is selected.
* @param option the object we want to transform. It might not exist if user input doesn't match any autocomplete option
* @returns option name if it exists, empty string otherwise
*/
protected _renderSelection(option: SearchAutocompleteOption<unknown>): string;
/**
* Notifies the `EditableElementaryPredicate` about changes to the predicate generated by the selected `Category`.
* @param newPredicate predicate generated by the selected `Category`
*/
protected processPredicateChange(newPredicate: ElementaryPredicate | undefined): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AbstractSearchPredicateComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AbstractSearchPredicateComponent, "ncc-abstract-search-predicate", never, { "editable": { "alias": "editable"; "required": false; }; "predicate": { "alias": "predicate"; "required": false; }; "predicateId": { "alias": "predicateId"; "required": false; }; "remove$": { "alias": "remove$"; "required": false; }; "generator": { "alias": "generator"; "required": false; }; }, {}, never, never, false, never>;
}