RED-9454 - Differences between Add Hint- and Add Redaction-Dialog
This commit is contained in:
parent
9d01fb5784
commit
e81e8e7252
@ -3,9 +3,56 @@
|
||||
<div [translate]="'add-hint.dialog.title'" class="dialog-header heading-l"></div>
|
||||
|
||||
<div class="dialog-content redaction">
|
||||
<div class="iqser-input-group w-450">
|
||||
<label class="selected-text" [translate]="'add-hint.dialog.content.selected-text'"></label>
|
||||
{{ form.get('selectedText').value }}
|
||||
<div class="iqser-input-group w-full selected-text-group">
|
||||
<div
|
||||
[class.fixed-height-36]="dictionaryRequest"
|
||||
[ngClass]="isEditingSelectedText ? 'flex relative' : 'flex-align-items-center'"
|
||||
>
|
||||
<div class="table">
|
||||
<label>Value</label>
|
||||
<div class="row">
|
||||
<span
|
||||
*ngIf="!isEditingSelectedText"
|
||||
[innerHTML]="form.controls.selectedText.value"
|
||||
[ngStyle]="{
|
||||
'min-width': textWidth > maximumSelectedTextWidth ? '95%' : 'unset',
|
||||
'max-width': textWidth > maximumSelectedTextWidth ? 0 : 'unset',
|
||||
}"
|
||||
></span>
|
||||
<textarea
|
||||
*ngIf="isEditingSelectedText"
|
||||
[rows]="selectedTextRows"
|
||||
[ngStyle]="{ width: maximumTextAreaWidth + 'px' }"
|
||||
formControlName="selectedText"
|
||||
iqserHasScrollbar
|
||||
name="value"
|
||||
type="text"
|
||||
></textarea>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="toggleEditingSelectedText()"
|
||||
*ngIf="dictionaryRequest && !isEditingSelectedText"
|
||||
[tooltip]="'redact-text.dialog.content.edit-text' | translate"
|
||||
[size]="20"
|
||||
[iconSize]="13"
|
||||
icon="iqser:edit"
|
||||
tooltipPosition="below"
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="undoTextChange(); toggleEditingSelectedText()"
|
||||
*ngIf="isEditingSelectedText"
|
||||
[showDot]="initialText !== form.get('selectedText').value"
|
||||
[tooltip]="'redact-text.dialog.content.revert-text' | translate"
|
||||
[size]="20"
|
||||
[iconSize]="13"
|
||||
class="undo-button"
|
||||
icon="red:undo"
|
||||
tooltipPosition="below"
|
||||
></iqser-circle-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<iqser-details-radio
|
||||
|
||||
@ -1,3 +1,67 @@
|
||||
.dialog-content {
|
||||
height: 400px;
|
||||
height: 493px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.selected-text-group > div {
|
||||
gap: 0.5rem;
|
||||
|
||||
span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
iqser-circle-button {
|
||||
padding-left: 10px;
|
||||
|
||||
&.undo-button {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
::ng-deep mat-icon {
|
||||
padding: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.fixed-height-36 {
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
textarea[name='value'] {
|
||||
margin-top: 0;
|
||||
min-height: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: calc(100% - 26px);
|
||||
padding: 0 13px;
|
||||
|
||||
label {
|
||||
opacity: 0.7;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
background-color: var(--iqser-alt-background);
|
||||
min-width: 100%;
|
||||
|
||||
span {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
list-style-position: inside;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { NgForOf, NgIf } from '@angular/common';
|
||||
import { NgClass, NgForOf, NgIf, NgStyle } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { FormBuilder, ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
|
||||
@ -23,12 +23,14 @@ import { ActiveDossiersService } from '@services/dossiers/active-dossiers.servic
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { Roles } from '@users/roles';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { stringToBoolean } from '@utils/functions';
|
||||
import { calcTextWidthInPixels, stringToBoolean } from '@utils/functions';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { SystemDefaultOption, SystemDefaults } from '../../../account/utils/dialog-defaults';
|
||||
import { getRedactOrHintOptions } from '../../utils/dialog-options';
|
||||
import { AddHintData, AddHintResult, RedactOrHintOption, RedactOrHintOptions } from '../../utils/dialog-types';
|
||||
|
||||
const MAXIMUM_TEXT_AREA_WIDTH = 421;
|
||||
|
||||
@Component({
|
||||
templateUrl: './add-hint-dialog.component.html',
|
||||
styleUrls: ['./add-hint-dialog.component.scss'],
|
||||
@ -49,6 +51,8 @@ import { AddHintData, AddHintResult, RedactOrHintOption, RedactOrHintOptions } f
|
||||
CircleButtonComponent,
|
||||
MatDialogClose,
|
||||
NgForOf,
|
||||
NgClass,
|
||||
NgStyle,
|
||||
],
|
||||
})
|
||||
export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogComponent, AddHintData, AddHintResult> implements OnInit {
|
||||
@ -58,9 +62,15 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
||||
readonly roles = Roles;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
||||
readonly initialText = this.data?.manualRedactionEntryWrapper?.manualRedactionEntry?.value;
|
||||
readonly maximumTextAreaWidth = MAXIMUM_TEXT_AREA_WIDTH;
|
||||
readonly maximumSelectedTextWidth = 567;
|
||||
dictionaryRequest = false;
|
||||
dictionaries: Dictionary[] = [];
|
||||
form!: UntypedFormGroup;
|
||||
isEditingSelectedText = false;
|
||||
selectedTextRows = 1;
|
||||
textWidth: number;
|
||||
|
||||
constructor(
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
@ -83,6 +93,7 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
||||
);
|
||||
|
||||
this.form = this.#getForm();
|
||||
this.textWidth = calcTextWidthInPixels(this.form.controls.selectedText.value);
|
||||
|
||||
this.form
|
||||
.get('option')
|
||||
@ -97,6 +108,18 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
toggleEditingSelectedText() {
|
||||
this.isEditingSelectedText = !this.isEditingSelectedText;
|
||||
if (this.isEditingSelectedText) {
|
||||
const width = calcTextWidthInPixels(this.form.controls.selectedText.value);
|
||||
this.selectedTextRows = Math.ceil(width / MAXIMUM_TEXT_AREA_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
undoTextChange() {
|
||||
this.form.patchValue({ selectedText: this.initialText });
|
||||
}
|
||||
|
||||
get displayedDictionaryLabel() {
|
||||
const dictType = this.form.get('dictionary').value;
|
||||
if (dictType) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user