MCPcopy
hub / github.com/alibaba/lowcode-engine / Prop

Class Prop

packages/designer/src/document/node/props/prop.ts:58–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56export type ValueTypes = 'unset' | 'literal' | 'map' | 'list' | 'expression' | 'slot';
57
58export class Prop implements IProp, IPropParent {
59 readonly isProp = true;
60
61 readonly owner: INode;
62
63 /**
64 * 键值
65 */
66 @obx key: string | number | undefined;
67
68 /**
69 * 扩展值
70 */
71 @obx spread: boolean;
72
73 readonly props: IProps;
74
75 readonly options: any;
76
77 readonly id = uniqueId('prop$');
78
79 @obx.ref private _type: ValueTypes = 'unset';
80
81 /**
82 * 属性类型
83 */
84 get type(): ValueTypes {
85 return this._type;
86 }
87
88 @obx private _value: any = UNSET;
89
90 /**
91 * 属性值
92 */
93 @computed get value(): IPublicTypeCompositeValue | UNSET {
94 return this.export(IPublicEnumTransformStage.Serilize);
95 }
96
97 private _code: string | null = null;
98
99 /**
100 * 获得表达式值
101 */
102 @computed get code() {
103 if (isJSExpression(this.value)) {
104 return this.value.value;
105 }
106 // todo: JSFunction ...
107 if (this.type === 'slot') {
108 return JSON.stringify(this._slotNode!.export(IPublicEnumTransformStage.Save));
109 }
110 return this._code != null ? this._code : JSON.stringify(this.value);
111 }
112
113 /**
114 * 设置表达式值
115 */

Callers

nothing calls this directly

Calls 3

uniqueIdFunction · 0.85
emitMethod · 0.65
emitPropChangeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…