@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
60 lines (57 loc) • 1.85 kB
TypeScript
import { Provider } from '@angular/core';
import { DefaultWidgetIdValues } from '@c8y/ngx-components/widgets/definitions';
/**
* Type representing all available widget IDs that can be configured
* This ensures type safety when specifying widget IDs
*/
type WidgetId = DefaultWidgetIdValues;
/**
* Configuration interface for widget providers
*/
interface WidgetProvidersConfig {
/**
* List of widget IDs to exclude from the providers
* Use defaultWidgetIds constants for type safety and autocomplete
* @example { exclude: [defaultWidgetIds.HTML, defaultWidgetIds.MARKDOWN] }
*/
exclude?: WidgetId[];
}
/**
* Default widgets that are typically useful
* These are the widgets that will be loaded unless explicitly excluded
*/
declare const DEFAULT_WIDGETS: WidgetId[];
/**
* Configures and returns widget providers.
*
* This function allows selective loading of widget providers with their configuration hooks.
* Unlike `cockpitWidgets()` which only provides widget definitions, this includes
* the full providers with `hookWidgetConfig` registrations for features like widget preview.
*
* @param config Configuration options for widget providers
* @returns Array of providers to be included in app.module.ts
*
* @example
* ```typescript
* // In app.module.ts
* providers: [
* ...configureWidgetProviders({
* exclude: [defaultWidgetIds.HTML, defaultWidgetIds.MARKDOWN]
* }),
* // other providers
* ]
* ```
*
* @example
* ```typescript
* // Load all default widgets
* providers: [
* ...configureWidgetProviders(),
* // other providers
* ]
* ```
*/
declare function configureWidgetProviders(config?: WidgetProvidersConfig): Provider[];
export { DEFAULT_WIDGETS, configureWidgetProviders };
export type { WidgetId, WidgetProvidersConfig };
//# sourceMappingURL=index.d.ts.map