Merge branch 'fix/minor-bugs-lianjie.lj' into 'release/0.9.13'

fix(editor-skeleton): add canSetFixed prop to panel config



See merge request !951079
This commit is contained in:
力皓 2020-08-26 21:29:23 +08:00
commit 4f426f29d6
2 changed files with 20 additions and 8 deletions

View File

@ -68,7 +68,7 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
newConfig.type = 'PanelDock'; newConfig.type = 'PanelDock';
newConfig.area = 'left'; newConfig.area = 'left';
newConfig.props.description = description || title; newConfig.props.description = description || title;
const { contents, hideTitleBar, tip, width, maxWidth, height, maxHeight, menu, isAction } = config; const { contents, hideTitleBar, tip, width, maxWidth, height, maxHeight, menu, isAction, canSetFixed } = config;
if (menu) { if (menu) {
newConfig.props.title = menu; newConfig.props.title = menu;
} }
@ -83,6 +83,7 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
maxWidth, maxWidth,
height, height,
maxHeight, maxHeight,
canSetFixed,
onInit: init, onInit: init,
onDestroy: destroy, onDestroy: destroy,
}; };

View File

@ -91,6 +91,7 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
if (!current) { if (!current) {
return; return;
} }
area.skeleton.leftFloatArea.remove(current); area.skeleton.leftFloatArea.remove(current);
area.skeleton.leftFixedArea.add(current); area.skeleton.leftFixedArea.add(current);
area.skeleton.leftFixedArea.container.active(current); area.skeleton.leftFixedArea.container.active(current);
@ -99,6 +100,12 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
render() { render() {
const { area } = this.props; const { area } = this.props;
const width = area.current?.config.props?.width; const width = area.current?.config.props?.width;
// can be set fixed by default
let canSetFixed = true;
if (area.current?.config.props?.canSetFixed === false) {
canSetFixed = false;
}
const hideTitleBar = area.current?.config.props?.hideTitleBar; const hideTitleBar = area.current?.config.props?.hideTitleBar;
const style = width ? { const style = width ? {
width width
@ -114,6 +121,8 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
{ {
!hideTitleBar && ( !hideTitleBar && (
<Fragment> <Fragment>
{
canSetFixed && (
<Button <Button
text text
className="lc-pane-icon-fix" className="lc-pane-icon-fix"
@ -121,6 +130,8 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
> >
<IconFix /> <IconFix />
</Button> </Button>
)
}
<Button <Button
text text
className="lc-pane-icon-close" className="lc-pane-icon-close"