mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
fix(vision): 兼容原 vision proto transducers 功能
This commit is contained in:
parent
71ff7c698d
commit
b11331fdbf
@ -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 路径查询属性
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user