sub-assets/asset-properties-item.component.ts
selector | c8y-asset-properties-item |
templateUrl | ./asset-properties-item.component.html |
Properties |
|
Methods |
|
Inputs |
constructor(alert: AlertService, c8yJsonSchemaService: C8yJSONSchema, filesService: FilesService)
|
||||||||||||
Parameters :
|
complex |
Type : AssetPropertiesItem[]
|
file |
Type : IManagedObjectBinary
|
isEdit |
Type : boolean
|
jsonSchema |
Type : JSONSchema7
|
key |
Type : string
|
label |
Type : string
|
type |
Type : string
|
value |
Type : any
|
Async ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
Returns :
Promise<void>
|
fields |
Type : FormlyFieldConfig[]
|
Public filesService |
Type : FilesService
|
form |
Type : FormGroup
|
model |
Type : any
|
previewImage |
<ng-container [ngSwitch]="type" *ngIf="!isEdit">
<ng-container *ngSwitchCase="'date'">
{{ value | c8yDate: 'fullDate' }}
</ng-container>
<ng-container *ngSwitchCase="'file'">
<ng-container *ngIf="file">
<img *ngIf="previewImage" [src]="previewImage" class="img-responsive" />
<button
*ngIf="!previewImage"
(click)="filesService.download(file)"
translate
type="button"
title="{{'Download' | translate}} {{ file.name }}"
class="btn btn-clean text-truncate p-0"
>
Download {{ file.name }}
</button>
</ng-container>
<ng-container *ngIf="!file">
{{ 'No file attached.' | translate }}
</ng-container>
</ng-container>
<ng-container *ngSwitchCase="'object'">
<ul class="list-unstyled c8y-custom-properties">
<li
*ngFor="let prop of complex; let i = index"
[ngClass]="{ 'separator-top-bottom': i === 0, 'separator-bottom': i > 0 }"
class="p-t-4 p-b-4 flex-row text-nowrap"
>
<label class="small m-b-0 m-r-8" [ngClass]="{ 'a-s-start': prop.file }">{{
prop.label | humanize
}}</label>
<span class="m-l-auto" style="max-width: {{ prop.file ? '50%' : '100%' }}">
<c8y-asset-properties-item
[file]="prop.file"
[key]="prop.key"
[type]="prop.type"
[value]="prop.value"
></c8y-asset-properties-item>
</span>
</li>
</ul>
</ng-container>
<!--
<ng-container *ngSwitchCase="'boolean'">
<input type="checkbox" [checked]="value" [disabled]="true" />
</ng-container>
-->
<ng-container *ngSwitchDefault>
<p>{{ (value | translate) || ('Undefined' | translate) }}</p>
</ng-container>
</ng-container>
<formly-form *ngIf="isEdit" [form]="form" [fields]="fields" [model]="model"></formly-form>