diff --git a/src/app/common/formula-input/formula-input.component.ts b/src/app/common/formula-input/formula-input.component.ts index 2ff75fe64c95c7ab1a66c75ae20798ea2ea7324e..56534d8f1b972be29f330c263279620ebe9a5682 100644 --- a/src/app/common/formula-input/formula-input.component.ts +++ b/src/app/common/formula-input/formula-input.component.ts @@ -68,8 +68,19 @@ export class FormulaInputComponent implements OnInit, OnChanges, OnDestroy, Afte const rect = this.inputEl.nativeElement.getBoundingClientRect(); const fb = document.getElementById(this.FB_id); fb.style.position = 'absolute'; - fb.style.left = rect.left + rect.width + 'px'; - fb.style.top = rect.top + 'px'; + let left = rect.left + rect.width; + let top = rect.top; + // @ts-ignore + const padWidth = $('#' + this.FB_id).outerWidth() * .8; + // @ts-ignore + const ww = $(window).innerWidth(); + if ((left + padWidth) > ww) { + left = ww - padWidth; + top = top + rect.height; + } + console.log('left', left); + fb.style.left = left + 'px'; + fb.style.top = top + 'px'; fb.style.visibility = 'visible'; } updateValue(val) { diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 47aa82917505dfd69a5798fac5bc44243023ca03..b66ad82c011b977965702daa5eddda116abeb052 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -1,7 +1,7 @@ <div class="model-content"> - <app-formula-input [(ngfModel)]="item.title" (ngfBlur)="save()"></app-formula-input><br> + <app-formula-input style="position: absolute;right:0;" [(ngfModel)]="item.title" (ngfBlur)="save()"></app-formula-input><br> <app-formula-input [(ngfModel)]="item.title" (ngfBlur)="save()"></app-formula-input><br> <div style="padding: 20px;"> @@ -182,8 +182,8 @@ </div> </div> - - + + <div *ngFor="let op of item.choice_obj.optionArr" style="border: 1px solid #ccc; margin: 10px; padding: 10px; border-radius: 5px;"> <div style="margin-top: 20px; display: flex; align-items: center; width: 500px;"> <span style="margin-right: 5px;">{{op.id}}:</span>