mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
fixes #781
This commit is contained in:
committed by
Aiden McClelland
parent
2660437e78
commit
41da8e89cf
@@ -106,6 +106,7 @@
|
||||
[formGroup]="$any(entry.value)"
|
||||
[current]="current ? current[entry.key] : undefined"
|
||||
[unionSpec]="spec.type === 'union' ? spec : undefined"
|
||||
(onUnionChange)="resizeUnion(entry.key)"
|
||||
></form-object>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,7 @@ export class FormObjectComponent {
|
||||
@Input() current: { [key: string]: any }
|
||||
@Input() showEdited: boolean = false
|
||||
@Output() onInputChange = new EventEmitter<void>()
|
||||
@Output() onUnionChange = new EventEmitter<void>()
|
||||
warningAck: { [key: string]: boolean } = { }
|
||||
unmasked: { [key: string]: boolean } = { }
|
||||
objectDisplay: { [key: string]: { expanded: boolean, height: string } } = { }
|
||||
@@ -59,17 +60,27 @@ export class FormObjectComponent {
|
||||
}
|
||||
|
||||
updateUnion (e: any): void {
|
||||
const primary = this.unionSpec.tag.id
|
||||
|
||||
Object.keys(this.formGroup.controls).forEach(control => {
|
||||
if (control === 'type') return
|
||||
if (control === primary) return
|
||||
this.formGroup.removeControl(control)
|
||||
})
|
||||
|
||||
const unionGroup = this.formService.getUnionObject(this.unionSpec as ValueSpecUnion, e.detail.value)
|
||||
|
||||
Object.keys(unionGroup.controls).forEach(control => {
|
||||
if (control === 'type') return
|
||||
if (control === primary) return
|
||||
this.formGroup.addControl(control, unionGroup.controls[control])
|
||||
})
|
||||
|
||||
this.onUnionChange.emit()
|
||||
}
|
||||
|
||||
resizeUnion (key: string): void {
|
||||
setTimeout(() => {
|
||||
this.objectDisplay[key].height = this.getDocSize(key)
|
||||
}, 100)
|
||||
}
|
||||
|
||||
addListItemWrapper (key: string, spec: ValueSpec) {
|
||||
|
||||
Reference in New Issue
Block a user