Skip to content

Commit

Permalink
fix(collapse): open editor not expand expected (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored Jun 22, 2021
1 parent 3c6c875 commit 2af530f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/collapse/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,20 @@ export function Collapse(props: ICollapseProps) {
const dom = select<HTMLElement>(
`.${collapseItemClassName}[data-content='${panel.id}']`
);
const contentDom = select<HTMLElement>(
`.${collapseContentClassName}[data-content='${panel.id}']`
);
if (dom && contentDom) {

// Only set content height for non-grow-zero panel
// 'Cause when you set height for grow-zero panel, you'll get wrong height next render time
if (panel.config?.grow !== 0) {
const contentDom = select<HTMLElement>(
`.${collapseContentClassName}[data-content='${panel.id}']`
);
if (contentDom) {
contentDom.style.height = `${height - HEADER_HEIGTH - 2}px`;
}
}
if (dom) {
dom.style.height = `${height}px`;
dom.style.top = `${top}px`;
contentDom.style.height = `${height - HEADER_HEIGTH - 2}px`;
}
});
}, [filterData]);
Expand Down

0 comments on commit 2af530f

Please sign in to comment.