Skip to content

Commit

Permalink
🐛 fix(draggable-panel): 修改展开受控模式的高度塌陷问题 (#127) (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
vv13 authored Jul 1, 2024
1 parent ff0a14f commit 568e14e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DraggablePanel/FixMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const FixMode: FC<FixModePanelProps> = memo<FixModePanelProps>(
maxHeight: typeof maxHeight === 'number' ? Math.max(maxHeight, 0) : undefined,
maxWidth: typeof maxWidth === 'number' ? Math.max(maxWidth, 0) : undefined,
defaultSize,
size: size as Size,
size: (size || { height: 'auto' }) as Size,
style,
}
: {
Expand Down
29 changes: 29 additions & 0 deletions src/DraggablePanel/demos/controlFixed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* compact: false
*/
import { DraggablePanel } from '@ant-design/pro-editor';
import { useState } from 'react';

export default () => {
const [open, setOpen] = useState(false);
return (
<div
style={{
height: 300,
display: 'flex',
overflow: 'hidden',
maxWidth: '100%',
}}
>
<div style={{ flex: 1, padding: 12 }}>Content</div>
<DraggablePanel
style={{ padding: 12 }}
maxWidth={600}
isExpand={open}
onExpandChange={setOpen}
>
Right Panel
</DraggablePanel>
</div>
);
};
2 changes: 2 additions & 0 deletions src/DraggablePanel/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Used for panels that need to be stretched or dragged and moved.

<code src="./demos/top.tsx" title="Fixed Panel at the Top" description="The panel at the top is fixed and can be dragged up and down"></code>

<code src="./demos/controlFixed.tsx" title="Fixed Panel expandable controlled" description="The panel is fixed and expand can be controlled"></code>

<code src="./demos/float.tsx" compact="true" title="Floating Draggable Panel" description="Set `mode` to `float`"></code>

<code src="./demos/controlFloat.tsx" compact="true" title="Floating Controlled Mode" description="The position of the floating panel is controlled"></code>
Expand Down
2 changes: 2 additions & 0 deletions src/DraggablePanel/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ group: 面板模块

<code src="./demos/top.tsx" title="顶部面板固定" description="顶部面板固定,上下拖动"></code>

<code src="./demos/controlFixed.tsx" title="面板展开受控" description="右侧面板固定,展开状态受控模式"></code>

<code src="./demos/float.tsx" compact="true" title="悬浮可拖拽面板" description="设置 `mode` 为 `float`"></code>

<code src="./demos/controlFloat.tsx" compact="true" title="悬浮受控模式" description="悬浮框位置受控"></code>
Expand Down

0 comments on commit 568e14e

Please sign in to comment.