/** @packageDocumentation * @module Content */ import { ClassInfo, ClassInfoJSON, CompressedClassInfoJSON, RelatedClassInfo, RelatedClassInfoJSON, RelationshipPath, RelationshipPathJSON } from "../EC"; import { CategoryDescription, CategoryDescriptionJSON } from "./Category"; import { Field, FieldDescriptor, FieldJSON } from "./Fields"; /** * Data structure that describes an ECClass in content [[Descriptor]]. * @public */ export interface SelectClassInfo { /** Information about the ECClass */ selectClassInfo: ClassInfo; /** Is the class handled polymorphically */ isSelectPolymorphic: boolean; /** Relationship path to the [Primary class]($docs/learning/presentation/Content/Terminology#primary-class) */ pathToPrimaryClass: RelationshipPath; /** Relationship paths to [Related property]($docs/learning/presentation/Content/Terminology#related-properties) classes */ relatedPropertyPaths: RelationshipPath[]; /** Relationship paths to navigation property classes */ navigationPropertyClasses: RelatedClassInfo[]; /** Relationship paths to [Related instance]($docs/learning/presentation/Content/Terminology#related-instance) classes */ relatedInstanceClasses: RelatedClassInfo[]; } /** * Serialized [[SelectClassInfo]] JSON representation * @public */ export interface SelectClassInfoJSON { selectClassInfo: TClassInfoJSON; isSelectPolymorphic: boolean; pathToPrimaryClass: RelationshipPathJSON; relatedPropertyPaths: RelationshipPathJSON[]; navigationPropertyClasses: RelatedClassInfoJSON[]; relatedInstanceClasses: RelatedClassInfoJSON[]; } /** @public */ export declare namespace SelectClassInfo { /** Deserialize [[SelectClassInfo]] from JSON */ function fromJSON(json: SelectClassInfoJSON): SelectClassInfo; /** Deserialize [[SelectClassInfo]] from compressed JSON */ function fromCompressedJSON(compressedSelectClass: SelectClassInfoJSON, classesMap: { [id: string]: CompressedClassInfoJSON; }): SelectClassInfoJSON; /** Serialize [[SelectClassInfo]] to compressed JSON */ function toCompressedJSON(selectClass: SelectClassInfo, classesMap: { [id: string]: CompressedClassInfoJSON; }): SelectClassInfoJSON; } /** * Flags that control content format. * @public */ export declare enum ContentFlags { /** Each content record only has [[InstanceKey]] and no data */ KeysOnly = 1, /** Each content record additionally has an image id */ ShowImages = 2, /** Each content record additionally has a display label */ ShowLabels = 4, /** All content records are merged into a single record (see [Merging values]($docs/learning/presentation/content/terminology#value-merging)) */ MergeResults = 8, /** Content has only distinct values */ DistinctValues = 16, /** Doesn't create property or calculated fields. Can be used in conjunction with [[ShowLabels]]. */ NoFields = 32, /** * Set related input keys on [[Item]] objects when creating content. This helps identify which [[Item]] is associated to which * given input key at the cost of performance creating those items. * * @beta */ IncludeInputKeys = 256 } /** * Data sorting direction * @public */ export declare enum SortDirection { Ascending = 0, Descending = 1 } /** * Data structure that contains selection information. Used * for cases when requesting content after a selection change. * * @public */ export interface SelectionInfo { /** Name of selection provider which cause the selection change */ providerName: string; /** Level of selection that changed */ level?: number; } /** * Serialized [[Descriptor]] JSON representation. * @public */ export interface DescriptorJSON { connectionId: string; inputKeysHash: string; contentOptions: any; selectionInfo?: SelectionInfo; displayType: string; selectClasses: SelectClassInfoJSON[]; categories?: CategoryDescriptionJSON[]; fields: FieldJSON[]; sortingFieldName?: string; sortDirection?: SortDirection; contentFlags: number; filterExpression?: string; } /** * Serialized [[Descriptor]] JSON representation. * @public */ export declare type CompressedDescriptorJSON = Omit & { selectClasses: SelectClassInfoJSON[]; classesMap: { [id: string]: CompressedClassInfoJSON; }; fields: FieldJSON[]; }; /** * Descriptor overrides that can be used to customize content * @public */ export interface DescriptorOverrides { /** * Content display type. Can be accessed in presentation rules and used * to modify content in various ways. Defaults to empty string. */ displayType?: string; /** Content flags used for content customization. See [[ContentFlags]] */ contentFlags?: number; /** * Names of fields which should be excluded from content * @deprecated Use [[fieldsSelector]] */ hiddenFieldNames?: string[]; /** * Fields selector that allows excluding or including only specified fields * @public */ fieldsSelector?: { /** Should the specified fields be included or excluded */ type: "include" | "exclude"; /** A list of field descriptors that identify fields to include / exclude */ fields: FieldDescriptor[]; }; /** * Name of the sorting field * @deprecated Use [[sorting]] */ sortingFieldName?: string; /** * Sort direction. Defaults to [[SortDirection.Ascending]] * @deprecated Use [[sorting]] */ sortDirection?: SortDirection; /** * Specification for sorting data * @public */ sorting?: { /** Identifier of the field to use for sorting */ field: FieldDescriptor; /** Sort direction */ direction: SortDirection; }; /** [ECExpression]($docs/learning/presentation/ECExpressions.md) for filtering content */ filterExpression?: string; } /** * Descriptor properties * @public */ export interface DescriptorSource { /** Selection info used to create the descriptor */ readonly selectionInfo?: SelectionInfo; /** Display type used to create the descriptor */ readonly displayType: string; /** A list of classes that will be selected from when creating content with this descriptor */ readonly selectClasses: SelectClassInfo[]; /** A list of content field categories used in this descriptor */ readonly categories?: CategoryDescription[]; /** A list of fields contained in the descriptor */ readonly fields: Field[]; /** [[ContentFlags]] used to create the descriptor */ readonly contentFlags: number; /** Field used to sort the content */ readonly sortingField?: Field; /** Sorting direction */ readonly sortDirection?: SortDirection; /** Content filtering [ECExpression]($docs/learning/presentation/ECExpressions) */ readonly filterExpression?: string; } /** * Data structure that describes content: fields, sorting, filtering, format, etc. * Descriptor may be changed to control how content is created. * * @public */ export declare class Descriptor implements DescriptorSource { /** Id of the connection used to create the descriptor */ readonly connectionId: string; /** Hash of the input keys used to create the descriptor */ readonly inputKeysHash: string; /** Extended options used to create the descriptor */ readonly contentOptions: any; /** Selection info used to create the descriptor */ readonly selectionInfo?: SelectionInfo; /** Display type used to create the descriptor */ readonly displayType: string; /** A list of classes that will be selected when creating content with this descriptor */ readonly selectClasses: SelectClassInfo[]; /** A list of content field categories used in this descriptor */ readonly categories: CategoryDescription[]; /** A list of fields contained in the descriptor */ readonly fields: Field[]; /** [[ContentFlags]] used to create the descriptor */ readonly contentFlags: number; /** Field used to sort the content */ sortingField?: Field; /** Sorting direction */ sortDirection?: SortDirection; /** Content filtering [ECExpression]($docs/learning/presentation/ECExpressions) */ filterExpression?: string; /** Construct a new Descriptor using a `DescriptorSource` */ constructor(source: DescriptorSource); /** Serialize this object to JSON */ toJSON(): DescriptorJSON; /** Serialize [[Descriptor]] to compressed JSON */ toCompressedJSON(): CompressedDescriptorJSON; /** Deserialize [[Descriptor]] from JSON */ static fromJSON(json: DescriptorJSON | CompressedDescriptorJSON | string | undefined): Descriptor | undefined; private static fromJSONWithCategories; private static fromJSONWithoutCategories; private static fromCompressedJSON; private static getFieldsFromJSON; private static getCategoriesFromFields; /** * Reviver function that can be used as a second argument for * `JSON.parse` method when parsing Content objects. * * @internal */ static reviver(key: string, value: any): any; /** * Get field by its name * @param name Name of the field to find * @param recurse Recurse into nested fields */ getFieldByName(name: string, recurse?: boolean): Field | undefined; /** * Create descriptor overrides object from this descriptor. * @public */ createDescriptorOverrides(): DescriptorOverrides; } //# sourceMappingURL=Descriptor.d.ts.map