mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +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)"
|
[formGroup]="$any(entry.value)"
|
||||||
[current]="current ? current[entry.key] : undefined"
|
[current]="current ? current[entry.key] : undefined"
|
||||||
[unionSpec]="spec.type === 'union' ? spec : undefined"
|
[unionSpec]="spec.type === 'union' ? spec : undefined"
|
||||||
|
(onUnionChange)="resizeUnion(entry.key)"
|
||||||
></form-object>
|
></form-object>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export class FormObjectComponent {
|
|||||||
@Input() current: { [key: string]: any }
|
@Input() current: { [key: string]: any }
|
||||||
@Input() showEdited: boolean = false
|
@Input() showEdited: boolean = false
|
||||||
@Output() onInputChange = new EventEmitter<void>()
|
@Output() onInputChange = new EventEmitter<void>()
|
||||||
|
@Output() onUnionChange = new EventEmitter<void>()
|
||||||
warningAck: { [key: string]: boolean } = { }
|
warningAck: { [key: string]: boolean } = { }
|
||||||
unmasked: { [key: string]: boolean } = { }
|
unmasked: { [key: string]: boolean } = { }
|
||||||
objectDisplay: { [key: string]: { expanded: boolean, height: string } } = { }
|
objectDisplay: { [key: string]: { expanded: boolean, height: string } } = { }
|
||||||
@@ -59,17 +60,27 @@ export class FormObjectComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateUnion (e: any): void {
|
updateUnion (e: any): void {
|
||||||
|
const primary = this.unionSpec.tag.id
|
||||||
|
|
||||||
Object.keys(this.formGroup.controls).forEach(control => {
|
Object.keys(this.formGroup.controls).forEach(control => {
|
||||||
if (control === 'type') return
|
if (control === primary) return
|
||||||
this.formGroup.removeControl(control)
|
this.formGroup.removeControl(control)
|
||||||
})
|
})
|
||||||
|
|
||||||
const unionGroup = this.formService.getUnionObject(this.unionSpec as ValueSpecUnion, e.detail.value)
|
const unionGroup = this.formService.getUnionObject(this.unionSpec as ValueSpecUnion, e.detail.value)
|
||||||
|
|
||||||
Object.keys(unionGroup.controls).forEach(control => {
|
Object.keys(unionGroup.controls).forEach(control => {
|
||||||
if (control === 'type') return
|
if (control === primary) return
|
||||||
this.formGroup.addControl(control, unionGroup.controls[control])
|
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) {
|
addListItemWrapper (key: string, spec: ValueSpec) {
|
||||||
|
|||||||
Reference in New Issue
Block a user