diff --git a/packages/editor-skeleton/src/area.ts b/packages/editor-skeleton/src/area.ts index aafbab857..403a93dcf 100644 --- a/packages/editor-skeleton/src/area.ts +++ b/packages/editor-skeleton/src/area.ts @@ -34,6 +34,10 @@ export default class Area + + + ); +} + +IconFix.displayName = 'Fix'; diff --git a/packages/editor-skeleton/src/icons/float.tsx b/packages/editor-skeleton/src/icons/float.tsx new file mode 100644 index 000000000..a6d88109c --- /dev/null +++ b/packages/editor-skeleton/src/icons/float.tsx @@ -0,0 +1,12 @@ +import { SVGIcon, IconProps } from "@ali/lowcode-utils"; + +export function IconFloat(props: IconProps) { + return ( + + + + + ); +} + +IconFloat.displayName = 'Float'; diff --git a/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx b/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx index 1a7359d38..b3d9594a7 100644 --- a/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx +++ b/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx @@ -6,16 +6,31 @@ import Area from '../area'; import { PanelConfig } from '../types'; import Panel from '../widget/panel'; import { Designer } from '@ali/lowcode-designer'; +import { IconFloat } from '../icons/float'; @observer export default class LeftFixedPane extends Component<{ area: Area }> { shouldComponentUpdate() { return false; } + componentDidUpdate() { // FIXME: dirty fix, need deep think this.props.area.skeleton.editor.get(Designer)?.touchOffsetObserver(); } + + // 取消固定 + setFloat() { + const { area } = this.props; + const { current } = area; + if (!current) { + return; + } + area.skeleton.leftFixedArea.remove(current); + area.skeleton.leftFloatArea.add(current); + area.skeleton.leftFloatArea.container.active(current); + } + render() { const { area } = this.props; const hideTitleBar = area.current?.config.props?.hideTitleBar; @@ -26,15 +41,24 @@ export default class LeftFixedPane extends Component<{ area: Area {!hideTitleBar && ( - + + + + )} diff --git a/packages/editor-skeleton/src/layouts/left-float-pane.tsx b/packages/editor-skeleton/src/layouts/left-float-pane.tsx index d904887f7..6d184c5ac 100644 --- a/packages/editor-skeleton/src/layouts/left-float-pane.tsx +++ b/packages/editor-skeleton/src/layouts/left-float-pane.tsx @@ -2,6 +2,7 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; import { observer, Focusable, focusTracker } from '@ali/lowcode-editor-core'; import { Button, Icon } from '@alifd/next'; +import { IconFix } from '../icons/fix'; import Area from '../area'; import Panel from '../widget/panel'; @@ -76,6 +77,18 @@ export default class LeftFloatPane extends Component<{ area: Area }> this.dispose?.(); } + // 固定 + setFixed() { + const { area } = this.props; + const { current } = area; + if (!current) { + return; + } + area.skeleton.leftFloatArea.remove(current); + area.skeleton.leftFixedArea.add(current); + area.skeleton.leftFixedArea.container.active(current); + } + render() { const { area } = this.props; const width = area.current?.config.props?.width; @@ -93,15 +106,24 @@ export default class LeftFloatPane extends Component<{ area: Area }> > { !hideTitleBar && ( - + + + + ) } diff --git a/packages/editor-skeleton/src/layouts/workbench.less b/packages/editor-skeleton/src/layouts/workbench.less index 504b1e6ff..f73c6ca52 100644 --- a/packages/editor-skeleton/src/layouts/workbench.less +++ b/packages/editor-skeleton/src/layouts/workbench.less @@ -171,6 +171,65 @@ body { display: flex; min-height: 0; position: relative; + + .lc-tabs-title { + width: 100%; + height: 32px; + position: relative; + display: center; + display: flex; + justify-content: center; + align-items: center; + // background: rgba(31,56,88,0.04); + border-bottom: 1px solid #EDEFF3; + .lc-tab-title{ + flex: 1; + height: 32px; + display: flex; + align-items: center; + justify-content: center; + border-bottom: 2px solid transparent; + cursor: pointer; + font-size: 12px; + &.actived { + color: #0079F2; + border-bottom-color: #0079F2; + } + } + } + + .lc-tabs-content { + position: absolute; + top: 32px; + bottom: 0; + left: 0; + right: 0; + } + + .lc-pane-icon-close { + position: absolute; + right: 16px; + top: 14px; + height: auto; + z-index: 2; + .next-icon{ + line-height: 1; + color: rgba(0,0,0,0.6); + } + } + + .lc-pane-icon-fix, .lc-pane-icon-float{ + position: absolute; + right: 38px; + top: 14px; + height: auto; + z-index: 2; + svg { + vertical-align: middle; + color: rgba(0,0,0,0.6); + } + } + .lc-left-float-pane { position: absolute; top: 0; @@ -186,48 +245,6 @@ body { &.lc-area-visible { display: block; } - .lc-pane-close{ - position: absolute; - right: 16px; - top: 16px; - height: auto; - z-index: 2; - .next-icon{ - line-height: 1; - } - } - .lc-tabs-title { - width: 100%; - height: 32px; - position: relative; - display: center; - display: flex; - justify-content: center; - align-items: center; - // background: rgba(31,56,88,0.04); - border-bottom: 1px solid #EDEFF3; - .lc-tab-title{ - flex: 1; - height: 32px; - display: flex; - align-items: center; - justify-content: center; - border-bottom: 2px solid transparent; - cursor: pointer; - font-size: 12px; - &.actived { - color: #0079F2; - border-bottom-color: #0079F2; - } - } - } - .lc-tabs-content { - position: absolute; - top: 32px; - bottom: 0; - left: 0; - right: 0; - } } .lc-left-area { height: 100%; @@ -289,16 +306,6 @@ body { &.lc-area-visible { display: block; } - .lc-pane-close { - position: absolute; - right: 16px; - top: 16px; - height: auto; - z-index: 2; - .next-icon { - line-height: 1; - } - } } .lc-left-area.lc-area-visible ~ .lc-left-fixed-pane { margin-left: 1px;