RED-8342 - Component Editor not showing all values for a multi-value-component
This commit is contained in:
parent
42cc494e2f
commit
82b11d2eba
@ -35,8 +35,8 @@
|
||||
[placeholder]="placeholder"
|
||||
[id]="id"
|
||||
name="name"
|
||||
[style.width]="this.parentDimensions.width + 'px'"
|
||||
[style.height]="this.parentDimensions.height + 'px'"
|
||||
[style.width]="this.textArea.width + 'px'"
|
||||
[style.height]="this.textArea.height + 'px'"
|
||||
></textarea>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
@ -24,8 +24,9 @@ export class EditableInputComponent implements OnChanges {
|
||||
@Input() canEdit = true;
|
||||
@Input() buttonsType: CircleButtonType = CircleButtonTypes.default;
|
||||
@Input() helpModeKey: string = '';
|
||||
@Input() lastChild = false;
|
||||
@Output() readonly save = new EventEmitter<string>();
|
||||
parentDimensions?: { width: number; height: number };
|
||||
textAreaSize?: { width: number; height: number };
|
||||
newValue = '';
|
||||
|
||||
private _editing = false;
|
||||
@ -45,13 +46,24 @@ export class EditableInputComponent implements OnChanges {
|
||||
this.editing = false;
|
||||
}
|
||||
if (changes['parentId']?.currentValue) {
|
||||
setTimeout(() => {
|
||||
const parent = document.getElementById(this.parentId as string) as HTMLElement;
|
||||
this.parentDimensions = { width: parent.offsetWidth - 98, height: parent.offsetHeight - 16 };
|
||||
}, 20);
|
||||
this.setTextAreaSize();
|
||||
}
|
||||
}
|
||||
|
||||
setTextAreaSize() {
|
||||
setTimeout(() => {
|
||||
const element = document.getElementById(this.id as string) as HTMLElement;
|
||||
const parentElement = document.getElementById(this.parentId as string) as HTMLElement;
|
||||
const width = parentElement.offsetWidth - 98;
|
||||
let height = (this.lastChild ? parentElement.offsetHeight : element.offsetHeight) - 16;
|
||||
if (this.lastChild) {
|
||||
const lastChildIndex = Number(this.id?.split('-')[2]);
|
||||
height = height - lastChildIndex * element.offsetHeight;
|
||||
}
|
||||
this.textAreaSize = { width, height };
|
||||
}, 50);
|
||||
}
|
||||
|
||||
saveValue(): void {
|
||||
this.save.emit(this.newValue);
|
||||
this.editing = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user