packageDocumentation module import * as React from "react" ; import { VirtualizedPropertyGridContext } from "./component/VirtualizedPropertyGrid" ; import { GridCategoryItem } from "./internal/flat-items/FlatGridItem" ; beta export interface PropertyCategoryRendererProps { /** The category being rendered. */ categoryItem : GridCategoryItem ; /** Context of the surrounding property grid. */ gridContext : VirtualizedPropertyGridContext ; /** Sets the allocated height for category contents. */ onHeightChanged : ( newHeight : number ) => void ; } beta export type PropertyCategoryRenderer = ( categoryItem : GridCategoryItem ) => React . ComponentType < PropertyCategoryRendererProps > | undefined ; beta export class PropertyCategoryRendererManager { private _categoryRenderers = new Map < string , PropertyCategoryRenderer > ( ) ; public static defaultManager = new PropertyCategoryRendererManager ( ) ; /** Retrieves a category rendering component based for the passed category item. */ public getCategoryComponent ( categoryItem ) { if ( categoryItem . derivedCategory . renderer === undefined ) { return undefined ; } return this . _categoryRenderers . get ( categoryItem . derivedCategory . renderer . name ) ?. ( categoryItem ) ; } /** Registers a renderer factory function to be invoked on categories with specific renderer name. */ public addRenderer ( rendererName , categoryRenderer , override = false ) { if ( this . _categoryRenderers . has ( rendererName ) && ! override ) { const className = PropertyCategoryRendererManager . name ; const methodName = PropertyCategoryRendererManager . prototype . addRenderer . name ; throw new Error ( `${ className }.${ methodName } error: renderer '${ rendererName }' has already been added. Did you mean to override it?` ) ; } this . _categoryRenderers . set ( rendererName , categoryRenderer ) ; } /** Removes previous renderer factory registration. */ public removeRenderer ( rendererName ) { this . _categoryRenderers . delete ( rendererName ) ; } }