Merge branch 'VM/RED-9454' into 'master'
RED-9454 - Differences between Add Hint- and Add Redaction-Dialog Closes RED-9454 See merge request redactmanager/red-ui!559
This commit is contained in:
commit
201f4ca07f
@ -3,9 +3,56 @@
|
|||||||
<div [translate]="'add-hint.dialog.title'" class="dialog-header heading-l"></div>
|
<div [translate]="'add-hint.dialog.title'" class="dialog-header heading-l"></div>
|
||||||
|
|
||||||
<div class="dialog-content redaction">
|
<div class="dialog-content redaction">
|
||||||
<div class="iqser-input-group w-450">
|
<div class="iqser-input-group w-full selected-text-group">
|
||||||
<label class="selected-text" [translate]="'add-hint.dialog.content.selected-text'"></label>
|
<div
|
||||||
{{ form.get('selectedText').value }}
|
[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>
|
</div>
|
||||||
|
|
||||||
<iqser-details-radio
|
<iqser-details-radio
|
||||||
|
|||||||
@ -1,3 +1,67 @@
|
|||||||
.dialog-content {
|
.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 { Component, OnInit } from '@angular/core';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { FormBuilder, ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
|
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 { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||||
import { Roles } from '@users/roles';
|
import { Roles } from '@users/roles';
|
||||||
import { UserPreferenceService } from '@users/user-preference.service';
|
import { UserPreferenceService } from '@users/user-preference.service';
|
||||||
import { stringToBoolean } from '@utils/functions';
|
import { calcTextWidthInPixels, stringToBoolean } from '@utils/functions';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
import { SystemDefaultOption, SystemDefaults } from '../../../account/utils/dialog-defaults';
|
import { SystemDefaultOption, SystemDefaults } from '../../../account/utils/dialog-defaults';
|
||||||
import { getRedactOrHintOptions } from '../../utils/dialog-options';
|
import { getRedactOrHintOptions } from '../../utils/dialog-options';
|
||||||
import { AddHintData, AddHintResult, RedactOrHintOption, RedactOrHintOptions } from '../../utils/dialog-types';
|
import { AddHintData, AddHintResult, RedactOrHintOption, RedactOrHintOptions } from '../../utils/dialog-types';
|
||||||
|
|
||||||
|
const MAXIMUM_TEXT_AREA_WIDTH = 421;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './add-hint-dialog.component.html',
|
templateUrl: './add-hint-dialog.component.html',
|
||||||
styleUrls: ['./add-hint-dialog.component.scss'],
|
styleUrls: ['./add-hint-dialog.component.scss'],
|
||||||
@ -49,6 +51,8 @@ import { AddHintData, AddHintResult, RedactOrHintOption, RedactOrHintOptions } f
|
|||||||
CircleButtonComponent,
|
CircleButtonComponent,
|
||||||
MatDialogClose,
|
MatDialogClose,
|
||||||
NgForOf,
|
NgForOf,
|
||||||
|
NgClass,
|
||||||
|
NgStyle,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogComponent, AddHintData, AddHintResult> implements OnInit {
|
export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogComponent, AddHintData, AddHintResult> implements OnInit {
|
||||||
@ -58,9 +62,15 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
|||||||
readonly roles = Roles;
|
readonly roles = Roles;
|
||||||
readonly iconButtonTypes = IconButtonTypes;
|
readonly iconButtonTypes = IconButtonTypes;
|
||||||
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
||||||
|
readonly initialText = this.data?.manualRedactionEntryWrapper?.manualRedactionEntry?.value;
|
||||||
|
readonly maximumTextAreaWidth = MAXIMUM_TEXT_AREA_WIDTH;
|
||||||
|
readonly maximumSelectedTextWidth = 567;
|
||||||
dictionaryRequest = false;
|
dictionaryRequest = false;
|
||||||
dictionaries: Dictionary[] = [];
|
dictionaries: Dictionary[] = [];
|
||||||
form!: UntypedFormGroup;
|
form!: UntypedFormGroup;
|
||||||
|
isEditingSelectedText = false;
|
||||||
|
selectedTextRows = 1;
|
||||||
|
textWidth: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _activeDossiersService: ActiveDossiersService,
|
private readonly _activeDossiersService: ActiveDossiersService,
|
||||||
@ -83,6 +93,7 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.form = this.#getForm();
|
this.form = this.#getForm();
|
||||||
|
this.textWidth = calcTextWidthInPixels(this.form.controls.selectedText.value);
|
||||||
|
|
||||||
this.form
|
this.form
|
||||||
.get('option')
|
.get('option')
|
||||||
@ -97,6 +108,18 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
|||||||
.subscribe();
|
.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() {
|
get displayedDictionaryLabel() {
|
||||||
const dictType = this.form.get('dictionary').value;
|
const dictType = this.form.get('dictionary').value;
|
||||||
if (dictType) {
|
if (dictType) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user