@c8y/ngx-components 1018.0.23 → 1018.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/ecosystem/activity-log/activity-log.component.mjs +6 -1
- package/esm2020/sub-assets/asset-properties-item.component.mjs +26 -6
- package/esm2020/sub-assets/asset-properties.component.mjs +3 -3
- package/fesm2015/c8y-ngx-components-ecosystem.mjs +6 -0
- package/fesm2015/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-sub-assets.mjs +27 -7
- package/fesm2015/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-ecosystem.mjs +5 -0
- package/fesm2020/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-sub-assets.mjs +27 -7
- package/fesm2020/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/package.json +1 -1
- package/sub-assets/asset-properties-item.component.d.ts +2 -0
|
@@ -646,14 +646,34 @@ class AssetPropertiesItemComponent {
|
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
+
formComplexPropsValue() {
|
|
650
|
+
const complexProps = {};
|
|
651
|
+
this.complex.forEach(complexObj => {
|
|
652
|
+
if (complexObj.file) {
|
|
653
|
+
complexProps[complexObj.key] = complexObj.value;
|
|
654
|
+
}
|
|
655
|
+
else if (this.value[complexObj.key] != null) {
|
|
656
|
+
complexProps[complexObj.key] = this.value[complexObj.key];
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
return complexProps;
|
|
660
|
+
}
|
|
661
|
+
getModel() {
|
|
662
|
+
if (this.complex && this.complex.length > 0) {
|
|
663
|
+
return {
|
|
664
|
+
[this.key]: this.formComplexPropsValue()
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
return {
|
|
668
|
+
[this.key]: clone(this.value)
|
|
669
|
+
};
|
|
670
|
+
}
|
|
649
671
|
resolveJsonSchema() {
|
|
650
672
|
if (this.jsonSchema) {
|
|
651
673
|
const fieldConfig = this.c8yJsonSchemaService.toFieldConfig(this.jsonSchema, this.jsonSchema);
|
|
652
674
|
this.form = new FormGroup({});
|
|
653
675
|
this.fields = [fieldConfig];
|
|
654
|
-
this.model =
|
|
655
|
-
[this.key]: clone(this.value)
|
|
656
|
-
};
|
|
676
|
+
this.model = this.getModel();
|
|
657
677
|
}
|
|
658
678
|
}
|
|
659
679
|
async getPreviewIfImage(imageFile) {
|
|
@@ -663,10 +683,10 @@ class AssetPropertiesItemComponent {
|
|
|
663
683
|
}
|
|
664
684
|
}
|
|
665
685
|
AssetPropertiesItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: AssetPropertiesItemComponent, deps: [{ token: i1.AlertService }, { token: i1.C8yJSONSchema }, { token: i1.FilesService }], target: i0.ɵɵFactoryTarget.Component });
|
|
666
|
-
AssetPropertiesItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: AssetPropertiesItemComponent, selector: "c8y-asset-properties-item", inputs: { key: "key", value: "value", label: "label", type: "type", file: "file", complex: "complex", isEdit: "isEdit", jsonSchema: "jsonSchema" }, usesOnChanges: true, ngImport: i0, template: "<ng-container [ngSwitch]=\"type\" *ngIf=\"!isEdit\">\n <ng-container *ngSwitchCase=\"'date'\">\n {{ value | c8yDate: 'fullDate' }}\n </ng-container>\n <ng-container *ngSwitchCase=\"'file'\">\n <ng-container *ngIf=\"file\">\n <img *ngIf=\"previewImage\" [src]=\"previewImage\" class=\"img-responsive\" />\n <button\n *ngIf=\"!previewImage\"\n (click)=\"filesService.download(file)\"\n type=\"button\"\n title=\"{{ 'Download' | translate }} {{ file.name }}\"\n class=\"btn btn-clean text-truncate p-0\"\n >\n {{ file.name }}\n </button>\n </ng-container>\n <ng-container *ngIf=\"!file\">\n {{ 'No file attached.' | translate }}\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'object'\">\n <ul class=\"list-unstyled c8y-custom-properties\">\n <li\n *ngFor=\"let prop of complex; let i = index\"\n [ngClass]=\"{ 'separator-top-bottom': i === 0, 'separator-bottom': i > 0 }\"\n class=\"p-t-4 p-b-4 d-flex text-nowrap\"\n >\n <label
|
|
686
|
+
AssetPropertiesItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: AssetPropertiesItemComponent, selector: "c8y-asset-properties-item", inputs: { key: "key", value: "value", label: "label", type: "type", file: "file", complex: "complex", isEdit: "isEdit", jsonSchema: "jsonSchema" }, usesOnChanges: true, ngImport: i0, template: "<ng-container [ngSwitch]=\"type\" *ngIf=\"!isEdit\">\n <ng-container *ngSwitchCase=\"'date'\">\n {{ value | c8yDate: 'fullDate' }}\n </ng-container>\n <ng-container *ngSwitchCase=\"'file'\">\n <ng-container *ngIf=\"file\">\n <img *ngIf=\"previewImage\" [src]=\"previewImage\" class=\"img-responsive\" />\n <button\n *ngIf=\"!previewImage\"\n (click)=\"filesService.download(file)\"\n type=\"button\"\n title=\"{{ 'Download' | translate }} {{ file.name }}\"\n class=\"btn btn-clean text-truncate p-0\"\n >\n {{ file.name }}\n </button>\n </ng-container>\n <ng-container *ngIf=\"!file\">\n {{ 'No file attached.' | translate }}\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'object'\">\n <ul class=\"list-unstyled c8y-custom-properties\">\n <li\n *ngFor=\"let prop of complex; let i = index\"\n [ngClass]=\"{ 'separator-top-bottom': i === 0, 'separator-bottom': i > 0 }\"\n class=\"p-t-4 p-b-4 d-flex text-nowrap\"\n >\n <label\n class=\"small m-b-0 m-r-8 text-truncate\"\n title=\"{{ prop.label | translate }}\"\n [ngClass]=\"{ 'a-s-start': prop.file }\"\n >\n {{ prop.label | translate }}\n </label>\n <span class=\"m-l-auto\" style=\"max-width: {{ prop.file ? '50%' : '100%' }}; min-width:0;\">\n <c8y-asset-properties-item\n [file]=\"prop.file\"\n [key]=\"prop.key\"\n [type]=\"prop.type\"\n [value]=\"prop.value\"\n ></c8y-asset-properties-item>\n </span>\n </li>\n </ul>\n </ng-container>\n <!--\n <ng-container *ngSwitchCase=\"'boolean'\">\n <input type=\"checkbox\" [checked]=\"value\" [disabled]=\"true\" />\n </ng-container>\n -->\n <ng-container *ngSwitchCase=\"type === 'number' || type === 'boolean' ? type : ''\">\n <p class=\"text-truncate\" title=\"{{ value != null ? value : ('Undefined' | translate) }}\">\n {{ value != null ? value : ('Undefined' | translate) }}\n </p>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <p class=\"text-truncate\" title=\"{{ (value | translate) || ('Undefined' | translate) }}\">\n {{ (value | translate) || ('Undefined' | translate) }}\n </p>\n </ng-container>\n</ng-container>\n<formly-form *ngIf=\"isEdit\" [form]=\"form\" [fields]=\"fields\" [model]=\"model\"></formly-form>\n", dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i4.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i4.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i3.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "component", type: AssetPropertiesItemComponent, selector: "c8y-asset-properties-item", inputs: ["key", "value", "label", "type", "file", "complex", "isEdit", "jsonSchema"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i1.DatePipe, name: "c8yDate" }] });
|
|
667
687
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: AssetPropertiesItemComponent, decorators: [{
|
|
668
688
|
type: Component,
|
|
669
|
-
args: [{ selector: 'c8y-asset-properties-item', template: "<ng-container [ngSwitch]=\"type\" *ngIf=\"!isEdit\">\n <ng-container *ngSwitchCase=\"'date'\">\n {{ value | c8yDate: 'fullDate' }}\n </ng-container>\n <ng-container *ngSwitchCase=\"'file'\">\n <ng-container *ngIf=\"file\">\n <img *ngIf=\"previewImage\" [src]=\"previewImage\" class=\"img-responsive\" />\n <button\n *ngIf=\"!previewImage\"\n (click)=\"filesService.download(file)\"\n type=\"button\"\n title=\"{{ 'Download' | translate }} {{ file.name }}\"\n class=\"btn btn-clean text-truncate p-0\"\n >\n {{ file.name }}\n </button>\n </ng-container>\n <ng-container *ngIf=\"!file\">\n {{ 'No file attached.' | translate }}\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'object'\">\n <ul class=\"list-unstyled c8y-custom-properties\">\n <li\n *ngFor=\"let prop of complex; let i = index\"\n [ngClass]=\"{ 'separator-top-bottom': i === 0, 'separator-bottom': i > 0 }\"\n class=\"p-t-4 p-b-4 d-flex text-nowrap\"\n >\n <label
|
|
689
|
+
args: [{ selector: 'c8y-asset-properties-item', template: "<ng-container [ngSwitch]=\"type\" *ngIf=\"!isEdit\">\n <ng-container *ngSwitchCase=\"'date'\">\n {{ value | c8yDate: 'fullDate' }}\n </ng-container>\n <ng-container *ngSwitchCase=\"'file'\">\n <ng-container *ngIf=\"file\">\n <img *ngIf=\"previewImage\" [src]=\"previewImage\" class=\"img-responsive\" />\n <button\n *ngIf=\"!previewImage\"\n (click)=\"filesService.download(file)\"\n type=\"button\"\n title=\"{{ 'Download' | translate }} {{ file.name }}\"\n class=\"btn btn-clean text-truncate p-0\"\n >\n {{ file.name }}\n </button>\n </ng-container>\n <ng-container *ngIf=\"!file\">\n {{ 'No file attached.' | translate }}\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"'object'\">\n <ul class=\"list-unstyled c8y-custom-properties\">\n <li\n *ngFor=\"let prop of complex; let i = index\"\n [ngClass]=\"{ 'separator-top-bottom': i === 0, 'separator-bottom': i > 0 }\"\n class=\"p-t-4 p-b-4 d-flex text-nowrap\"\n >\n <label\n class=\"small m-b-0 m-r-8 text-truncate\"\n title=\"{{ prop.label | translate }}\"\n [ngClass]=\"{ 'a-s-start': prop.file }\"\n >\n {{ prop.label | translate }}\n </label>\n <span class=\"m-l-auto\" style=\"max-width: {{ prop.file ? '50%' : '100%' }}; min-width:0;\">\n <c8y-asset-properties-item\n [file]=\"prop.file\"\n [key]=\"prop.key\"\n [type]=\"prop.type\"\n [value]=\"prop.value\"\n ></c8y-asset-properties-item>\n </span>\n </li>\n </ul>\n </ng-container>\n <!--\n <ng-container *ngSwitchCase=\"'boolean'\">\n <input type=\"checkbox\" [checked]=\"value\" [disabled]=\"true\" />\n </ng-container>\n -->\n <ng-container *ngSwitchCase=\"type === 'number' || type === 'boolean' ? type : ''\">\n <p class=\"text-truncate\" title=\"{{ value != null ? value : ('Undefined' | translate) }}\">\n {{ value != null ? value : ('Undefined' | translate) }}\n </p>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <p class=\"text-truncate\" title=\"{{ (value | translate) || ('Undefined' | translate) }}\">\n {{ (value | translate) || ('Undefined' | translate) }}\n </p>\n </ng-container>\n</ng-container>\n<formly-form *ngIf=\"isEdit\" [form]=\"form\" [fields]=\"fields\" [model]=\"model\"></formly-form>\n" }]
|
|
670
690
|
}], ctorParameters: function () { return [{ type: i1.AlertService }, { type: i1.C8yJSONSchema }, { type: i1.FilesService }]; }, propDecorators: { key: [{
|
|
671
691
|
type: Input
|
|
672
692
|
}], value: [{
|
|
@@ -855,10 +875,10 @@ class AssetPropertiesComponent {
|
|
|
855
875
|
}
|
|
856
876
|
}
|
|
857
877
|
AssetPropertiesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: AssetPropertiesComponent, deps: [{ token: i1.AssetTypesService }, { token: i2.InventoryService }, { token: i2.InventoryBinaryService }, { token: i1.AlertService }, { token: i1.ContextRouteService }, { token: i3$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
858
|
-
AssetPropertiesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: AssetPropertiesComponent, selector: "c8y-asset-properties", inputs: { asset: "asset", properties: "properties" }, outputs: { assetChange: "assetChange" }, usesOnChanges: true, ngImport: i0, template: "<ng-container>\n <div class=\"card-header bg-inherit separator sticky-top\">\n <h1\n class=\"card-title p-t-4 p-b-4\"\n ngNonBindable\n translate\n [translateParams]=\"{ label: assetType?.label || '' |
|
|
878
|
+
AssetPropertiesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: AssetPropertiesComponent, selector: "c8y-asset-properties", inputs: { asset: "asset", properties: "properties" }, outputs: { assetChange: "assetChange" }, usesOnChanges: true, ngImport: i0, template: "<ng-container>\n <div class=\"card-header bg-inherit separator sticky-top\">\n <h1\n class=\"card-title p-t-4 p-b-4\"\n ngNonBindable\n translate\n [translateParams]=\"{ label: assetType?.label || '' | translate }\"\n >\n {{ label }} properties\n </h1>\n </div>\n <div class=\"card-block\">\n <div class=\"text-center\" *ngIf=\"isLoading\">\n <c8y-loading></c8y-loading>\n </div>\n\n <ng-container *ngIf=\"!isLoading\">\n <div\n class=\"card m-b-8\"\n *ngFor=\"let prop of customProperties\"\n [ngClass]=\"{ 'card-highlight': prop.isEdit }\"\n title=\"{{ prop.description | translate }}\"\n >\n <div class=\"card-block\" [ngClass]=\"{ 'p-b-0': prop.isEdit }\">\n <div class=\"d-flex p-b-8 a-i-center\" *ngIf=\"!prop.isEdit\">\n <p title=\"{{ prop?.label | translate }}\" class=\"text-medium text-truncate\">\n {{ prop?.label | translate }}\n </p>\n <button\n class=\"btn btn-dot m-l-auto text-12\"\n type=\"button\"\n tooltip=\"{{ 'Edit' | translate }}\"\n [attr.aria-label]=\"'Edit' | translate\"\n [delay]=\"500\"\n (click)=\"toggleEdit(prop)\"\n >\n <i c8yIcon=\"pencil\"></i>\n </button>\n </div>\n <c8y-asset-properties-item\n #assetProps\n [file]=\"prop.file\"\n [key]=\"prop.key\"\n [type]=\"prop.type\"\n [value]=\"prop.value\"\n [complex]=\"prop.complex\"\n [isEdit]=\"prop.isEdit\"\n [jsonSchema]=\"prop.jsonSchema\"\n ></c8y-asset-properties-item>\n </div>\n <div class=\"card-footer p-t-0\" *ngIf=\"prop.isEdit\">\n <button\n class=\"btn btn-default btn-sm\"\n type=\"button\"\n title=\"{{ 'Cancel' | translate }}\"\n (click)=\"toggleEdit(prop)\"\n >\n {{ 'Cancel' | translate }}\n </button>\n <button\n class=\"btn btn-primary btn-sm\"\n type=\"button\"\n title=\"{{ 'Save' | translate }}\"\n [disabled]=\"!assetProps?.form?.valid\"\n (click)=\"save(assetProps.model, prop)\"\n >\n {{ 'Save' | translate }}\n </button>\n </div>\n </div>\n </ng-container>\n </div>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LoadingComponent, selector: "c8y-loading" }, { kind: "directive", type: i5$1.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: "component", type: AssetPropertiesItemComponent, selector: "c8y-asset-properties-item", inputs: ["key", "value", "label", "type", "file", "complex", "isEdit", "jsonSchema"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] });
|
|
859
879
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: AssetPropertiesComponent, decorators: [{
|
|
860
880
|
type: Component,
|
|
861
|
-
args: [{ selector: 'c8y-asset-properties', template: "<ng-container>\n <div class=\"card-header bg-inherit separator sticky-top\">\n <h1\n class=\"card-title p-t-4 p-b-4\"\n ngNonBindable\n translate\n [translateParams]=\"{ label: assetType?.label || '' |
|
|
881
|
+
args: [{ selector: 'c8y-asset-properties', template: "<ng-container>\n <div class=\"card-header bg-inherit separator sticky-top\">\n <h1\n class=\"card-title p-t-4 p-b-4\"\n ngNonBindable\n translate\n [translateParams]=\"{ label: assetType?.label || '' | translate }\"\n >\n {{ label }} properties\n </h1>\n </div>\n <div class=\"card-block\">\n <div class=\"text-center\" *ngIf=\"isLoading\">\n <c8y-loading></c8y-loading>\n </div>\n\n <ng-container *ngIf=\"!isLoading\">\n <div\n class=\"card m-b-8\"\n *ngFor=\"let prop of customProperties\"\n [ngClass]=\"{ 'card-highlight': prop.isEdit }\"\n title=\"{{ prop.description | translate }}\"\n >\n <div class=\"card-block\" [ngClass]=\"{ 'p-b-0': prop.isEdit }\">\n <div class=\"d-flex p-b-8 a-i-center\" *ngIf=\"!prop.isEdit\">\n <p title=\"{{ prop?.label | translate }}\" class=\"text-medium text-truncate\">\n {{ prop?.label | translate }}\n </p>\n <button\n class=\"btn btn-dot m-l-auto text-12\"\n type=\"button\"\n tooltip=\"{{ 'Edit' | translate }}\"\n [attr.aria-label]=\"'Edit' | translate\"\n [delay]=\"500\"\n (click)=\"toggleEdit(prop)\"\n >\n <i c8yIcon=\"pencil\"></i>\n </button>\n </div>\n <c8y-asset-properties-item\n #assetProps\n [file]=\"prop.file\"\n [key]=\"prop.key\"\n [type]=\"prop.type\"\n [value]=\"prop.value\"\n [complex]=\"prop.complex\"\n [isEdit]=\"prop.isEdit\"\n [jsonSchema]=\"prop.jsonSchema\"\n ></c8y-asset-properties-item>\n </div>\n <div class=\"card-footer p-t-0\" *ngIf=\"prop.isEdit\">\n <button\n class=\"btn btn-default btn-sm\"\n type=\"button\"\n title=\"{{ 'Cancel' | translate }}\"\n (click)=\"toggleEdit(prop)\"\n >\n {{ 'Cancel' | translate }}\n </button>\n <button\n class=\"btn btn-primary btn-sm\"\n type=\"button\"\n title=\"{{ 'Save' | translate }}\"\n [disabled]=\"!assetProps?.form?.valid\"\n (click)=\"save(assetProps.model, prop)\"\n >\n {{ 'Save' | translate }}\n </button>\n </div>\n </div>\n </ng-container>\n </div>\n</ng-container>\n" }]
|
|
862
882
|
}], ctorParameters: function () { return [{ type: i1.AssetTypesService }, { type: i2.InventoryService }, { type: i2.InventoryBinaryService }, { type: i1.AlertService }, { type: i1.ContextRouteService }, { type: i3$1.ActivatedRoute }]; }, propDecorators: { asset: [{
|
|
863
883
|
type: Input
|
|
864
884
|
}], assetChange: [{
|