@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
216 lines (205 loc) • 12.1 kB
JavaScript
import * as i0 from '@angular/core';
import { Component, inject } from '@angular/core';
import * as i1 from '@c8y/ngx-components';
import { CommonModule, BaseColumn, DeviceStatusComponent, C8yTranslatePipe } from '@c8y/ngx-components';
import * as i3 from 'ngx-bootstrap/tooltip';
import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { gettext } from '@c8y/ngx-components/gettext';
import * as i2 from '@angular/router';
import { RouterModule } from '@angular/router';
import { InventoryService } from '@c8y/client';
import * as i2$1 from '@angular/common';
import { OPERATION_STATUS_OPTIONS_MAP } from '@c8y/ngx-components/operations/shared';
class CreationTimeCellRendererComponent {
constructor(context) {
this.context = context;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: CreationTimeCellRendererComponent, deps: [{ token: i1.CellRendererContext }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: CreationTimeCellRendererComponent, isStandalone: true, selector: "c8y-creation-time-cell-renderer", ngImport: i0, template: `<small class="icon-flex text-muted">
<i class="m-r-4" c8yIcon="calendar"></i>
{{ context.item.creationTime | c8yDate }}
</small>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "pipe", type: i1.DatePipe, name: "c8yDate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: CreationTimeCellRendererComponent, decorators: [{
type: Component,
args: [{
template: `<small class="icon-flex text-muted">
<i class="m-r-4" c8yIcon="calendar"></i>
{{ context.item.creationTime | c8yDate }}
</small>`,
selector: 'c8y-creation-time-cell-renderer',
standalone: true,
imports: [CommonModule, TooltipModule]
}]
}], ctorParameters: () => [{ type: i1.CellRendererContext }] });
class CreationTimeGridColumn extends BaseColumn {
constructor(initialColumnConfig) {
super(initialColumnConfig);
this.name = 'creationTime';
this.path = 'creationTime';
this.header = gettext('Creation time');
this.cellRendererComponent = CreationTimeCellRendererComponent;
this.filterable = false;
this.sortable = false;
}
}
class DeviceCellRendererComponent {
constructor(context) {
this.context = context;
this.inventoryService = inject(InventoryService);
}
async ngOnInit() {
this.device = (await this.inventoryService.detail(this.context.item.deviceId))?.data;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: DeviceCellRendererComponent, deps: [{ token: i1.CellRendererContext }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: DeviceCellRendererComponent, isStandalone: true, selector: "c8y-operation-device-cell-renderer", ngImport: i0, template: `
<span class="m-r-4">
<device-status [mo]="device || {}"></device-status>
</span>
<a
class="interact"
[title]="context.item.deviceName"
[routerLink]="['/device', context.item.deviceId, 'device-info']"
>
{{ context.item.deviceName }}
</a>
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: DeviceStatusComponent, selector: "device-status, c8y-device-status", inputs: ["mo", "size"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: DeviceCellRendererComponent, decorators: [{
type: Component,
args: [{
template: `
<span class="m-r-4">
<device-status [mo]="device || {}"></device-status>
</span>
<a
class="interact"
[title]="context.item.deviceName"
[routerLink]="['/device', context.item.deviceId, 'device-info']"
>
{{ context.item.deviceName }}
</a>
`,
selector: 'c8y-operation-device-cell-renderer',
standalone: true,
imports: [CommonModule, RouterModule, DeviceStatusComponent]
}]
}], ctorParameters: () => [{ type: i1.CellRendererContext }] });
class DeviceGridColumn extends BaseColumn {
constructor(initialColumnConfig) {
super(initialColumnConfig);
this.name = 'deviceName';
this.path = 'deviceName';
this.header = gettext('Device');
this.cellRendererComponent = DeviceCellRendererComponent;
this.filterable = false;
this.sortable = false;
}
}
class FailureReasonCellRendererComponent {
constructor(context) {
this.context = context;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: FailureReasonCellRendererComponent, deps: [{ token: i1.CellRendererContext }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: FailureReasonCellRendererComponent, isStandalone: true, selector: "c8y-failure-reason-cell-renderer", ngImport: i0, template: ` <div class="d-flex">
<span class="text-truncate" #failureReason>
{{ context.value | translate }}
</span>
<button
class="btn-help btn-help--sm"
[attr.aria-label]="'Help' | translate"
[tooltip]="context.value | translate"
placement="left"
container="body"
type="button"
*ngIf="failureReason.offsetWidth < failureReason.scrollWidth"
>
<i [c8yIcon]="'info-circle'"></i>
</button>
</div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: FailureReasonCellRendererComponent, decorators: [{
type: Component,
args: [{
template: ` <div class="d-flex">
<span class="text-truncate" #failureReason>
{{ context.value | translate }}
</span>
<button
class="btn-help btn-help--sm"
[attr.aria-label]="'Help' | translate"
[tooltip]="context.value | translate"
placement="left"
container="body"
type="button"
*ngIf="failureReason.offsetWidth < failureReason.scrollWidth"
>
<i [c8yIcon]="'info-circle'"></i>
</button>
</div>`,
selector: 'c8y-failure-reason-cell-renderer',
standalone: true,
imports: [CommonModule, TooltipModule]
}]
}], ctorParameters: () => [{ type: i1.CellRendererContext }] });
class FailureReasonGridColumn extends BaseColumn {
constructor(initialColumnConfig) {
super(initialColumnConfig);
this.name = 'failureReason';
this.path = 'failureReason';
this.header = gettext('Failure reason');
this.cellRendererComponent = FailureReasonCellRendererComponent;
this.filterable = false;
this.sortable = false;
}
}
class StatusCellRendererComponent {
constructor(context) {
this.context = context;
this.OPERATION_STATUS_OPTIONS_MAP = OPERATION_STATUS_OPTIONS_MAP;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: StatusCellRendererComponent, deps: [{ token: i1.CellRendererContext }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: StatusCellRendererComponent, isStandalone: true, selector: "c8y-operation-status-cell-renderer", ngImport: i0, template: `
<i
[c8yIcon]="OPERATION_STATUS_OPTIONS_MAP[context.item.status].icon"
style="font-size: 20px"
[tooltip]="context.item.status.toString() | translate"
container="body"
[ngClass]="OPERATION_STATUS_OPTIONS_MAP[context.item.status].styleClass"
></i>
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: StatusCellRendererComponent, decorators: [{
type: Component,
args: [{
template: `
<i
[c8yIcon]="OPERATION_STATUS_OPTIONS_MAP[context.item.status].icon"
style="font-size: 20px"
[tooltip]="context.item.status.toString() | translate"
container="body"
[ngClass]="OPERATION_STATUS_OPTIONS_MAP[context.item.status].styleClass"
></i>
`,
selector: 'c8y-operation-status-cell-renderer',
standalone: true,
imports: [CommonModule, RouterModule, C8yTranslatePipe, TooltipModule]
}]
}], ctorParameters: () => [{ type: i1.CellRendererContext }] });
class OperationStatusGridColumn extends BaseColumn {
constructor(initialColumnConfig) {
super(initialColumnConfig);
this.name = 'status';
this.path = 'status';
this.header = gettext('Status');
this.cellRendererComponent = StatusCellRendererComponent;
this.filterable = false;
this.sortable = false;
this.gridTrackSize = '76px';
}
}
/**
* Generated bundle index. Do not edit.
*/
export { CreationTimeCellRendererComponent, CreationTimeGridColumn, DeviceCellRendererComponent, DeviceGridColumn, FailureReasonCellRendererComponent, FailureReasonGridColumn, OperationStatusGridColumn, StatusCellRendererComponent };
//# sourceMappingURL=c8y-ngx-components-operations-grid-columns.mjs.map