Merge branch 'fix/jsslot-schema-format' into 'release/0.9.0'

Fix/jsslot schema format



See merge request !895040
This commit is contained in:
康为 2020-07-15 20:59:05 +08:00
commit 5016f8d0eb
5 changed files with 8 additions and 2 deletions

View File

@ -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,
};

View File

@ -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,

View File

@ -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 {
@ -140,7 +141,6 @@ function compatiableReducer(props: any) {
const newProps: any = {};
Object.entries<any>(props).forEach(([key, val]) => {
if (isJSSlot(val)) {
val.value
val = {
type: 'JSBlock',
value: {
@ -148,6 +148,7 @@ function compatiableReducer(props: any) {
children: val.value,
props: {
slotTitle: val.title,
slotName: val.name,
},
},
}

View File

@ -69,6 +69,7 @@ export interface BlockSchema extends NodeSchema {
componentName: 'Block';
}
export interface SlotSchema extends NodeSchema {
name?: string;
componentName: 'Slot';
params?: string[];
}

View File

@ -14,6 +14,7 @@ export interface JSExpression {
}
export interface JSSlot {
name?: string;
type: 'JSSlot';
title?: string;
// 函数的入参