Skip to content

Commit

Permalink
fix: remove subpanels of subpanels on hide
Browse files Browse the repository at this point in the history
  • Loading branch information
tFaster committed Jul 22, 2024
1 parent aae0700 commit 7724664
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tfaster/stacked-panels",
"version": "5.0.0",
"version": "5.0.1",
"scripts": {
"ng": "ng",
"start": "ng serve demo",
Expand Down
2 changes: 1 addition & 1 deletion projects/stacked-panels/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tfaster/stacked-panels",
"version": "5.0.0",
"version": "5.0.1",
"repository": {
"type" : "git",
"url" : "https://github.com/tFaster/stacked-panels"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const animationDefaultParams: AnimationParams = {
contentFadeAndScaleTime: '200ms',
hiddenContentScale: 0.95,
panelGrowHeightTime: '200ms',
panelShrinkHeightTime: '500ms',
panelShrinkHeightTime: '200ms',
panelSlideInTime: '100ms',
panelSlideOutTime: '100ms'
}
Expand Down
8 changes: 5 additions & 3 deletions projects/stacked-panels/src/lib/stacked-panels.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ export class StackedPanelsService {
private _hidePanelById(panelId: string): void {
const panelIndex: number = this._shownPanels.findIndex((panel: Panel) => panel.id === panelId);
if (panelIndex !== -1) {
this._removeSubPanels(panelId);
const newShownPanels: Panel[] = [...this._shownPanels];
newShownPanels.splice(panelIndex, 1);
const panelsToRemove: Panel[] = this._shownPanels.slice(panelIndex);
panelsToRemove.forEach((panelToRemove: Panel) => {
this._removeSubPanels(panelToRemove.id);
})
const newShownPanels: Panel[] = this._shownPanels.slice(0, panelIndex);
this._shownPanels$.next(newShownPanels);
}
}
Expand Down

0 comments on commit 7724664

Please sign in to comment.