mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-21 13:03:29 +00:00
Pane 相关 bug fix
This commit is contained in:
parent
c8ceb8443f
commit
51a45cfa5f
@ -1,6 +1,7 @@
|
|||||||
import { Component, ReactElement } from 'react';
|
import { Component, ReactElement } from 'react';
|
||||||
|
import { Icon } from '@alifd/next';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Title, observer } from '@ali/lowcode-editor-core';
|
import { Title, observer, Tip } from '@ali/lowcode-editor-core';
|
||||||
import { DockProps } from '../types';
|
import { DockProps } from '../types';
|
||||||
import PanelDock from '../widget/panel-dock';
|
import PanelDock from '../widget/panel-dock';
|
||||||
import { composeTitle } from '../widget/utils';
|
import { composeTitle } from '../widget/utils';
|
||||||
@ -21,6 +22,25 @@ export function DockView({ title, icon, description, size, className, onClick }:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function HelpTip({ tip }: any) {
|
||||||
|
if (tip && tip.url) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<a href={tip.url} target="_blank" rel="noopener noreferrer">
|
||||||
|
<Icon type="help" size="small" className="lc-help-tip"/>
|
||||||
|
</a>
|
||||||
|
<Tip>{tip.content}</Tip>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Icon type="help" size="small" className="lc-help-tip"/>
|
||||||
|
<Tip>{tip.content}</Tip>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class PanelDockView extends Component<DockProps & { dock: PanelDock }> {
|
export class PanelDockView extends Component<DockProps & { dock: PanelDock }> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@ -196,7 +216,7 @@ class PanelTitle extends Component<{ panel: Panel; className?: string }> {
|
|||||||
data-name={panel.name}
|
data-name={panel.name}
|
||||||
>
|
>
|
||||||
<Title title={panel.title || panel.name} />
|
<Title title={panel.title || panel.name} />
|
||||||
{/*pane.help ? <HelpTip tip={panel.help} /> : null*/}
|
{panel.help ? <HelpTip tip={panel.help} /> : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,12 +13,15 @@ export default class LeftFixedPane extends Component<{ area: Area<PanelConfig, P
|
|||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const { area } = this.props;
|
const { area } = this.props;
|
||||||
|
const hideTitleBar = area.current?.config.props?.hideTitleBar;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames('lc-left-fixed-pane', {
|
className={classNames('lc-left-fixed-pane', {
|
||||||
'lc-area-visible': area.visible,
|
'lc-area-visible': area.visible,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
{
|
||||||
|
!hideTitleBar && (
|
||||||
<Button
|
<Button
|
||||||
text
|
text
|
||||||
className="lc-pane-close"
|
className="lc-pane-close"
|
||||||
@ -28,6 +31,8 @@ export default class LeftFixedPane extends Component<{ area: Area<PanelConfig, P
|
|||||||
>
|
>
|
||||||
<Icon type="close" />
|
<Icon type="close" />
|
||||||
</Button>
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
<Contents area={area} />
|
<Contents area={area} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -32,6 +32,7 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
|
|||||||
// focusout remove focus
|
// focusout remove focus
|
||||||
// onEsc
|
// onEsc
|
||||||
const width = area.current?.config.props?.width;
|
const width = area.current?.config.props?.width;
|
||||||
|
const hideTitleBar = area.current?.config.props?.hideTitleBar;
|
||||||
const style = width ? {
|
const style = width ? {
|
||||||
width
|
width
|
||||||
} : undefined;
|
} : undefined;
|
||||||
@ -42,6 +43,8 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
|
|||||||
})}
|
})}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
|
{
|
||||||
|
!hideTitleBar && (
|
||||||
<Button
|
<Button
|
||||||
text
|
text
|
||||||
className="lc-pane-close"
|
className="lc-pane-close"
|
||||||
@ -51,6 +54,8 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
|
|||||||
>
|
>
|
||||||
<Icon type="close" />
|
<Icon type="close" />
|
||||||
</Button>
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
<Contents area={area} />
|
<Contents area={area} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -57,4 +57,6 @@
|
|||||||
--color-block-background-deep-dark: @normal-5;
|
--color-block-background-deep-dark: @normal-5;
|
||||||
--color-layer-mask-background: @dark-alpha-7;
|
--color-layer-mask-background: @dark-alpha-7;
|
||||||
--color-layer-tooltip-background: rgba(44,47,51,0.8);
|
--color-layer-tooltip-background: rgba(44,47,51,0.8);
|
||||||
|
|
||||||
|
--pane-title-bg-color: rgba(31,56,88,.04);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,19 +54,25 @@ body {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.lc-panel-title {
|
.lc-panel-title {
|
||||||
height: 32px;
|
height: 38px;
|
||||||
background-color: var(--pane-title-bg-color);
|
font-size: 14px;
|
||||||
|
background-color: var(--pane-title-bg-color,rgba(31,56,88,.04));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
|
border-bottom: 1px solid var(--color-line-normal,rgba(31,56,88,.1));
|
||||||
|
|
||||||
.lc-help-tip {
|
.lc-help-tip {
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
|
color: rgba(0,0,0,0.4);
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lc-panel-body {
|
.lc-panel-body {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 32px;
|
top: 38px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|||||||
@ -64,7 +64,7 @@ export default class PanelDock implements IWidget {
|
|||||||
name: this.panelName,
|
name: this.panelName,
|
||||||
props: {
|
props: {
|
||||||
// FIXME! give default title for panel
|
// FIXME! give default title for panel
|
||||||
// title: props ? composeTitle(props?.title, props?.icon, props?.description, true) : '',
|
title: props ? composeTitle(props?.title, props?.icon, props?.description, true) : '',
|
||||||
...panelProps,
|
...panelProps,
|
||||||
},
|
},
|
||||||
contentProps,
|
contentProps,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { skeleton, editor } from './editor';
|
import { skeleton, editor } from './editor';
|
||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
import { IWidgetBaseConfig } from '@ali/lowcode-editor-skeleton';
|
import { IWidgetBaseConfig, Skeleton } from '@ali/lowcode-editor-skeleton';
|
||||||
import { uniqueId } from '@ali/lowcode-utils';
|
import { uniqueId } from '@ali/lowcode-utils';
|
||||||
|
|
||||||
export interface IContentItemConfig {
|
export interface IContentItemConfig {
|
||||||
@ -85,6 +85,7 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
|
|||||||
}
|
}
|
||||||
if (!isAction) {
|
if (!isAction) {
|
||||||
newConfig.panelProps = {
|
newConfig.panelProps = {
|
||||||
|
title,
|
||||||
hideTitleBar,
|
hideTitleBar,
|
||||||
help: tip,
|
help: tip,
|
||||||
width,
|
width,
|
||||||
@ -156,6 +157,10 @@ const dockPane = Object.assign(skeleton.leftArea, {
|
|||||||
* compatible *VE.dockPane.activeDock*
|
* compatible *VE.dockPane.activeDock*
|
||||||
*/
|
*/
|
||||||
activeDock(item: any) {
|
activeDock(item: any) {
|
||||||
|
if (!item) {
|
||||||
|
skeleton.leftFloatArea?.current?.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
const name = item.name || item;
|
const name = item.name || item;
|
||||||
skeleton.getPanel(name)?.active();
|
skeleton.getPanel(name)?.active();
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user