mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-14 18:28:13 +00:00
topArea 增加 prop itemClassName
This commit is contained in:
parent
7868ff210a
commit
0eaac97eed
@ -4,23 +4,23 @@ import { observer } from '@ali/lowcode-editor-core';
|
|||||||
import Area from '../area';
|
import Area from '../area';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export default class TopArea extends Component<{ area: Area }> {
|
export default class TopArea extends Component<{ area: Area, itemClassName?: string }> {
|
||||||
render() {
|
render() {
|
||||||
const { area } = this.props;
|
const { area, itemClassName } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className={classNames("lc-top-area", {
|
<div className={classNames("lc-top-area", {
|
||||||
'lc-area-visible': area.visible
|
'lc-area-visible': area.visible
|
||||||
})}>
|
})}>
|
||||||
<Contents area={area} />
|
<Contents area={area} itemClassName={itemClassName} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
class Contents extends Component<{ area: Area }> {
|
class Contents extends Component<{ area: Area, itemClassName?: string }> {
|
||||||
render() {
|
render() {
|
||||||
const { area } = this.props;
|
const { area, itemClassName } = this.props;
|
||||||
const left: any[] = [];
|
const left: any[] = [];
|
||||||
const center: any[] = [];
|
const center: any[] = [];
|
||||||
const right: any[] = [];
|
const right: any[] = [];
|
||||||
@ -29,12 +29,17 @@ class Contents extends Component<{ area: Area }> {
|
|||||||
const index2 = b.config?.index || 0;
|
const index2 = b.config?.index || 0;
|
||||||
return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1);
|
return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1);
|
||||||
}).forEach(item => {
|
}).forEach(item => {
|
||||||
|
const content = (
|
||||||
|
<div className={itemClassName || ''}>
|
||||||
|
{item.content}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
if (item.align === 'center') {
|
if (item.align === 'center') {
|
||||||
center.push(item.content);
|
center.push(content);
|
||||||
} else if (item.align === 'left') {
|
} else if (item.align === 'left') {
|
||||||
left.push(item.content);
|
left.push(content);
|
||||||
} else {
|
} else {
|
||||||
right.push(item.content);
|
right.push(content);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -13,16 +13,16 @@ import RightArea from './right-area';
|
|||||||
import './workbench.less';
|
import './workbench.less';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Workbench extends Component<{ skeleton: Skeleton, className?: string }> {
|
export class Workbench extends Component<{ skeleton: Skeleton, className?: string, topAreaItemClassName?: string }> {
|
||||||
shouldComponentUpdate() {
|
shouldComponentUpdate() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { skeleton, className } = this.props;
|
const { skeleton, className, topAreaItemClassName } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className={classNames('lc-workbench', className)}>
|
<div className={classNames('lc-workbench', className)}>
|
||||||
<TopArea area={skeleton.topArea} />
|
<TopArea area={skeleton.topArea} itemClassName={topAreaItemClassName} />
|
||||||
<div className="lc-workbench-body">
|
<div className="lc-workbench-body">
|
||||||
<LeftArea area={skeleton.leftArea} />
|
<LeftArea area={skeleton.leftArea} />
|
||||||
<LeftFloatPane area={skeleton.leftFloatArea} />
|
<LeftFloatPane area={skeleton.leftFloatArea} />
|
||||||
|
|||||||
@ -44,6 +44,7 @@ function init(container?: Element) {
|
|||||||
createElement(Workbench, {
|
createElement(Workbench, {
|
||||||
skeleton,
|
skeleton,
|
||||||
className: 'engine-main',
|
className: 'engine-main',
|
||||||
|
topAreaItemClassName: 'engine-actionitem',
|
||||||
}),
|
}),
|
||||||
container,
|
container,
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user