Skip to content

SiWidgetDefaultIdProvider Service documentation

provided in root

The default implementation of the SiWidgetIdProvider which generates random widget ids.

Attributes and Methods

NameTypeDefaultDescription
generateWidgetId(...)
(widget: Omit<WidgetConfig, "id">, dashboardId: string) => stringGenerates a unique widget id.

The method uses crypto.randomUUID() which generates a RFC4122 version 4 UUID (a cryptographically secure random identifier with 122 bits of entropy).

Returns A unique widget id string in the format crypto.randomUUID() .

Parameters
  • widget: Omit<WidgetConfig, "id">  The widget instance config without any id.
  • dashboardId: string  The id of the dashboard where the widget is added.

Types Documentation

Abstract class to provide widget id generation logic.
Constructor
() => {}
Methods
(widget: Omit<WidgetConfig, "id">, dashboardId: string) => string
Generates a transient widget id for newly added widgets in edit mode.
Returns A transient widget id as a string.
Parameters
The widget instance config without any id.
widget: Omit<WidgetConfig, "id">
The id of the dashboard where the widget is added.
dashboardId?: string
A 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.
Properties
Optional type of the accent line.
accentLine?: AccentLineType
actionBarViewType?: ViewType
Defines whether the widget instance component can be expanded and enlarged over the dashboard.
expandable?: boolean
grid item header text.
heading?: TranslatableString
Height of the grid item, where number represents how many rows it takes. (default?: 1)
height?: number
A unique id of a widget instance
id: string
Optional configuration for an image to be displayed on the widget instance.
image?: WidgetImage
immutable?: boolean
isNotRemovable?: boolean
minimum height allowed during resize/creation (default?: undefined = un-constrained)
minHeight?: number
minimum width allowed during resize/creation (default?: undefined = un-constrained)
minWidth?: number
A widget specific payload object. Placeholder to pass in additional configuration.
payload?: any
If true, the widget host renders a placeholder and waits for explicit configuration before instantiating the widget instance component.

Indicates that initial setup by the user is still pending. The flag flips to false once the setup has been completed.

setupPending?: boolean
Optionally, the version widget description that was used to create the widget config.
version?: string
The id of the widget descriptor that was used to instantiate the WidgetConfig and the widget instance component.
widgetId: string
Width of the grid item, where number represents how many columns it spans (default?: 1)
width?: number
Grid item position on x axis of the grid (default?: 0)
x?: number
Grid item position on y axis of the grid (default?: 0)
y?: number
(StatusType | "caution" | "primary" | "inactive")
("collapsible" | "expanded" | "mobile")
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.
Image is used to configure an image to be displayed on a widget instance.
Properties
The HTMLImageElement property alt provides fallback (alternate) text to display when the image specified by the element is not loaded.
alt: string
Defines if an image is placed on top or start (left) of the card.
dir?: ("horizontal" | "vertical")
Sets the image object-fit CSS property.
objectFit?: ObjectFit
Sets the image object-position CSS property.
objectPosition?: string
The image URL (See ).
src: string
("success" | "info" | "warning" | "danger" | "caution" | "critical")
("contain" | "cover" | "fill" | "none" | "scale-down")
ObjectFit configuration options for a widget image.
See https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit

Except where otherwise noted, content on this site is licensed under MIT License.