@itwin/presentation-components
Version:
React components based on iTwin.js Presentation library
63 lines • 2.47 kB
TypeScript
/** @packageDocumentation
* @module FavoriteProperties
*/
import { PropertyData } from "@itwin/components-react";
import { Id64Arg } from "@itwin/core-bentley";
import { IModelConnection } from "@itwin/core-frontend";
import { KeySet, Ruleset } from "@itwin/presentation-common";
import { computeSelection } from "@itwin/unified-selection";
/**
* An data provider interface for returning favorite properties for the given elements
* @public
*/
export interface IFavoritePropertiesDataProvider {
/** Returns property data for an element. */
getData: (imodel: IModelConnection, elementIds: Id64Arg | KeySet) => Promise<PropertyData>;
}
/**
* Props for [[FavoritePropertiesDataProvider]]
* @public
*/
export interface FavoritePropertiesDataProviderProps {
/**
* Id of the ruleset to use when requesting properties or a ruleset itself. If not
* set, default presentation rules are used which return content for the selected elements.
*/
ruleset?: Ruleset | string;
/**
* Active selection scope provider.
* Takes active scope from `Presentation.selection.scopes.activeScope` if not provided.
*/
activeScopeProvider?: () => Parameters<typeof computeSelection>[0]["scope"];
}
/**
* Presentation Rules-driven element favorite properties data provider implementation.
* @public
*/
export declare class FavoritePropertiesDataProvider implements IFavoritePropertiesDataProvider {
private _customRuleset?;
private _getActiveScope;
/**
* Should fields with no values be included in the property list. No value means:
* - For *primitive* fields: `null`, `undefined`, `""` (empty string)
* - For *array* fields: `[]` (empty array)
* - For *struct* fields: `{}` (object with no members)
*/
includeFieldsWithNoValues: boolean;
/**
* Should fields with composite values be included in the property list.
* Fields with composite values:
* - *array* fields.
* - *struct* fields.
*/
includeFieldsWithCompositeValues: boolean;
/** Constructor. */
constructor(props?: FavoritePropertiesDataProviderProps);
/**
* Returns PropertyData for the specified elements.
* PropertyData only contains a single category for favorite properties (if there are any).
*/
getData(imodel: IModelConnection, elementIds: Id64Arg | KeySet): Promise<PropertyData>;
private createPropertyDataProvider;
}
//# sourceMappingURL=DataProvider.d.ts.map