-
rhenck authored
The unit tests errored out because of circular dependencies via the Elementfactory class. Therefore: - No longer creates styling/position/player-Properties. This is done in the Element parent class. - Move element creation from Section to the ElementFactory class instead.
rhenck authoredThe unit tests errored out because of circular dependencies via the Elementfactory class. Therefore: - No longer creates styling/position/player-Properties. This is done in the Element parent class. - Move element creation from Section to the ElementFactory class instead.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
spell-correct.ts 2.00 KiB
import { Type } from '@angular/core';
import {
BasicStyles,
InputAssistancePreset,
InputElement,
PositionedUIElement,
PositionProperties, AnswerScheme, UIElement
} from 'common/models/elements/element';
import { ElementComponent } from 'common/directives/element-component.directive';
import { SpellCorrectComponent } from 'common/components/input-elements/spell-correct.component';
export class SpellCorrectElement extends InputElement implements PositionedUIElement {
inputAssistancePreset: InputAssistancePreset = null;
inputAssistancePosition: 'floating' | 'right' = 'floating';
restrictedToInputAssistanceChars: boolean = true;
showSoftwareKeyboard: boolean = false;
softwareKeyboardShowFrench: boolean = false;
position: PositionProperties;
styling: BasicStyles;
constructor(element: Partial<SpellCorrectElement>) {
super({ width: 230, height: 80, ...element });
if (element.inputAssistancePreset) this.inputAssistancePreset = element.inputAssistancePreset;
if (element.inputAssistancePosition) this.inputAssistancePosition = element.inputAssistancePosition;
if (element.restrictedToInputAssistanceChars !== undefined) {
this.restrictedToInputAssistanceChars = element.restrictedToInputAssistanceChars;
}
if (element.showSoftwareKeyboard) this.showSoftwareKeyboard = element.showSoftwareKeyboard;
if (element.softwareKeyboardShowFrench) this.softwareKeyboardShowFrench = element.softwareKeyboardShowFrench;
this.position = UIElement.initPositionProps(element.position);
this.styling = {
...UIElement.initStylingProps({ backgroundColor: 'transparent', ...element.styling })
};
}
hasAnswerScheme(): boolean {
return Boolean(this.getAnswerScheme);
}
getAnswerScheme(): AnswerScheme {
return {
id: this.id,
type: 'string',
format: '',
multiple: false,
nullable: true,
values: [],
valuesComplete: false
};
}
getElementComponent(): Type<ElementComponent> {
return SpellCorrectComponent;
}
}