diff --git a/projects/common/models/uI-element.ts b/projects/common/models/uI-element.ts index d9900867b06daa2a2ec25fe9562a02a94fe8479c..c90bb8dbb1ed408f393ddacc9e6a8970180798d0 100644 --- a/projects/common/models/uI-element.ts +++ b/projects/common/models/uI-element.ts @@ -3,6 +3,8 @@ export type UIElementType = 'text' | 'button' | 'text-field' | 'text-area' | 'ch | 'dropdown' | 'radio' | 'image' | 'audio' | 'video' | 'likert' | 'likert_row' | 'radio-group-images' | 'drop-list' | 'cloze' | 'spell-correct' | 'slider' | 'frame' | 'toggle-button'; export type InputElementValue = string[] | string | number | boolean | DragNDropValueObject[] | null; +export type InputAssistancePreset = 'none' | 'french' | 'numbers' | 'numbersAndOperators' | 'comparisonOperators'; + export type DragNDropValueObject = { id: string; stringValue?: string; diff --git a/projects/common/ui-elements/text-area/text-area-element.ts b/projects/common/ui-elements/text-area/text-area-element.ts index c3440ae193b076dc861c2eefb7c55c0bd7687715..3911d98954f183fc550175369f4cd7a0bc020b27 100644 --- a/projects/common/ui-elements/text-area/text-area-element.ts +++ b/projects/common/ui-elements/text-area/text-area-element.ts @@ -1,6 +1,7 @@ import { FontElement, FontProperties, + InputAssistancePreset, InputElement, PositionedElement, PositionProperties, SurfaceElement, @@ -13,7 +14,7 @@ export class TextAreaElement extends InputElement implements PositionedElement, appearance: 'fill' | 'outline' = 'outline'; resizeEnabled: boolean = false; rowCount: number = 3; - inputAssistancePreset: 'none' | 'french' | 'numbers' | 'numbersAndOperators' | 'comparisonOperators' = 'none'; + inputAssistancePreset: InputAssistancePreset = 'none'; inputAssistancePosition: 'floating' | 'right' = 'floating'; positionProps: PositionProperties; diff --git a/projects/common/ui-elements/text-field/text-field-element.ts b/projects/common/ui-elements/text-field/text-field-element.ts index 166fbe54af808ecb8c2068bcd26faa8e04ca2061..71d649493bc50b519f7626827696b5968d37676e 100644 --- a/projects/common/ui-elements/text-field/text-field-element.ts +++ b/projects/common/ui-elements/text-field/text-field-element.ts @@ -1,6 +1,7 @@ import { FontElement, FontProperties, + InputAssistancePreset, InputElement, PositionedElement, PositionProperties, SurfaceElement, @@ -17,7 +18,7 @@ export class TextFieldElement extends InputElement implements PositionedElement, maxLengthWarnMessage: string = 'Eingabe zu lang'; pattern: string = ''; patternWarnMessage: string = 'Eingabe entspricht nicht der Vorgabe'; - inputAssistancePreset: 'none' | 'french' | 'numbers' | 'numbersAndOperators' | 'comparisonOperators' = 'none'; + inputAssistancePreset: InputAssistancePreset = 'none'; inputAssistancePosition: 'floating' | 'right' = 'floating'; clearable: boolean = false; diff --git a/projects/player/src/app/components/keyboard/keyboard.component.ts b/projects/player/src/app/components/keyboard/keyboard.component.ts index 4d37ea747248c47e7eafc1dabe68649128cc77c7..ad6591346f1bea767a32d0b4d90f5101b4e3d5f0 100644 --- a/projects/player/src/app/components/keyboard/keyboard.component.ts +++ b/projects/player/src/app/components/keyboard/keyboard.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { InputAssistancePreset } from '../../../../../common/models/uI-element'; @Component({ selector: 'app-keyboard', @@ -8,7 +9,7 @@ import { styleUrls: ['./keyboard.component.css'] }) export class KeyboardComponent { - @Input() preset!: 'french' | 'numbers' | 'numbersAndOperators' | 'comparisonOperators' | 'none'; + @Input() preset!: InputAssistancePreset; @Input() position!: 'floating' | 'right'; @Input() inputElement!: HTMLTextAreaElement | HTMLInputElement; @Input() positionOffset!: number; diff --git a/projects/player/src/app/components/math-keyboard/math-keyboard.component.ts b/projects/player/src/app/components/math-keyboard/math-keyboard.component.ts index b5b7a653a095b0ea9e7a726dae64a78108cdd4b8..1e071b77a4d597884a01d477ad20d166be31c1b1 100644 --- a/projects/player/src/app/components/math-keyboard/math-keyboard.component.ts +++ b/projects/player/src/app/components/math-keyboard/math-keyboard.component.ts @@ -1,6 +1,7 @@ import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { InputAssistancePreset } from '../../../../../common/models/uI-element'; @Component({ selector: 'app-math-keyboard', @@ -8,7 +9,7 @@ import { styleUrls: ['./math-keyboard.component.css'] }) export class MathKeyboardComponent implements OnInit, AfterViewInit { - @Input() preset!: 'french' | 'numbers' | 'numbersAndOperators' | 'comparisonOperators' | 'none'; + @Input() preset!: InputAssistancePreset; @Input() position!: 'floating' | 'right'; @Input() inputElement!: HTMLTextAreaElement | HTMLInputElement; diff --git a/projects/player/src/app/services/keyboard.service.ts b/projects/player/src/app/services/keyboard.service.ts index 875c9f36f9b9018ab9f3d2bab618a0a17d7cf2b6..9d8da4ea6989210dd66ba773075f71c464c606f2 100644 --- a/projects/player/src/app/services/keyboard.service.ts +++ b/projects/player/src/app/services/keyboard.service.ts @@ -1,13 +1,14 @@ import { Injectable } from '@angular/core'; import { TextFieldComponent } from '../../../../common/ui-elements/text-field/text-field.component'; import { TextAreaComponent } from '../../../../common/ui-elements/text-area/text-area.component'; +import { InputAssistancePreset } from '../../../../common/models/uI-element'; @Injectable({ providedIn: 'root' }) export class KeyboardService { isOpen!: boolean; - preset!: 'french' | 'numbers' | 'numbersAndOperators' | 'comparisonOperators' | 'none'; + preset!: InputAssistancePreset; position!: 'floating' | 'right'; inputElement!: HTMLTextAreaElement | HTMLInputElement; elementComponent!: TextFieldComponent | TextAreaComponent; @@ -31,7 +32,7 @@ export class KeyboardService { } openKeyboard(inputElement: HTMLTextAreaElement | HTMLInputElement, - preset: 'french' | 'numbers' | 'numbersAndOperators' | 'comparisonOperators' | 'none', + preset: InputAssistancePreset, position: 'floating' | 'right', elementComponent: TextFieldComponent | TextAreaComponent): boolean { this.inputElement = inputElement;