fix: 使用引擎标准的 lc-container-placeholder,支持 children 属性

This commit is contained in:
mario.gk 2020-09-27 10:46:48 +08:00
parent 05133181ca
commit b26266547b
2 changed files with 13 additions and 45 deletions

View File

@ -151,18 +151,18 @@ class Renderer extends Component<{
viewProps._leaf = leaf;
viewProps._componentName = leaf?.componentName;
// 如果是容器 && 无children && 高宽为空 增加一个占位容器,方便拖动
// if (
// !viewProps.dataSource &&
// leaf?.isContainer() &&
// (children == null || (Array.isArray(children) && !children.length)) &&
// (!viewProps.style || Object.keys(viewProps.style).length === 0)
// ) {
// children = (
// <div className="lc-container-placeholder" style={viewProps.placeholderStyle}>
// {viewProps.placeholder || '拖拽组件或模板到这里'}
// </div>
// );
// }
if (
!viewProps.dataSource &&
leaf?.isContainer() &&
(children == null || (Array.isArray(children) && !children.length)) &&
(!viewProps.style || Object.keys(viewProps.style).length === 0)
) {
children = (
<div className="lc-container-placeholder" style={viewProps.placeholderStyle}>
{viewProps.placeholder || '拖拽组件或模板到这里'}
</div>
);
}
if (viewProps._componentName === 'a') {
delete viewProps.href;
}
@ -189,7 +189,7 @@ class Renderer extends Component<{
return createElement(
getDeviceView(Component, device, designMode),
viewProps,
leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : null,
leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : children,
);
}}
onCompGetRef={(schema: any, ref: ReactInstance | null) => {

View File

@ -63,28 +63,6 @@ html.engine-cursor-ew-resize, html.engine-cursor-ew-resize * {
text-align: center;
}
.engine-empty {
background: #f2f3f5;
color: #a7b1bd;
outline: 1px dashed rgba(31, 56, 88, 0.2);
outline-offset: -1px !important;
height: 66px;
max-height: 100%;
min-width: 140px;
text-align: center;
overflow: hidden;
display: flex;
align-items: center;
}
.engine-empty:before {
content: '\62D6\62FD\7EC4\4EF6\6216\6A21\677F\5230\8FD9\91CC';
font-size: 14px;
z-index: 1;
width: 100%;
white-space: nowrap;
}
body.engine-document {
&:after, &:before {
content: "";
@ -93,16 +71,6 @@ body.engine-document {
&:after {
clear: both;
}
/*
.next-input-group,
.next-checkbox-group,.next-date-picker,.next-input,.next-month-picker,
.next-number-picker,.next-radio-group,.next-range,.next-range-picker,
.next-rating,.next-select,.next-switch,.next-time-picker,.next-upload,
.next-year-picker,
.next-breadcrumb-item,.next-calendar-header,.next-calendar-table {
pointer-events: none !important;
}*/
}
.engine-live-editing {