From 39a9afe1d550c356a67ab35303384ce8b5457e58 Mon Sep 17 00:00:00 2001 From: mchouliara Date: Tue, 17 Sep 2024 16:07:21 +0300 Subject: [PATCH] add id input to select components, focus function to text editor --- .../multiple/multiple-auto-complete.component.html | 2 +- .../multiple/multiple-auto-complete.component.ts | 2 +- .../single/single-auto-complete.component.html | 2 +- .../single/single-auto-complete.component.ts | 3 ++- .../rich-text-editor/rich-text-editor.component.ts | 10 ++++++++-- frontend/src/app/ui/navbar/navbar.component.html | 6 ++++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html b/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html index 4d025718b..2e0faeea3 100644 --- a/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html +++ b/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.html @@ -19,7 +19,7 @@
- +
diff --git a/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts b/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts index dcd7d9795..08785b7ae 100644 --- a/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts +++ b/frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts @@ -54,6 +54,7 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp @Input() separatorKeysCodes = []; + @Input({required: false}) id: string = `multiple-autocomplete-${MultipleAutoCompleteComponent.nextId++}`; // Selected Option Event @Output() optionSelected: EventEmitter = new EventEmitter(); @@ -62,7 +63,6 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp @Output() optionActionClicked: EventEmitter = new EventEmitter(); - id = `multiple-autocomplete-${MultipleAutoCompleteComponent.nextId++}`; stateChanges = new Subject(); valueOnBlur = new BehaviorSubject(null); diff --git a/frontend/src/app/library/auto-complete/single/single-auto-complete.component.html b/frontend/src/app/library/auto-complete/single/single-auto-complete.component.html index 631b2bf9a..927be0689 100644 --- a/frontend/src/app/library/auto-complete/single/single-auto-complete.component.html +++ b/frontend/src/app/library/auto-complete/single/single-auto-complete.component.html @@ -1,5 +1,5 @@
- + arrow_drop_down diff --git a/frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts b/frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts index 3b547b323..757435371 100644 --- a/frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts +++ b/frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts @@ -40,6 +40,8 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple @ViewChild('autocompleteInput', { static: true }) autocompleteInput: ElementRef; @Input() initialSelectedData: any; + @Input({required: false}) id: string = `single-autocomplete-${SingleAutoCompleteComponent.nextId++}`; + @Input() get configuration(): SingleAutoCompleteConfiguration { return this._configuration; } set configuration(configuration: SingleAutoCompleteConfiguration) { @@ -55,7 +57,6 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple @Output() optionSelected: EventEmitter = new EventEmitter(); @Output() optionActionClicked: EventEmitter = new EventEmitter(); - id = `single-autocomplete-${SingleAutoCompleteComponent.nextId++}`; stateChanges = new Subject(); focused = false; controlType = 'single-autocomplete'; diff --git a/frontend/src/app/library/rich-text-editor/rich-text-editor.component.ts b/frontend/src/app/library/rich-text-editor/rich-text-editor.component.ts index ea37ca853..4b168c36e 100644 --- a/frontend/src/app/library/rich-text-editor/rich-text-editor.component.ts +++ b/frontend/src/app/library/rich-text-editor/rich-text-editor.component.ts @@ -1,6 +1,6 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from "@angular/core"; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild } from "@angular/core"; import { FormControl } from "@angular/forms"; -import { AngularEditorConfig } from "@kolkov/angular-editor"; +import { AngularEditorComponent, AngularEditorConfig } from "@kolkov/angular-editor"; import { Subscription } from "rxjs"; @Component({ @@ -20,6 +20,8 @@ import { Subscription } from "rxjs"; }) export class RichTextEditorComponent implements OnInit, OnChanges, OnDestroy { + @ViewChild(AngularEditorComponent) editor: AngularEditorComponent + @Input() form: FormControl; @Input() id: string = "editor1"; @Input() placeholder: string = "Enter text"; @@ -104,6 +106,10 @@ export class RichTextEditorComponent implements OnInit, OnChanges, OnDestroy { window.document.execCommand("insertText", false, text); } + focus(){ + this.editor?.focus(); + } + private observeFormStatus(): void { this.formTouchSubscription = this.formTouchEvent .subscribe( diff --git a/frontend/src/app/ui/navbar/navbar.component.html b/frontend/src/app/ui/navbar/navbar.component.html index 7886d230d..0ba841c5e 100644 --- a/frontend/src/app/ui/navbar/navbar.component.html +++ b/frontend/src/app/ui/navbar/navbar.component.html @@ -6,7 +6,9 @@
- + @if(extraImageURL){