# WidgetComponentFactory Type documentation

## TypeScript declaration

### [WidgetComponentFactory](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L49-L50>)

**Kind:** type alias

```
import type { WidgetComponentFactory } from '@siemens/dashboards-ng';
```

Factory type that is either a [WidgetComponentTypeFactory](<index.html#t:WidgetComponentTypeFactory>), [FederatedModule](<index.html#t:FederatedModule>), [FederatedBridgeModule](<index.html#t:FederatedBridgeModule>) or [WebComponent](<index.html#t:WebComponent>).

```
type WidgetComponentFactory = WidgetComponentTypeFactory | FederatedModule | WebComponent | FederatedBridgeModule
```

### Types Documentation

### [FederatedBridgeModule](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L97-L101>)

**Kind:** type alias

```
import type { FederatedBridgeModule } from '@siemens/dashboards-ng';
```

Use this when having native federation shell and remote module is using module federation.

```
type FederatedBridgeModule = CommonFactoryFields &
  LoadRemoteBridgeOptions & {
    factoryType: 'native-federation-module-bridge';
    [index: string]: any;
  }
```

#### Index Signatures

| Name | Type | Description |
| --- | --- | --- |
| [\[index: string\]](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L100-L100>) | `any` |  |

### [FederatedModule](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L88-L92>)

**Kind:** type alias

```
import type { FederatedModule } from '@siemens/dashboards-ng';
```

Factory configuration for loading widget components from a federated module. Supports both Module Federation and Native Federation patterns for micro-frontend architectures. Use this when the widget component is hosted in a separate, independently deployed application.

```
type FederatedModule = CommonFactoryFields &
  LoadRemoteModuleOptions & {
    factoryType: 'module-federation' | 'native-federation';
    [index: string]: any;
  }
```

### [WebComponent](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L103-L107>)

**Kind:** type alias

```
import type { WebComponent } from '@siemens/dashboards-ng';
```

```
type WebComponent = CommonFactoryFields & {
  factoryType: 'web-component';
  url: string;
  [index: string]: any;
}
```

#### Index Signatures

| Name | Type | Description |
| --- | --- | --- |
| [\[index: string\]](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L106-L106>) | `any` |  |

### [WidgetComponentTypeFactory](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L81-L81>)

**Kind:** type alias

```
import type { WidgetComponentTypeFactory } from '@siemens/dashboards-ng';
```

```
type WidgetComponentTypeFactory = CommonFactoryFields & (ModuleOptions | StandaloneOptions)
```

### [CommonFactoryFields](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L52-L60>)

**Kind:** type alias

```
type CommonFactoryFields = {
  componentName: string;
  editorComponentName?: string;
  /**
   * CSS class that is added to the modal dialog when component editor dialog is shown.
   * Provides the option to change the size if the dialog.
   */
  editorModalClass?: string;
}
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [componentName](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L53-L53>) | `string` |  |
| [editorComponentName](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L54-L54>) (optional) | `string` |  |
| [editorModalClass](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L59-L59>) (optional) | `string` | CSS class that is added to the modal dialog when component editor dialog is shown. Provides the option to change the size if the dialog. |

### [ModuleOptions](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L68-L72>)

**Kind:** type alias

Use when component is not standalone and part of a module

```
type ModuleOptions = WidgetComponentTypeBaseConfig & {
  moduleName: string;
  moduleLoader: (name: string) => Promise<any>;
  componentLoader?: never;
}
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [componentLoader](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L71-L71>) (optional) | `undefined` |  |
| [factoryType](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L63-L63>) (optional) | `"default"` |  |
| [moduleLoader](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L70-L70>) | `(name: string) => Promise<any>` |  |
| [moduleName](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L69-L69>) | `string` |  |

### [StandaloneOptions](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L75-L79>)

**Kind:** type alias

Use when component is standalone

```
type StandaloneOptions = WidgetComponentTypeBaseConfig & {
  componentLoader: <T = unknown>(componentName: string) => Promise<Type<T>>;
  moduleName?: never;
  moduleLoader?: never;
}
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [componentLoader](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L76-L76>) | `<T = unknown>(componentName: string) => Promise<Type<T>>` |  |
| [factoryType](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L63-L63>) (optional) | `"default"` |  |
| [moduleLoader](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L78-L78>) (optional) | `undefined` |  |
| [moduleName](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L77-L77>) (optional) | `undefined` |  |

### [LoadRemoteModuleOptions](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L383-L384>)

**Kind:** type alias

```
import type { LoadRemoteModuleOptions } from '@siemens/dashboards-ng';
```

The Remote Module definition is based on `@angular-architects`. We take it over into this file to prevent adding a hard dependency.

```
type LoadRemoteModuleOptions = LoadRemoteModuleScriptOptions | LoadRemoteModuleEsmOptions | LoadRemoteModuleManifestOptions
```

### [LoadRemoteBridgeOptions](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L390-L398>)

**Kind:** type alias

```
import type { LoadRemoteBridgeOptions } from '@siemens/dashboards-ng';
```

Definition is based on `@module-federation/enhanced` loadRemote options. We take it over into this file to prevent adding a hard dependency.

```
type LoadRemoteBridgeOptions = {
  id: string;
  options?:
    | {
        loadFactory?: boolean | undefined;
        from: 'build' | 'runtime';
      }
    | undefined;
}
```

### [WidgetComponentTypeBaseConfig](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L62-L65>)

**Kind:** type alias

```
type WidgetComponentTypeBaseConfig = {
  factoryType?: 'default';
  [index: string]: any;
}
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [factoryType](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L63-L63>) (optional) | `"default"` |  |

#### Index Signatures

| Name | Type | Description |
| --- | --- | --- |
| [\[index: string\]](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L64-L64>) | `any` |  |

### [LoadRemoteModuleScriptOptions](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L400-L410>)

**Kind:** type alias

```
import type { LoadRemoteModuleScriptOptions } from '@siemens/dashboards-ng';
```

```
type LoadRemoteModuleScriptOptions = {
  type?: 'script';
  remoteEntry?: string;
  remoteName: string;
  exposedModule: string;
  /**
   * Optional nonce value applied to the script element for Content Security Policy (CSP) support.
   * Supported in Module Federation v21.2.0+; safely ignored by earlier versions.
   */
  nonce?: string;
}
```

### [LoadRemoteModuleEsmOptions](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L412-L416>)

**Kind:** type alias

```
import type { LoadRemoteModuleEsmOptions } from '@siemens/dashboards-ng';
```

```
type LoadRemoteModuleEsmOptions = {
  type: 'module';
  remoteEntry: string;
  exposedModule: string;
}
```

### [LoadRemoteModuleManifestOptions](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L418-L422>)

**Kind:** type alias

```
import type { LoadRemoteModuleManifestOptions } from '@siemens/dashboards-ng';
```

```
type LoadRemoteModuleManifestOptions = {
  type: 'manifest';
  remoteName: string;
  exposedModule: string;
}
```
