mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch 'release/1.0.56' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into release/1.0.56
This commit is contained in:
commit
f5d8a200e9
@ -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 路径查询属性
|
||||
*
|
||||
|
||||
@ -45,6 +45,7 @@ export default class StageBox extends Component<StageBoxProps> {
|
||||
} else {
|
||||
const stateName = skeleton.createStage({
|
||||
content: children,
|
||||
isRoot: true,
|
||||
});
|
||||
this.stageChain = new StageChain(skeleton.getStage(stateName as string) as StageWidget);
|
||||
}
|
||||
|
||||
@ -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<string, unknow
|
||||
if (!icon) {
|
||||
return null;
|
||||
}
|
||||
if (isESModule(icon)) {
|
||||
icon = icon.default;
|
||||
}
|
||||
if (typeof icon === 'string') {
|
||||
if (URL_RE.test(icon)) {
|
||||
return <img src={icon} {...props} />;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user