MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / export

Method export

packages/designer/src/document/node/props/props.ts:154–204  ·  view source on GitHub ↗
(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save)

Source from the content-addressed store, hash-verified

152 }
153
154 export(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save): {
155 props?: IPublicTypePropsMap | IPublicTypePropsList;
156 extras?: ExtrasObject;
157 } {
158 stage = compatStage(stage);
159 if (this.items.length < 1) {
160 return {};
161 }
162 let allProps = {} as any;
163 let props: any = {};
164 const extras: any = {};
165 if (this.type === 'list') {
166 props = [];
167 this.items.forEach((item) => {
168 let value = item.export(stage);
169 let name = item.key as string;
170 if (name && typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
171 name = getOriginalExtraKey(name);
172 extras[name] = value;
173 } else {
174 props.push({
175 spread: item.spread,
176 name,
177 value,
178 });
179 }
180 });
181 } else {
182 this.items.forEach((item) => {
183 let name = item.key as string;
184 if (name == null || item.isUnset() || item.isVirtual()) return;
185 let value = item.export(stage);
186 if (value != null) {
187 allProps[name] = value;
188 }
189 });
190 // compatible vision
191 const transformedProps = this.transformToStatic(allProps);
192 Object.keys(transformedProps).forEach((name) => {
193 const value = transformedProps[name];
194 if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
195 name = getOriginalExtraKey(name);
196 extras[name] = value;
197 } else {
198 props[name] = value;
199 }
200 });
201 }
202
203 return { props, extras };
204 }
205
206 /**
207 * @deprecated

Callers 1

toDataMethod · 0.95

Calls 8

transformToStaticMethod · 0.95
compatStageFunction · 0.85
getOriginalExtraKeyFunction · 0.85
pushMethod · 0.80
forEachMethod · 0.65
exportMethod · 0.65
isUnsetMethod · 0.65
isVirtualMethod · 0.65

Tested by

no test coverage detected