mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-20 15:38:32 +00:00
chore: fix conflicts
This commit is contained in:
commit
95a8356803
@ -73,6 +73,14 @@ export class BorderDetecting extends Component<{ host: BuiltinSimulatorHost }> {
|
|||||||
render() {
|
render() {
|
||||||
const { host } = this.props;
|
const { host } = this.props;
|
||||||
const { current } = this;
|
const { current } = this;
|
||||||
|
|
||||||
|
const canHoverHook = current?.componentMeta.getMetadata()?.experimental?.callbacks?.onHoverHook;
|
||||||
|
const canHover = (canHoverHook && typeof canHoverHook === 'function') ? canHoverHook(current) : true;
|
||||||
|
|
||||||
|
if (!canHover) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!current || host.viewport.scrolling || host.liveEditing.editing) {
|
if (!current || host.viewport.scrolling || host.liveEditing.editing) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ export class BoxResizingForNode extends Component<{ host: BuiltinSimulatorHost;
|
|||||||
const { node } = this.props;
|
const { node } = this.props;
|
||||||
const { designer } = this.host;
|
const { designer } = this.host;
|
||||||
|
|
||||||
if (!instances || instances.length < 1) {
|
if (!instances || instances.length < 1 || this.dragging) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@ -114,9 +114,15 @@ export class BoxResizingInstance extends Component<{
|
|||||||
// private outline: any;
|
// private outline: any;
|
||||||
private willUnbind: () => any;
|
private willUnbind: () => any;
|
||||||
|
|
||||||
private outlineRight: any;
|
// outline of eight direction
|
||||||
|
private outlineN: any;
|
||||||
private outlineLeft: any;
|
private outlineE: any;
|
||||||
|
private outlineS: any;
|
||||||
|
private outlineW: any;
|
||||||
|
private outlineNE: any;
|
||||||
|
private outlineNW: any;
|
||||||
|
private outlineSE: any;
|
||||||
|
private outlineSW: any;
|
||||||
|
|
||||||
private dragEngine: DragResizeEngine;
|
private dragEngine: DragResizeEngine;
|
||||||
|
|
||||||
@ -204,29 +210,33 @@ export class BoxResizingInstance extends Component<{
|
|||||||
this.willUnbind();
|
this.willUnbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.outlineRight && !this.outlineLeft) {
|
if (
|
||||||
|
!this.outlineN &&
|
||||||
|
!this.outlineE &&
|
||||||
|
!this.outlineS &&
|
||||||
|
!this.outlineW &&
|
||||||
|
!this.outlineNE &&
|
||||||
|
!this.outlineNW &&
|
||||||
|
!this.outlineSE &&
|
||||||
|
!this.outlineSW
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unBind: any[] = [];
|
const unBind: any[] = [];
|
||||||
|
const node = this.props.observed.node;
|
||||||
|
|
||||||
unBind.push(
|
unBind.push(
|
||||||
this.dragEngine.from(this.outlineRight, 'e', () => {
|
...[
|
||||||
// if (!this.hoveringLine.hasOutline()) {
|
this.dragEngine.from(this.outlineN, 'n', () => node),
|
||||||
// return null;
|
this.dragEngine.from(this.outlineE, 'e', () => node),
|
||||||
// }
|
this.dragEngine.from(this.outlineS, 's', () => node),
|
||||||
// return this.hoveringLine.getCurrentNode();
|
this.dragEngine.from(this.outlineW, 'w', () => node),
|
||||||
return this.props.observed.node;
|
this.dragEngine.from(this.outlineNE, 'ne', () => node),
|
||||||
}),
|
this.dragEngine.from(this.outlineNW, 'nw', () => node),
|
||||||
);
|
this.dragEngine.from(this.outlineSE, 'se', () => node),
|
||||||
unBind.push(
|
this.dragEngine.from(this.outlineSW, 'sw', () => node),
|
||||||
this.dragEngine.from(this.outlineLeft, 'w', () => {
|
],
|
||||||
return this.props.observed.node;
|
|
||||||
// if (!this.hoveringLine.hasOutline()) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// return this.hoveringLine.getCurrentNode();
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.willUnbind = () => {
|
this.willUnbind = () => {
|
||||||
@ -252,29 +262,36 @@ export class BoxResizingInstance extends Component<{
|
|||||||
triggerVisible = metaData.experimental.getResizingHandlers(node);
|
triggerVisible = metaData.experimental.getResizingHandlers(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
const className = classNames('lc-borders lc-resize-box');
|
const baseSideClass = 'lc-borders lc-resize-side';
|
||||||
|
const baseCornerClass = 'lc-borders lc-resize-corner';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{triggerVisible.includes('w') && (
|
{triggerVisible.includes('n') && (
|
||||||
<div
|
<div
|
||||||
ref={(ref) => {
|
ref={(ref) => { this.outlineN = ref; }}
|
||||||
this.outlineLeft = ref;
|
className={classNames(baseSideClass, 'n')}
|
||||||
}}
|
|
||||||
className={className}
|
|
||||||
style={{
|
style={{
|
||||||
height: offsetHeight,
|
height: 20,
|
||||||
transform: `translate(${offsetLeft - 10}px, ${offsetTop}px)`,
|
transform: `translate(${offsetLeft}px, ${offsetTop - 10}px)`,
|
||||||
width: 20,
|
width: offsetWidth,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{triggerVisible.includes('ne') && (
|
||||||
|
<div
|
||||||
|
ref={(ref) => { this.outlineNE = ref; }}
|
||||||
|
className={classNames(baseCornerClass, 'ne')}
|
||||||
|
style={{
|
||||||
|
transform: `translate(${offsetLeft + offsetWidth - 5}px, ${offsetTop - 3}px)`,
|
||||||
|
cursor: 'nesw-resize',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{triggerVisible.includes('e') && (
|
{triggerVisible.includes('e') && (
|
||||||
<div
|
<div
|
||||||
className={className}
|
className={classNames(baseSideClass, 'e')}
|
||||||
ref={(ref) => {
|
ref={(ref) => { this.outlineE = ref; }}
|
||||||
this.outlineRight = ref;
|
|
||||||
}}
|
|
||||||
style={{
|
style={{
|
||||||
height: offsetHeight,
|
height: offsetHeight,
|
||||||
transform: `translate(${offsetLeft + offsetWidth - 10}px, ${offsetTop}px)`,
|
transform: `translate(${offsetLeft + offsetWidth - 10}px, ${offsetTop}px)`,
|
||||||
@ -282,6 +299,58 @@ export class BoxResizingInstance extends Component<{
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{triggerVisible.includes('se') && (
|
||||||
|
<div
|
||||||
|
ref={(ref) => { this.outlineSE = ref; }}
|
||||||
|
className={classNames(baseCornerClass, 'se')}
|
||||||
|
style={{
|
||||||
|
transform: `translate(${offsetLeft + offsetWidth - 5}px, ${offsetTop + offsetHeight - 5}px)`,
|
||||||
|
cursor: 'nwse-resize',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{triggerVisible.includes('s') && (
|
||||||
|
<div
|
||||||
|
ref={(ref) => { this.outlineS = ref; }}
|
||||||
|
className={classNames(baseSideClass, 's')}
|
||||||
|
style={{
|
||||||
|
height: 20,
|
||||||
|
transform: `translate(${offsetLeft}px, ${offsetTop + offsetHeight - 10}px)`,
|
||||||
|
width: offsetWidth,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{triggerVisible.includes('sw') && (
|
||||||
|
<div
|
||||||
|
ref={(ref) => { this.outlineSW = ref; }}
|
||||||
|
className={classNames(baseCornerClass, 'sw')}
|
||||||
|
style={{
|
||||||
|
transform: `translate(${offsetLeft - 3}px, ${offsetTop + offsetHeight - 5}px)`,
|
||||||
|
cursor: 'nesw-resize',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{triggerVisible.includes('w') && (
|
||||||
|
<div
|
||||||
|
ref={(ref) => { this.outlineW = ref; }}
|
||||||
|
className={classNames(baseSideClass, 'w')}
|
||||||
|
style={{
|
||||||
|
height: offsetHeight,
|
||||||
|
transform: `translate(${offsetLeft - 10}px, ${offsetTop}px)`,
|
||||||
|
width: 20,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{triggerVisible.includes('nw') && (
|
||||||
|
<div
|
||||||
|
ref={(ref) => { this.outlineNW = ref; }}
|
||||||
|
className={classNames(baseCornerClass, 'nw')}
|
||||||
|
style={{
|
||||||
|
transform: `translate(${offsetLeft - 3}px, ${offsetTop - 3}px)`,
|
||||||
|
cursor: 'nwse-resize',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,12 @@ export class BorderSelectingInstance extends Component<{
|
|||||||
dragging,
|
dragging,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hideSelectTools = observed.node.componentMeta.getMetadata().experimental?.hideSelectTools;
|
||||||
|
|
||||||
|
if (hideSelectTools) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className} style={style}>
|
<div className={className} style={style}>
|
||||||
{!dragging && <Toolbar observed={observed} />}
|
{!dragging && <Toolbar observed={observed} />}
|
||||||
|
|||||||
@ -49,10 +49,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.lc-resize-box {
|
&.lc-resize-corner {
|
||||||
|
display: inline-block;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border: 1px solid #197aff;
|
||||||
|
background: #fff;
|
||||||
|
pointer-events: auto;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.lc-resize-side {
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
cursor: ew-resize;
|
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -61,13 +70,32 @@
|
|||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: "";
|
||||||
display: block;
|
display: block;
|
||||||
height: calc(100% - 20px);
|
border: 1px solid #197aff;
|
||||||
min-height: 50%;
|
background: #fff;
|
||||||
width: 4px;
|
// background: #738397;
|
||||||
background: #738397;
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
// animation: flashing 1.5s infinite linear;
|
// animation: flashing 1.5s infinite linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.e,
|
||||||
|
&.w {
|
||||||
|
cursor: ew-resize;
|
||||||
|
&:after {
|
||||||
|
width: 4px;
|
||||||
|
// height: calc(100% - 20px);
|
||||||
|
min-height: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.n,
|
||||||
|
&.s {
|
||||||
|
cursor: ns-resize;
|
||||||
|
&:after {
|
||||||
|
// width: calc(100% - 20px);
|
||||||
|
min-width: 50%;
|
||||||
|
height: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// &&-hovering {
|
// &&-hovering {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export default class DragGhost extends Component<{ designer: Designer }> {
|
|||||||
this.y = e.globalY;
|
this.y = e.globalY;
|
||||||
if (isSimulatorHost(e.sensor)) {
|
if (isSimulatorHost(e.sensor)) {
|
||||||
const container = e.sensor.getDropContainer(e);
|
const container = e.sensor.getDropContainer(e);
|
||||||
if (container.container.componentMeta.getMetadata().experimental?.isAbsoluteLayoutContainer) {
|
if (container?.container.componentMeta.getMetadata().experimental?.isAbsoluteLayoutContainer) {
|
||||||
this.isAbsoluteLayoutContainer = true;
|
this.isAbsoluteLayoutContainer = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,6 +137,7 @@ export interface OldPrototypeConfig {
|
|||||||
|
|
||||||
isContainer?: boolean; // => configure.component.isContainer
|
isContainer?: boolean; // => configure.component.isContainer
|
||||||
isAbsoluteLayoutContainer?: boolean; // => meta.experimental.isAbsoluteLayoutContainer 是否是绝对定位容器
|
isAbsoluteLayoutContainer?: boolean; // => meta.experimental.isAbsoluteLayoutContainer 是否是绝对定位容器
|
||||||
|
hideSelectTools?: boolean; // => meta.experimental.hideSelectTools
|
||||||
isModal?: boolean; // => configure.component.isModal
|
isModal?: boolean; // => configure.component.isModal
|
||||||
isFloating?: boolean; // => configure.component.isFloating
|
isFloating?: boolean; // => configure.component.isFloating
|
||||||
descriptor?: string; // => configure.component.descriptor
|
descriptor?: string; // => configure.component.descriptor
|
||||||
@ -144,6 +145,7 @@ export interface OldPrototypeConfig {
|
|||||||
// alias to canDragging
|
// alias to canDragging
|
||||||
canDraging?: boolean; // => onDrag
|
canDraging?: boolean; // => onDrag
|
||||||
canDragging?: boolean; // => ?
|
canDragging?: boolean; // => ?
|
||||||
|
canHovering?: ((dragment: Node) => boolean) | boolean;
|
||||||
|
|
||||||
canSelecting?: boolean; // => onClickHook
|
canSelecting?: boolean; // => onClickHook
|
||||||
canOperating?: boolean; // => disabledActions
|
canOperating?: boolean; // => disabledActions
|
||||||
@ -596,6 +598,7 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
|||||||
transducers,
|
transducers,
|
||||||
isContainer,
|
isContainer,
|
||||||
isAbsoluteLayoutContainer,
|
isAbsoluteLayoutContainer,
|
||||||
|
hideSelectTools,
|
||||||
rectSelector,
|
rectSelector,
|
||||||
isModal,
|
isModal,
|
||||||
isFloating,
|
isFloating,
|
||||||
@ -614,6 +617,7 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
|||||||
canDraging,
|
canDraging,
|
||||||
canDragging, // handleDragging
|
canDragging, // handleDragging
|
||||||
canSelecting, // onClickHook
|
canSelecting, // onClickHook
|
||||||
|
canHovering,
|
||||||
// events
|
// events
|
||||||
didDropOut, // onNodeRemove
|
didDropOut, // onNodeRemove
|
||||||
didDropIn, // onNodeAdd
|
didDropIn, // onNodeAdd
|
||||||
@ -686,6 +690,7 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
|||||||
// 未考虑清楚的,放在实验性段落
|
// 未考虑清楚的,放在实验性段落
|
||||||
const experimental: any = {
|
const experimental: any = {
|
||||||
isAbsoluteLayoutContainer,
|
isAbsoluteLayoutContainer,
|
||||||
|
hideSelectTools,
|
||||||
};
|
};
|
||||||
if (context) {
|
if (context) {
|
||||||
// for prototype.getContextInfo
|
// for prototype.getContextInfo
|
||||||
@ -743,7 +748,7 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
|||||||
if (canResizing) {
|
if (canResizing) {
|
||||||
// TODO: enhance
|
// TODO: enhance
|
||||||
experimental.getResizingHandlers = (currentNode: any) => {
|
experimental.getResizingHandlers = (currentNode: any) => {
|
||||||
const directs = ['n', 'w', 's', 'e'];
|
const directs = ['n', 'e', 's', 'w', 'ne', 'nw', 'se', 'sw'];
|
||||||
if (canResizing === true) {
|
if (canResizing === true) {
|
||||||
return directs;
|
return directs;
|
||||||
}
|
}
|
||||||
@ -766,6 +771,9 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
|||||||
}
|
}
|
||||||
callbacks.onClickHook = () => v;
|
callbacks.onClickHook = () => v;
|
||||||
}
|
}
|
||||||
|
if (canHovering != null) {
|
||||||
|
callbacks.onHoverHook = typeof canHovering === 'boolean' ? () => canHovering : canHovering;
|
||||||
|
}
|
||||||
if (didDropIn) {
|
if (didDropIn) {
|
||||||
callbacks.onNodeAdd = didDropIn;
|
callbacks.onNodeAdd = didDropIn;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ export interface Experimental {
|
|||||||
callbacks?: Callbacks;
|
callbacks?: Callbacks;
|
||||||
initialChildren?: NodeData[] | ((target: SettingTarget) => NodeData[]);
|
initialChildren?: NodeData[] | ((target: SettingTarget) => NodeData[]);
|
||||||
isAbsoluteLayoutContainer: boolean;
|
isAbsoluteLayoutContainer: boolean;
|
||||||
|
hideSelectTools?: boolean;
|
||||||
|
|
||||||
// 样式 及 位置,handle上必须有明确的标识以便事件路由判断,或者主动设置事件独占模式
|
// 样式 及 位置,handle上必须有明确的标识以便事件路由判断,或者主动设置事件独占模式
|
||||||
// NWSE 是交给引擎计算放置位置,ReactElement 必须自己控制初始位置
|
// NWSE 是交给引擎计算放置位置,ReactElement 必须自己控制初始位置
|
||||||
@ -183,6 +184,7 @@ export interface Callbacks {
|
|||||||
// onLocateHook?: (e: any, currentNode: any) => any;
|
// onLocateHook?: (e: any, currentNode: any) => any;
|
||||||
// onAcceptHook?: (currentNode: any, locationData: any) => any;
|
// onAcceptHook?: (currentNode: any, locationData: any) => any;
|
||||||
onMoveHook?: (currentNode: any) => boolean; // thinkof 限制性拖拽
|
onMoveHook?: (currentNode: any) => boolean; // thinkof 限制性拖拽
|
||||||
|
onHoverHook?: (currentNode: any) => boolean;
|
||||||
onChildMoveHook?: (childNode: any, currentNode: any) => boolean;
|
onChildMoveHook?: (childNode: any, currentNode: any) => boolean;
|
||||||
|
|
||||||
// events
|
// events
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user