File

projects/netgrif-components-core/src/lib/search/models/predicate/editable-elementary-predicate.ts

Description

A simple, editable type of Predicate. Represents a leaf node in the predicate tree, that can change the Query it holds and can notify the parent tree node about changes.

Extends

EditablePredicate

Index

Properties
Methods
Accessors

Constructor

constructor(parentNotifier?: Subject, initiallyVisible)
Parameters :
Name Type Optional
parentNotifier Subject<void> Yes
initiallyVisible No

Properties

Protected _query
Type : Query
Protected _parentNotifier
Type : Subject<void>
Inherited from EditablePredicate
Protected _filterTextSegmentsGenerator
Type : function
Inherited from Predicate
Defined in Predicate:16
Protected _metadataGenerator
Type : function
Inherited from Predicate
Defined in Predicate:15
Protected _visible
Type : boolean
Inherited from Predicate
Defined in Predicate:14

Methods

Public destroy
destroy()
Inherited from EditablePredicate
Returns : void
Protected notifyParentPredicate
notifyParentPredicate()
Inherited from EditablePredicate

Notify the parent Predicate that this Predicate updated its Query

Returns : void
Static combineTextSegmentsWithBooleanOperator
combineTextSegmentsWithBooleanOperator(predicates: IterableIterator<Predicate> | Array<Predicate>, operator: BooleanOperator, wrapWithBrackets)
Inherited from Predicate
Defined in Predicate:51

Combines the text segments of the predicates with the given operator and wraps the individual predicates in brackets optionaly (if only one predicate is provided it is never wrapped)

Parameters :
Name Type Optional Default value Description
predicates IterableIterator<Predicate> | Array<Predicate> No

sources of text segments that are to be combined with a boolean operator

operator BooleanOperator No

boolean operator used to combine the individual predicate text segments

wrapWithBrackets No false

whether the individual predicate text segments should be wrapped in braces or not (if only one predicate is provided it is never wrapped)

Public createFilterTextSegments
createFilterTextSegments()
Inherited from Predicate
Defined in Predicate:110

The default implementation returns an empty array.

an Array containing text segments representing the content of this predicate. The default implementation returns an empty array.

Public createGeneratorMetadata
createGeneratorMetadata()
Inherited from Predicate
Defined in Predicate:98

Returns undefined if the predicate tree rooted at this node is incomplete and would evaluate into an empty filter.

an object containing the necessary information for the reconstruction of the entire predicate tree in serializable form. Returns undefined if the predicate tree rooted at this node is incomplete and would evaluate into an empty filter.

Public setFilterTextSegmentsGenerator
setFilterTextSegmentsGenerator(filterTextSegmentsGenerator: () => void)
Inherited from Predicate
Defined in Predicate:102
Parameters :
Name Type Optional
filterTextSegmentsGenerator function No
Returns : void
Public setMetadataGenerator
setMetadataGenerator(metadataGenerator: () => void)
Inherited from Predicate
Defined in Predicate:90
Parameters :
Name Type Optional
metadataGenerator function No
Returns : void
Public show
show()
Inherited from Predicate
Defined in Predicate:86

Sets the predicates state to visible

Returns : void

Accessors

query
getquery()
setquery(query: Query)
Parameters :
Name Type Optional
query Query No
Returns : void
import {Subject} from 'rxjs';
import {Query} from '../query/query';
import {EditablePredicate} from './editable-predicate';

/**
 * A simple, editable type of `Predicate`. Represents a leaf node in the predicate tree, that can change the `Query` it holds
 * and can notify the parent tree node about changes.
 */
export class EditableElementaryPredicate extends EditablePredicate {

    protected _query: Query;

    constructor(parentNotifier?: Subject<void>, initiallyVisible = true) {
        super(parentNotifier, initiallyVisible);
        this._query = Query.emptyQuery();
    }

    get query(): Query {
        return this._query;
    }

    set query(query: Query) {
        this._query = query;
        this.notifyParentPredicate();
    }
}

result-matching ""

    No results matching ""