mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-11 15:20:56 +03:00
Fixed downloads not sorting properly
Confirm dialog can now be a selection list
This commit is contained in:
@@ -1,18 +1,27 @@
|
||||
<h4 mat-dialog-title>{{dialogTitle}}</h4>
|
||||
<mat-dialog-content>
|
||||
<div style="margin-bottom: 10px;">
|
||||
{{dialogText}}
|
||||
<!-- We can support text dialogs or dialogs where users must select items from a list -->
|
||||
<ng-container *ngIf="dialogType === 'text'">
|
||||
{{dialogText}}
|
||||
</ng-container>
|
||||
<ng-container *ngIf="dialogType === 'selection_list'">
|
||||
<mat-selection-list [(ngModel)]="selected_items">
|
||||
<mat-list-option *ngFor="let item of list" [value]="item.key">
|
||||
{{item.title}}
|
||||
</mat-list-option>
|
||||
</mat-selection-list>
|
||||
</ng-container>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
|
||||
<button [color]="warnSubmitColor ? 'warn' : 'primary'" mat-flat-button type="submit" (click)="confirmClicked()">{{submitText}}</button>
|
||||
<button [disabled]="dialogType === 'selection_list' && selected_items.length === 0" [color]="warnSubmitColor ? 'warn' : 'primary'" mat-flat-button type="submit" (click)="confirmClicked()">{{submitText}}</button>
|
||||
<div class="mat-spinner" *ngIf="submitClicked">
|
||||
<mat-spinner [diameter]="25"></mat-spinner>
|
||||
</div>
|
||||
<span class="spacer"></span>
|
||||
<button style="float: right;" mat-stroked-button mat-dialog-close>
|
||||
<ng-container *ngIf="cancelText">{{cancelText}}</ng-container>
|
||||
<ng-container *ngIf="!cancelText" i18n="Cancel">Cancel</ng-container>
|
||||
{{cancelText}}
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
@@ -8,10 +8,13 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
})
|
||||
export class ConfirmDialogComponent implements OnInit {
|
||||
|
||||
dialogType = 'text';
|
||||
dialogTitle = 'Confirm';
|
||||
dialogText = 'Would you like to confirm?';
|
||||
submitText = 'Yes'
|
||||
cancelText = null;
|
||||
cancelText = $localize`Cancel`;
|
||||
list: { key: string, title: string }[] = [];
|
||||
selected_items = [];
|
||||
submitClicked = false;
|
||||
closeOnSubmit = true;
|
||||
|
||||
@@ -21,13 +24,15 @@ export class ConfirmDialogComponent implements OnInit {
|
||||
warnSubmitColor = false;
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public dialogRef: MatDialogRef<ConfirmDialogComponent>) {
|
||||
if (this.data.dialogTitle !== undefined) { this.dialogTitle = this.data.dialogTitle }
|
||||
if (this.data.dialogText !== undefined) { this.dialogText = this.data.dialogText }
|
||||
if (this.data.submitText !== undefined) { this.submitText = this.data.submitText }
|
||||
if (this.data.cancelText !== undefined) { this.cancelText = this.data.cancelText }
|
||||
if (this.data.dialogTitle !== undefined) { this.dialogTitle = this.data.dialogTitle }
|
||||
if (this.data.dialogType !== undefined) { this.dialogType = this.data.dialogType }
|
||||
if (this.data.dialogText !== undefined) { this.dialogText = this.data.dialogText }
|
||||
if (this.data.list !== undefined) { this.list = this.data.list }
|
||||
if (this.data.submitText !== undefined) { this.submitText = this.data.submitText }
|
||||
if (this.data.cancelText !== undefined) { this.cancelText = this.data.cancelText }
|
||||
if (this.data.warnSubmitColor !== undefined) { this.warnSubmitColor = this.data.warnSubmitColor }
|
||||
if (this.data.warnSubmitColor !== undefined) { this.warnSubmitColor = this.data.warnSubmitColor }
|
||||
if (this.data.closeOnSubmit !== undefined) { this.closeOnSubmit = this.data.closeOnSubmit }
|
||||
if (this.data.closeOnSubmit !== undefined) { this.closeOnSubmit = this.data.closeOnSubmit }
|
||||
|
||||
// checks if emitter exists, if so don't autoclose as it should be handled by caller
|
||||
if (this.data.doneEmitter) {
|
||||
@@ -36,7 +41,7 @@ export class ConfirmDialogComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
confirmClicked() {
|
||||
confirmClicked(): void {
|
||||
if (this.onlyEmitOnDone) {
|
||||
this.doneEmitter.emit(true);
|
||||
if (this.closeOnSubmit) this.submitClicked = true;
|
||||
|
||||
Reference in New Issue
Block a user