@netgrif/components-core
Version:
Netgrif Application engine frontend core Angular library
57 lines (56 loc) • 2.54 kB
TypeScript
import { Predicate } from './predicate';
import { Query } from '../query/query';
import { BooleanOperator } from '../boolean-operator';
/**
* Represents a clause of {@link Predicate}s combined with a {@link BooleanOperator}.
*/
export declare class ClausePredicate extends Predicate {
protected _operator: BooleanOperator;
protected _bracketSubPredicateText: boolean;
/**
* Stores the {@link Predicate}s that this Predicate combines.
*/
protected _predicates: Array<Predicate>;
/**
* Stores the resulting query of this Predicate.
*/
protected _query: Query;
/**
* @param predicates Predicates that should be combined into one
* @param _operator Operator that is used to combine the predicates
* @param initiallyVisible whether the predicate should be initially displayed or not
* @param _bracketSubPredicateText whether the individual sub predicates are wrapped in brackets when a textual representation
* is generated
*/
constructor(predicates: Array<Predicate>, _operator: BooleanOperator, initiallyVisible?: boolean, _bracketSubPredicateText?: boolean);
get query(): Query;
/**
* Adds another {@link Predicate} to the clause and updates this {@link Predicate}'s {@link Query}.
* @param newPredicate - the Predicate that should be added to the clause
* @returns the index of the added Predicate, that can be used to remove it.
* Note that removing predicates with a lower index shifts the order of indices.
*/
addPredicate(newPredicate: Predicate): number;
/**
* Removes the {@link Predicate} at the given `index` from this clause and updates this {@link Predicate}'s {@link Query}.
* If the `index` is invalid does nothing.
* @param index index of the {@link Predicate} in this clause that should be removed
* @returns whether a predicate was removed, or not
*/
removePredicate(index: number): boolean;
/**
* Sets this predicate and all its sub-predicates to visible.
*/
showAll(): void;
/**
* Updates the value of the [_query]{@link ClausePredicate#_query} attribute.
*
* See [combineQueries()]{@link Query#combineQueries} for more information.
*/
protected updateQuery(): void;
/**
* @returns the `Array` of {@link Query} objects stored within this object's [_predicates]{@link ClausePredicate#_predicates} attribute.
*/
protected get queries(): Array<Query>;
private initializeFilterTextSegmentsGenerator;
}