Skip to content

SiGridComponent documentation

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

The grid component is the actual component on which the widget instances are placed and visualized. You can think of a headless dashboard, without a title, toolbar or edit buttons.

Input Properties

NameTypeDefaultDescription
dashboardId
string | undefined

An optional, but recommended dashboard id that is used in persistence and passed to the widget store for saving and loading data.

editable
boolean false

Sets the grid into editable mode, in which the widget instances can be moved, resized, removed or new ones added.

emitWidgetInstanceEditEvents
boolean false

When the user clicks edit on a widget instance, an editor need to appear and the widget editor component need to be loaded. When the grid is used standalone, it takes care and opens a modal dialog and loads the configured widget editor component. When the grid is used in a container like the flexible dashboard, the container manages where the widget instance editor is displayed. In this case this options prevents the grid from showing the editor in the dialog, and emits on widgetInstanceEdit on clicking the widget edit action.

gridConfig
GridConfig | undefined inject(SI_DASHBOARD_CONFIGURATION)?.grid

Configuration options for a grid instance. Default is the optional value from the SI_DASHBOARD_CONFIGURATION.

hideProgressIndicator
boolean false

Option to turn off the loading spinner on save and load operations.

widgetCatalog
Widget[] []

Provides the available widgets to the grid. When loading the widget configurations from the storage, we need to have the widget definition available to be able to create the widget instances on the grid.

widgetInstanceEditorDialogComponent
Type<SiWidgetInstanceEditorDialogComponent> | undefined

Option to configure a custom widget instance editor dialog component. The component provides the editor hosting and the buttons to save and cancel.

Output Properties

NameTypeDescription
editableChange
boolean

Sets the grid into editable mode, in which the widget instances can be moved, resized, removed or new ones added.

isModified
boolean

Emits the modification state of the grid. It is unmodified when the visible state is equal to the loaded state from the widget storage. When the user modifies the dashboard by e.g. while moving the widgets, the dashboard is marked as modified and emits true and when the user persists the change by saving, or reverts the state by canceling, the state is unmodified again and emits false.

widgetInstanceEdit
WidgetConfig

Emits to notify about edit events of widget instances. Only emits if emitWidgetInstanceEditEvents is set to true.

Attributes and Methods

NameTypeDefaultDescription
addWidgetInstance()
(widgetInstanceConfig: Omit<WidgetConfig, "id">) => void

Adds a new widget instance configuration to the dashboard grid. It is not persisted yet and is added to the transient widget instances.

Parameters
cancel()
() => void

Cancel current changes and restore last saved state.

edit()
() => void

Set dashboard grid in editable mode to modify widget instances.

editWidgetInstance()
(widgetInstanceConfig: WidgetConfig) => void

Opens the provided widget configuration in the related editor or emits on widgetInstanceEdit, if emitWidgetInstanceEditEvents is true.

Parameters
(readonly) gridStackWrapper
Signal<SiGridstackWrapperComponent> viewChild.required(SiGridstackWrapperComponent)
(readonly) isLoading
BehaviorSubject<boolean> new BehaviorSubject<boolean>(false)

Indication for load and save operations.

removeWidgetInstance()
(widgetInstanceId: string) => void

Removes a widget instance from the visible widgets and puts it in the markedForRemoval array.

Parameters
save()
() => void

Persists the current widget instances to the widget storage and changes the editable and isModified modes.

updateWidgetInstance()
(editedWidgetConfig: WidgetConfig) => void

Updates the visible widgets with an updated configuration. Will update the user interface and emit on isModified.

Parameters

Types Documentation

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

Configuration object for the si-grid component, including the options of gridstack.

Properties
import type { Widget } from '@siemens/dashboards-ng';

Widgets describe the entries within the widget catalog and holds all default configuration and factory functionality to instantiate a widget instance, represented as WidgetConfig objects.

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

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

  • Icon name or a single-entry map of camelCase icon name to SVG data URI.

    headingIcon?: string | Record<string, string>

  • 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

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.

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

Factory type that is either a WidgetComponentTypeFactory, FederatedModule, FederatedBridgeModule or WebComponent.

ViewType

'collapsible' | 'expanded' | 'mobile'
type alias
import type { ViewType } from '@siemens/element-ng/content-action-bar';
import type { WidgetImage } from '@siemens/dashboards-ng';

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

Properties

AccentLineType

StatusType | 'caution' | 'primary' | 'inactive'
type alias
import type { AccentLineType } from '@siemens/element-ng/common';
import type { WidgetComponentTypeFactory } from '@siemens/dashboards-ng';

FederatedModule

CommonFactoryFields & LoadRemoteModuleOptions & { factoryType: 'module-federation' | 'native-federation'; [index: string]: any; }
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.

WebComponent

CommonFactoryFields & { factoryType: 'web-component'; url: string; [index: string]: any; }
type alias
import type { WebComponent } from '@siemens/dashboards-ng';
Index Signatures

FederatedBridgeModule

CommonFactoryFields & LoadRemoteBridgeOptions & { factoryType: 'native-federation-module-bridge'; [index: string]: any; }
type alias
import type { FederatedBridgeModule } from '@siemens/dashboards-ng';

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

Index Signatures

ObjectFit

'contain' | 'cover' | 'fill' | 'none' | 'scale-down'
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

StatusType

'success' | 'info' | 'warning' | 'danger' | 'caution' | 'critical'
type alias
import type { StatusType } from '@siemens/element-ng/common';

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; }
type alias
Properties

ModuleOptions

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

Use when component is not standalone and part of a module

StandaloneOptions

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

Use when component is standalone

Properties
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.

LoadRemoteBridgeOptions

{ id: string; options?: | { loadFactory?: boolean | undefined; from: 'build' | 'runtime'; } | undefined; }
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.

WidgetComponentTypeBaseConfig

{ factoryType?: 'default'; [index: string]: any; }
type alias
Properties
Index Signatures

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; }
type alias
import type { LoadRemoteModuleScriptOptions } from '@siemens/dashboards-ng';

LoadRemoteModuleEsmOptions

{ type: 'module'; remoteEntry: string; exposedModule: string; }
type alias
import type { LoadRemoteModuleEsmOptions } from '@siemens/dashboards-ng';

LoadRemoteModuleManifestOptions

{ type: 'manifest'; remoteName: string; exposedModule: string; }
type alias
import type { LoadRemoteModuleManifestOptions } from '@siemens/dashboards-ng';

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