Skip to content

SiDefaultWeatherIconResolver Service documentation

import { SiDefaultWeatherIconResolver } from '@siemens/element-ng/dashboard';

Built-in resolver that maps the library's minimal SiWeatherCondition vocabulary to Element icons:

• clear → element-sun

• clouds → element-cloudy

• rain → element-rain

• storm → element-storm

• wind → element-wind

• unknown → no illustration

Unknown tokens fall through to null so callers can register a more capable resolver without losing the built-in fallback.

Attributes and Methods

Name Type Description
resolve()

Inherited from SiWeatherIconResolver

Parameters

Types Documentation

import type { SiWeatherIcon } from '@siemens/element-ng/dashboard';

Describes how a weather illustration should be resolved. Callers can either provide a direct SiWeatherIcon.src or a semantic SiWeatherIcon.condition token resolved by a SiWeatherIconResolver.

Properties

import type { SiWeatherIconResolution } from '@siemens/element-ng/dashboard';

Result returned by a SiWeatherIconResolver. Implementations should return either icon (rendered via <si-icon>) or src (rendered as a plain <img>). When both are present, icon wins.

Properties
  • Resolved alt text. The widget falls back to a sensible default.

    alt ? : TranslatableString

  • Resolved Element icon name (e.g. "element-sun"). Rendered via <si-icon>.

    icon ? : string

  • Resolved image URL. Rendered as a plain <img>.

    src ? : string

import { SiWeatherIconResolver } from '@siemens/element-ng/dashboard';

Maps a semantic SiWeatherIcon to a renderable illustration. The library ships a SiDefaultWeatherIconResolver that maps the built-in SiWeatherCondition vocabulary to Element icons, so the widget renders a reasonable illustration out of the box. Applications can override the mapping or add provider-specific vocabularies by registering their own resolver:

Example:

@Injectable({ providedIn: 'root' })
export class MyWeatherIconResolver extends SiWeatherIconResolver {
  override resolve(icon: SiWeatherIcon): SiWeatherIconResolution | null {
    // ...
  }
}

Resolvers SHOULD return null for unknown or 'unknown' conditions so the widget can skip the illustration.

Constructor

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.


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