From 71ff7c698daa54465594352374f1fa598d083706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=9B=E7=9A=93?= Date: Thu, 17 Jun 2021 11:13:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=8C=BA=20stage=20=E5=9B=9E=E5=88=B0=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-skeleton/src/components/stage-box/stage-box.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/editor-skeleton/src/components/stage-box/stage-box.tsx b/packages/editor-skeleton/src/components/stage-box/stage-box.tsx index 92e77db57..f1125d229 100644 --- a/packages/editor-skeleton/src/components/stage-box/stage-box.tsx +++ b/packages/editor-skeleton/src/components/stage-box/stage-box.tsx @@ -45,6 +45,7 @@ export default class StageBox extends Component { } else { const stateName = skeleton.createStage({ content: children, + isRoot: true, }); this.stageChain = new StageChain(skeleton.getStage(stateName as string) as StageWidget); } From b11331fdbf24e0e7d065a16b9ed6a2b32ab76bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=9B=E7=9A=93?= Date: Thu, 17 Jun 2021 11:14:03 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(vision):=20=E5=85=BC=E5=AE=B9=E5=8E=9F?= =?UTF-8?q?=20vision=20proto=20transducers=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/src/document/node/props/props.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/designer/src/document/node/props/props.ts b/packages/designer/src/document/node/props/props.ts index 028d190a0..2d24e477d 100644 --- a/packages/designer/src/document/node/props/props.ts +++ b/packages/designer/src/document/node/props/props.ts @@ -107,6 +107,7 @@ export class Props implements IPropParent { if (this.items.length < 1) { return {}; } + let allProps = {} as any; let props: any = {}; const extras: any = {}; if (this.type === 'list') { @@ -139,6 +140,12 @@ export class Props implements IPropParent { if (value === UNSET) { value = undefined; } + allProps[name] = value; + }); + // compatible vision + const transformedProps = this.transformToStatic(allProps); + Object.keys(transformedProps).forEach((name) => { + const value = transformedProps[name]; if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) { name = getOriginalExtraKey(name); extras[name] = value; @@ -151,6 +158,26 @@ export class Props implements IPropParent { return { props, extras }; } + /** + * @deprecated + */ + private transformToStatic(props: any) { + let transducers = this.owner.componentMeta.prototype?.options?.transducers; + if (!transducers) { + return props; + } + if (!Array.isArray(transducers)) { + transducers = [transducers]; + } + props = transducers.reduce((xprops: any, transducer: any) => { + if (transducer && typeof transducer.toStatic === 'function') { + return transducer.toStatic(xprops); + } + return xprops; + }, props); + return props; + } + /** * 根据 path 路径查询属性 * From e2af81e68031d3a079d67b3bcbbf89fa8de2e6c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=9B=E7=9A=93?= Date: Thu, 17 Jun 2021 11:14:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9=20icon=20?= =?UTF-8?q?=E4=B8=BA=20esmodule=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/utils/src/create-icon.tsx | 4 ++++ packages/utils/src/is-es-module.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/utils/src/create-icon.tsx b/packages/utils/src/create-icon.tsx index a69a042ae..34c405147 100644 --- a/packages/utils/src/create-icon.tsx +++ b/packages/utils/src/create-icon.tsx @@ -2,6 +2,7 @@ import { isValidElement, ReactNode, createElement, cloneElement } from 'react'; import { Icon } from '@alifd/next'; import { IconType } from '@ali/lowcode-types'; import { isReactComponent } from './is-react'; +import { isESModule } from './is-es-module'; const URL_RE = /^(https?:)\/\//i; @@ -9,6 +10,9 @@ export function createIcon(icon?: IconType | null, props?: Record; diff --git a/packages/utils/src/is-es-module.ts b/packages/utils/src/is-es-module.ts index 32839a38b..6a9d0fa9e 100644 --- a/packages/utils/src/is-es-module.ts +++ b/packages/utils/src/is-es-module.ts @@ -1,3 +1,7 @@ -export function isESModule(obj: any): obj is { [key: string]: any } { +export type ESModule = { + __esModule: true; + default: any; +}; +export function isESModule(obj: any): obj is ESModule { return obj && obj.__esModule; }