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.area = 'left';
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) {
newConfig.props.title = menu;
}
@ -83,6 +83,7 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
maxWidth,
height,
maxHeight,
canSetFixed,
onInit: init,
onDestroy: destroy,
};

View File

@ -91,6 +91,7 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
if (!current) {
return;
}
area.skeleton.leftFloatArea.remove(current);
area.skeleton.leftFixedArea.add(current);
area.skeleton.leftFixedArea.container.active(current);
@ -99,6 +100,12 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
render() {
const { area } = this.props;
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 style = width ? {
width
@ -114,13 +121,17 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
{
!hideTitleBar && (
<Fragment>
<Button
text
className="lc-pane-icon-fix"
onClick={this.setFixed.bind(this)}
>
<IconFix />
</Button>
{
canSetFixed && (
<Button
text
className="lc-pane-icon-fix"
onClick={this.setFixed.bind(this)}
>
<IconFix />
</Button>
)
}
<Button
text
className="lc-pane-icon-close"