Loading packages/angular/upload/src/lib/upload-button/upload-button.component.html +14 −7 Changes for packages/angular/upload/src/lib/upload-button/upload-button.component.html: 14 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -9,15 +9,18 @@ type="button"> <span class="flex flex-row justify-center items-center gap-3"> <mat-icon class="grow-0" svgIcon="upload"></mat-icon> <span *ngIf="value; else infoText" class="truncate grow-0">{{value.name}}</span> <ng-template #infoText> <span *ngIf="placeholder">{{ placeholder }}</span> @if (value) { <span class="truncate grow-0">{{ value.name }}</span> } @else { @if (placeholder) { <span>{{ placeholder }}</span> } <ng-content></ng-content> </ng-template> } </span> </button> @if (isImage) { <button (click)="openOverlay()" *ngIf="isImage" class="grow-0" i18n-matTooltip mat-icon-button Loading @@ -25,10 +28,13 @@ type="button"> <mat-icon>preview</mat-icon> </button> <button (click)="download()" *ngIf="allowDownload() && value" class="grow-0" i18n-matTooltip mat-icon-button } @if (allowDownload() && value) { <button (click)="download()" class="grow-0" i18n-matTooltip mat-icon-button matTooltip="Download file" type="button"> <mat-icon svgIcon="download"></mat-icon> </button> } </div> <ng-template Loading @@ -44,4 +50,5 @@ </div> </ng-template> <input #fileInput (change)="onFileInputChange($event)" [accept]="accept()" [id]="id" class="hidden" type="file"> <input #fileInput (change)="onFileInputChange($event)" [accept]="acceptAttribute()" [id]="id" class="hidden" type="file"> packages/angular/upload/src/lib/upload-button/upload-button.component.ts +9 −2 Changes for packages/angular/upload/src/lib/upload-button/upload-button.component.ts: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, computed, ElementRef, EventEmitter, HostListener, Loading Loading @@ -59,7 +60,6 @@ import { ReadAsDataURLPipe } from './read-as-data-url.pipe'; CdkOverlayOrigin, MethodDirective, MatIconModule, NgIf, MatProgressSpinnerModule, MatTooltipModule, CdkConnectedOverlay, Loading @@ -72,7 +72,9 @@ export class UploadButtonComponent implements ControlValueAccessor, MatFormField static nextId = 0; public accept = input('**/**'); public accept = input<string | string[]>('**/**'); readonly acceptAttribute = computed(() => Array.isArray(this.accept) ? this.accept.join(',') : this.accept); public allowDownload = input(false); Loading Loading @@ -229,4 +231,9 @@ export class UploadButtonComponent implements ControlValueAccessor, MatFormField this.stateChanges.next(); } } clear() { this.value = null; } } Loading
packages/angular/upload/src/lib/upload-button/upload-button.component.html +14 −7 Changes for packages/angular/upload/src/lib/upload-button/upload-button.component.html: 14 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -9,15 +9,18 @@ type="button"> <span class="flex flex-row justify-center items-center gap-3"> <mat-icon class="grow-0" svgIcon="upload"></mat-icon> <span *ngIf="value; else infoText" class="truncate grow-0">{{value.name}}</span> <ng-template #infoText> <span *ngIf="placeholder">{{ placeholder }}</span> @if (value) { <span class="truncate grow-0">{{ value.name }}</span> } @else { @if (placeholder) { <span>{{ placeholder }}</span> } <ng-content></ng-content> </ng-template> } </span> </button> @if (isImage) { <button (click)="openOverlay()" *ngIf="isImage" class="grow-0" i18n-matTooltip mat-icon-button Loading @@ -25,10 +28,13 @@ type="button"> <mat-icon>preview</mat-icon> </button> <button (click)="download()" *ngIf="allowDownload() && value" class="grow-0" i18n-matTooltip mat-icon-button } @if (allowDownload() && value) { <button (click)="download()" class="grow-0" i18n-matTooltip mat-icon-button matTooltip="Download file" type="button"> <mat-icon svgIcon="download"></mat-icon> </button> } </div> <ng-template Loading @@ -44,4 +50,5 @@ </div> </ng-template> <input #fileInput (change)="onFileInputChange($event)" [accept]="accept()" [id]="id" class="hidden" type="file"> <input #fileInput (change)="onFileInputChange($event)" [accept]="acceptAttribute()" [id]="id" class="hidden" type="file">
packages/angular/upload/src/lib/upload-button/upload-button.component.ts +9 −2 Changes for packages/angular/upload/src/lib/upload-button/upload-button.component.ts: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, computed, ElementRef, EventEmitter, HostListener, Loading Loading @@ -59,7 +60,6 @@ import { ReadAsDataURLPipe } from './read-as-data-url.pipe'; CdkOverlayOrigin, MethodDirective, MatIconModule, NgIf, MatProgressSpinnerModule, MatTooltipModule, CdkConnectedOverlay, Loading @@ -72,7 +72,9 @@ export class UploadButtonComponent implements ControlValueAccessor, MatFormField static nextId = 0; public accept = input('**/**'); public accept = input<string | string[]>('**/**'); readonly acceptAttribute = computed(() => Array.isArray(this.accept) ? this.accept.join(',') : this.accept); public allowDownload = input(false); Loading Loading @@ -229,4 +231,9 @@ export class UploadButtonComponent implements ControlValueAccessor, MatFormField this.stateChanges.next(); } } clear() { this.value = null; } }