Skip to content
Snippets Groups Projects
Commit ae5dd3e1 authored by jojohoch's avatar jojohoch
Browse files

[player] Support mapping for DropListSimple

parent b95a676b
No related branches found
No related tags found
No related merge requests found
...@@ -93,10 +93,11 @@ export class AppComponent implements OnInit { ...@@ -93,10 +93,11 @@ export class AppComponent implements OnInit {
private initElementModelElementCodeMappingService(pages: Page[]): void { private initElementModelElementCodeMappingService(pages: Page[]): void {
this.elementModelElementCodeMappingService.dragNDropValueObjects = ( this.elementModelElementCodeMappingService.dragNDropValueObjects = (
UnitUtils.findUIElements(pages, 'drop-list').reduce( UnitUtils.findUIElements(pages, 'drop-list')
(accumulator: DragNDropValueObject[], currentValue: UIElement) => ( .concat(UnitUtils.findUIElements(pages, 'drop-list-simple')).reduce(
(currentValue.value && (currentValue.value as DragNDropValueObject[]).length) ? (accumulator: DragNDropValueObject[], currentValue: UIElement) => (
accumulator.concat(currentValue.value as DragNDropValueObject) : accumulator), [])); (currentValue.value && (currentValue.value as DragNDropValueObject[]).length) ?
accumulator.concat(currentValue.value as DragNDropValueObject) : accumulator), []));
} }
private onFocus(focused: boolean): void { private onFocus(focused: boolean): void {
......
...@@ -17,6 +17,7 @@ export class ElementModelElementCodeMappingService { ...@@ -17,6 +17,7 @@ export class ElementModelElementCodeMappingService {
): InputElementValue => { ): InputElementValue => {
switch (elementModel.type) { switch (elementModel.type) {
case 'drop-list': case 'drop-list':
case 'drop-list-simple':
return (elementCodeValue !== undefined) ? return (elementCodeValue !== undefined) ?
(elementCodeValue as string[]).map(id => this.getDragNDropValueObjectById(id)) as DragNDropValueObject[] : (elementCodeValue as string[]).map(id => this.getDragNDropValueObjectById(id)) as DragNDropValueObject[] :
(elementModel as InputElement).value; (elementModel as InputElement).value;
...@@ -50,6 +51,7 @@ export class ElementModelElementCodeMappingService { ...@@ -50,6 +51,7 @@ export class ElementModelElementCodeMappingService {
mapToElementCodeValue = (elementModelValue: InputElementValue, elementType: UIElementType): InputElementValue => { mapToElementCodeValue = (elementModelValue: InputElementValue, elementType: UIElementType): InputElementValue => {
switch (elementType) { switch (elementType) {
case 'drop-list': case 'drop-list':
case 'drop-list-simple':
return (elementModelValue as DragNDropValueObject[]).map(object => object.id); return (elementModelValue as DragNDropValueObject[]).map(object => object.id);
case 'text': case 'text':
return TextMarker.getMarkingData(elementModelValue as string); return TextMarker.getMarkingData(elementModelValue as string);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment