MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / Props

Class Props

packages/designer/src/document/node/props/props.ts:63–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63export class Props implements IProps, IPropParent {
64 readonly id = uniqueId('props');
65
66 @obx.shallow private items: IProp[] = [];
67
68 @computed private get maps(): Map<string, Prop> {
69 const maps = new Map();
70 if (this.items.length > 0) {
71 this.items.forEach((prop) => {
72 if (prop.key) {
73 maps.set(prop.key, prop);
74 }
75 });
76 }
77 return maps;
78 }
79
80 readonly path = [];
81
82 get props(): IProps {
83 return this;
84 }
85
86 readonly owner: INode;
87
88 /**
89 * 元素个数
90 */
91 @computed get size() {
92 return this.items.length;
93 }
94
95 @obx type: 'map' | 'list' = 'map';
96
97 private purged = false;
98
99 constructor(owner: INode, value?: IPublicTypePropsMap | IPublicTypePropsList | null, extras?: ExtrasObject) {
100 makeObservable(this);
101 this.owner = owner;
102 if (Array.isArray(value)) {
103 this.type = 'list';
104 this.items = value.map(
105 (item, idx) => new Prop(this, item.value, item.name || idx, item.spread),
106 );
107 } else if (value != null) {
108 this.items = Object.keys(value).map((key) => new Prop(this, value[key], key, false));
109 }
110 if (extras) {
111 Object.keys(extras).forEach((key) => {
112 this.items.push(new Prop(this, (extras as any)[key], getConvertedExtraKey(key)));
113 });
114 }
115 }
116
117 @action
118 import(value?: IPublicTypePropsMap | IPublicTypePropsList | null, extras?: ExtrasObject) {
119 const originItems = this.items;
120 if (Array.isArray(value)) {

Callers

nothing calls this directly

Calls 1

uniqueIdFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…