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

Method export

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

Source from the content-addressed store, hash-verified

275 }
276
277 export(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save): IPublicTypeCompositeValue {
278 stage = compatStage(stage);
279 const type = this._type;
280 if (stage === IPublicEnumTransformStage.Render && this.key === '___condition___') {
281 // 在设计器里,所有组件默认需要展示,除非开启了 enableCondition 配置
282 if (engineConfig?.get('enableCondition') !== true) {
283 return true;
284 }
285 return this._value;
286 }
287
288 if (type === 'unset') {
289 return undefined;
290 }
291
292 if (type === 'literal' || type === 'expression') {
293 return this._value;
294 }
295
296 if (type === 'slot') {
297 const schema = this._slotNode?.export(stage) || {} as any;
298 if (stage === IPublicEnumTransformStage.Render) {
299 return {
300 type: 'JSSlot',
301 params: schema.params,
302 value: schema,
303 id: schema.id,
304 };
305 }
306 return {
307 type: 'JSSlot',
308 params: schema.params,
309 value: schema.children,
310 title: schema.title,
311 name: schema.name,
312 id: schema.id,
313 };
314 }
315
316 if (type === 'map') {
317 if (!this._items) {
318 return this._value;
319 }
320 let maps: any;
321 this.items!.forEach((prop, key) => {
322 if (!prop.isUnset()) {
323 const v = prop.export(stage);
324 if (v != null) {
325 maps = maps || {};
326 maps[prop.key || key] = v;
327 }
328 }
329 });
330 return maps;
331 }
332
333 if (type === 'list') {
334 if (!this._items) {

Callers 2

valueMethod · 0.95
getValueMethod · 0.95

Calls 6

compatStageFunction · 0.85
getMethod · 0.65
exportMethod · 0.65
forEachMethod · 0.65
isUnsetMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected