mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-04 17:27:09 +00:00
Merge branch 'fix/vision-preset-bug-fix-0729' into 'release/0.9.0'
Fix/vision preset bug fix 0729 See merge request !913094
This commit is contained in:
commit
867f63aea8
@ -244,7 +244,7 @@ export class NodeChildren {
|
|||||||
return this.children.some((child, index) => fn(child, index));
|
return this.children.some((child, index) => fn(child, index));
|
||||||
}
|
}
|
||||||
|
|
||||||
filter(fn: (item: Node, index: number) => item is Node) {
|
filter(fn: (item: Node, index: number) => any) {
|
||||||
return this.children.filter(fn);
|
return this.children.filter(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -793,11 +793,39 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
getSuitablePlace(node: Node, ref: any): any {
|
getSuitablePlace(node: Node, ref: any): any {
|
||||||
// TODO:
|
if (this.isRoot() && this.children) {
|
||||||
if (this.isRoot()) {
|
const dropElement = this.children.filter((c: Node) => {
|
||||||
|
if (!c.isContainer()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const canDropIn = c.componentMeta?.prototype?.options?.canDropIn;
|
||||||
|
if (typeof canDropIn === 'function') {
|
||||||
|
return canDropIn(node);
|
||||||
|
} else if (typeof canDropIn === 'boolean'){
|
||||||
|
return canDropIn;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})[0];
|
||||||
|
if (dropElement) {
|
||||||
|
return { container: dropElement, ref };
|
||||||
|
}
|
||||||
return { container: this, ref };
|
return { container: this, ref };
|
||||||
}
|
}
|
||||||
return { container: this.parent, ref: this };
|
|
||||||
|
const canDropIn = this.componentMeta?.prototype?.options?.canDropIn;
|
||||||
|
if (this.isContainer()) {
|
||||||
|
if (canDropIn === undefined ||
|
||||||
|
(typeof canDropIn === 'boolean' && canDropIn) ||
|
||||||
|
(typeof canDropIn === 'function' && canDropIn(node))){
|
||||||
|
return { container: this, ref };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.parent) {
|
||||||
|
return this.parent.getSuitablePlace(node, ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -813,9 +841,9 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
registerAddon(key: string, exportData: () => any, isProp: boolean = false) {
|
registerAddon(key: string, exportData: () => any, isProp: boolean = false) {
|
||||||
if (this._addons[key]) {
|
// if (this._addons[key]) {
|
||||||
throw new Error(`node addon ${key} exist`);
|
// throw new Error(`node addon ${key} exist`);
|
||||||
}
|
// }
|
||||||
|
|
||||||
this._addons[key] = { exportData, isProp };
|
this._addons[key] = { exportData, isProp };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,21 +281,24 @@ export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollec
|
|||||||
}
|
}
|
||||||
|
|
||||||
let initialFn = (slotName ? null : initial) || initialValue;
|
let initialFn = (slotName ? null : initial) || initialValue;
|
||||||
if (slotName && initialValue === true) {
|
// 在 upgrade reducer 做了 JSBlock ——> JSSlot
|
||||||
initialFn = (value: any, defaultValue: any) => {
|
// if (slotName && initialValue === true) {
|
||||||
if (isJSSlot(value)) {
|
// initialFn = (value: any, defaultValue: any) => {
|
||||||
return {
|
// if (isJSSlot(value)) {
|
||||||
title: slotTitle || title,
|
// return {
|
||||||
...value,
|
// title: slotTitle || title,
|
||||||
};
|
// name: slotName,
|
||||||
}
|
// ...value,
|
||||||
return {
|
// };
|
||||||
type: 'JSSlot',
|
// }
|
||||||
title: slotTitle || title,
|
// return {
|
||||||
value: initialChildren,
|
// type: 'JSSlot',
|
||||||
};
|
// title: slotTitle || title,
|
||||||
};
|
// name: slotName,
|
||||||
}
|
// value: initialChildren,
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
if (!slotName) {
|
if (!slotName) {
|
||||||
if (accessor) {
|
if (accessor) {
|
||||||
@ -401,6 +404,7 @@ export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollec
|
|||||||
return {
|
return {
|
||||||
type: 'JSSlot',
|
type: 'JSSlot',
|
||||||
title: slotTitle || title,
|
title: slotTitle || title,
|
||||||
|
name: slotName,
|
||||||
value: value == null ? initialChildren : value,
|
value: value == null ? initialChildren : value,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -51,5 +51,5 @@
|
|||||||
"ts-node/register"
|
"ts-node/register"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@0.8.35/build/index.html"
|
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@0.8.36/build/index.html"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -309,6 +309,8 @@ export default class BaseEngine extends PureComponent {
|
|||||||
if (scopeKey && this.__compScopes[scopeKey]) {
|
if (scopeKey && this.__compScopes[scopeKey]) {
|
||||||
props.__scope = this.__compScopes[scopeKey];
|
props.__scope = this.__compScopes[scopeKey];
|
||||||
}
|
}
|
||||||
|
// FIXME 这里清除 key 是为了避免循环渲染中更改 key 导致的渲染重复
|
||||||
|
props.key = '';
|
||||||
if (schema.__ctx && schema.__ctx.lunaKey) {
|
if (schema.__ctx && schema.__ctx.lunaKey) {
|
||||||
if (!isFileSchema(schema)) {
|
if (!isFileSchema(schema)) {
|
||||||
engine && engine.props.onCompGetCtx(schema, self);
|
engine && engine.props.onCompGetCtx(schema, self);
|
||||||
@ -317,6 +319,7 @@ export default class BaseEngine extends PureComponent {
|
|||||||
} else if (typeof idx === 'number' && !props.key) {
|
} else if (typeof idx === 'number' && !props.key) {
|
||||||
props.key = idx;
|
props.key = idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
props.__id = schema.id;
|
props.__id = schema.id;
|
||||||
const renderComp = (props) => {
|
const renderComp = (props) => {
|
||||||
return engine.createElement(
|
return engine.createElement(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user