@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
61 lines (56 loc) • 5.56 kB
JavaScript
import * as i0 from '@angular/core';
import { Input, Component, NgModule } from '@angular/core';
import * as i1 from '@c8y/client';
import { NgIf, NgPlural, NgPluralCase } from '@angular/common';
import { C8yTranslateDirective, C8yTranslatePipe } from '@c8y/ngx-components';
class OperationSummaryComponent {
set deviceQueryString(query) {
this.displayDeviceCount = true;
const filters = {
q: query || '',
pageSize: 1,
currentPage: 1,
withTotalPages: true
};
this.inventoryService
.list(filters)
.then((result) => (this.deviceCount = result.paging.totalPages));
}
constructor(inventoryService) {
this.inventoryService = inventoryService;
this.deviceCount = 0;
this.displayDeviceCount = false;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OperationSummaryComponent, deps: [{ token: i1.InventoryService }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: OperationSummaryComponent, isStandalone: true, selector: "c8y-operation-summary", inputs: { name: "name", description: "description", deviceQueryString: "deviceQueryString" }, ngImport: i0, template: "<div class=\"d-flex\">\n <div class=\"p-l-0 col-xs-12 col-sm-6\">\n <h4>{{ name | translate }}</h4>\n <p class=\"text-muted m-b-8\">\n {{ description | translate }}\n </p>\n </div>\n <div class=\"p-r-0 text-right col-xs-12 col-sm-6\">\n <span\n [ngPlural]=\"deviceCount\"\n *ngIf=\"displayDeviceCount && deviceCount !== undefined && deviceCount !== null\"\n >\n <ng-template ngPluralCase=\"=0\">\n <span\n class=\"label label-default\"\n translate\n >\n No devices selected\n </span>\n </ng-template>\n <ng-template ngPluralCase=\"=1\">\n <span class=\"badge badge-info m-r-4\">1</span>\n <span translate>device selected</span>\n </ng-template>\n <ng-template ngPluralCase=\"other\">\n <span class=\"badge badge-info m-r-4\">{{ deviceCount }}</span>\n <span translate>devices selected</span>\n </ng-template>\n </span>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgPlural, selector: "[ngPlural]", inputs: ["ngPlural"] }, { kind: "directive", type: NgPluralCase, selector: "[ngPluralCase]" }, { kind: "directive", type: C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OperationSummaryComponent, decorators: [{
type: Component,
args: [{ selector: 'c8y-operation-summary', imports: [NgIf, NgPlural, NgPluralCase, C8yTranslateDirective, C8yTranslatePipe], template: "<div class=\"d-flex\">\n <div class=\"p-l-0 col-xs-12 col-sm-6\">\n <h4>{{ name | translate }}</h4>\n <p class=\"text-muted m-b-8\">\n {{ description | translate }}\n </p>\n </div>\n <div class=\"p-r-0 text-right col-xs-12 col-sm-6\">\n <span\n [ngPlural]=\"deviceCount\"\n *ngIf=\"displayDeviceCount && deviceCount !== undefined && deviceCount !== null\"\n >\n <ng-template ngPluralCase=\"=0\">\n <span\n class=\"label label-default\"\n translate\n >\n No devices selected\n </span>\n </ng-template>\n <ng-template ngPluralCase=\"=1\">\n <span class=\"badge badge-info m-r-4\">1</span>\n <span translate>device selected</span>\n </ng-template>\n <ng-template ngPluralCase=\"other\">\n <span class=\"badge badge-info m-r-4\">{{ deviceCount }}</span>\n <span translate>devices selected</span>\n </ng-template>\n </span>\n </div>\n</div>\n" }]
}], ctorParameters: () => [{ type: i1.InventoryService }], propDecorators: { name: [{
type: Input
}], description: [{
type: Input
}], deviceQueryString: [{
type: Input
}] } });
/**
* This module provides a component for displaying the summary of given bulk operation.
*/
class OperationSummaryModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OperationSummaryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: OperationSummaryModule, imports: [OperationSummaryComponent], exports: [OperationSummaryComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OperationSummaryModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OperationSummaryModule, decorators: [{
type: NgModule,
args: [{
imports: [OperationSummaryComponent],
exports: [OperationSummaryComponent]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { OperationSummaryComponent, OperationSummaryModule };
//# sourceMappingURL=c8y-ngx-components-operations-operation-summary.mjs.map