projects/netgrif-components-core/src/lib/search/models/persistance/generator-metadata.ts
Holds serializable information necessary for recreation of any Category instance in any internal state.
Is used to persist search GUI state.
Properties |
category |
category:
|
Type : Categories | string
|
configuration |
configuration:
|
Type : CategoryMetadataConfiguration
|
values |
values:
|
Type : Array<unknown>
|
import {Categories} from '../category/categories';
/**
* Holds serializable information necessary for recreation of any {@link Category} instance in any internal state.
*
* Is used to persist search GUI state.
*/
export interface CategoryGeneratorMetadata {
category: Categories | string;
configuration: CategoryMetadataConfiguration;
values: Array<unknown>;
}
/**
* The keys are some configuration options that make sense to the {@link Category} instance that generated
* the {@link CategoryGeneratorMetadata} object.
*
* The values are some serializable data, that the Category needs to restore its state.
*/
export interface CategoryMetadataConfiguration {
[k: string]: unknown;
}
/**
* The two nested arrays represent a predicate tree with 3 levels. The root node of the tree is a predicate consisting of a conjunction
* (AND) of its subtrees.
*
* The single array represents a predicate tree with 2 levels. The root node of the tree is a predicate consisting of a disjunction (OR) of
* its subtrees.
*
* The {@link CategoryGeneratorMetadata} represents a predicate tree with 1 level - a leaf node.
*/
export type GeneratorMetadata = PredicateTreeMetadata | Array<CategoryGeneratorMetadata> | CategoryGeneratorMetadata;
/**
* Serialized [advanced search]{@link AbstractAdvancedSearchComponent} filter predicate tree.
*
* The nested array represent nested predicate trees with boolean operators.
* The structure of the tree mirrors the search component.
*
* The top level array is a conjunction (AND) of its subtrees.
*
* The second level array is a disjunction (OR) of the leaves.
*
* The {@link CategoryGeneratorMetadata} is a leaf node of the predicate tree containing a single query
* generated by {@link AbstractSearchPredicateComponent} (and by extension by a {@link Category}).
*/
export type PredicateTreeMetadata = Array<Array<CategoryGeneratorMetadata>>;