Merge pull request #4815 from tsiegleauq/multiselect-stack-calls

Enhance Choice service.
This commit is contained in:
Emanuel Schütze 2019-07-02 13:08:53 +02:00 committed by GitHub
commit bf4f93c502
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 64 deletions

View File

@ -42,7 +42,7 @@ export class ChoiceService {
clearChoice?: string
): Promise<ChoiceAnswer> {
const dialogRef = this.dialog.open(ChoiceDialogComponent, {
minWidth: '250px',
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true,
data: {

View File

@ -1,6 +1,8 @@
<div class="scrollmenu-outer">
<!-- Title -->
<h2 mat-dialog-title>{{ data.title | translate }}</h2>
<div class="scrollmenu">
<!-- Content -->
<mat-dialog-content>
<mat-radio-group
#radio
name="choice"
@ -26,7 +28,9 @@
</mat-checkbox>
</mat-list-item>
</mat-list>
</div>
</mat-dialog-content>
<!-- Actions -->
<mat-dialog-actions>
<div *ngIf="data.actionButtons">
<button
@ -50,4 +54,3 @@
</div>
<button mat-button (click)="closeDialog(false)"><span translate>Cancel</span></button>
</mat-dialog-actions>
</div>

View File

@ -1,21 +1,17 @@
mat-radio-group {
.mat-dialog-content {
display: block;
}
.mat-radio-group {
display: inline-flex;
flex-direction: column;
mat-radio-button {
.mat-radio-button {
margin: 5px;
}
}
.scrollmenu {
padding: 5px;
display: block;
}
.scrollmenu-outer {
max-height: inherit;
}
mat-divider {
.mat-divider {
margin-top: 10px;
margin-bottom: 10px;
}

View File

@ -1,4 +1,4 @@
import { Component, Inject } from '@angular/core';
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { Displayable } from 'app/site/base/displayable';
@ -61,11 +61,13 @@ export type ChoiceAnswer = undefined | { action?: string; items: number | number
@Component({
selector: 'os-choice-dialog',
templateUrl: './choice-dialog.component.html',
styleUrls: ['./choice-dialog.component.scss']
styleUrls: ['./choice-dialog.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ChoiceDialogComponent {
/**
* One number selected, if this is a single select choice
* User over template
*/
public selectedChoice: number;
@ -78,6 +80,8 @@ export class ChoiceDialogComponent {
public get isSelectionEmpty(): boolean {
if (this.data.multiSelect) {
return this.selectedMultiChoices.length === 0;
} else if (!this.data.choices) {
return false;
} else {
return this.selectedChoice === undefined;
}