diff --git a/projects/common/models/elements/button/button.ts b/projects/common/models/elements/button/button.ts index 595b107c50dad4771d6a220d7486af809cc16a6f..2596637f7fa243431635763f8a522bc7449065fb 100644 --- a/projects/common/models/elements/button/button.ts +++ b/projects/common/models/elements/button/button.ts @@ -1,7 +1,7 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, PositionedUIElement, PositionProperties, UIElement } from 'common/models/elements/element'; import { ButtonComponent } from 'common/components/button/button.component'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; export class ButtonElement extends UIElement implements PositionedUIElement { diff --git a/projects/common/models/elements/compound-elements/likert/likert-row.ts b/projects/common/models/elements/compound-elements/likert/likert-row.ts index e4ae7a398aa0e3a692779462d19a6908d02909a8..715d0f6c1d4e660799d5b8a87df18e9134cce50f 100644 --- a/projects/common/models/elements/compound-elements/likert/likert-row.ts +++ b/projects/common/models/elements/compound-elements/likert/likert-row.ts @@ -1,5 +1,5 @@ -import { InputElement, TextImageLabel } from 'common/models/elements/element'; import { Type } from '@angular/core'; +import { InputElement, TextImageLabel } from 'common/models/elements/element'; import { ElementComponent } from 'common/directives/element-component.directive'; import { LikertRadioButtonGroupComponent diff --git a/projects/common/models/elements/compound-elements/likert/likert.ts b/projects/common/models/elements/compound-elements/likert/likert.ts index 261fac49930713d04fb7269b8db7f01e24743b1b..076ad6d8c76cad39d8d4ccafada6d971944196f7 100644 --- a/projects/common/models/elements/compound-elements/likert/likert.ts +++ b/projects/common/models/elements/compound-elements/likert/likert.ts @@ -1,13 +1,10 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { - BasicStyles, CompoundElement, - PositionedUIElement, - PositionProperties, - TextImageLabel, - UIElement + BasicStyles, CompoundElement, UIElement, + PositionedUIElement, PositionProperties, TextImageLabel } from 'common/models/elements/element'; import { LikertRowElement } from 'common/models/elements/compound-elements/likert/likert-row'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { LikertComponent } from 'common/components/compound-elements/likert/likert.component'; diff --git a/projects/common/models/elements/frame/frame.ts b/projects/common/models/elements/frame/frame.ts index 409933c0ecd64ee4526ec27df9e75639cbfa07a0..5a63eafeff14fbb031b76753d97b77cfdb196190 100644 --- a/projects/common/models/elements/frame/frame.ts +++ b/projects/common/models/elements/frame/frame.ts @@ -1,8 +1,8 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, PositionedUIElement, PositionProperties, UIElement } from 'common/models/elements/element'; import { FrameComponent } from 'common/components/frame/frame.component'; import { ElementComponent } from 'common/directives/element-component.directive'; -import { Type } from '@angular/core'; export class FrameElement extends UIElement implements PositionedUIElement { position: PositionProperties; diff --git a/projects/common/models/elements/input-elements/checkbox.ts b/projects/common/models/elements/input-elements/checkbox.ts index 00f448bd8448f85d45a1f1180c18b2f1dee6259c..a7d8b77c4b22299fdbcec70a78311547219805de 100644 --- a/projects/common/models/elements/input-elements/checkbox.ts +++ b/projects/common/models/elements/input-elements/checkbox.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, InputElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { CheckboxComponent } from 'common/components/input-elements/checkbox.component'; diff --git a/projects/common/models/elements/input-elements/drop-list.ts b/projects/common/models/elements/input-elements/drop-list.ts index e392fb3d7c5ffe85dc6896e998bc39cee75c29de..a0a5727d290759112f75845fe4783bda456d6c2a 100644 --- a/projects/common/models/elements/input-elements/drop-list.ts +++ b/projects/common/models/elements/input-elements/drop-list.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, InputElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { DropListComponent } from 'common/components/input-elements/drop-list.component'; @@ -24,7 +24,8 @@ export class DropListElement extends InputElement implements PositionedUIElement if (element.copyOnDrop) this.copyOnDrop = element.copyOnDrop; if (element.orientation) this.orientation = element.orientation; if (element.highlightReceivingDropList) this.highlightReceivingDropList = element.highlightReceivingDropList; - if (element.highlightReceivingDropListColor) this.highlightReceivingDropListColor = element.highlightReceivingDropListColor; + if (element.highlightReceivingDropListColor) this.highlightReceivingDropListColor = + element.highlightReceivingDropListColor; this.position = ElementFactory.initPositionProps({ useMinHeight: true, ...element.position }); this.styling = { ...ElementFactory.initStylingProps({ diff --git a/projects/common/models/elements/input-elements/dropdown.ts b/projects/common/models/elements/input-elements/dropdown.ts index 2f25dedcae6bb0c1c23a4e014bfca6e098abe181..0a20295878469804ae045825a4490c90fc53e8b7 100644 --- a/projects/common/models/elements/input-elements/dropdown.ts +++ b/projects/common/models/elements/input-elements/dropdown.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, InputElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { DropdownComponent } from 'common/components/input-elements/dropdown.component'; diff --git a/projects/common/models/elements/input-elements/radio-button-group-complex.ts b/projects/common/models/elements/input-elements/radio-button-group-complex.ts index b0bd11853bd129099177bd0b5231f73d577c8ae8..18a5c1be43ba60010841bcde2d596d53abd4fb16 100644 --- a/projects/common/models/elements/input-elements/radio-button-group-complex.ts +++ b/projects/common/models/elements/input-elements/radio-button-group-complex.ts @@ -1,3 +1,4 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, @@ -6,7 +7,6 @@ import { PositionProperties, TextImageLabel } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { RadioGroupImagesComponent } from 'common/components/input-elements/radio-group-images.component'; diff --git a/projects/common/models/elements/input-elements/radio-button-group.ts b/projects/common/models/elements/input-elements/radio-button-group.ts index 1549dec75eb5e944b7e6bcf401261bcf0691588d..b6f4403c7fc526c65300deca18f4fddd6d58626a 100644 --- a/projects/common/models/elements/input-elements/radio-button-group.ts +++ b/projects/common/models/elements/input-elements/radio-button-group.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, InputElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { RadioButtonGroupComponent } from 'common/components/input-elements/radio-button-group.component'; diff --git a/projects/common/models/elements/input-elements/slider.ts b/projects/common/models/elements/input-elements/slider.ts index f71a9cfb1307e4e2caebe0f02f57b190950d0506..fdd6c6556f3a3c631b21d4c7418a45054bf3e10a 100644 --- a/projects/common/models/elements/input-elements/slider.ts +++ b/projects/common/models/elements/input-elements/slider.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, InputElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { SliderComponent } from 'common/components/input-elements/slider.component'; diff --git a/projects/common/models/elements/input-elements/spell-correct.ts b/projects/common/models/elements/input-elements/spell-correct.ts index bbaa278a7dee4639176d436d68a5691761ceb171..67856149300a58c183c5757c1c41f64eee6cf78b 100644 --- a/projects/common/models/elements/input-elements/spell-correct.ts +++ b/projects/common/models/elements/input-elements/spell-correct.ts @@ -1,3 +1,4 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, @@ -6,7 +7,6 @@ import { PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { SpellCorrectComponent } from 'common/components/input-elements/spell-correct.component'; diff --git a/projects/common/models/elements/input-elements/text-area.ts b/projects/common/models/elements/input-elements/text-area.ts index df2645318e2e18a6cc1a7f81af79b516acd94d95..ef6eb0d9722711c5d0fcdcdd6f6deccb6f0f1e0d 100644 --- a/projects/common/models/elements/input-elements/text-area.ts +++ b/projects/common/models/elements/input-elements/text-area.ts @@ -1,3 +1,4 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, @@ -6,7 +7,6 @@ import { PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { TextAreaComponent } from 'common/components/input-elements/text-area.component'; diff --git a/projects/common/models/elements/input-elements/text-field.ts b/projects/common/models/elements/input-elements/text-field.ts index aec57c7dd5791f3d5992a13b3b68051fe1c67043..584ee9980664845af1a70bf3d156eb534bda94e8 100644 --- a/projects/common/models/elements/input-elements/text-field.ts +++ b/projects/common/models/elements/input-elements/text-field.ts @@ -1,9 +1,9 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { BasicStyles, InputAssistancePreset, InputElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { TextFieldComponent } from 'common/components/input-elements/text-field.component'; diff --git a/projects/common/models/elements/media-elements/audio.ts b/projects/common/models/elements/media-elements/audio.ts index ca2c2712d2d4b9ca53f23e380eab9b04b8fc5551..388ac28b0c37f72d709b77e63f04cd14fb9e284b 100644 --- a/projects/common/models/elements/media-elements/audio.ts +++ b/projects/common/models/elements/media-elements/audio.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { PlayerElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { AudioComponent } from 'common/components/media-elements/audio.component'; diff --git a/projects/common/models/elements/media-elements/image.ts b/projects/common/models/elements/media-elements/image.ts index 4ce17a75be8081d386d13f7546fce80abdcc6c47..f189af3e1b76ef119e16098a283e923b55c675e2 100644 --- a/projects/common/models/elements/media-elements/image.ts +++ b/projects/common/models/elements/media-elements/image.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { PositionedUIElement, PositionProperties, UIElement } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { ImageComponent } from 'common/components/media-elements/image.component'; diff --git a/projects/common/models/elements/media-elements/video.ts b/projects/common/models/elements/media-elements/video.ts index 99e285f588b930ab96bfdc0805c5a9e87f99b007..89ff862e1664ea3f8bf9793b51aafbfd3eaad7d8 100644 --- a/projects/common/models/elements/media-elements/video.ts +++ b/projects/common/models/elements/media-elements/video.ts @@ -1,6 +1,6 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { PlayerElement, PositionedUIElement, PositionProperties } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { VideoComponent } from 'common/components/media-elements/video.component'; diff --git a/projects/common/models/elements/text/text.ts b/projects/common/models/elements/text/text.ts index 8186aedd77c9e62efc93c764fbd786bad6771270..7474633bb0e66ca26ceaad369ef08423a3af578a 100644 --- a/projects/common/models/elements/text/text.ts +++ b/projects/common/models/elements/text/text.ts @@ -1,11 +1,9 @@ +import { Type } from '@angular/core'; import { ElementFactory } from 'common/util/element.factory'; import { - BasicStyles, - PositionedUIElement, - PositionProperties, - UIElement + BasicStyles, PositionedUIElement, + PositionProperties, UIElement } from 'common/models/elements/element'; -import { Type } from '@angular/core'; import { ElementComponent } from 'common/directives/element-component.directive'; import { TextComponent } from 'common/components/text/text.component'; diff --git a/projects/common/models/section.ts b/projects/common/models/section.ts index 3fbd1d2fd7c43c057eb603ea7136837e760a561d..8e5c76918b459ab594c1d354a3e86487e45769c4 100644 --- a/projects/common/models/section.ts +++ b/projects/common/models/section.ts @@ -1,4 +1,6 @@ -import { PositionedUIElement, UIElement } from 'common/models/elements/element'; +import { Type } from '@angular/core'; +import { IDManager } from 'common/util/id-manager'; +import { PositionedUIElement, UIElement, UIElementValue } from 'common/models/elements/element'; import { ButtonElement } from 'common/models/elements/button/button'; import { TextElement } from 'common/models/elements/text/text'; import { TextFieldElement } from 'common/models/elements/input-elements/text-field'; @@ -23,7 +25,6 @@ import { SliderElement } from 'common/models/elements/input-elements/slider'; import { SpellCorrectElement } from 'common/models/elements/input-elements/spell-correct'; import { FrameElement } from 'common/models/elements/frame/frame'; import { ToggleButtonElement } from 'common/models/elements/compound-elements/cloze/cloze-child-elements/toggle-button'; -import { IDManager } from 'common/util/id-manager'; export class Section { [index: string]: any; diff --git a/projects/common/util/unit-utils.ts b/projects/common/util/unit-utils.ts index b242c9c2eaafcfdb9f12dd8ac401d1957052a81e..c5989685a249600d2d3a5951d344f7b7c0070531 100644 --- a/projects/common/util/unit-utils.ts +++ b/projects/common/util/unit-utils.ts @@ -1,6 +1,6 @@ import { UIElement, UIElementType } from 'common/models/elements/element'; -export abstract class UnitUtils { +export abstract class UnitUtils { // TODO delete this. replce by unit method static findUIElements(value: any | unknown[], type?: UIElementType): UIElement[] { const elements: UIElement[] = []; if (value && typeof value === 'object') { diff --git a/projects/editor/src/app/components/canvas/canvas.component.html b/projects/editor/src/app/components/canvas/canvas.component.html index d99ef49a9a7c8149f9280bae6a9ab4617a471fbc..8f130d24db7e979cbbdf3673e53e1141b395668f 100644 --- a/projects/editor/src/app/components/canvas/canvas.component.html +++ b/projects/editor/src/app/components/canvas/canvas.component.html @@ -14,7 +14,7 @@ [allowDelete]="page.sections.length > 1" (moveSection)="unitService.moveSection(section, page, $event)" (duplicateSection)="unitService.duplicateSection(section, page, i)" - (selectElementComponent)="selectElementComponent($event)"> + (selectElementComponent)="selectElementOverlay($event)"> </aspect-section-menu> <aspect-section-static *ngIf="!section.dynamicPositioning" #sectionComponent diff --git a/projects/editor/src/app/components/canvas/canvas.component.ts b/projects/editor/src/app/components/canvas/canvas.component.ts index b7346e505cf4671a765f421c259e6f4d9ec76d3a..4fc948d6be6d257dbd081aa5b354b9941f5442b1 100644 --- a/projects/editor/src/app/components/canvas/canvas.component.ts +++ b/projects/editor/src/app/components/canvas/canvas.component.ts @@ -25,7 +25,7 @@ import { Section } from 'common/models/section'; export class CanvasComponent { @Input() page!: Page; @ViewChildren('sectionComponent') - childSectionComponents!: QueryList<SectionStaticComponent | SectionDynamicComponent>; + sectionComponents!: QueryList<SectionStaticComponent | SectionDynamicComponent>; constructor(public selectionService: SelectionService, public unitService: UnitService) { } @@ -75,8 +75,8 @@ export class CanvasComponent { this.selectionService.selectedPageSectionIndex = this.page.sections.length - 1; } - selectElementComponent(element: UIElement): void { - const elementComponent = this.getElementComponent(element); + selectElementOverlay(element: UIElement): void { + const elementComponent = this.getElementOverlay(element); if (elementComponent) { this.selectionService.selectElement({ elementComponent: elementComponent, multiSelect: false }); } else { @@ -84,8 +84,8 @@ export class CanvasComponent { } } - private getElementComponent(element: UIElement): CanvasElementOverlay | null { - for (const sectionComponent of this.childSectionComponents.toArray()) { + private getElementOverlay(element: UIElement): CanvasElementOverlay | null { + for (const sectionComponent of this.sectionComponents.toArray()) { for (const elementComponent of sectionComponent.childElementComponents.toArray()) { if (elementComponent.element.id === element.id) { return elementComponent; diff --git a/projects/editor/src/app/components/canvas/dynamic-section-helper-grid.component.ts b/projects/editor/src/app/components/canvas/dynamic-section-helper-grid.component.ts index 37d00cd234da4d6fbf4097bc9235d633189b68f1..f8c898252a7e5a65c19df8988a3519727aba2084 100644 --- a/projects/editor/src/app/components/canvas/dynamic-section-helper-grid.component.ts +++ b/projects/editor/src/app/components/canvas/dynamic-section-helper-grid.component.ts @@ -17,7 +17,7 @@ import { Section } from 'common/models/section'; [style.grid-row-start]="y + 1" [style.grid-row-end]="y + 1" cdkDropList [cdkDropListData]="{ sectionIndex: sectionIndex, gridCoordinates: [x + 1, y + 1] }" - (cdkDropListDropped)="drop($any($event))" + (cdkDropListDropped)="drop($event)" id="list-{{sectionIndex}}-{{x+1}}-{{y+1}}" (dragover)="$event.preventDefault()" (drop)="newElementDropped( $event, x + 1, y + 1)"> @@ -97,7 +97,7 @@ export class DynamicSectionHelperGridComponent implements OnInit, OnChanges { this.rowCountArray = Array(Math.max(numberOfRows, 1)); } - drop(event: CdkDragDrop<{ sectionIndex: number; gridCoordinates?: number[]; }>): void { + drop(event: CdkDragDrop<{ sectionIndex: number; gridCoordinates: number[]; }>): void { const dragItemData: { dragType: string; element: UIElement; } = event.item.data; // Move element to other section - handled by parent (page-canvas). @@ -111,23 +111,23 @@ export class DynamicSectionHelperGridComponent implements OnInit, OnChanges { this.unitService.updateElementsPositionProperty( [event.item.data.element], 'gridColumn', - event.container.data.gridCoordinates![0] + event.container.data.gridCoordinates[0] ); this.unitService.updateElementsPositionProperty( [dragItemData.element], 'gridRow', - event.container.data.gridCoordinates![1] + event.container.data.gridCoordinates[1] ); } else if (event.item.data.dragType === 'resize') { this.unitService.updateElementsPositionProperty( [dragItemData.element], 'gridColumnEnd', - event.container.data.gridCoordinates![0] + 1 + event.container.data.gridCoordinates[0] + 1 ); this.unitService.updateElementsPositionProperty( [dragItemData.element], 'gridRowEnd', - event.container.data.gridCoordinates![1] + 1 + event.container.data.gridCoordinates[1] + 1 ); } else { throw new Error('Unknown drop event'); diff --git a/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts b/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts index 73ff5e32d38a9813d753dc579521db11d28805ff..1388d7d083fd83c859ec15bce599e5434caac81e 100644 --- a/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts +++ b/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts @@ -10,7 +10,7 @@ import { SelectionService } from '../../../services/selection.service'; import { CompoundElementComponent } from 'common/directives/compound-element.directive'; import { ClozeComponent } from 'common/components/compound-elements/cloze/cloze.component'; import { CompoundChildOverlayComponent } from - 'common/components/compound-elements/cloze/compound-child-overlay.component'; + 'common/components/compound-elements/cloze/compound-child-overlay.component'; import { UIElement } from 'common/models/elements/element'; @Directive() @@ -70,7 +70,7 @@ export abstract class CanvasElementOverlay implements OnInit, OnDestroy { } } - elementClicked(event: MouseEvent): void { + elementClicked(event: MouseEvent): void { //TODO method name if (!this.isSelected) { this.selectElement(event.shiftKey); } diff --git a/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/drop-list-properties.component.ts b/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/drop-list-properties.component.ts index 83360045f672176c29604b3f9493d595d06a5306..dcf7b37f87d41e71e3e2d40237c3dcc0ffe9ff3e 100644 --- a/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/drop-list-properties.component.ts +++ b/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/drop-list-properties.component.ts @@ -1,5 +1,5 @@ import { - Component, ElementRef, EventEmitter, Input, Output, ViewChild + Component, EventEmitter, Input, Output } from '@angular/core'; import { UnitService } from '../../../../services/unit.service'; import { SelectionService } from '../../../../services/selection.service';