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.
Example
Section titled “Example”// 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 }); }}Methods
Section titled “Methods”register()
Section titled “register()”Register type-level defaults for a custom type.
register(type: string, defaults: TypeDefaultRegistration<T>): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string | The type name (e.g., ‘country’, ‘currency’) |
defaults | TypeDefaultRegistration<T> | Renderer/editor configuration |
Get type defaults for a given type.
get(type: string): TypeDefaultRegistration<unknown> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string |
unregister()
Section titled “unregister()”Remove type defaults for a type.
unregister(type: string): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string |
Check if a type has registered defaults.
has(type: string): booleanParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string |
getRegisteredTypes()
Section titled “getRegisteredTypes()”Get all registered type names.
getRegisteredTypes(): string[]getAsTypeDefault()
Section titled “getAsTypeDefault()”Convert to TypeDefault for use with grid’s typeDefaults. This is used internally by the adapter.
getAsTypeDefault(type: string): TypeDefault<unknown> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string |
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