Maps type names to field component types for the Card View component.
string
, defaultValue: Type<any>
= this.defaultValue
): DynamicComponentResolveFunction
string
- The type whose resolver you wantType<any>
- Default type returned for types that are not yet mappedDynamicComponentResolveFunction
- Resolver functionFunction
, override: boolean
= false
)Function
- boolean
- DynamicComponentModel
, defaultValue: Type<any>
= this.defaultValue
): Type<any>
DynamicComponentModel
- Form field model for the field to renderType<any>
- Default type returned for field types that are not yet mapped.Type<any>
- Component typestring
, resolver: DynamicComponentResolveFunction
, override: boolean
= true
)string
- The type whose resolver you want to setDynamicComponentResolveFunction
- The new resolver functionboolean
- The new resolver will only replace an existing one if this parameter is trueThe Card View component uses this service to find the component
type that is required to display a particular field type (text, date, etc). The service
maps a type name string to a corresponding DynamicComponentResolveFunction
that takes a
model object as a parameter and returns the component type needed to display that model.
The default mapping is shown below:
Type string | Component |
---|---|
'text' | CardViewTextItemComponent |
'int' | CardViewTextItemComponent |
'float' | CardViewTextItemComponent |
'date' | CardViewDateItemComponent |
'datetime' | CardViewDateItemComponent |
'bool' | CardViewBoolItemComponent |
'map' | CardViewMapItemComponent |
You can define your own custom field types for the Card View (see the Card View Item interface page for full details of how to do this). When you have defined the field component, you need to register it with the Card Item Types service so that the Card View component can make use of it:
@Component({
...
providers: [ CardItemTypeService ] /* If you don't want to pollute the main instance of the CardItemTypeService service */
...
})
class SomeParentComponent {
constructor(private cardItemTypeService: CardItemTypeService) {
cardItemTypeService.setComponentTypeResolver('star-date', () => CardViewStarDateItemComponent);
}
}
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.