Utility variable that can be used as value for the [configurationInputs$]{@link Category#configurationInputs$} Observable
.
Emit a new Predicate
if the Category
is in a state that it can be created.
Emits undefined
if the Category
is not in such state.
Stores the FormControl
objects that are pushed into the observable when the number of operands changes.
Contains the FormControl
objects that can be used to input search arguments.
Contains the FormControl
object that is used to drive the operator selection.
The category can subscribe to it if it wishes to react to the selection change by the user.
Contains the operator template parts that make up the operands GUI.
Autocomplete categories usually require a map to represent mapping of display names of their options to objects that are needed to construct their queries.
You are not required to use this map when you implement your own Category, but it comes with helpful functions and might save you some time.
See [options()]{@link AutocompleteCategory#options} and [addToMap()]{@link AutocompleteCategory#addToMap}.
Generates IDs for template parts supplied to ng for.
The CategoryMetadataConfiguration key for this Category's Operator
the set of Operators that can be used with this category. Iteration order determines the display order.
Always returns an array with only the [OPERATOR]{@link SearchInputType#OPERATOR} constant.
No configuration categories are displayed with bold text
the set of Elasticsearch keywords that should be queried by queries generated with this category. The method can be overridden if the keywords are not static and change based on some additional selection (eg. Data fields)
Returns the Predicate currently generated by the Category.
For more information see [generatedPredicate$]{@link Category#generatedPredicate$}.
If you use the Category
class as a sort of PredicateBuilder, then you want to use the
[generatePredicate()]{@link Category#generatePredicate} method instead.
This stream publishes either a new Predicate
object or undefined
based on changes to the FormControls
that are
managed by this class. If (based on user input) the Category
reaches a state when construction of a Predicate
is possible
it will emit this Predicate
. If it reaches a state when the Predicate
can not longer be created undefined
is emitted.
Beware that while most categories always return the same constant it is not a requirement. An example for such behavior is the CaseDataset category, where the argument input type depends on the selected data field type.
the required input type for arguments for this category
an array of FormControl
objects that contains as many controls as is the arity of the selected operator.
Calling this method multiple times will return the same FormControl
instances.
When no operator is selected undefined
is emitted.
A new value is emitted whenever the selected operator changes. undefined
is emitted if no operator is selected.
{@link Operator#getOperatorNameTemplate} in processed form fit for GUI rendering
Options the user can select from for this search Category.
An Observable of the options the user can select from for this search Category.
The Observable is updated when the base set of options changes, not when the available options are filtered, see [filterOptions()]{@link AutocompleteCategory#filterOptions}.
The Observable initially contains an empty array and the options may appear at a later point in time (based on the concrete AutocompleteCategory subclass implementation)
whether the category is fully configured and represents a valid predicate or not
the currently selected operator or undefined
if no operator is selected.
the arity of the selected operator. Throws an error if no operator is selected.
Adds a new entry or pushes value into an existing entry. When a new entry is created, it is created as an Array of one element.
where in the map should the value be added
the value that should be added to the map
Deselects the currently selected operator (if any)
an Array containing text segments representing the configuration inputs of this category
an Array containing text segments representing the content of the predicate generated by this category
Provides the necessary information for the serialisation of this category's state.
Not every state must be preservable. The default library implementation supports only the preservation of the final state when the Category is generating a predicate object.
an object containing all the necessary information for the reconstruction of this category's state,
barring information about allowed nets. Returns undefined
if the category is not in a state that generates a predicate.
See [providesPredicate()]{@link Category#providesPredicate}.
The default implementation serializes only the operator. If the category contains additional configuration, this method must be extended.
an object containing all the necessary information for the reconstruction of the configuration of this category instance
The default implementation returns the value of all operand form control objects up to the current number of operands. To serialize value of each operand the [serializeOperandValue()]{@link Category#serializeOperandValue} method is used.
If the values used by this category are not serializable, then either this method, or the serializeOperandValue
method,
must be overridden.
an array containing values input by the user in a serializable form
filter text segment representing the operand value at the specified index
an Array containing text segments representing the operators with operands of this category
Populates the [_options]{@link AutocompleteCategory#_options} field with options for this category.
You must call this method yourself in an appropriate place of Category creation.
the deserialized value, that can be set as FormControl value
This method throws na error if the serialized value is not one of the autocomplete options.
Cleans up the internal state of the object before its destruction.
The developer must call this method at an appropriate moment, as this object cannot hook into the Angular lifecycle.
Creates a duplicate of the current category object. Note that a duplicate is NOT a clone. The state of the returned category is not necessarily the same as the state of this category.
a category instance of the same type as this category in its initial state.
The function that is used to filter shown options in the autocomplete field.
By default the options that start with the input string are returned (case insensitive).
By default a new value is emitted, whenever either the user input or the base set of options changes.
options that satisfy the autocomplete condition
Calls the [generateQuery]{@link Category#generateQuery} method and creates an ElementaryPredicate with the result.
values entered by the user. The length of the array should match the [arity]{@link Operator#_numberOfOperands} of the selected Operator.
Predicate with Query generated by this object's [generateQuery]{@link Category#generateQuery} method
Calls the [createQuery]{@link Operator#createQuery} method on the selected Operator.
Throws an Error if no Operator is selected.
Override this method if the query should be generated in some other way.
the Query generated by the selected Operator
This method is calle in the constructor. Apart from calling this method, the constructor only creates instances to fill the protected fields of this class.
The default implementation manages creation of operand FormControl
instances and manages subscriptions to them.
You can override this method to change the initialization of your category without having to rewrite the base constructor from scratch.
true
if the newly selected value is a valid value, false
otherwise.
whether an operator is currently selected or not.
Checks for selected operator
the operator to be checked
boolean of the statement
Restored the saved configuration from the metadata created by the [createMetadataConfiguration()]{@link Category#createMetadataConfiguration} method.
The default implementation restores only the saved operator.
If the Category overrides the serialization method, it must override this method as well.
the serialized configuration
an Observable. When the Observable emits the category has finished loading its configuration.
Restores the saved state contained in the provided metadata.
the metadata created by calling the [createMetadata()]{@link Category#createMetadata} method
an Observable. When the Observable emits the category has finished restoring its state.
The default implementation sets the provided values into this Category's operand form controls.
An operator must be set before calling this method! Otherwise an error will be thrown.
If the number of values doesn't match the arity of the selected operator an error will be thrown!
If this Category overrides the [serializeOperandValue()]{@link Category#serializeOperandValue}, it must also override its deserialization counterpart - [deserializeOperandValue()]{@link #Category#deserializeOperandValue}!
the serialized values that should be loaded into this Category instance
an Observable. When the Observable emits the category has finished loading its values.
The method that is (by default) called whenever an operand FormControl
changes its value.
the index of the operand that changed its value
Resets the state of the Category, deselecting any selected category and removing other state information if the Category defines them.
This method can be used to reset the state of the category after each predicate constructed, effectively turning the category instance into a predicate builder.
Selects the default operator that should be used for query generation, when no Operator selection is provided to the user.
The default implementation selects the first operator in the [_allowedOperators]{@link Category#allowedOperators} array.
See [selectOperator()]{@link Category#selectOperator} for more information.
Changes the state of the Category. Category can create queries when an Operator is selected.
This method is useful if you want to use the Category class as predicate builder.
index in the [allowedOperators]{@link Category#allowedOperators} array of the Operator that should be selected
the category class in a serializable form
the value of the operand in a serialized form. The default implementation returns the FormControls value
attribute.
Changes the state of the Category and generates a query if all necessary operands were set.
If you are using the category as a builder. Consider using the [generatePredicate()]{@link Category#generatePredicate} method instead.
values entered by the user. The length of the array should match the [arity]{@link Operator#_numberOfOperands} of the selected Operator.
Performs a transformation of the FormControl
value before passing it into the selected Operator
for query generation.
It is mostly useful only for AutocompleteCategories, where the selected value of the FormControl is an object.
The default AutocompleteCategory implementation returns the SearchAutocompleteOption value
attribute.
the FormControlValue
the value used for query generation
Publishes a new value in the [_options$]{@link AutocompleteCategory#_options$} Subject generated from the [_optionsMap]{@link AutocompleteCategory#_optionsMap}.
The default implementation iterates trough the [_optionsMap]{@link AutocompleteCategory#_optionsMap} and creates options with the keys as [text]{@link SearchAutocompleteOption#text} and values as [value]{@link SearchAutocompleteOption#value}.
Generated using TypeDoc
The constructor fills the values of all protected fields and then calls the [initializeCategory()]{@link Category#initializeCategory} method. If you want to override the category creation behavior override that method.