UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

349 lines (322 loc) 20.2 kB
import * as i1 from '@c8y/ngx-components'; import { CellRendererContext, BaseColumn, ColumnConfig, FilteringFormRendererContext, ServerSideDataResult, FilteringModifier, BuiltInActionType, ExtensionFactory, DataGridService, AlertService, ModalService, UserPreferencesService, InventorySearchService, Column, Pagination, BulkActionControl, HeaderActionControl, GridConfig, ProductExperienceEventSource, LoadMoreMode, ActionControl, ServerSideDataCallback, DataGridComponent, ProductExperienceEvent, DataSourceModifier, FilteringActionType } from '@c8y/ngx-components'; import * as _c8y_client from '@c8y/client'; import { IManagedObject, InventoryService, UserService } from '@c8y/client'; import { TranslateService } from '@ngx-translate/core'; import * as i0 from '@angular/core'; import { OnInit, ElementRef, OnDestroy, EventEmitter } from '@angular/core'; import { SupportedIcons } from '@c8y/ngx-components/icon-selector/icons'; import { Observable } from 'rxjs'; import * as i2 from '@c8y/ngx-components/assets-navigator'; import * as i3 from 'ngx-bootstrap/popover'; import * as i4 from '@angular/router'; /** * Service contains logic extracted from the device-grid service to avoid circular dependency MTM-40239. */ declare class ColumnUtilService { protected translateService: TranslateService; constructor(translateService: TranslateService); getAlarmsHref(device: IManagedObject): string; getHref(groupOrDevice: IManagedObject, prefix?: string): string; getParentsNames(device: IManagedObject, featuredParentId?: string | number): string; getModel(device: IManagedObject): string; getProperName(device: IManagedObject): string; getSerialNumber(device: IManagedObject): string; private getHardware; static ɵfac: i0.ɵɵFactoryDeclaration<ColumnUtilService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ColumnUtilService>; } declare class AlarmsCellRendererComponent { context: CellRendererContext; columnUtilService: ColumnUtilService; readonly linkAriaLabel: "See alarms for device \"{{ name }}\""; constructor(context: CellRendererContext, columnUtilService: ColumnUtilService); static ɵfac: i0.ɵɵFactoryDeclaration<AlarmsCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<AlarmsCellRendererComponent, "c8y-alarms-cell-renderer", never, {}, {}, never, never, true, never>; } declare class AlarmsDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class AlarmsHeaderCellRendererComponent { context: CellRendererContext; constructor(context: CellRendererContext); static ɵfac: i0.ɵɵFactoryDeclaration<AlarmsHeaderCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<AlarmsHeaderCellRendererComponent, "c8y-alarms-header-cell-renderer", never, {}, {}, never, never, true, never>; } declare class GroupCellRendererComponent { context: CellRendererContext; columnUtilService: ColumnUtilService; constructor(context: CellRendererContext, columnUtilService: ColumnUtilService); static ɵfac: i0.ɵɵFactoryDeclaration<GroupCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<GroupCellRendererComponent, "c8y-group-cell-renderer", never, {}, {}, never, never, true, never>; } declare class GroupDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class GroupFilteringFormRendererComponent implements OnInit { context: FilteringFormRendererContext; assetSelector: ElementRef; model: any; preselected: string[]; initialSelection: string[]; isApplyDisabled: boolean; constructor(context: FilteringFormRendererContext); onEnterKeyUp(event: KeyboardEvent): void; onEscapeKeyDown(event: KeyboardEvent): void; ngOnInit(): void; ngAfterViewInit(): void; applyFilter(): void; resetFilter(): void; selectionChanged(nodes: any): void; private isSelectionChanged; static ɵfac: i0.ɵɵFactoryDeclaration<GroupFilteringFormRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<GroupFilteringFormRendererComponent, "ng-component", never, {}, {}, never, never, true, never>; } declare class ImeiDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class ModelCellRendererComponent { context: CellRendererContext; columnUtilService: ColumnUtilService; constructor(context: CellRendererContext, columnUtilService: ColumnUtilService); static ɵfac: i0.ɵɵFactoryDeclaration<ModelCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ModelCellRendererComponent, "c8y-model-cell-renderer", never, {}, {}, never, never, true, never>; } declare class ModelDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class NameCellRendererComponent { context: CellRendererContext; columnUtilService: ColumnUtilService; constructor(context: CellRendererContext, columnUtilService: ColumnUtilService); static ɵfac: i0.ɵɵFactoryDeclaration<NameCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NameCellRendererComponent, "c8y-name-cell-renderer", never, {}, {}, never, never, true, never>; } declare class NameDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class RegistrationDateCellRendererComponent { context: CellRendererContext; constructor(context: CellRendererContext); static ɵfac: i0.ɵɵFactoryDeclaration<RegistrationDateCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<RegistrationDateCellRendererComponent, "c8y-registration-date-cell-renderer", never, {}, {}, never, never, true, never>; } declare class RegistrationDateDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); protected formatDate(dateToFormat: string): string; } declare class SerialNumberCellRendererComponent { context: CellRendererContext; columnUtilService: ColumnUtilService; constructor(context: CellRendererContext, columnUtilService: ColumnUtilService); static ɵfac: i0.ɵɵFactoryDeclaration<SerialNumberCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<SerialNumberCellRendererComponent, "c8y-serial-number-cell-renderer", never, {}, {}, never, never, true, never>; } declare class SerialNumberDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class DeviceStatusCellRendererComponent { context: CellRendererContext; constructor(context: CellRendererContext); static ɵfac: i0.ɵɵFactoryDeclaration<DeviceStatusCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<DeviceStatusCellRendererComponent, "c8y-device-status-cell-renderer", never, {}, {}, never, never, true, never>; } declare class StatusDeviceGridColumn extends BaseColumn { constructor(); } declare class SystemIdDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class TypeDeviceGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare class IconDeviceGridColumnComponent { icon: SupportedIcons; constructor(context: CellRendererContext); static ɵfac: i0.ɵɵFactoryDeclaration<IconDeviceGridColumnComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<IconDeviceGridColumnComponent, "c8y-icon-device-grid-column", never, {}, {}, never, never, true, never>; } declare class IconDeviceGridColumn extends BaseColumn { iconRetriever?: (context: CellRendererContext) => SupportedIcons; constructor(options?: Partial<BaseColumn>, iconRetriever?: (context: CellRendererContext) => SupportedIcons); } type DataCallback = (serverSideDataResult: ServerSideDataResult) => ServerSideDataResult; interface FilterConfig { columnName: string; filteringModifier: FilteringModifier; } declare const enum DeviceGridActionType { Delete = "DELETE" } declare const enum DeviceGridBulkActionType { } /** * Defines an action hook for the device grid. * * @interface DeviceGridActionHook * @member {BuiltInActionType} type of the action * @member {boolean} refreshAfterActionDone refreshs the device grid after the action execution * @member {(mo: IManagedObject) => boolean} deviceMatches resolves the object of the row and needs to return true for an element that you want to execute your action on * ```typescript * { * ... * deviceMatches: (device: IManagedObject) => device?.type === 'my_custom_type' * } * ``` * @member {(mo: IManagedObject) => Observable<unknown> | Promise<unknown> | unknown} onAction is called for a matching device. It resolves the object of the row. * ```typescript * { * ... * onAction: (device: IManagedObject) => this.myService.triggerCustomAction(device) * } * ``` * * @deprecated Use `ActionControlHook` instead. */ interface DeviceGridActionHook { type: BuiltInActionType | string; text?: string; icon?: string; showOnHover?: boolean; refreshAfterActionDone: boolean; deviceMatches: (mo: IManagedObject) => boolean; onAction: (mo: IManagedObject) => Observable<unknown> | Promise<unknown> | unknown; } /** * @deprecated Use `ActionControlFactory` instead. */ type DeviceGridExtensionFactory = ExtensionFactory<DeviceGridActionHook>; declare class DeviceGridService extends DataGridService { protected inventoryService: InventoryService; protected userService: UserService; protected translateService: TranslateService; protected alertService: AlertService; protected modal: ModalService; protected columnUtilService: ColumnUtilService; protected userPreferencesService: UserPreferencesService; protected searchService: InventorySearchService; protected GRID_CONFIG_DEFAULT_STORAGE_KEY: string; constructor(inventoryService: InventoryService, userService: UserService, translateService: TranslateService, alertService: AlertService, modal: ModalService, columnUtilService: ColumnUtilService, userPreferencesService: UserPreferencesService, searchService: InventorySearchService); getDefaultColumns(): Column[]; getChildDeviceGridColumns(): Column[]; getDefaultPagination(): Pagination; getInfiniteScrollPagination(): Pagination; getDefaultBulkActionControls(): BulkActionControl[]; getDefaultHeaderActionControls(): HeaderActionControl[]; getProperName(device: IManagedObject): string; getModel(device: IManagedObject): string; getSerialNumber(device: IManagedObject): string; getParentsNames(device: IManagedObject, featuredParentId?: string | number): string; getHref(groupOrDevice: IManagedObject, prefix?: string): string; getAlarmsHref(device: IManagedObject): string; delete(device: IManagedObject): Promise<void>; getData(columns: Column[], pagination: Pagination, query?: any, withChildren?: boolean, text?: any): Promise<_c8y_client.IResultList<IManagedObject>>; getChildDeviceData(columns: Column[], pagination: Pagination, query: any, withChildren: boolean, id: string): Promise<_c8y_client.IResultList<IManagedObject>>; getCount(columns: Column[], pagination: Pagination, query?: any, text?: string): Promise<number>; getCountChildDevices(columns: Column[], pagination: Pagination, query: any, id: string): Promise<number>; getTotalChildDevices(query: any, id: string): Promise<number>; getTotal(query?: any): Promise<number>; getDeviceQueryString(columns: Column[], query: any, text: string, isWildcardSearchEnabled: boolean): string; clearConfig(key?: string): void; getConfig$(key?: string): Observable<GridConfig>; saveConfig$(config: GridConfig, key?: string): Observable<GridConfig>; private getDevicesFilters; static ɵfac: i0.ɵɵFactoryDeclaration<DeviceGridService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<DeviceGridService>; } declare class DeviceGridComponent implements OnDestroy, ProductExperienceEventSource { deviceGridService: DeviceGridService; /** Optional callback function that allows to modify server side data result before it's rendered. */ dataCallback: DataCallback; /** Takes an event emitter. When an event is emitted, the grid will be reloaded. */ refresh: EventEmitter<void>; /** The title for the data grid, it's displayed in the grid's header. */ title: string; /** The label for load more button. */ loadMoreItemsLabel: "Load more devices"; /** The label for loading indicator. */ loadingItemsLabel: string; /** * @deprecated * * Internal use only: used to define user preferences key under which 'All devices' column config is stored. */ legacyConfigKey: string; /** * @deprecated * * Internal use only: used to define user preferences key under which 'All devices' filter/sorting config is stored. */ legacyFilterKey: string; /** The list of columns to be displayed in the grid. If not given, it defaults to standard columns. */ columns: Column[]; /** Pagination settings, e.g. allows for setting current page or page size. If not given, defaults to standard settings. */ set _pagination(value: Pagination); infiniteScroll: LoadMoreMode; /** Sets load more mode. */ set _infiniteScroll(infiniteScroll: LoadMoreMode); /** Sets action controls (actions available for individual items). If not given, it defaults to standard actions. */ set _actionControls(value: ActionControl[]); /** Determines whether items can be selected by clicking a checkbox in the first column. */ selectable: boolean; /** Restricts selection to a single row only. Selection column displays radio button instead of checkboxes */ singleSelection: boolean; /** Sets the base query which is appended to the request for data. */ baseQuery: object; /** Sets bulk action controls (actions available for items selected by user). If not given, it defaults to standard bulk actions. */ set _bulkActionControls(value: BulkActionControl[]); /** Sets header action controls (actions available from the grid header). If not given, it defaults to empty list of actions. */ set _headerActionControls(value: HeaderActionControl[]); childDeviceGrid: boolean; parentDeviceId: string; /** Sets the withChildren query which is appended to the request. */ withChildren: boolean; /** * Enables the search for devices where any device propery is matched agains the search term. * Enabled by default. This input does not take effect if the <code>childDeviceGrid</code> input is set to <code>true</code> */ showSearch: boolean; /** * Sets the class name used for active rows (last clicked). * Set empty string to disable appending active class to grid rows. */ activeClassName: string; /** Emits an event when columns configuration changes. */ onColumnsChange: EventEmitter<Column[]>; onFilterChange: EventEmitter<FilterConfig[]>; onDeviceQueryStringChange: EventEmitter<string>; /** Emits an event when items selection changes. The array contains ids of selected items. */ itemsSelect: EventEmitter<string[]>; actionControls: ActionControl[]; appliedFilters: FilterConfig[]; pagination: Pagination; bulkActionControls: BulkActionControl[]; headerActionControls: HeaderActionControl[]; serverSideDataCallback: ServerSideDataCallback; dataGrid: DataGridComponent; productExperienceEvent: ProductExperienceEvent; noResultsMessage: "No matching devices."; noDataMessage: "No devices to display."; noResultsSubtitle: "Refine your search terms"; private destroyed$; constructor(deviceGridService: DeviceGridService); ngOnDestroy(): void; trackByName(_index: any, column: Column): string; onDataSourceModifier(dataSourceModifier: DataSourceModifier): Promise<ServerSideDataResult>; updateFiltering(columnNames: string[], action: { type: FilteringActionType; payload?: { filteringModifier: FilteringModifier; }; }): void; static ɵfac: i0.ɵɵFactoryDeclaration<DeviceGridComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<DeviceGridComponent, "c8y-device-grid", never, { "dataCallback": { "alias": "dataCallback"; "required": false; }; "refresh": { "alias": "refresh"; "required": false; }; "title": { "alias": "title"; "required": false; }; "loadMoreItemsLabel": { "alias": "loadMoreItemsLabel"; "required": false; }; "loadingItemsLabel": { "alias": "loadingItemsLabel"; "required": false; }; "legacyConfigKey": { "alias": "legacyConfigKey"; "required": false; }; "legacyFilterKey": { "alias": "legacyFilterKey"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "_pagination": { "alias": "pagination"; "required": false; }; "_infiniteScroll": { "alias": "infiniteScroll"; "required": false; }; "_actionControls": { "alias": "actionControls"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "singleSelection": { "alias": "singleSelection"; "required": false; }; "baseQuery": { "alias": "baseQuery"; "required": false; }; "_bulkActionControls": { "alias": "bulkActionControls"; "required": false; }; "_headerActionControls": { "alias": "headerActionControls"; "required": false; }; "childDeviceGrid": { "alias": "childDeviceGrid"; "required": false; }; "parentDeviceId": { "alias": "parentDeviceId"; "required": false; }; "withChildren": { "alias": "withChildren"; "required": false; }; "showSearch": { "alias": "showSearch"; "required": false; }; "activeClassName": { "alias": "activeClassName"; "required": false; }; }, { "onColumnsChange": "onColumnsChange"; "onFilterChange": "onFilterChange"; "onDeviceQueryStringChange": "onDeviceQueryStringChange"; "itemsSelect": "itemsSelect"; }, never, never, true, never>; } declare class DeviceGridModule { static ɵfac: i0.ɵɵFactoryDeclaration<DeviceGridModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<DeviceGridModule, never, [typeof i1.CommonModule, typeof i1.FormsModule, typeof i1.DeviceStatusModule, typeof i1.DataGridModule, typeof i2.AssetSelectorModule, typeof i1.DynamicFormsModule, typeof i3.PopoverModule, typeof i4.RouterModule, typeof i1.ProductExperienceModule, typeof DeviceGridComponent, typeof GroupFilteringFormRendererComponent, typeof DeviceStatusCellRendererComponent, typeof NameCellRendererComponent, typeof ModelCellRendererComponent, typeof SerialNumberCellRendererComponent, typeof GroupCellRendererComponent, typeof RegistrationDateCellRendererComponent, typeof AlarmsCellRendererComponent, typeof AlarmsHeaderCellRendererComponent], [typeof DeviceGridComponent, typeof GroupFilteringFormRendererComponent, typeof DeviceStatusCellRendererComponent, typeof NameCellRendererComponent, typeof ModelCellRendererComponent, typeof SerialNumberCellRendererComponent, typeof GroupCellRendererComponent, typeof RegistrationDateCellRendererComponent, typeof AlarmsCellRendererComponent, typeof AlarmsHeaderCellRendererComponent]>; static ɵinj: i0.ɵɵInjectorDeclaration<DeviceGridModule>; } export { AlarmsCellRendererComponent, AlarmsDeviceGridColumn, AlarmsHeaderCellRendererComponent, ColumnUtilService, DeviceGridActionType, DeviceGridBulkActionType, DeviceGridComponent, DeviceGridModule, DeviceGridService, DeviceStatusCellRendererComponent, GroupCellRendererComponent, GroupDeviceGridColumn, GroupFilteringFormRendererComponent, IconDeviceGridColumn, IconDeviceGridColumnComponent, ImeiDeviceGridColumn, ModelCellRendererComponent, ModelDeviceGridColumn, NameCellRendererComponent, NameDeviceGridColumn, RegistrationDateCellRendererComponent, RegistrationDateDeviceGridColumn, SerialNumberCellRendererComponent, SerialNumberDeviceGridColumn, StatusDeviceGridColumn, SystemIdDeviceGridColumn, TypeDeviceGridColumn }; export type { DataCallback, DeviceGridActionHook, DeviceGridExtensionFactory, FilterConfig }; //# sourceMappingURL=index.d.ts.map