Skip to content

GridTypeRegistry

Injectable service for managing type-level defaults.

Use provideGridTypeDefaults() in your app config to set up defaults, or inject this service for dynamic registration.

// App-level setup (app.config.ts)
export const appConfig: ApplicationConfig = {
providers: [
provideGridTypeDefaults({
country: {
renderer: CountryCellComponent,
editor: CountryEditorComponent
},
status: {
renderer: StatusBadgeComponent
}
})
]
};
// Dynamic registration
@Component({ ... })
export class AppComponent {
private registry = inject(GridTypeRegistry);
ngOnInit() {
this.registry.register('currency', {
renderer: CurrencyCellComponent
});
}
}

Register type-level defaults for a custom type.

register(type: string, defaults: TypeDefaultRegistration<T>): void
NameTypeDescription
typestringThe type name (e.g., ‘country’, ‘currency’)
defaultsTypeDefaultRegistration<T>Renderer/editor configuration

Get type defaults for a given type.

get(type: string): TypeDefaultRegistration<unknown> | undefined
NameTypeDescription
typestring

Remove type defaults for a type.

unregister(type: string): void
NameTypeDescription
typestring

Check if a type has registered defaults.

has(type: string): boolean
NameTypeDescription
typestring

Get all registered type names.

getRegisteredTypes(): string[]

Convert to TypeDefault for use with grid’s typeDefaults. This is used internally by the adapter.

getAsTypeDefault(type: string): TypeDefault<unknown> | undefined
NameTypeDescription
typestring

AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt