import { CategoryDescription , ClassInfo , Descriptor , DescriptorSource , DisplayValuesMap , EditorDescription , Field , InstanceKey , Item , LabelDefinition , NestedContentField , PropertiesField , Property , PropertyValueFormat , RelationshipPath , RendererDescription , SelectClassInfo , StructTypeDescription , TypeDescription , ValuesMap , } from "../../presentation-common" ; import { RelationshipMeaning } from "../../presentation-common/rules/content/modifiers/RelatedPropertiesSpecification" ; import { createTestECClassInfo , createTestECInstanceKey , createTestRelationshipPath } from "./EC" ; internal export const createTestCategoryDescription = ( props ? ) => ( { name : "test-category" , label : "Test Category" , description : "Test category description" , priority : 0 , expand : false , ... props } ) ; internal export const createTestSelectClassInfo = ( props ? ) => ( { selectClassInfo : createTestECClassInfo ( ) , isSelectPolymorphic : false , ... props } ) ; internal export function createTestSimpleContentField ( props ? ) { return new Field ( props ?. category ?? createTestCategoryDescription ( ) , props ?. name ?? "SimpleField" , props ?. label ?? "Simple Field" , props ?. type ?? { valueFormat : PropertyValueFormat . Primitive , typeName : "string" } , props ?. isReadonly ?? false , props ?. priority ?? 0 , props ?. editor , props ?. renderer ) ; } internal export function createTestPropertiesContentField ( props ) { return new PropertiesField ( props . category ?? createTestCategoryDescription ( ) , props . name ?? "PropertiesField" , props . label ?? "Properties Field" , props . type ?? { valueFormat : PropertyValueFormat . Primitive , typeName : "string" } , props . isReadonly ?? false , props . priority ?? 0 , props . properties , props . editor , props . renderer ) ; } internal export function createTestNestedContentField ( props ) { const nestedContentFieldType = { valueFormat : PropertyValueFormat . Struct , typeName : "NestedContentFieldType" , members : props . nestedFields . map ( ( f ) => ( { name : f . name , label : f . label , type : f . type } ) ) } ; const field = new NestedContentField ( props . category ?? createTestCategoryDescription ( ) , props . name ?? "NestedContentField" , props . label ?? "Nested Content" , nestedContentFieldType , props . isReadonly ?? false , props . priority ?? 0 , props . contentClassInfo ?? createTestECClassInfo ( ) , props . pathToPrimaryClass ?? createTestRelationshipPath ( 1 ) , props . nestedFields , props . editor , ! ! props . autoExpand , props . renderer ) ; if ( props . relationshipMeaning ) field . relationshipMeaning = props . relationshipMeaning ; field . rebuildParentship ( ) ; return field ; } internal export function createTestContentDescriptor ( props ) { return new Descriptor ( { connectionId : "" , displayType : "" , contentFlags : 0 , selectClasses : [ createTestSelectClassInfo ( ) ] , categories : [ createTestCategoryDescription ( ) ] , ... props } ) ; } internal export function createTestContentItem ( props ) { return new Item ( props . primaryKeys ?? [ createTestECInstanceKey ( ) ] , props . label ?? "" , props . imageId ?? "" , props . classInfo , props . values , props . displayValues , props . mergedFieldNames ?? [ ] , props . extendedData ) ; }