{"version":3,"file":"c8y-ngx-components-widgets.mjs","sources":["../../widgets/widgets.module.ts","../../widgets/c8y-ngx-components-widgets.ts"],"sourcesContent":["import { ModuleWithProviders, NgModule, Provider } from '@angular/core';\nimport {\n  DynamicComponentDefinition,\n  DynamicWidgetDefinition,\n  hookWidget\n} from '@c8y/ngx-components';\n\n/**\n * Module with providers for the given widgets.\n * Does not include any widgets by default.\n * Import this modules by using the `WidgetsModule.config` method.\n */\n@NgModule()\nexport class WidgetsModule {\n  static config<T extends DynamicComponentDefinition>(config: {\n    widgets: T[];\n    excludeList?: T['id'][];\n  }): ModuleWithProviders<WidgetsModule> {\n    return {\n      ngModule: WidgetsModule,\n      providers: this.providers(config)\n    };\n  }\n\n  static providers<T extends DynamicWidgetDefinition>(config: {\n    widgets: T[];\n    excludeList?: T['id'][];\n  }): Provider[] {\n    const filteredWidgets = this.excludeById(config.widgets, config.excludeList || []);\n    return [hookWidget(filteredWidgets)];\n  }\n\n  private static excludeById<T extends DynamicWidgetDefinition>(\n    widgetDefinitions: T[],\n    excludeList: T['id'][]\n  ): DynamicWidgetDefinition[] {\n    return widgetDefinitions.filter(widgetDefinition => !excludeList.includes(widgetDefinition.id));\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAOA;;;;AAIG;MAEU,aAAa,CAAA;IACxB,OAAO,MAAM,CAAuC,MAGnD,EAAA;QACC,OAAO;AACL,YAAA,QAAQ,EAAE,aAAa;AACvB,YAAA,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;SAClC,CAAC;KACH;IAED,OAAO,SAAS,CAAoC,MAGnD,EAAA;AACC,QAAA,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;AACnF,QAAA,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;KACtC;AAEO,IAAA,OAAO,WAAW,CACxB,iBAAsB,EACtB,WAAsB,EAAA;AAEtB,QAAA,OAAO,iBAAiB,CAAC,MAAM,CAAC,gBAAgB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC;KACjG;+GAxBU,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAb,aAAa,EAAA,CAAA,CAAA,EAAA;gHAAb,aAAa,EAAA,CAAA,CAAA,EAAA;;4FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,QAAQ;;;ACZT;;AAEG;;;;"}