RED-5445 - updated input design, abort the editing when the user clicks somewhere else on the screen
This commit is contained in:
parent
4dd9185edf
commit
39ce5b0826
@ -3,8 +3,9 @@
|
|||||||
<ng-template #date>
|
<ng-template #date>
|
||||||
<span class="clamp-3"> {{ fileAttributeValue ? (fileAttributeValue | date : 'd MMM yyyy') : '-' }}</span>
|
<span class="clamp-3"> {{ fileAttributeValue ? (fileAttributeValue | date : 'd MMM yyyy') : '-' }}</span>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-container *ngIf="(selectedFile$ | async) === false && ((isEditingFileAttribute$ | async) === false || isInEditMode)">
|
|
||||||
<div class="edit-button" *ngIf="!isInEditMode">
|
<ng-container *ngIf="(isEditingFileAttribute$ | async) === false || isInEditMode">
|
||||||
|
<div class="edit-button" *ngIf="!isInEditMode; else input">
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
id="edit-attribute-button"
|
id="edit-attribute-button"
|
||||||
*ngIf="permissionsService.canEditFileAttributes(file, dossier)"
|
*ngIf="permissionsService.canEditFileAttributes(file, dossier)"
|
||||||
@ -14,20 +15,30 @@
|
|||||||
[tooltip]="'file-attribute.actions.edit' | translate"
|
[tooltip]="'file-attribute.actions.edit' | translate"
|
||||||
></iqser-circle-button>
|
></iqser-circle-button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="isInEditMode" class="edit">
|
<ng-template #input>
|
||||||
<form (submit)="save()" [formGroup]="form">
|
<div class="edit-input" (click)="$event?.stopPropagation()">
|
||||||
<iqser-dynamic-input
|
<form (submit)="save()" [formGroup]="form">
|
||||||
[formControlName]="fileAttribute.id"
|
<iqser-dynamic-input
|
||||||
[id]="fileAttribute.id"
|
[formControlName]="fileAttribute.id"
|
||||||
[type]="fileAttribute.type"
|
[id]="fileAttribute.id"
|
||||||
[classList]="'w-full'"
|
[type]="fileAttribute.type"
|
||||||
(keydown.escape)="close()"
|
(keydown.escape)="close()"
|
||||||
>
|
(closedDatepicker)="closedDatepicker = $event"
|
||||||
</iqser-dynamic-input>
|
>
|
||||||
|
</iqser-dynamic-input>
|
||||||
|
|
||||||
<iqser-circle-button [icon]="'iqser:check'" [disabled]="disabled" (action)="save($event)"></iqser-circle-button>
|
<iqser-circle-button
|
||||||
<iqser-circle-button [icon]="'iqser:close'" (action)="close($event)"></iqser-circle-button>
|
class="save"
|
||||||
</form>
|
[icon]="'iqser:check'"
|
||||||
</div>
|
[disabled]="disabled"
|
||||||
|
(action)="save($event)"
|
||||||
|
></iqser-circle-button>
|
||||||
|
<iqser-circle-button [icon]="'iqser:close'" (action)="close($event)"></iqser-circle-button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- A hack to avoid subscribing in component -->
|
||||||
|
<ng-container *ngIf="selectedFile$ | async"></ng-container>
|
||||||
|
|||||||
@ -5,52 +5,18 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.edit-button {
|
.edit-button {
|
||||||
transform: translate(-25%);
|
|
||||||
background: radial-gradient(var(--iqser-side-nav) 10%, rgba(244, 245, 247, 0) 60%);
|
|
||||||
|
|
||||||
#edit-attribute-button {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
left: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.edit-button,
|
|
||||||
.edit {
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
top: 0;
|
background: radial-gradient(var(--iqser-side-nav) 10%, rgba(244, 245, 247, 0) 60%);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 150%;
|
width: 150%;
|
||||||
z-index: 1;
|
transform: translate(-25%);
|
||||||
}
|
|
||||||
|
|
||||||
iqser-dynamic-input {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.edit {
|
|
||||||
width: 300%;
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
background: radial-gradient(var(--iqser-side-nav) 10%, rgba(244, 245, 247, 0) 95%);
|
|
||||||
|
|
||||||
form {
|
|
||||||
display: flex;
|
|
||||||
gap: 5px;
|
|
||||||
align-items: center;
|
|
||||||
z-index: 10;
|
|
||||||
width: 75%;
|
|
||||||
|
|
||||||
|
iqser-circle-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(0%, -50%);
|
left: 50%;
|
||||||
}
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
iqser-dynamic-input {
|
|
||||||
width: 75%;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,4 +25,28 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit-input {
|
||||||
|
cursor: default;
|
||||||
|
display: flex;
|
||||||
|
z-index: 1;
|
||||||
|
border: solid var(--iqser-grey-4);
|
||||||
|
border-radius: 10px;
|
||||||
|
background: var(--iqser-background);
|
||||||
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
|
||||||
|
|
||||||
|
form {
|
||||||
|
margin: 5px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
iqser-dynamic-input {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save {
|
||||||
|
margin-left: 7px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, HostListener, Input, OnInit } from '@angular/core';
|
||||||
import { Dossier, File, FileAttributeConfigTypes, IFileAttributeConfig } from '@red/domain';
|
import { Dossier, File, FileAttributeConfigTypes, IFileAttributeConfig } from '@red/domain';
|
||||||
import { BaseFormComponent, ListingService, Toaster } from '@iqser/common-ui';
|
import { BaseFormComponent, ListingService, Toaster } from '@iqser/common-ui';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
@ -24,6 +24,7 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit
|
|||||||
|
|
||||||
@Input() dossier!: Dossier;
|
@Input() dossier!: Dossier;
|
||||||
isInEditMode = false;
|
isInEditMode = false;
|
||||||
|
closedDatepicker = true;
|
||||||
readonly isEditingFileAttribute$: BehaviorSubject<boolean>;
|
readonly isEditingFileAttribute$: BehaviorSubject<boolean>;
|
||||||
readonly selectedFile$: Observable<boolean>;
|
readonly selectedFile$: Observable<boolean>;
|
||||||
|
|
||||||
@ -139,4 +140,11 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit
|
|||||||
input.focus();
|
input.focus();
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('document:click')
|
||||||
|
clickOutside() {
|
||||||
|
if (this.isInEditMode && this.closedDatepicker) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit d9a92992c3b6f4700fbbdb3662d981bfe23b979b
|
Subproject commit cdfd0b59b4e1f63693366ac5c9e80d3c309d687d
|
||||||
Loading…
x
Reference in New Issue
Block a user