packageDocumentation module import { PropertyRecord , PropertyValueFormat } from "@itwin/appui-abstract" ; import { PropertyCategory } from "../../PropertyDataProvider" ; import { MutableCategorizedArrayProperty } from "./MutableCategorizedArrayProperty" ; import { MutableCategorizedPrimitiveProperty } from "./MutableCategorizedPrimitiveProperty" ; import { MutableCategorizedStructProperty } from "./MutableCategorizedStructProperty" ; import { MutableCustomGridCategory } from "./MutableCustomGridCategory" ; import { IMutableCategorizedPropertyItem , IMutableGridCategoryItem } from "./MutableFlatGridItem" ; import { CategoryRecordsDict , MutableGridCategory } from "./MutableGridCategory" ; beta export interface IMutableGridItemFactory { createCategorizedProperty : ( record : PropertyRecord , parentSelectionKey : string , parentCategorySelectionKey : string , depth : number , overrideName ? : string , overrideDisplayLabel ? : string ) => IMutableCategorizedPropertyItem ; createGridCategory : ( category : PropertyCategory , recordsDict : CategoryRecordsDict , parentSelectionKey ? : string , depth ? : number ) => IMutableGridCategoryItem ; } beta export class MutableGridItemFactory implements IMutableGridItemFactory { protected createPrimitiveProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName ? , overrideDisplayLabel ? ) { return new MutableCategorizedPrimitiveProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName , overrideDisplayLabel ) ; } protected createArrayProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName ? , overrideDisplayLabel ? ) { return new MutableCategorizedArrayProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , this , overrideName , overrideDisplayLabel ) ; } protected createStructProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName ? , overrideDisplayLabel ? ) { return new MutableCategorizedStructProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , this , overrideName , overrideDisplayLabel ) ; } param record param parentSelectionKey param parentCategorySelectionKey param depth param overrideName param overrideDisplayLabel returns public createCategorizedProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName ? , overrideDisplayLabel ? ) { const valueFormat = record . value . valueFormat ; switch ( valueFormat ) { case PropertyValueFormat . Primitive : return this . createPrimitiveProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName , overrideDisplayLabel ) ; case PropertyValueFormat . Array : return this . createArrayProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName , overrideDisplayLabel ) ; case PropertyValueFormat . Struct : return this . createStructProperty ( record , parentSelectionKey , parentCategorySelectionKey , depth , overrideName , overrideDisplayLabel ) ; default : const unhandledRecordType = valueFormat ; throw new Error ( `Unhandled property record type. Was a new type added? ${ unhandledRecordType }` ) ; } } param category param recordsDict param parentSelectionKey param depth returns public createGridCategory ( category , recordsDict , parentSelectionKey ? , depth ? ) { if ( category . renderer !== undefined ) return new MutableCustomGridCategory ( category , recordsDict , this , parentSelectionKey , depth ?? 0 ) ; if ( parentSelectionKey !== undefined && depth !== undefined ) return new MutableGridCategory ( category , recordsDict , this , parentSelectionKey , depth ) ; return new MutableGridCategory ( category , recordsDict , this ) ; } }