Skip to content

Commit

Permalink
Fix opening of config item panels #3212
Browse files Browse the repository at this point in the history
  • Loading branch information
fritschldwg authored and Nereboss committed Apr 2, 2024
1 parent be5a2da commit 6a3ccd3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<mat-expansion-panel
#matExpansionPanel
*ngFor="let customConfigItemGroup of customConfigItemGroups | keyvalue"
[expanded]="isGroupExpanded(customConfigItemGroup.key) || searchTerm.length > 0"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component, Input, OnChanges, ViewEncapsulation } from "@angular/core"
import { Component, Input, OnChanges, SimpleChanges, ViewChild, ViewEncapsulation } from "@angular/core"
import { CustomConfigHelper } from "../../../../util/customConfigHelper"
import { CustomConfigItemGroup } from "../../customConfigs.component"
import { ThreeCameraService } from "../../../codeMap/threeViewer/threeCamera.service"
import { ThreeOrbitControlsService } from "../../../codeMap/threeViewer/threeOrbitControls.service"
import { Store } from "@ngrx/store"
import { MatExpansionPanel } from "@angular/material/expansion"

@Component({
selector: "cc-custom-config-item-group",
Expand All @@ -13,6 +14,7 @@ import { Store } from "@ngrx/store"
})
export class CustomConfigItemGroupComponent implements OnChanges {
@Input() customConfigItemGroups: Map<string, CustomConfigItemGroup>
@ViewChild("matExpansionPanel") matExpansionPanel: MatExpansionPanel
@Input() searchTerm = ""
expandedStates: { [key: string]: boolean } = {}

Expand All @@ -22,7 +24,10 @@ export class CustomConfigItemGroupComponent implements OnChanges {
private threeOrbitControlsService: ThreeOrbitControlsService
) {}

ngOnChanges(): void {
ngOnChanges(changes: SimpleChanges): void {
if (changes.searchTerm && changes.searchTerm.currentValue.length > 0) {
this.matExpansionPanel.open()
}
this.expandedStates = {}
}

Expand Down

0 comments on commit 6a3ccd3

Please sign in to comment.