File

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

Description

Base class for editable predicates that allows them to notify their parent predicate tree nodes about updates to their queries.

Extends

Predicate

Index

Properties
Methods
Accessors

Constructor

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

Properties

Protected _parentNotifier
Type : Subject<void>
Protected _filterTextSegmentsGenerator
Type : function
Inherited from Predicate
Defined in Predicate:14
Protected _visible
Type : boolean
Inherited from Predicate
Defined in Predicate:13

Methods

Public destroy
destroy()
Returns : void
Protected notifyParentPredicate
notifyParentPredicate()

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:46

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:93

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 setFilterTextSegmentsGenerator
setFilterTextSegmentsGenerator(filterTextSegmentsGenerator: () => void)
Inherited from Predicate
Defined in Predicate:85
Parameters :
Name Type Optional
filterTextSegmentsGenerator function No
Returns : void
Public show
show()
Inherited from Predicate
Defined in Predicate:81

Sets the predicates state to visible

Returns : void

Accessors

parentNotifier
setparentNotifier(parentNotifier: Subject)
Parameters :
Name Type Optional
parentNotifier Subject<void> No
Returns : void
import {Predicate} from './predicate';
import {Subject} from 'rxjs';

/**
 * Base class for editable predicates that allows them to notify their parent predicate tree nodes about updates to their queries.
 */
export abstract class EditablePredicate extends Predicate {

    protected _parentNotifier: Subject<void>;

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

    /**
     * Notify the parent `Predicate` that this `Predicate` updated its `Query`
     */
    protected notifyParentPredicate(): void {
        if (this._parentNotifier && !this._parentNotifier.isStopped) {
            this._parentNotifier.next();
        }
    }

    public set parentNotifier(parentNotifier: Subject<void>) {
        this._parentNotifier = parentNotifier;
    }

    public destroy() {
        this._parentNotifier.complete();
    }
}

results matching ""

    No results matching ""