@itwin/presentation-common
Version:
Common pieces for iModel.js presentation packages
94 lines • 3.68 kB
TypeScript
/** @packageDocumentation
* @module Content
*/
import { ClassInfo, InstanceKey } from "../EC.js";
import { LabelDefinition } from "../LabelDefinition.js";
import { ValuesDictionary } from "../Utils.js";
import { DisplayValue, Value } from "./Value.js";
/**
* Serialized [[Item]] JSON representation.
* @public
*/
export interface ItemJSON {
inputKeys?: InstanceKey[];
primaryKeys: InstanceKey[];
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [[label]] instead. */
labelDefinition: LabelDefinition;
label?: LabelDefinition;
classInfo?: ClassInfo;
values: ValuesDictionary<Value>;
displayValues: ValuesDictionary<DisplayValue>;
mergedFieldNames: string[];
extendedData?: {
[key: string]: any;
};
}
/**
* Props for creating [[Item]].
* @public
*/
interface ItemProps {
inputKeys?: InstanceKey[];
primaryKeys: InstanceKey[];
label: LabelDefinition;
classInfo?: ClassInfo;
values: ValuesDictionary<Value>;
displayValues: ValuesDictionary<DisplayValue>;
mergedFieldNames: string[];
extendedData?: {
[key: string]: any;
};
}
/**
* A data structure that represents a single content record.
* @public
*/
export declare class Item {
/**
* Keys of input instances that caused this item to be included in content. Only set if the content is
* created with [[ContentFlags.IncludeInputKeys]] flag.
*/
inputKeys?: InstanceKey[];
/** Keys of instances whose data is contained in this item */
primaryKeys: InstanceKey[];
/** Display label of the item */
label: LabelDefinition;
/** For cases when item consists only of same class instances, information about the ECClass */
classInfo?: ClassInfo;
/** Raw values dictionary */
values: ValuesDictionary<Value>;
/** Display values dictionary */
displayValues: ValuesDictionary<DisplayValue>;
/** List of field names whose values are merged (see [Merging values]($docs/presentation/content/Terminology#value-merging)) */
mergedFieldNames: string[];
/** Extended data injected into this content item */
extendedData?: {
[key: string]: any;
};
/**
* Creates an instance of Item.
* @param primaryKeys Keys of instances whose data is contained in this item
* @param label Display label of the item
* @param imageId ID of the image associated with this item
* @param classInfo For cases when item consists only of same class instances, information about the ECClass
* @param values Raw values dictionary
* @param displayValues Display values dictionary
* @param mergedFieldNames List of field names whose values are merged (see [Merging values]($docs/presentation/content/Terminology#value-merging))
* @param extendedData Extended data injected into this content item
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use an overload with `ItemProps` instead.
*/
constructor(primaryKeys: InstanceKey[], label: string | LabelDefinition, imageId: string, classInfo: ClassInfo | undefined, values: ValuesDictionary<Value>, displayValues: ValuesDictionary<DisplayValue>, mergedFieldNames: string[], extendedData?: {
[key: string]: any;
});
constructor(props: ItemProps);
/**
* Is value of field with the specified name merged in this record.
*/
isFieldMerged(fieldName: string): boolean;
/** Serialize this object to JSON */
toJSON(): ItemJSON;
/** Deserialize [[Item]] from JSON */
static fromJSON(json: ItemJSON | string | undefined): Item | undefined;
}
export {};
//# sourceMappingURL=Item.d.ts.map