# SiWidgetIdProvider Type documentation

## TypeScript declaration

### [SiWidgetIdProvider](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/si-widget-id-provider.ts#L29-L38>)

**Kind:** class

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

Abstract class to provide widget id generation logic.

```
undecorated_class SiWidgetIdProvider
```

#### Constructor

##### constructor

[Source for constructor](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/si-widget-id-provider.ts#L29-L38>)

```
constructor(): SiWidgetIdProvider
```

**Returns:** [SiWidgetIdProvider](<index.html#t:SiWidgetIdProvider>)

#### Methods

##### generateWidgetId

[Source for generateWidgetId](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/si-widget-id-provider.ts#L37-L37>)

Generates a transient widget id for newly added widgets in edit mode.

Returns: A transient widget id as a string.

```
generateWidgetId(widget: Omit<WidgetConfig, "id">, dashboardId?: string): string
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [widget](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/si-widget-id-provider.ts#L37-L37>) | `Omit<WidgetConfig, "id">` |  | • The widget instance config without any id. |
| [dashboardId](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/si-widget-id-provider.ts#L37-L37>) (optional) | `string` |  | • The id of the dashboard where the widget is added. |

**Returns:** [string](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String>)

### Types Documentation

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

**Kind:** interface

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

A [WidgetConfig](<index.html#t:WidgetConfig>) holds the configuration of a widget instance component that is visible on a dashboard. It can be persisted and used to restore a dashboards state.

```
interface WidgetConfig
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [accentLine](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L210-L210>) (optional) | `AccentLineType` | Optional type of the accent line. |
| [actionBarViewType](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L200-L200>) (optional) | `ViewType` |  |
| [expandable](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L189-L189>) (optional) | `boolean` | Defines whether the widget instance component can be expanded and enlarged over the dashboard. |
| [heading](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L185-L185>) (optional) | `TranslatableString` | grid item header text. |
| [headingIcon](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L187-L187>) (optional) | `string \| Record<string, string>` | Icon name or a single-entry map of camelCase icon name to SVG data URI. |
| [height](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L165-L165>) (optional) | `number` | Height of the grid item, where number represents how many rows it takes. (default?: 1) |
| [id](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L148-L148>) | `string` | A unique id of a widget instance |
| [image](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L206-L206>) (optional) | `WidgetImage` | Optional configuration for an image to be displayed on the widget instance. |
| [immutable](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L202-L202>) (optional) | `boolean` |  |
| [isNotRemovable](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L201-L201>) (optional) | `boolean` |  |
| [minHeight](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L181-L181>) (optional) | `number` | minimum height allowed during resize/creation (default?: undefined = un-constrained) |
| [minWidth](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L177-L177>) (optional) | `number` | minimum width allowed during resize/creation (default?: undefined = un-constrained) |
| [payload](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L191-L191>) (optional) | `any` | A widget specific payload object. Placeholder to pass in additional configuration. |
| [setupPending](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L199-L199>) (optional) | `boolean` | If true, the widget host renders a placeholder and waits for explicit configuration before instantiating the widget instance component.<br><br>Indicates that initial setup by the user is still pending. The flag flips to `false` once the setup has been completed. |
| [version](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L157-L157>) (optional) | `string` | Optionally, the version widget description that was used to create the widget config. |
| [widgetId](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L153-L153>) | `string` | The id of the widget descriptor that was used to instantiate the `WidgetConfig` and the widget instance component. |
| [width](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L161-L161>) (optional) | `number` | Width of the grid item, where number represents how many columns it spans (default?: 1) |
| [x](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L169-L169>) (optional) | `number` | Grid item position on x axis of the grid (default?: 0) |
| [y](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L173-L173>) (optional) | `number` | Grid item position on y axis of the grid (default?: 0) |

### [TranslatableString](<https://github.com/siemens/element/blob/main/projects/element-translate-ng/translate-types/global.types.ts#L18-L18>)

**Kind:** type alias

```
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';
```

Represents a translatable string. This can either be a translation key, e.g. `ACTIONS.EDIT` that will be automatically translated when displayed on the UI or a pre-translated string, e.g. `Edit`. Equivalent to a normal string in usage and functionality.

```
type TranslatableString = string & Translatable
```

### [ViewType](<https://github.com/siemens/element/blob/main/projects/element-ng/content-action-bar/si-content-action-bar.model.ts#L13-L13>)

**Kind:** type alias

```
import type { ViewType } from '@siemens/element-ng/content-action-bar';
```

```
type ViewType = 'collapsible' | 'expanded' | 'mobile'
```

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

**Kind:** interface

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

Image is used to configure an image to be displayed on a widget instance.

```
interface WidgetImage
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [alt](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L127-L127>) | `string` | The HTMLImageElement property [alt](<https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#usage_notes>) provides fallback (alternate) text to display when the image specified by the \<img\> element is not loaded. |
| [dir](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L131-L131>) (optional) | `"horizontal" \| "vertical"` | Defines if an image is placed on top or start (left) of the card. |
| [objectFit](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L135-L135>) (optional) | `ObjectFit` | Sets the image [object-fit](<https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit>) CSS property. |
| [objectPosition](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L139-L139>) (optional) | `string` | Sets the image [object-position](<https://developer.mozilla.org/en-US/docs/Web/CSS/object-position>) CSS property. |
| [src](<https://github.com/siemens/element/blob/main/projects/dashboards-ng/src/model/widgets.model.ts#L122-L122>) | `string` | The image URL (See [\<img\>](<https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#src>)). |

### [AccentLineType](<https://github.com/siemens/element/blob/main/projects/element-ng/common/models/status-type.model.ts#L10-L10>)

**Kind:** type alias

```
import type { AccentLineType } from '@siemens/element-ng/common';
```

```
type AccentLineType = StatusType | 'caution' | 'primary' | 'inactive'
```

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

**Kind:** type alias

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

ObjectFit configuration options for a widget image.

See: [https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit](<https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit>)

```
type ObjectFit = 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'
```

### [StatusType](<https://github.com/siemens/element/blob/main/projects/element-ng/common/models/status-type.model.ts#L7-L7>)

**Kind:** type alias

```
import type { StatusType } from '@siemens/element-ng/common';
```

```
type StatusType = 'success' | 'info' | 'warning' | 'danger' | 'caution' | 'critical'
```
