Merge branch 'fix/slot-initial' into 'release/0.9.0'

fix: 修复 slot 获取初始值异常的 bug



See merge request !920699
This commit is contained in:
高凯 2020-08-04 20:01:53 +08:00
commit 66d0ed4b93
2 changed files with 20 additions and 25 deletions

View File

@ -1,6 +1,6 @@
import { ComponentType, ReactElement, isValidElement, ComponentClass } from 'react'; import { ComponentType, ReactElement, isValidElement, ComponentClass } from 'react';
import { isPlainObject, uniqueId } from '@ali/lowcode-utils'; import { isPlainObject, uniqueId } from '@ali/lowcode-utils';
import { isI18nData, SettingTarget, InitialItem, FilterItem, isJSSlot, ProjectSchema, AutorunItem } from '@ali/lowcode-types'; import { isI18nData, SettingTarget, InitialItem, FilterItem, isJSSlot, ProjectSchema, AutorunItem, isJSBlock } from '@ali/lowcode-types';
import { untracked } from '@ali/lowcode-editor-core'; import { untracked } from '@ali/lowcode-editor-core';
import { editor, designer } from '../editor'; import { editor, designer } from '../editor';
import { SettingField } from '@ali/lowcode-designer'; import { SettingField } from '@ali/lowcode-designer';
@ -281,24 +281,19 @@ export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollec
} }
let initialFn = (slotName ? null : initial) || initialValue; let initialFn = (slotName ? null : initial) || initialValue;
// 在 upgrade reducer 做了 JSBlock ——> JSSlot if (slotName && initialValue === true) {
// if (slotName && initialValue === true) { initialFn = (value: any, defaultValue: any) => {
// initialFn = (value: any, defaultValue: any) => { if (isJSBlock(value)) {
// if (isJSSlot(value)) { return value;
// return { }
// title: slotTitle || title, return {
// name: slotName, type: 'JSSlot',
// ...value, title: slotTitle || title,
// }; name: slotName,
// } value: initialChildren,
// return { };
// type: 'JSSlot', };
// title: slotTitle || title, }
// name: slotName,
// value: initialChildren,
// };
// };
// }
if (!slotName) { if (!slotName) {
if (accessor) { if (accessor) {

View File

@ -55,5 +55,5 @@ export function isJSSlot(data: any): data is JSSlot {
} }
export function isJSBlock(data: any): data is JSBlock { export function isJSBlock(data: any): data is JSBlock {
return data && data.type === 'JSBlock' return data && data.type === 'JSBlock';
} }