Commit 82ba5919 authored by rhenck's avatar rhenck
Browse files

Moar refactoring

parent aaca3126
......@@ -2,7 +2,7 @@ import {
Component, EventEmitter, Input, Output
} from '@angular/core';
import { ElementComponent } from '../../directives/element-component.directive';
import { ButtonElement } from 'common/ui-elements/button/button';
import { ButtonElement } from 'common/models/elements/button/button';
@Component({
selector: 'aspect-button',
......@@ -20,11 +20,12 @@ import { ButtonElement } from 'common/ui-elements/button/button';
[style.text-decoration]="elementModel.styling.underline ? 'underline' : ''"
[style.border-radius.px]="elementModel.styling.borderRadius"
(click)="$event.preventDefault(); elementModel.action && elementModel.actionParam !== null ?
navigateTo.emit({
action: elementModel.action,
param: elementModel.actionParam
}) :
false">{{elementModel.label}}</a>
navigateTo.emit({
action: elementModel.action,
param: elementModel.actionParam
}) : false">
{{elementModel.label}}
</a>
<button *ngIf="!elementModel.imageSrc && !elementModel.asLink" mat-button
type='button'
[style.width.%]="100"
......
......@@ -3,9 +3,9 @@ import { CdkDragDrop } from '@angular/cdk/drag-drop/drag-events';
import {
CdkDrag, CdkDropList, moveItemInArray, transferArrayItem
} from '@angular/cdk/drag-drop';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { DragNDropValueObject } from 'common/interfaces/elements';
import { DropListSimpleElement } from 'common/ui-elements/cloze/drop-list-simple';
import { FormElementComponent } from '../../../../directives/form-element-component.directive';
import { DropListSimpleElement } from 'common/models/elements/compound-elements/cloze/cloze-child-elements/drop-list-simple';
import { DragNDropValueObject } from 'common/models/elements/element';
@Component({
selector: 'aspect-drop-list-simple',
......
import {
Component, EventEmitter, Input, Output
} from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { TextFieldSimpleElement } from 'common/ui-elements/cloze/text-field-simple';
import { FormElementComponent } from '../../../../directives/form-element-component.directive';
import { TextFieldSimpleElement } from 'common/models/elements/compound-elements/cloze/cloze-child-elements/text-field-simple';
@Component({
selector: 'aspect-text-field-simple',
......
import { Component, Input } from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { ToggleButtonElement } from 'common/ui-elements/cloze/toggle-button';
import { FormElementComponent } from '../../../../directives/form-element-component.directive';
import { ToggleButtonElement } from 'common/models/elements/compound-elements/cloze/cloze-child-elements/toggle-button';
@Component({
selector: 'aspect-toggle-button',
......
import {
Component, EventEmitter, Input, Output, QueryList, ViewChildren
} from '@angular/core';
import { CompoundElementComponent } from '../../directives/compound-element.directive';
import { CompoundChildOverlayComponent } from '../../components/compound-child-overlay.component';
import { ElementComponent } from '../../directives/element-component.directive';
import { InputElement } from 'common/classes/element';
import { ClozeUtils } from '../../util/cloze';
import { ClozeElement } from 'common/ui-elements/cloze/cloze';
import { CompoundElementComponent } from 'common/directives/compound-element.directive';
import { CompoundChildOverlayComponent } from './compound-child-overlay.component';
import { ElementComponent } from 'common/directives/element-component.directive';
import { InputElement } from 'common/models/elements/element';
import { ClozeElement } from 'common/models/elements/compound-elements/cloze/cloze';
// TODO background color implementieren
@Component({
selector: 'aspect-cloze',
template: `
<ng-container *ngIf="elementModel.document.content.length == 0">
<ng-container *ngIf="!elementModel.document"> TODO
Kein Dokument vorhanden
</ng-container>
<div [style.width.%]="100"
[style.height]="'auto'"
[style.column-count]="elementModel.columnCount">
<ng-container *ngFor="let part of elementModel.document.content">
<ng-container *ngFor="let part of elementModel.document?.content">
<ul *ngIf="part.type === 'bulletList'"
[style.font-size]="part.attrs.fontSize"
[style.list-style]="part.attrs.listStyle">
......@@ -196,10 +195,6 @@ export class ClozeComponent extends CompoundElementComponent {
editorMode: boolean = false;
getFormElementModelChildren(): InputElement[] {
return ClozeUtils.getClozeChildElements(this.elementModel);
}
getFormElementChildrenComponents(): ElementComponent[] {
return this.compoundChildren.map((child: CompoundChildOverlayComponent) => child.childComponent);
}
......
......@@ -3,11 +3,11 @@ import {
Component, EventEmitter, Input, Output, ViewChild
} from '@angular/core';
import { FormGroup } from '@angular/forms';
import { ElementComponent } from '../directives/element-component.directive';
import { ValueChangeElement } from 'common/interfaces/elements';
import { ToggleButtonElement } from 'common/ui-elements/cloze/toggle-button';
import { TextFieldSimpleElement } from 'common/ui-elements/cloze/text-field-simple';
import { DropListSimpleElement } from 'common/ui-elements/cloze/drop-list-simple';
import { ElementComponent } from '../../../directives/element-component.directive';
import { ToggleButtonElement } from 'common/models/elements/compound-elements/cloze/cloze-child-elements/toggle-button';
import { TextFieldSimpleElement } from 'common/models/elements/compound-elements/cloze/cloze-child-elements/text-field-simple';
import { DropListSimpleElement } from 'common/models/elements/compound-elements/cloze/cloze-child-elements/drop-list-simple';
import { ValueChangeElement } from 'common/models/elements/element';
@Component({
selector: 'aspect-compound-child-overlay',
......@@ -45,7 +45,7 @@ import { DropListSimpleElement } from 'common/ui-elements/cloze/drop-list-simple
'aspect-drop-list-simple {line-height: unset; vertical-align: top;}'
]
})
export class CompoundChildOverlayComponent {
export class CompoundChildOverlayComponent { // TODO rename to ClozeChildOverlay
@Input() element!: ToggleButtonElement | TextFieldSimpleElement | DropListSimpleElement;
@Input() parentForm!: FormGroup;
@Input() editorMode: boolean = false;
......
import { Component, Input } from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { LikertRowElement } from 'common/ui-elements/likert/likert-row';
import { FormElementComponent } from '../../../directives/form-element-component.directive';
import { LikertRowElement } from 'common/models/elements/compound-elements/likert/likert-row';
@Component({
selector: 'aspect-likert-radio-button-group',
......
......@@ -2,10 +2,10 @@ import {
Component, Input, QueryList, ViewChildren
} from '@angular/core';
import { LikertRadioButtonGroupComponent } from './likert-radio-button-group.component';
import { CompoundElementComponent } from '../../directives/compound-element.directive';
import { ElementComponent } from '../../directives/element-component.directive';
import { LikertElement } from 'common/ui-elements/likert/likert';
import { LikertRowElement } from 'common/ui-elements/likert/likert-row';
import { CompoundElementComponent } from '../../../directives/compound-element.directive';
import { ElementComponent } from '../../../directives/element-component.directive';
import { LikertElement } from 'common/models/elements/compound-elements/likert/likert';
import { LikertRowElement } from 'common/models/elements/compound-elements/likert/likert-row';
@Component({
selector: 'aspect-likert',
......@@ -69,10 +69,6 @@ export class LikertComponent extends CompoundElementComponent {
@ViewChildren(LikertRadioButtonGroupComponent) compoundChildren!: QueryList<LikertRadioButtonGroupComponent>;
@Input() elementModel!: LikertElement;
getFormElementModelChildren(): LikertRowElement[] {
return this.elementModel.rows;
}
getFormElementChildrenComponents(): ElementComponent[] {
return this.compoundChildren.toArray();
}
......
import { Component, Input } from '@angular/core';
import { ElementComponent } from '../../directives/element-component.directive';
import { FrameElement } from 'common/ui-elements/frame/frame';
import { FrameElement } from 'common/models/elements/frame/frame';
@Component({
selector: 'aspect-frame',
......
import { Component, Input } from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { CheckboxElement } from 'common/ui-elements/checkbox/checkbox';
import { CheckboxElement } from 'common/models/elements/input-elements/checkbox';
@Component({
selector: 'aspect-checkbox',
......
......@@ -4,8 +4,8 @@ import {
CdkDrag, CdkDropList, moveItemInArray
} from '@angular/cdk/drag-drop';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { DragNDropValueObject } from 'common/interfaces/elements';
import { DropListElement } from 'common/ui-elements/drop-list/drop-list';
import { DropListElement } from 'common/models/elements/input-elements/drop-list';
import { DragNDropValueObject } from 'common/models/elements/element';
@Component({
selector: 'aspect-drop-list',
......
import { Component, Input } from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { DropdownElement } from 'common/ui-elements/dropdown/dropdown';
import { DropdownElement } from 'common/models/elements/input-elements/dropdown';
@Component({
selector: 'aspect-dropdown',
......
import { Component, Input } from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { RadioButtonGroupElement } from 'common/ui-elements/radio/radio-button-group';
import { RadioButtonGroupElement } from 'common/models/elements/input-elements/radio-button-group';
@Component({
selector: 'aspect-radio-button-group',
......
import { Component, Input } from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { RadioButtonGroupComplexElement } from 'common/ui-elements/radio-complex/radio-button-group-complex';
import { RadioButtonGroupComplexElement } from 'common/models/elements/input-elements/radio-button-group-complex';
@Component({
selector: 'aspect-radio-group-images',
......
......@@ -3,7 +3,7 @@ import {
} from '@angular/core';
import { MatSlider } from '@angular/material/slider';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { SliderElement } from 'common/ui-elements/slider/slider';
import { SliderElement } from 'common/models/elements/input-elements/slider';
@Component({
selector: 'aspect-slider',
......
......@@ -3,7 +3,7 @@ import {
} from '@angular/core';
import { MatInput } from '@angular/material/input';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { SpellCorrectElement } from 'common/ui-elements/spell-correct/spell-correct';
import { SpellCorrectElement } from 'common/models/elements/input-elements/spell-correct';
@Component({
selector: 'aspect-spell-correct',
......
......@@ -2,7 +2,7 @@ import {
Component, Output, EventEmitter, Input
} from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { TextAreaElement } from 'common/ui-elements/text-area/text-area';
import { TextAreaElement } from 'common/models/elements/input-elements/text-area';
@Component({
selector: 'aspect-text-area',
......
......@@ -2,7 +2,7 @@ import {
Component, EventEmitter, Input, Output
} from '@angular/core';
import { FormElementComponent } from '../../directives/form-element-component.directive';
import { TextFieldElement } from 'common/ui-elements/text-field/text-field';
import { TextFieldElement } from 'common/models/elements/input-elements/text-field';
@Component({
selector: 'aspect-text-field',
......
import { Component, Input } from '@angular/core';
import { MediaPlayerElementComponent } from '../../directives/media-player-element-component.directive';
import { AudioElement } from 'common/ui-elements/audio/audio';
import { AudioElement } from 'common/models/elements/media-elements/audio';
@Component({
selector: 'aspect-audio',
......
import {
Component, EventEmitter, HostListener, Input, Output
} from '@angular/core';
import { ValueChangeElement } from '../interfaces/elements';
import { ValueChangeElement } from 'common/models/elements/element';
@Component({
selector: 'aspect-image-magnifier',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment