@rlucan/ui 19.0.1 → 19.0.2

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.
@@ -1018,20 +1018,26 @@ class FileComponent {
1018
1018
  if (changes['srcData']) {
1019
1019
  this.nativeFileSizeRatio = -1;
1020
1020
  if (changes['srcData'].currentValue.nativeFile) {
1021
- this.src = this.domSanitizer.bypassSecurityTrustUrl(URL.createObjectURL(changes['srcData'].currentValue.nativeFile));
1022
- const img = new Image();
1023
- img.onload = () => {
1024
- if (this.fitImageFileSize) {
1025
- this.nativeFileSizeRatio = Math.max(img.width / this.uiFileSize.width, img.height / this.uiFileSize.height, 1);
1026
- }
1027
- else {
1028
- this.nativeFileSizeRatio = 1;
1029
- }
1030
- this.nativeFileWidth = img.width / this.nativeFileSizeRatio;
1031
- this.nativeFileHeight = img.height / this.nativeFileSizeRatio;
1032
- URL.revokeObjectURL(img.src);
1033
- };
1034
- img.src = URL.createObjectURL(changes['srcData'].currentValue.nativeFile);
1021
+ const nf = changes['srcData'].currentValue.nativeFile;
1022
+ if (nf.type.startsWith('image/') || nf.type.startsWith('video/')) {
1023
+ this.src = this.domSanitizer.bypassSecurityTrustUrl(URL.createObjectURL(changes['srcData'].currentValue.nativeFile));
1024
+ const img = new Image();
1025
+ img.onload = () => {
1026
+ if (this.fitImageFileSize) {
1027
+ this.nativeFileSizeRatio = Math.max(img.width / this.uiFileSize.width, img.height / this.uiFileSize.height, 1);
1028
+ }
1029
+ else {
1030
+ this.nativeFileSizeRatio = 1;
1031
+ }
1032
+ this.nativeFileWidth = img.width / this.nativeFileSizeRatio;
1033
+ this.nativeFileHeight = img.height / this.nativeFileSizeRatio;
1034
+ URL.revokeObjectURL(img.src);
1035
+ };
1036
+ img.src = URL.createObjectURL(changes['srcData'].currentValue.nativeFile);
1037
+ }
1038
+ else {
1039
+ this.src = this.fileServiceConfig.getMediaSrc(this.uiFileSize, { name: nf.name, mimeType: nf.type }, this.srcOptions);
1040
+ }
1035
1041
  }
1036
1042
  else {
1037
1043
  this.src = this.fileServiceConfig.getMediaSrc(this.uiFileSize, changes['srcData'].currentValue, this.srcOptions);
@@ -1048,11 +1054,11 @@ class FileComponent {
1048
1054
  }
1049
1055
  }
1050
1056
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FileComponent, deps: [{ token: UI_FILESERVICE, optional: true }, { token: i1$1.DomSanitizer }, { token: UiFileService }], target: i0.ɵɵFactoryTarget.Component }); }
1051
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: FileComponent, isStandalone: false, selector: "ui-file", inputs: { fileSize: "fileSize", srcOptions: "srcOptions", srcData: "srcData", srcUrl: "srcUrl" }, host: { properties: { "style.width": "this.width", "style.maxWidth": "this.maxWidth", "style.height": "this.height", "style.maxHeight": "this.maxHeight" } }, usesOnChanges: true, ngImport: i0, template: "<mat-spinner *ngIf=\"visible\"></mat-spinner>\r\n<img *ngIf=\"!isVideo && useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\" [srcset]=\"src + ' 2x'\"/>\r\n<img *ngIf=\"!isVideo && !useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\"/>\r\n<video *ngIf=\"isVideo\" muted controls [src]=\"src\" [ngStyle]=\"imgStyle\"></video>\r\n\r\n", styles: [":host{display:flex;align-items:center;justify-content:center;position:relative}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i4$3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
1057
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: FileComponent, isStandalone: false, selector: "ui-file", inputs: { fileSize: "fileSize", srcOptions: "srcOptions", srcData: "srcData", srcUrl: "srcUrl" }, host: { properties: { "style.width": "this.width", "style.maxWidth": "this.maxWidth", "style.height": "this.height", "style.maxHeight": "this.maxHeight" } }, usesOnChanges: true, ngImport: i0, template: "<mat-spinner *ngIf=\"visible\"></mat-spinner>\r\n<img *ngIf=\"!isVideo && useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\" [srcset]=\"src + ' 2x'\"/>\r\n<img *ngIf=\"!isVideo && !useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\" />\r\n<video *ngIf=\"isVideo\" muted controls [src]=\"src\" [ngStyle]=\"imgStyle\"></video>\r\n\r\n", styles: [":host{display:flex;align-items:center;justify-content:center;position:relative}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i4$3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
1052
1058
  }
1053
1059
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FileComponent, decorators: [{
1054
1060
  type: Component,
1055
- args: [{ selector: 'ui-file', standalone: false, template: "<mat-spinner *ngIf=\"visible\"></mat-spinner>\r\n<img *ngIf=\"!isVideo && useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\" [srcset]=\"src + ' 2x'\"/>\r\n<img *ngIf=\"!isVideo && !useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\"/>\r\n<video *ngIf=\"isVideo\" muted controls [src]=\"src\" [ngStyle]=\"imgStyle\"></video>\r\n\r\n", styles: [":host{display:flex;align-items:center;justify-content:center;position:relative}\n"] }]
1061
+ args: [{ selector: 'ui-file', standalone: false, template: "<mat-spinner *ngIf=\"visible\"></mat-spinner>\r\n<img *ngIf=\"!isVideo && useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\" [srcset]=\"src + ' 2x'\"/>\r\n<img *ngIf=\"!isVideo && !useRetinaSrc\" [ngStyle]=\"imgStyle\" [src]=\"src\" />\r\n<video *ngIf=\"isVideo\" muted controls [src]=\"src\" [ngStyle]=\"imgStyle\"></video>\r\n\r\n", styles: [":host{display:flex;align-items:center;justify-content:center;position:relative}\n"] }]
1056
1062
  }], ctorParameters: () => [{ type: undefined, decorators: [{
1057
1063
  type: Optional
1058
1064
  }, {