UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

1,092 lines (1,074 loc) 857 kB
import * as i0 from '@angular/core'; import { PipeTransform, EnvironmentInjector, Injector, NgModuleRef, Type, InjectionToken, ValueProvider, ClassProvider, ExistingProvider, StaticProvider, AfterViewInit, OnDestroy, OnChanges, EventEmitter, ElementRef, ChangeDetectorRef, SimpleChanges, Provider, ModuleWithProviders, ViewContainerRef, Renderer2, TemplateRef, OnInit, AfterViewChecked, EnvironmentProviders, QueryList, AfterContentInit, DoCheck, NgZone, DestroyRef, ApplicationRef } from '@angular/core'; import * as _c8y_client from '@c8y/client'; import { IApplication, VersioningMatrix, IManagedObject, SystemOptionsService, TenantOptionsService, IUser, ICurrentUser, ICurrentTenant, ApplicationService, FetchClient, TenantLoginOptionsService, Realtime, InventoryService, UserService, IIdentified, IResultList, Paging, InventoryBinaryService, IManagedObjectBinary, IdReference, IEvent, OperationStatus, ITenantLoginOption, TenantLoginOptionType, ICustomProperties, Service, IResult, BasicAuth, CookieAuth, PasswordStrength, Client, ITotp, TenantService, QueriesUtil, ApplicationType, aggregationType, AuditRecordType, IAuditRecord, AuditService, IAlarm, IMeasurement, MeasurementService, IOperationBulk, IOperation, DeviceRegistrationStatus, ApplicationRemotePlugins, IManifest, FeatureService } from '@c8y/client'; import * as rxjs from 'rxjs'; import { Observable, BehaviorSubject, ReplaySubject, Subject, UnaryFunction, MonoTypeOperatorFunction, Subscription } from 'rxjs'; import * as _c8y_options from '@c8y/options'; import { ApplicationOptions as ApplicationOptions$1, BrandingCssVars, Languages, I18nExtra, Docs, Icon, LoginExtraLink, CookieBannerConfiguration, CookiePreferencesConfiguration, MessageBannerConfiguration, PluginsExports, RemotePlugins, MapTileLayer, MapDefaultConfig } from '@c8y/options'; export { ApplicationOptions } from '@c8y/options'; import * as i1$1 from '@angular/router'; import { ActivatedRoute, Router, NavigationExtras, Route as Route$1, RouterStateSnapshot, ActivatedRouteSnapshot, Data, Routes, ExtraOptions, Event as Event$1 } from '@angular/router'; import { ApiService, ApiCall } from '@c8y/ngx-components/api'; import { BootstrapMetaData, RemoteModuleFactoryWithMetadata } from '@c8y/bootstrap'; import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons'; import { TranslateService as TranslateService$1, TranslatePipe, TranslateDirective, TranslateStore, Language, InterpolatableTranslation, TranslationObject, RootTranslateServiceConfig, MissingTranslationHandler, TranslateParser, MissingTranslationHandlerParams, TranslateLoader } from '@ngx-translate/core'; import * as i1 from '@angular/common'; import { DatePipe as DatePipe$1, DatePipeConfig, DecimalPipe, LocationStrategy, Location } from '@angular/common'; import * as i3 from 'ngx-bootstrap/tooltip'; import * as i4 from '@angular/cdk/scrolling'; import { CdkVirtualScrollViewport, VirtualScrollStrategy } from '@angular/cdk/scrolling'; import * as _angular_platform_browser from '@angular/platform-browser'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { Stream } from 'stream'; import * as i5 from 'ngx-bootstrap/dropdown'; import { BsDropdownDirective } from 'ngx-bootstrap/dropdown'; import * as i1$2 from '@angular/cdk/a11y'; import * as i2 from 'ngx-bootstrap/collapse'; import * as i3$1 from 'ngx-bootstrap/popover'; import { PopoverDirective } from 'ngx-bootstrap/popover'; import * as i2$3 from '@angular/cdk/stepper'; import { StepState, CdkStepper, CdkStep } from '@angular/cdk/stepper'; import * as i2$1 from '@angular/forms'; import { NgModel, FormControlName, ValidationErrors, FormControl, Validator, AbstractControl, ValidatorFn, NgControl, ControlValueAccessor, AsyncValidatorFn, CheckboxControlValueAccessor, FormGroup, FormBuilder, NgForm, AbstractControlOptions } from '@angular/forms'; import * as i1$3 from 'ngx-bootstrap/modal'; import { BsModalRef, BsModalService, ModalOptions } from 'ngx-bootstrap/modal'; import * as i5$1 from 'angularx-qrcode'; import * as i4$1 from 'ngx-bootstrap/datepicker'; import { BsLocaleService, BsDatepickerDirective, BsDaterangepickerConfig } from 'ngx-bootstrap/datepicker'; import * as i6 from '@ngx-formly/core'; import { FormlyFieldConfig, FieldArrayType, FormlyFieldProps, FieldType, FieldWrapper, FieldTypeConfig, FormlyFormOptions } from '@ngx-formly/core'; import * as _c8y_ngx_components_dist_icon_selector_icons from '@c8y/ngx-components/dist/icon-selector/icons'; import { Directionality } from '@angular/cdk/bidi'; import { Entry } from '@zip.js/zip.js'; import * as i10 from '@ngx-formly/core/select'; import * as i5$2 from 'ngx-bootstrap/timepicker'; import * as i16 from '@angular/cdk/text-field'; import { FormlyJsonschema } from '@ngx-formly/core/json-schema'; import { JSONSchema7 } from 'json-schema'; import * as i3$2 from '@angular/cdk/drag-drop'; import { CdkDrag, CdkDragStart, CdkDragEnd } from '@angular/cdk/drag-drop'; import * as i16$1 from '@c8y/ngx-components/interval-picker'; import { Interval } from '@c8y/ngx-components/interval-picker'; import * as packages_client_lib from 'packages/client/lib'; import * as i2$2 from '@angular/cdk/table'; import { CdkTable } from '@angular/cdk/table'; import * as i12 from 'ngx-bootstrap/pagination'; import { DataSource, CollectionViewer } from '@angular/cdk/collections'; import { ComponentType } from '@angular/cdk/overlay'; declare class AppSwitcherComponent { static ɵfac: i0.ɵɵFactoryDeclaration<AppSwitcherComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<AppSwitcherComponent, "c8y-app-switcher", never, {}, {}, never, never, true, never>; } declare class ApplicationOptions implements ApplicationOptions$1 { /** Application name (saved to the server). */ name: string; /** Application context path (saved to the server). */ contextPath: string; /** Application key (saved to the server). */ key: string; /** The version of the application */ version: string; /** The version of the used WebSDK version */ webSdkVersion?: string; /** Set to `true` if the application is hybrid and uses Angular and AngularJS simultaneously. */ upgrade?: boolean; /** * Path to the branding entry file. (Set it to false to disable any styling. You can handle the styling then on your own e.g. in an angular.json file using ng-cli) * @deprecated Add your global styles via the angular.json file. */ brandingEntry?: false; /** * Enables all preview features in the application UI. * * Note: This only affects features on the frontend. * If a preview feature also requires backend support it must be enabled separately on the backend. */ enableAllPreviewFeatures?: boolean; /** * Hides the feature preview section in the right drawer. */ hidePreviewFeature?: boolean; /** Path to tsccnfig.json file if TypeScript is used (default: ./tsconfig.json). */ tsConfigPath?: string; /** Entry module for Angular compiler (only used with lazy loaded routes), e.g. `'app.module.ts#AppModule'`. */ entryModule?: string; /** Path to custom index.html (otherwise default one will be used). */ indexTemplate?: string; /** * URL to dynamically fetched options. * If set to `true` or left undefined, an URL will be used based on the applications contextPath. * If set to `false`, no dynamic options will be fetched. * */ dynamicOptionsUrl?: string | boolean; /** URL to favicon. */ faviconUrl?: string; /** URL to `*.css` file which will replace default branding. */ brandingUrl?: string; /** Enables the branding preview mode. If set to true, the `dynamicOptionsUrl` will be polled regularly for changes. In case the `lastUpdated` field of the dynamic options changes, the page is reloaded in order to apply the new branding. */ brandingPreview?: boolean; /** Object with properties that will be converted to CSS custom variables. */ brandingCssVars?: BrandingCssVars; /** * Allows for adding or overriding languages available in the application. * * Its keys are language codes and its values are objects with the following properties: * * - **name:** English name of the language, * - **nativeName:** native name of the language, * - **url:** full URL to JSON file with compiled translations; * if not defined, translations will be loaded from `${localePath}/${langCode}.json. * * ```json * "languages": { * "de": { * "name": "German", * "nativeName": "Deutsch", * "url": "/apps/public/ui-assets/de.json" * } * } * ``` */ languages?: Languages; /** * Allows to add custom translations. It is an optional property. * * Its keys are language codes (https://cumulocity.com/guides/users-guide/getting-started/#a-name-languages-a-available-languages) * and its values are objects with key-value pairs, where the key is the original string in English and the value - its translation. * * - **Home:** "Startseite"` * * For example you can add the translation of your custom cookie banner configured in the branding settings: * ```json * "i18nExtra": { * "de": { * "About cookies on Cumulocity IoT": "Informationen zu Cookies in Cumulocity IoT", * "Click Agree and Proceed to accept cookies and go directly to the platform or click on Privacy Policy to see detailed descriptions of the used cookies.": "Klicken Sie auf Zustimmen und fortfahren, um Cookies zu akzeptieren und direkt zur Plattform zu gelangen, oder klicken Sie auf Datenschutzrichtlinie, um detaillierte Beschreibungen der verwendeten Cookies anzuzeigen." * } * } * ``` */ i18nExtra?: I18nExtra; /** Path to the folder from which *.po files will be loaded. */ localePath?: string; /** Array of URLs to additional `*.css` files to be loaded at runtime. */ extraCssUrls?: string[]; /** Stylesheet (CSS) that will be added at runtime. The string should actually contain the CSS not a path or URL to it. */ extraCss?: string; /** Documentation links settings. */ docs?: Docs; /** Application icon to be displayed in app switcher and header bar. */ icon?: Icon; /** Hide application in app switcher (saved to the server). */ noAppSwitcher?: boolean; /** HTML page title. */ globalTitle?: string; /** Hide "powered by" and version info at the bottom of the navigator and in the right drawer. */ hidePowered?: boolean; /** Hides the header bar */ hideHeader?: boolean; /** Hides the "Platform information" in the right drawer, will overrule the "hidePowered" option */ hidePlatformInformation?: boolean; /** URL to support page (set to `false` to hide the link). */ supportUrl?: boolean | string; /** * Replacement string for `user` field in audit logs for actions performed by a support user * (available placeholders: `{{support_user}}`, `{{supported_user}}`). */ supportUserString?: string; /** * Disables realtime updates on the map widget and maps in general. */ mapWidgetRealtimeDisabled?: boolean; /** * Allows to adjust the default pagesize of 100 items of the map widget and maps in general. */ mapWidgetPageSize?: number; /** * Allows to hide the hint that there are more devices with geo coordinates then displayed on the map widget and maps in general. */ mapWidgetHideMaxDeviceOnMapHint?: boolean; /** Enable or disable the right drawer. */ rightDrawer?: boolean; /** Enable or disable breadcrumbs in the header for groups and devices (default: false). */ breadcrumbs?: boolean; /** Collapse navigator on initial load. */ hideNavigator?: boolean; /** Show tabs horizontally or vertically. */ tabsHorizontal?: boolean; /** Additional link(s) to display on login screen. */ loginExtraLink?: LoginExtraLink | LoginExtraLink[]; /** Enable or disable storage limitation feature. */ storageLimitationFeatureEnabled?: boolean; /** Name of company handling support requests from app users (displayed in notification message). */ companyName?: string; /** URL template for documentation links (default: `'${docsBaseUrl}${partialUrl}'`). */ guideHrefTemplate?: string; /** Base URL for documentation links (include `{{ version }}` placeholder, if you want versioned links). */ docsBaseUrl?: string; /** CSP string to be applied to `index.html` by replacing default values. */ contentSecurityPolicy?: string; /** Enables cloud sensor wizard */ sensorPhone?: boolean; /** Show or hide a newsletter subscription checkbox in edit user modal. */ newsletter?: boolean; /** Path to the root node_modules dir (useful when working in monorepo setup, e.g. yarn workspaces). */ rootNodeModulesPath?: string; /** Cookie Banner configuration */ cookieBanner?: CookieBannerConfiguration; /** Cookie preferences configuration. Here you can enable or disable cookie categories */ cookiePreferences?: CookiePreferencesConfiguration; /** Message Banner configuration */ messageBanner?: MessageBannerConfiguration; /** A key for the product experience software Gainsight. */ gainsightKey?: string; /** Disable user tracking */ disableTracking?: boolean; /** NgModule export for plugins. */ exports?: PluginsExports[]; /** List of imported remote plugins. */ remotes?: RemotePlugins; /** If set to true, only remotes defined in the `remotes` query parameter will be loaded. */ forceUrlRemotes?: boolean; /** The package source a application origins from as IApplication or simply the id of the source */ source?: string | number | IApplication; /** * Additional assets to copy to the build output. * See https://github.com/webpack-contrib/copy-webpack-plugin for more information * about the patterns to add here. */ copy?: []; /** * Allows to enable or disable context help, or to override the default base URL used to load its contents. * By default, the context help uses the same base URL as defined in the `docsBaseUrl` option * (if this option is undefined, then the following value will be used: `https://cumulocity.com/guides/{{version}}`). * Alternatively, if a string is provided here, it'll be used as the base URL * and any `{{ version }}` placeholder will be replaced with the relevant docs version. */ contextHelp?: boolean | string; /** * By default, cockpit and devicemanagement use the onlyRoots query to resolve root nodes. This * could lead to performance issues, if a customer has a lot of root nodes. Therefore you can disable * the use of this query with this flag. */ disableOnlyRootsQuery?: boolean; /** * Allows to force showing the setup wizard. */ forceSetup?: boolean; /** * Indicates if the application needs to show the setup wizard. */ isSetup?: boolean; /** * By default a WebSDK app requires the user to be logged in. * In case you would like to develop just a static application, that does not require any kind of access to the backend, * you can use this flag to disable the login screen. * NOTE: not all WebSDK components support this, some might require the user to be logged in and won't work. */ noLogin?: boolean; /** * Allows to opt out of supporting/loading plugins for this application. */ noPlugins?: boolean; /** * Allows to opt out of the version warning which is shown in the dev tools. */ noVersionWarning?: boolean; /** * Allows to set the map layers. If not set, defaults to open street map layer. */ mapLayers?: MapTileLayer[]; /** * Allows to set default configurations on the maps. */ mapConfig?: MapDefaultConfig; /** * The URL used to lookup geo coordinates for a user provided address via [nominatim API](https://nominatim.org/release-docs/develop/api/Search/). * Can be set to empty to disable the find address feature on the location tab. * Uses: `https://nominatim.openstreetmap.org/search?format=json&q={searchTerm}` if not set. */ mapNominatimUrl?: string; /** * The name of the root element. By default c8y-bootstrap. */ rootTagName?: string; /** * Hides possibility to create typed dashboards for assets (and groups). If true, typed dashboards can be created only for devices. * It is true by default. */ hideTypeDashboardForAssets?: boolean; /** * A matrix of versions indicating which versions of the application (key) are dependent on which version of a cumulocity component (API version and Web SDK version of the shell application currently supported, indicated by the value). * The versions of the dependent components can be indicated by a semver range. * ```json * { * "1.0.0": { * "sdk": ">=1016.0.0 <1017.0.0", * "api": ">=1016.0.0 <1017.0.0" * }, * "2.0.0": { * "sdk": "~1017.0.0", * "api": "~1017.0.0" * }, * "3.0.0": { * "sdk": ">=1018.0.0", * "api": ">=1018.0.0" * }, * } * ``` */ versioningMatrix?: VersioningMatrix; /** * Is used for plugins to indicate their owner. Cumulocity plugins are marked with OFFICIAL label. * You can use the special "ARCHIVED" label to mark them as archived. */ label?: string; /** * Defines the type of refresh mechanism used for alarms in the application. * * - **realtime:** Utilizes a realtime mechanism for updating alarms. * - **interval:** Utilizes HTTP polling at regular intervals to refresh the alarms. * * This setting allows to switch between realtime and interval-based refresh methods. */ alarmsRefreshType?: 'interval' | 'realtime'; /** * A map of import paths to their corresponding URLs. * This is used to resolve module paths when loading remote modules * (e.g. in the HTML-Widget). The keys are the import paths and the values are the URLs. * * You can also add a js file but need to copy it. Or you can add a node module name but * this need to have a single entry point. Otherwise you need to copy the files. A url can also * be used but you need to ensure that the CSP rules are not blocking the loading of the file. * * ``` * { * 'my-widget': 'https://example.com/path/to/widget.js', * 'node-module': '@scope/my-node-module', * 'local-js': './my-local-file.js' * } * ``` */ importMap?: { [key: string]: string; }; /** * Defines to which path the user will be redirected in case he is not logged in yet. * * This needs to be used for e.g. people who embed the application in an iframe in order to redirect to a none index.html file. */ loginRedirectPath?: string; /** * Allows to skip the Single Sign-On (SSO) redirect during the login process. * * Can be used to avoid the redirect to the Identity Provider, when you still want to use the built-in login instead. * This is needed in scenarios like e.g. support user access. */ skipSSORedirect?: boolean; } /** * Tells how a plugin is scoped. */ declare enum PluginsExportScopes { /** * Limit the plugin to the current application. It is imported by default. */ SELF = "self", /** * Allows to add the plugin to a global scope, meaning it is imported to all applications at the same time. * This is not used at the moment but planned to be implemented in the new branding editor. */ GLOBAL = "global", /** * Limit the plugin to the current application. The plugin is not imported by default. */ SELF_OPTIONAL = "self-optional", /** * Like undefined the plugin is available for any private application. */ DEFAULT = "" } /** * Converts a managed object into a context-aware URL, depending on its type and fragments. * Usage: * * ```html * {{ managedObject | assetLink }} <!-- e.g. '/device/<moId>' or '/group/<moId> --> * ``` */ declare class AssetLinkPipe implements PipeTransform { private groupService; transform(mo: IManagedObject): string; static ɵfac: i0.ɵɵFactoryDeclaration<AssetLinkPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<AssetLinkPipe, "assetLink", true>; } interface BytesOptions { precision?: number; binary?: boolean; } /** * Converts the file size to a readable format. * Supports both decimal (default) and binary units. * * Usage: * ```html * {{ myData | bytes }} <!-- e.g. 100.1 MB (decimal) --> * {{ myData | bytes:2 }} <!-- e.g. 100.12 MB (decimal) --> * {{ myData | bytes:1:true }} <!-- e.g. 97.7 MiB (binary) --> * {{ myData | bytes:{binary: true} }} <!-- e.g. 97.7 MiB (binary) --> * {{ myData | bytes:{precision: 2, binary: true} }} <!-- e.g. 97.66 MiB (binary) --> * ``` * * @param value The number of bytes to convert * @param precisionOrOptions Number of decimal places or options object * @param binary Whether to use binary (1024) or decimal (1000) units (legacy parameter) * * Options object properties: * - precision: number of decimal places (default: 1) * - binary: whether to use binary units (default: false) * * Decimal units: bytes, kB, MB, GB, TB, PB * Binary units: bytes, KiB, MiB, GiB, TiB, PiB */ declare class BytesPipe implements PipeTransform { static bytes(bytes: number, precisionOrOptions?: number | BytesOptions, binary?: boolean, translateService?: TranslateService$1): string | number; private translateService; transform(value: number, precisionOrOptions?: number | BytesOptions, binary?: boolean): string | number; static ɵfac: i0.ɵɵFactoryDeclaration<BytesPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<BytesPipe, "bytes", true>; } declare class ColorService { generateColor(data: string): Promise<string>; generateColorForDatapoint(fragment: string, series: string): Promise<string>; protected sha256(message: string): Promise<string>; protected stringToColor(str: string): string; static ɵfac: i0.ɵɵFactoryDeclaration<ColorService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ColorService>; } /** * The maximum pageSize used in API queries to c8y. */ declare const MAX_PAGE_SIZE = 2000; declare class PluginsResolveService { /** * Emits all injectors of already loaded plugins on subscription. */ injectors$: Observable<EnvironmentInjector | Injector>; /** * Emits once remotePlugins have been resolved. */ refresh$: Observable<void>; /** * Emits all plugin details of already loaded plugins on subscription. */ pluginDetails$: Observable<{ remoteNgModule: NgModuleRef<unknown> | Type<unknown>; moduleRef: NgModuleRef<unknown>; }>; allPluginsLoaded$: Observable<boolean>; loadedPluginNames$: Observable<string[]>; /** * Emits all contextPaths (including the corresponding version/tag, if provided) that have been already loaded on startup and further any newload loaded. */ contextPathsFromWhereRemotesHaveBeenLoaded$: Observable<string[]>; private _refresh$; private _allPluginsLoaded$; _contextPathsFromWhereRemotesHaveBeenLoaded$: BehaviorSubject<string[]>; _loadedPluginNames$: BehaviorSubject<string[]>; _injectors$: ReplaySubject<EnvironmentInjector | Injector>; _pluginDetails$: ReplaySubject<{ remoteNgModule: NgModuleRef<unknown> | Type<unknown>; moduleRef: NgModuleRef<unknown>; }>; constructor(); /** * Will refresh all current registered hooks. */ refreshHooks(): void; addInjector(injector: EnvironmentInjector | Injector): void; waitForPluginsToLoad(): Promise<void>; getAllInjectors(): Promise<(EnvironmentInjector | Injector)[]>; getAllInjectors$(): Observable<EnvironmentInjector | Injector>; getFromAllInjectors<T>(token: Type<T>, notFoundValue?: any): Observable<T>; markPluginsAsLoaded(): void; static ɵfac: i0.ɵɵFactoryDeclaration<PluginsResolveService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<PluginsResolveService>; } /** * A abstract state which should be included in each state. * @abstract */ declare abstract class StateService { /** * Saves the state. Should not be accessible directly. Use map or the getter to access * the state. Use functions in the implementation to change the state. */ protected abstract state$: BehaviorSubject<any> | any; /** * Should return the current state of this StateService */ abstract get state(): any; /** * Maps to a property and just returns that property. * @param mappedProperty The property to map to. */ map(mappedProperty: (stateProperty: any) => any): Observable<any>; /** * Emits a new state. */ protected emitNewState(): void; } declare function fromTrigger<T>(router: Router, refresh: Observable<any> | Observable<any>[], factories: Array<T | T[] | ExtensionFactory<T> | ExtensionFactory<T>[] | (() => T | ExtensionFactory<T> | Array<T | ExtensionFactory<T>>)>): Observable<T[]>; declare function fromTriggerOnce<T>(router: Router, refresh: Observable<any> | Observable<any>[], factories: Array<T | T[] | ExtensionFactory<T> | ExtensionFactory<T>[] | (() => T | ExtensionFactory<T> | Array<T | ExtensionFactory<T>>)>, withFirstEmpty?: boolean): Observable<T[]>; declare enum InjectionType { COMPONENT = 0, ROUTE = 1 } declare function getInjectedHooks<T>(token: InjectionToken<T[]>, injectors: Injector[], type?: InjectionType): () => T[]; declare function fromFactories<T>(factories?: Array<T | T[] | ExtensionFactory<T> | ExtensionFactory<T>[] | (() => T | ExtensionFactory<T> | Array<T | ExtensionFactory<T>>)>, router?: Router, withFirstEmpty?: boolean): Observable<T[]>; declare function resolveInjectedFactories<T>(factories: Array<T | T[] | ExtensionFactory<T> | ExtensionFactory<T>[] | (() => T | ExtensionFactory<T> | Array<T | ExtensionFactory<T>>)>): Array<T | T[] | ExtensionFactory<T>>; declare function stateToFactory<T>(componentsState: any): ExtensionFactory<T>; declare function sortByPriority<T>(items: T[]): T[]; declare function removeDuplicatesIds<T extends { id?: string; priority?: number; }>(items: T[]): T[]; declare function toObservableOfArrays<T>(factoryResult: T | T[] | Promise<T | T[]> | Observable<T | T[]>, withFirstEmpty: boolean): Observable<T[]>; declare function isPromise<T = any>(obj: any): obj is Promise<T>; declare function isExtensionFactory<T = any>(obj: any): obj is ExtensionFactory<T>; /** * Converts any value provided to an Observable that emits this value once and then completes. * A convenience method to represent all the data as Observables rather than * a mixture of Observables and other types. * * @param value The value the resulting Observable will emit. */ declare function toObservable<T>(value: T | Promise<T> | Observable<T>): Observable<T>; /** * Allows to extend the existing applications from a module. */ interface ExtensionFactory<T> { /** * Allows to resolve the data of an extension point. * The return value can be a Promise or Observable * (allowing for asynchronous data resolution). * * @param activatedRoute The current activated route (if possible to resolve). */ get(activatedRoute?: ActivatedRoute): Observable<T[] | T> | Promise<T[] | T> | T[] | T; } /** * Extension points allow to extend the application from * any module */ interface ExtensionPoint<T> { /** * Observable that emits of array of extensions active at any give time */ readonly items$: Observable<T[]>; /** * Additional factories that can be added dynamically. (without hook) */ factories: ExtensionFactory<T>[]; /** * Call the extension factories to refresh them. */ refresh(): any; } declare abstract class ExtensionPointWithoutStateForPlugins<T> implements ExtensionPoint<T> { items$: Observable<T[]>; factories: ExtensionFactory<T>[]; readonly refresh$: Observable<void>; /** * All injectors to search for an extension. */ protected injectors: Injector[]; private readonly refreshTrigger; constructor(rootInjector: Injector, pluginService: PluginsResolveService); /** * Refresh the extension factories */ refresh(): void; /** * Should be called within the constructor of the extending class and set the items$ attribute. */ protected abstract setupItemsObservable(): Observable<T[]>; } declare abstract class ExtensionPointForPlugins<T> extends StateService implements ExtensionPoint<T> { items$: Observable<T[]>; factories: ExtensionFactory<T>[]; readonly refresh$: Observable<void>; readonly state$: BehaviorSubject<Set<T>>; /** * All injectors to search for an extension. */ protected injectors: Injector[]; private readonly refreshTrigger; constructor(rootInjector: Injector, pluginService: PluginsResolveService); /** * Refresh the extension factories */ refresh(): void; /** * Should be called within the constructor of the extending class and set the items$ attribute. */ protected abstract setupItemsObservable(): Observable<T[]>; } /** * Helper function to get the activated route in * a service (as ActivatedRoute injection only * works in components). Works as long as we only use * a tree and no child is active at the same time. * * @param router The current router */ declare function getActivatedRoute(router: Router): ActivatedRoute; type GenericHookType<T> = T | T[] | Type<ExtensionFactory<T>>; type HookValueType<T> = T | T[] | Type<T>; /** * A generic function to be used by specific implementations of the HOOK concept. * @param items The items that should be provided under the `useValue` or `useClass` attribute. * Allows an extension factory to be passed as an argument, which can create instances of type T. * @param token The InjectionToken/HOOK to be provided. * @param options If this is a multi provider or not (defaults to true) and provider type definition (defaults to ClassProvider) - `HookOptions`. * @returns A `Provider` (either `ValueProvider` or `ClassProvider`) to be provided in a module. */ declare function hookGeneric<T>(items: GenericHookType<T> | HookValueType<T>, token: InjectionToken<T>, options?: Partial<GenericHookOptions>): ValueProvider | ClassProvider | ExistingProvider; interface GenericHookOptions { multi: boolean; providerType: HookProviderTypes; } declare enum HookProviderTypes { ExistingProvider = "ExistingProvider", ClassProvider = "ClassProvider" } declare function allEntriesAreEqual(previous: Array<unknown>, next: Array<unknown>): boolean; /** * @deprecated Consider using the `hookOptions` function instead. */ declare const HOOK_OPTIONS: InjectionToken<ExtensionFactory<ApplicationOptions>>; /** * You can either provide a single `ApplicationOptions` as parameter: * ```typescript * hookOptions(...) * ``` * * Or an array to directly register multiple: * ```typescript * hookOptions([...]) * ``` * * Or you provide an Service that implements `ExtensionFactory<ApplicationOptions>` * ```typescript * export class MyApplicationOptionsFactory implements ExtensionFactory<ApplicationOptions> {...} * ... * hookOptions(MyApplicationOptionsFactory) * ``` * A typed alternative to `HOOK_OPTIONS`. * @param options The `ApplicationOptions`'s or `ExtensionFactory` to be provided. * @returns An `Provider` to be provided in your module. */ declare function hookOptions(options: GenericHookType<ApplicationOptions>, hookOptions?: Partial<GenericHookOptions>): i0.ValueProvider | i0.ClassProvider | i0.ExistingProvider; /** * A service that allows to set or get application options * which configure the default behavior of the UI. */ declare class OptionsService extends ApplicationOptions { private systemOptionsService; private tenantOptionService; optionsUpdated$: Observable<void>; [key: string]: any; private _optionsUpdated$; constructor(options: any, systemOptionsService: SystemOptionsService, tenantOptionService: TenantOptionsService); /** * Returns an application option used to configure the UI. * @param optionKey The application options key. * @param defaultValue A value to return if non is set. * @param attemptParse Indicates whether the value should be parsed with JSON.parse. */ get<T extends keyof OptionsService>(optionKey: T, defaultValue?: OptionsService[T], attemptParse?: boolean): OptionsService[T]; /** * Returns an observable of an application option used to configure the UI. * @param optionKey The application options key. * @param defaultValue A value to return if non is set. * @param attemptParse Indicates whether the value should be parsed with JSON.parse. */ get$<T extends keyof OptionsService>(optionKey: T, defaultValue?: OptionsService[T], attemptParse?: boolean): Observable<OptionsService[T]>; /** * Sets an application option. * @param key The key to set. * @param value The value to set. */ set<T extends keyof OptionsService>(key: T, value: OptionsService[T]): void; /** * Deletes an application option. * @param key The key to remove. */ delete<T extends keyof OptionsService>(key: T): void; /** * Gets support URL from: * - application option: `supportUrl` * - or current tenant's option: `configuration / system.support.url` * - or current tenant's inherited option: `configuration / system.support.url` * - or system option: `configuration / system.support.url` * - otherwise defaults to: `false` * * @returns Returns support url or false. */ getSupportUrl(): Promise<string | boolean>; /** * Returns if the tenant allows to show the activate-support user menu entry. * Note: Only if system-level support-user/enabled is false we can activate it at tenant level. */ getActivateSupportUser(): Promise<boolean>; /** * Gets a value from the system service and parses it. * * @param category The category for this option. * @param key The key for that option. * @param defaultValue The default if the option was not found. */ getSystemOption<T = string>(category: string, key: string, defaultValue?: T): Promise<T | string>; /** * Gets a value from the tenant service and parses it. * * @param category The category for this option. * @param key The key for that option. * @param defaultValue The default if the option was not found. */ getTenantOption<T = string>(category: string, key: string, defaultValue?: T): Promise<T | string>; /** * Gets an inherited from parent value from the tenant service if inheritance supported based on given parameters. * * @param category The category for this option. * @param key The key for that option. * @param defaultValue The default if the option was not found. */ getInheritedTenantOption<T = string>(category: string, key: string, defaultValue?: T): Promise<T | string>; /** * Gets current tenant option value from the tenant service omitting the inheritance supported based on given parameters. * * @param category The category for this option. * @param key The key for that option. * @param defaultValue The default if the option was not found. */ getCurrentTenantOption<T = string>(category: string, key: string, defaultValue?: T): Promise<T | string>; private setupOptions; private applyOptions; private getOptionFromService; private parseOptionRawValue; static ɵfac: i0.ɵɵFactoryDeclaration<OptionsService, [{ optional: true; }, null, null]>; static ɵprov: i0.ɵɵInjectableDeclaration<OptionsService>; } declare const HOOK_CURRENT_USER: InjectionToken<IUser | ICurrentUser>; declare const HOOK_CURRENT_APPLICATION: InjectionToken<IApplication>; declare const HOOK_CURRENT_TENANT: InjectionToken<IApplication>; declare function hookCurrentUser(user: IUser | ICurrentUser): i0.ValueProvider | i0.ClassProvider | i0.ExistingProvider; declare function hookCurrentApplication(application: IApplication): i0.ValueProvider | i0.ClassProvider | i0.ExistingProvider; declare function hookCurrentTenant(tenant: ICurrentTenant): i0.ValueProvider | i0.ClassProvider | i0.ExistingProvider; declare function provideBootstrapMetadata(metadata: BootstrapMetaData): StaticProvider[]; declare class AppStateService extends StateService { private applicationService; apiService: ApiService; private options; private fetchClient; private tenantLoginOptionsService; /** * Saves the state. Should not be accessible directly. Use map or the getter to access * the state. Use functions in the implementation to change the state. */ state$: BehaviorSubject<any>; currentSupportUserName: BehaviorSubject<string | null>; currentUser: BehaviorSubject<IUser | ICurrentUser | null>; currentTenant: BehaviorSubject<ICurrentTenant | null>; currentApplication: BehaviorSubject<IApplication | null>; currentApplicationConfig: Observable<any>; /** * An Observable of the applications available for the current user. * The Observable emits a new array on user changes or if the application * performs POST, PUT or DELETE requests to the application API. */ currentAppsOfUser: Observable<IApplication[]>; constructor(applicationService: ApplicationService, apiService: ApiService, options: OptionsService, fetchClient: FetchClient, tenantLoginOptionsService: TenantLoginOptionsService, user?: IUser, application?: IApplication, tenant?: ICurrentTenant); assignApplicationKeyToDefaultHeaders(): void; /** * Returns the current state. */ get state(): any; getLangs(): any; /** * Returns the correct UI version. In hybrid mode for angular and ngx. */ get uiVersion(): any; /** * Dynamic options are stored on the API in a specific config: {} object. They can * be used to configure the app dynamically. * * Note: To avoids conflicts with the default Config, it is recommended * to use a certain namespace. */ updateCurrentApplicationConfig<T = ApplicationOptions>(config: T): Promise<T>; /** * When this function called, it refreshes the values of loginOptions stored within ui state object. * Function is throttled to execute the refresh once in a time specified by params of @throttled decorator, * it should be called on leading edge of the timeout. */ refreshLoginOptions(): Promise<void>; /** * Checks current users application list and matches it against given application name. * Returns true if application is in the list. * @param name application name */ isApplicationAvailable(name: string): Promise<boolean>; /** * Sets current user (including support user). * @param userInfo Info about current user and support user to be set. */ setUser(userInfo: { user: IUser | ICurrentUser; supportUserName?: string; }): void; /** * Verifies if the current application is owned by the current tenant. * @param app The application to verify. * @returns true if it belongs to the current tenant. */ isOwnerOfApplication(app?: IApplication): boolean; /** * Verifies if the current application is owned by the current tenant. * @param app The application to verify. * @returns true if it belongs to the current tenant. */ isOwnerOfApplication$(app?: IApplication): Observable<boolean>; loadDefaultOptions(): Promise<void>; protected currentAppsOfUser$(): Observable<IApplication[]>; /** * An Observable emitting once all POST, PUT, DELETE requests to the application API finished */ protected onAppChangesCompletion$(): Observable<void>; static ɵfac: i0.ɵɵFactoryDeclaration<AppStateService, [null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<AppStateService>; } interface DateFormatOptions { locale?: string; useUppercaseFormat?: boolean; } declare class DateFormatService { private appStateService; constructor(appStateService: AppStateService); /** * Returns date format pattern based on locale and formatting syntax. * * @param formattingOptions - Object containing formatting options * @returns A string containing the date format pattern for the specified locale */ getDateFormat(formattingOptions?: DateFormatOptions): string; /** * Determines whether a given locale should use 12-hour clock format with AM/PM. * * @param locale - The locale code (e.g., 'en', 'pl', 'en_US') * @returns boolean indicating whether meridian format (AM/PM) should be used */ shouldUseMeridianFormat(locale?: any): boolean; private isNonEmptyString; private isValidLocale; static ɵfac: i0.ɵɵFactoryDeclaration<DateFormatService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<DateFormatService>; } /** * The range of times supported by ECMAScript Date objects in milliseconds. * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.1 */ declare const ES_MAX_TIME_MILLISECONDS = 8640000000000000; /** * Formats a date value according to locale rules. If no other format specified it defaults to `medium` * used as standard date/time format. * * Extends Angular's DatePipe in a way so that date values exceeding the range supported by ECMAScript * are displayed as earliest/latest supported point in time printed in the desired format pre- or postfixed * by the word `before` or `after`, respectively. * In all other cases the pipe behaves as the standard [DatePipe](https://angular.io/api/common/DatePipe). * * ```html * <span class="highlight">{{ deadline | c8yDate }}</span> <!-- e.g. 7 May 2020, 17:45:19 (en-GB) or 07.05.2020, 17:45:19 (de) --> * <span>{{ lastUpdated | c8yDate: 'a h:MM:ss' }}</span> <!-- e.g. pm 5:45:19 --> * <span>{{ 8640000000000000 + 1 | c8yDate }}</span> <!-- e.g. after 13 Sep 275760, 03:00:00 --> * <span>{{ timestamp | c8yDate: 'adaptiveDate' }}</span> <!-- e.g. 2:45 PM for today's date or Oct 23, 2025 for other dates --> * ``` * * The `adaptiveDate` format type automatically selects the appropriate format based on the date: * - For dates from today: Uses the `shortTime` format (e.g., "2:45 PM") * - For all other dates: Uses the `mediumDate` format (e.g., "Oct 23, 2025") */ declare class DatePipe extends DatePipe$1 { private translateService; private appStateService?; private dateFormatService?; constructor(locale: string, translateService: TranslateService$1, appStateService?: AppStateService, dateFormatService?: DateFormatService, defaultTimezone?: string | null, defaultOptions?: DatePipeConfig | null); transform(value: any, format?: string, timezone?: string, locale?: string): any; static ɵfac: i0.ɵɵFactoryDeclaration<DatePipe, [null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>; static ɵpipe: i0.ɵɵPipeDeclaration<DatePipe, "c8yDate", true>; } interface AssetTypeChildEntry { id: string; isRequired: boolean; } interface AssetTypeIcon { category: string; name: string; } interface AssetType extends IManagedObject { c8y_IsAssetType: { properties?: AssetTypeChildEntry[]; allowedAssetTypes?: AssetTypeChildEntry[]; icon?: AssetTypeIcon; }; } declare class RealtimeMessage<T> { id: string; channel: string; realtimeAction: RealtimeAction; data: T | number; } type RealtimeAction = 'UPDATE' | 'DELETE' | 'CREATE'; /** * Service (providedIn root) that ensures to only create a single realtime subscription for each channel */ declare class RealtimeSubjectService { protected realtime: Realtime; reconnect$: Observable<void>; connectionStatus$: Observable<'connected' | 'disconnected'>; private subjects$; constructor(realtime: Realtime); getObservableForChannel<T>(channel: string): Observable<RealtimeMessage<T>>; protected createObservableForChannel<T>(channel: string, realtime: Realtime): Observable<RealtimeMessage<T>>; protected createObservableForReconnect(): Observable<void>; protected createObservableForConnectionStatus(): Observable<"connected" | "disconnected">; static ɵfac: i0.ɵɵFactoryDeclaration<RealtimeSubjectService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RealtimeSubjectService>; } /** * AssetTypesRealtimeService is being used to manage a cache of all existing asset types. * This service is injected in the AssetOverviewNavigationFactory class, which will trigger * the initialization of the cache as the constructor is called. */ declare class AssetTypesRealtimeService { private inventory; private appStateService; private realtimeSubject; private readonly DEFAULT_ASSET_ICON; private readonly assetTypes$; private readonly refreshTrigger; private managedObjectRealtimeService; constructor(inventory: InventoryService, appStateService: AppStateService, realtimeSubject: RealtimeSubjectService); /** * Returns an asset type from the cache based on the unique name property. * @param name Name of the asset type. * @returns IManagedObject which represents the asset type. */ getAssetTypeByName$(name: string): Observable<AssetType>; /** * Returns an asset type from the cache based on the id. * @param assetTypeId Id of the asset type. * @returns IManagedObject which represents the asset type. */ getAssetTypeById$(assetTypeId: string): Observable<AssetType>; /** * Returns all the available asset types from the cache. * @returns available asset types. */ getAssetTypesCache$(): Observable<Record<string, AssetType>>; /** * Extracts an icon from an asset type. * @param type Type of the asset type. * @returns Returns an icon for a given asset type. */ getIcon$(type: string): Observable<string>; /** * Refreshes the asset types cache */ refreshCache(): void; private initAssetTypes$; /** * Queries available asset types and adds every asset type to the local cache. * @returns available asset types. */ private getAssetTypes; private getAssetTypes$; /** * Validates whether the MO to update local asset types cache is already present. * If present, the MO gets subscribed for future updates. * else, the MO will not be subscribed */ private subscribeToCacheInvalidatorUpdates$; /** * Gets the MO that is used to update the local asset types cache. * @returns the id of the MO that has 'c8yAssetTypesCacheInvalidator' fragment, or 'null' */ private getAssetTypesCacheInvalidator; static ɵfac: i0.ɵɵFactoryDeclaration<AssetTypesRealtimeService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<AssetTypesRealtimeService>; } declare const MO_TYPES: readonly ["asset", "dynamicGroup", "brokerSource", "brokerSourceInactive", "group", "other"]; type MoTypes = (typeof MO_TYPES)[number]; type AssetTypes = Omit<MoTypes, 'brokerSource' | 'brokerSourceInactive'>; /** * Enumerates the supported asset paths. */ declare enum ASSET_PATH { /** * The default asset path. */ DEFAULT = "group", /** * The asset path for devices. */ DEVICE = "device" } /** * Asset paths. */ type AssetPath = `${ASSET_PATH}`; declare class GroupService { private assetTypesRealtimeService; readonly icons: { readonly brokerSourceInactive: { readonly icon: "c8y-group-remote-inactive"; readonly iconOpen: "c8y-group-remote-inactive"; }; readonly brokerSource: { readonly icon: "c8y-group-remote"; readonly iconOpen: "c8y-group-remote-open"; }; readonly group: { readonly icon: "c8y-group"; readonly iconOpen: "c8y-group-open"; }; readonly dynamicGroup: { readonly icon: "c8y-group-smart"; readonly iconOpen: "c8y-group-smart-open"; }; readonly other: { readonly icon: "exchange"; readonly iconClass: "statusUnknown"; }; }; /** * A mapping of managed object types to their corresponding asset path. */ assetPaths: Map<AssetTypes, AssetPath>; dataBrokerSourceFragmentInactive: string; constructor(assetTypesRealtimeService: AssetTypesRealtimeService); /** * Finds an icon based on the contents of a managed object. * It takes into account factors such as type, and specific fragments. * @param mo Managed object to be checked. * @param open Determines whether the method should return an alternative icon showing the open state. * @param fallbackIcon If no icon is found, this icon is returned. * @returns Returns an icon. */ getIcon(mo: IManagedObject, open?: boolean, fallbackIcon?: string): Promise<string>; /** * Checks whether a given managed object is a group. * @param mo Ma