mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 可以降级到历史的 JSBlock 格式
This commit is contained in:
parent
555824c9b7
commit
af1746b0be
@ -86,6 +86,8 @@ export class Prop implements IPropParent {
|
||||
type: 'JSSlot',
|
||||
params: schema.params,
|
||||
value: schema.children,
|
||||
title: schema.title,
|
||||
name: schema.name,
|
||||
};
|
||||
}
|
||||
|
||||
@ -235,6 +237,7 @@ export class Prop implements IPropParent {
|
||||
const slotSchema: SlotSchema = {
|
||||
componentName: 'Slot',
|
||||
title: data.title,
|
||||
name: data.name,
|
||||
params: data.params,
|
||||
children: data.value,
|
||||
};
|
||||
|
||||
@ -281,7 +281,7 @@ export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollec
|
||||
|
||||
let initialFn = (slotName ? null : initial) || initialValue;
|
||||
if (slotName && initialValue === true) {
|
||||
initialFn = (field: any, value: any) => {
|
||||
initialFn = (value: any, defaultValue: any) => {
|
||||
if (isJSSlot(value)) {
|
||||
return {
|
||||
title: slotTitle || title,
|
||||
|
||||
@ -55,6 +55,7 @@ function upgradePropsReducer(props: any) {
|
||||
val = {
|
||||
type: 'JSSlot',
|
||||
title: (val.value.props as any)?.slotTitle,
|
||||
name: (val.value.props as any)?.slotName,
|
||||
value: val.value.children
|
||||
};
|
||||
} else {
|
||||
@ -138,7 +139,6 @@ function compatiableReducer(props: any) {
|
||||
const newProps: any = {};
|
||||
Object.entries<any>(props).forEach(([key, val]) => {
|
||||
if (isJSSlot(val)) {
|
||||
val.value
|
||||
val = {
|
||||
type: 'JSBlock',
|
||||
value: {
|
||||
@ -146,6 +146,7 @@ function compatiableReducer(props: any) {
|
||||
children: val.value,
|
||||
props: {
|
||||
slotTitle: val.title,
|
||||
slotName: val.name,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ export interface BlockSchema extends NodeSchema {
|
||||
componentName: 'Block';
|
||||
}
|
||||
export interface SlotSchema extends NodeSchema {
|
||||
name?: string;
|
||||
componentName: 'Slot';
|
||||
params?: string[];
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ export interface JSExpression {
|
||||
}
|
||||
|
||||
export interface JSSlot {
|
||||
name?: string;
|
||||
type: 'JSSlot';
|
||||
title?: string;
|
||||
// 函数的入参
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user