Merge branch 'unprotected' into VM/RED-8748

This commit is contained in:
Valentin Mihai 2024-05-17 19:09:48 +03:00
commit 9473a7f5bd
4 changed files with 18 additions and 16 deletions

View File

@ -56,15 +56,11 @@
.dev-mode {
background-color: var(--iqser-primary);
color: var(--iqser-white);
font-size: 22px;
line-height: 16px;
text-align: center;
position: fixed;
top: 0;
z-index: 100;
right: 0;
height: var(--iqser-top-bar-height);
word-break: break-all;
writing-mode: vertical-rl;
text-orientation: upright;
display: flex;
justify-content: center;
align-items: center;

View File

@ -18,6 +18,7 @@
&.large {
height: 32px;
width: 32px;
min-width: 32px;
font-size: var(--iqser-font-size);
}

View File

@ -15,21 +15,21 @@ const TEXT_INPUT = 'text';
export interface SaveOptions {
closeAfterSave?: boolean;
addMembers?: boolean;
nextAction?: boolean;
}
@Directive()
export abstract class BaseDialogComponent implements AfterViewInit, OnDestroy {
readonly #confirmationDialogService = inject(ConfirmationDialogService);
readonly #dialog = inject(MatDialog);
readonly #hasErrors = signal(true);
readonly iconButtonTypes = IconButtonTypes;
form?: UntypedFormGroup;
initialFormValue!: Record<string, string>;
protected readonly _hasErrors = signal(true);
protected readonly _formBuilder = inject(UntypedFormBuilder);
protected readonly _loadingService = inject(LoadingService);
protected readonly _toaster = inject(Toaster);
protected readonly _subscriptions = new Subscription();
readonly iconButtonTypes = IconButtonTypes;
form?: UntypedFormGroup;
initialFormValue!: Record<string, string>;
readonly #confirmationDialogService = inject(ConfirmationDialogService);
readonly #dialog = inject(MatDialog);
protected constructor(
protected readonly _dialogRef: MatDialogRef<BaseDialogComponent>,
@ -45,17 +45,18 @@ export abstract class BaseDialogComponent implements AfterViewInit, OnDestroy {
}
get disabled(): boolean {
return !this.valid || !this.changed || this.#hasErrors();
return !this.valid || !this.changed || this._hasErrors();
}
ngAfterViewInit() {
this._subscriptions.add(this._dialogRef.backdropClick().subscribe(() => this.close()));
const valueChanges = this.form?.valueChanges ?? of(null);
const events = [fromEvent(window, 'keyup'), fromEvent(window, 'input'), valueChanges];
this._hasErrors.set(!!document.getElementsByClassName('ng-invalid')[0]);
const events$ = merge(...events).pipe(
debounceTime(10),
tap(() => {
this.#hasErrors.set(!!document.getElementsByClassName('ng-invalid')[0]);
this._hasErrors.set(!!document.getElementsByClassName('ng-invalid')[0]);
}),
);
this._subscriptions.add(events$.subscribe());

View File

@ -236,7 +236,11 @@ export class WorkflowComponent<T extends IListable, K extends string> extends Co
private _shouldUpdate(entity: T): boolean {
const existingEntity = this.all[entity.id]?.entity;
return existingEntity && this.config.itemVersionFn(entity) !== this.config.itemVersionFn(existingEntity);
return (
existingEntity &&
(this.config.itemVersionFn(entity) !== this.config.itemVersionFn(existingEntity) ||
JSON.stringify(entity) !== JSON.stringify(existingEntity))
);
}
private _shouldAdd(entity: T): boolean {