mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-07 10:57:19 +00:00
chore: fix conflicts
This commit is contained in:
parent
22aa77610a
commit
b4dbbdbe02
@ -11,6 +11,7 @@ import {
|
|||||||
import { ISimulatorHost } from '../../simulator';
|
import { ISimulatorHost } from '../../simulator';
|
||||||
import { ParentalNode } from '../../document';
|
import { ParentalNode } from '../../document';
|
||||||
import './insertion.less';
|
import './insertion.less';
|
||||||
|
import { NodeData, NodeSchema } from '@ali/lowcode-types';
|
||||||
|
|
||||||
interface InsertionData {
|
interface InsertionData {
|
||||||
edge?: DOMRect;
|
edge?: DOMRect;
|
||||||
@ -18,6 +19,7 @@ interface InsertionData {
|
|||||||
vertical?: boolean;
|
vertical?: boolean;
|
||||||
nearRect?: Rect;
|
nearRect?: Rect;
|
||||||
coverRect?: DOMRect;
|
coverRect?: DOMRect;
|
||||||
|
nearNode?: NodeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,6 +43,7 @@ function processChildrenDetail(sim: ISimulatorHost, container: ParentalNode, det
|
|||||||
if (detail.near) {
|
if (detail.near) {
|
||||||
const { node, pos, rect, align } = detail.near;
|
const { node, pos, rect, align } = detail.near;
|
||||||
ret.nearRect = rect || sim.computeRect(node);
|
ret.nearRect = rect || sim.computeRect(node);
|
||||||
|
ret.nearNode = node;
|
||||||
if (pos === 'replace') {
|
if (pos === 'replace') {
|
||||||
// FIXME: ret.nearRect mybe null
|
// FIXME: ret.nearRect mybe null
|
||||||
ret.coverRect = ret.nearRect;
|
ret.coverRect = ret.nearRect;
|
||||||
@ -82,6 +85,7 @@ function processChildrenDetail(sim: ISimulatorHost, container: ParentalNode, det
|
|||||||
ret.insertType = 'after';
|
ret.insertType = 'after';
|
||||||
}
|
}
|
||||||
ret.vertical = isVertical(ret.nearRect);
|
ret.vertical = isVertical(ret.nearRect);
|
||||||
|
ret.nearNode = nearNode;
|
||||||
} else {
|
} else {
|
||||||
ret.insertType = 'cover';
|
ret.insertType = 'cover';
|
||||||
ret.coverRect = edge;
|
ret.coverRect = edge;
|
||||||
@ -122,14 +126,13 @@ export class InsertionView extends Component<{ host: BuiltinSimulatorHost }> {
|
|||||||
if (!loc) {
|
if (!loc) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是个绝对定位容器,不需要渲染插入标记
|
// 如果是个绝对定位容器,不需要渲染插入标记
|
||||||
if (loc.target.componentMeta.getMetadata().experimental?.isAbsoluteLayoutContainer) {
|
if (loc.target.componentMeta.getMetadata().experimental?.isAbsoluteLayoutContainer) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { scale, scrollX, scrollY } = host.viewport;
|
const { scale, scrollX, scrollY } = host.viewport;
|
||||||
const { edge, insertType, coverRect, nearRect, vertical } = processDetail(loc);
|
const { edge, insertType, coverRect, nearRect, vertical, nearNode } = processDetail(loc);
|
||||||
|
|
||||||
if (!edge) {
|
if (!edge) {
|
||||||
return null;
|
return null;
|
||||||
@ -162,6 +165,9 @@ export class InsertionView extends Component<{ host: BuiltinSimulatorHost }> {
|
|||||||
y = ((insertType === 'before' ? nearRect.top : nearRect.bottom) + scrollY) * scale;
|
y = ((insertType === 'before' ? nearRect.top : nearRect.bottom) + scrollY) * scale;
|
||||||
style.width = nearRect.width * scale;
|
style.width = nearRect.width * scale;
|
||||||
}
|
}
|
||||||
|
if (y === 0 && (nearNode as NodeSchema)?.componentMeta?.isTopFixed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,12 @@ export class ComponentMeta {
|
|||||||
return this._liveTextEditing;
|
return this._liveTextEditing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _isTopFixed?: boolean;
|
||||||
|
|
||||||
|
get isTopFixed() {
|
||||||
|
return this._isTopFixed;
|
||||||
|
}
|
||||||
|
|
||||||
private parentWhitelist?: NestingFilter | null;
|
private parentWhitelist?: NestingFilter | null;
|
||||||
|
|
||||||
private childWhitelist?: NestingFilter | null;
|
private childWhitelist?: NestingFilter | null;
|
||||||
@ -195,6 +201,12 @@ export class ComponentMeta {
|
|||||||
collectLiveTextEditing(this.configure);
|
collectLiveTextEditing(this.configure);
|
||||||
this._liveTextEditing = liveTextEditing.length > 0 ? liveTextEditing : undefined;
|
this._liveTextEditing = liveTextEditing.length > 0 ? liveTextEditing : undefined;
|
||||||
|
|
||||||
|
const isTopFiexd = this._transformedMetadata.experimental?.isTopFixed;
|
||||||
|
|
||||||
|
if (isTopFiexd) {
|
||||||
|
this._isTopFixed = isTopFiexd;
|
||||||
|
}
|
||||||
|
|
||||||
const { configure = {} } = this._transformedMetadata;
|
const { configure = {} } = this._transformedMetadata;
|
||||||
this._acceptable = false;
|
this._acceptable = false;
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { Node, insertChildren, insertChild, isNode, RootNode, ParentalNode } fro
|
|||||||
import { Selection } from './selection';
|
import { Selection } from './selection';
|
||||||
import { History } from './history';
|
import { History } from './history';
|
||||||
import { TransformStage, ModalNodesManager } from './node';
|
import { TransformStage, ModalNodesManager } from './node';
|
||||||
import { uniqueId } from '@ali/lowcode-utils';
|
import { uniqueId, isPlainObject } from '@ali/lowcode-utils';
|
||||||
|
|
||||||
export type GetDataType<T, NodeType> = T extends undefined
|
export type GetDataType<T, NodeType> = T extends undefined
|
||||||
? NodeType extends {
|
? NodeType extends {
|
||||||
@ -350,7 +350,18 @@ export class DocumentModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export(stage: TransformStage = TransformStage.Serilize) {
|
export(stage: TransformStage = TransformStage.Serilize) {
|
||||||
return this.rootNode?.export(stage);
|
// 置顶只作用于 Page 的第一级子节点,目前还用不到里层的置顶;如果后面有需要可以考虑将这段写到 node-children 中的 export
|
||||||
|
const currentSchema = this.rootNode?.export(stage);
|
||||||
|
if (Array.isArray(currentSchema?.children) && currentSchema?.children.length > 0) {
|
||||||
|
const FixedTopNodeIndex = currentSchema.children
|
||||||
|
.filter(i => isPlainObject(i))
|
||||||
|
.findIndex((i => (i as NodeSchema).props?.__isTopFixed__));
|
||||||
|
if (FixedTopNodeIndex > 0) {
|
||||||
|
const FixedTopNode = currentSchema.children.splice(FixedTopNodeIndex, 1);
|
||||||
|
currentSchema.children.unshift(FixedTopNode[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -172,6 +172,7 @@ export interface OldPrototypeConfig {
|
|||||||
onResizeEnd?: (e: MouseEvent, triggerDirection: string, dragment: Node) => void;
|
onResizeEnd?: (e: MouseEvent, triggerDirection: string, dragment: Node) => void;
|
||||||
devMode?: string;
|
devMode?: string;
|
||||||
schema?: ProjectSchema;
|
schema?: ProjectSchema;
|
||||||
|
isTopFixed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISetterConfig {
|
export interface ISetterConfig {
|
||||||
@ -622,6 +623,7 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
|||||||
onResizeEnd, // onResizeEnd
|
onResizeEnd, // onResizeEnd
|
||||||
devMode,
|
devMode,
|
||||||
schema,
|
schema,
|
||||||
|
isTopFixed,
|
||||||
} = oldConfig;
|
} = oldConfig;
|
||||||
|
|
||||||
const meta: any = {
|
const meta: any = {
|
||||||
@ -728,6 +730,9 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
|||||||
if (view) {
|
if (view) {
|
||||||
experimental.view = view;
|
experimental.view = view;
|
||||||
}
|
}
|
||||||
|
if (isTopFixed) {
|
||||||
|
experimental.isTopFixed = isTopFixed;
|
||||||
|
}
|
||||||
if (transducers) {
|
if (transducers) {
|
||||||
// Array<{ toStatic, toNative }>
|
// Array<{ toStatic, toNative }>
|
||||||
// ? only twice
|
// ? only twice
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import {
|
|||||||
removeEmptyPropsReducer,
|
removeEmptyPropsReducer,
|
||||||
initNodeReducer,
|
initNodeReducer,
|
||||||
liveLifecycleReducer,
|
liveLifecycleReducer,
|
||||||
|
nodeTopFixedReducer,
|
||||||
} from './props-reducers';
|
} from './props-reducers';
|
||||||
|
|
||||||
export const editor = new Editor();
|
export const editor = new Editor();
|
||||||
@ -65,6 +66,9 @@ designer.addPropsReducer(deepValueParser, TransformStage.Render);
|
|||||||
designer.addPropsReducer(removeEmptyPropsReducer, TransformStage.Render);
|
designer.addPropsReducer(removeEmptyPropsReducer, TransformStage.Render);
|
||||||
designer.addPropsReducer(removeEmptyPropsReducer, TransformStage.Save);
|
designer.addPropsReducer(removeEmptyPropsReducer, TransformStage.Save);
|
||||||
|
|
||||||
|
designer.addPropsReducer(nodeTopFixedReducer, TransformStage.Render);
|
||||||
|
designer.addPropsReducer(nodeTopFixedReducer, TransformStage.Save);
|
||||||
|
|
||||||
skeleton.add({
|
skeleton.add({
|
||||||
area: 'mainArea',
|
area: 'mainArea',
|
||||||
name: 'designer',
|
name: 'designer',
|
||||||
|
|||||||
@ -5,3 +5,4 @@ export * from './live-lifecycle-reducer';
|
|||||||
export * from './remove-empty-prop-reducer';
|
export * from './remove-empty-prop-reducer';
|
||||||
export * from './style-reducer';
|
export * from './style-reducer';
|
||||||
export * from './upgrade-reducer';
|
export * from './upgrade-reducer';
|
||||||
|
export * from './node-top-fixed-reducer';
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
import { Node } from '@ali/lowcode-designer';
|
||||||
|
|
||||||
|
export function nodeTopFixedReducer(props: any, node: Node) {
|
||||||
|
if (node.componentMeta.isTopFixed) {
|
||||||
|
return {
|
||||||
|
...props,
|
||||||
|
// experimental prop value
|
||||||
|
__isTopFixed__: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
@ -54,5 +54,5 @@
|
|||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "http://registry.npm.alibaba-inc.com"
|
"registry": "http://registry.npm.alibaba-inc.com"
|
||||||
},
|
},
|
||||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@0.13.1-13/build/index.html"
|
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@0.13.1-15/build/index.html"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,6 +89,7 @@ export interface Experimental {
|
|||||||
// 纯文本编辑:如果 children 内容是
|
// 纯文本编辑:如果 children 内容是
|
||||||
// 文本编辑:配置
|
// 文本编辑:配置
|
||||||
liveTextEditing?: LiveTextEditingConfig[];
|
liveTextEditing?: LiveTextEditingConfig[];
|
||||||
|
isTopFixed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// thinkof Array
|
// thinkof Array
|
||||||
|
|||||||
@ -21,6 +21,7 @@ export interface NodeSchema {
|
|||||||
ignore?: boolean;
|
ignore?: boolean;
|
||||||
locked?: boolean;
|
locked?: boolean;
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
|
isTopFixed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PropsMap = CompositeObject;
|
export type PropsMap = CompositeObject;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user