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

Method getComponentsMap

packages/designer/src/project/project.ts:144–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142 }
143
144 private getComponentsMap(): IPublicTypeComponentsMap {
145 return this.documents.reduce<IPublicTypeComponentsMap>((
146 componentsMap: IPublicTypeComponentsMap,
147 curDoc: IDocumentModel,
148 ): IPublicTypeComponentsMap => {
149 const curComponentsMap = curDoc.getComponentsMap();
150 if (Array.isArray(curComponentsMap)) {
151 curComponentsMap.forEach((item) => {
152 const found = componentsMap.find((eItem) => {
153 if (
154 isProCodeComponentType(eItem) &&
155 isProCodeComponentType(item) &&
156 eItem.package === item.package &&
157 eItem.componentName === item.componentName
158 ) {
159 return true;
160 } else if (
161 isLowCodeComponentType(eItem) &&
162 eItem.componentName === item.componentName
163 ) {
164 return true;
165 }
166 return false;
167 });
168 if (found) return;
169 componentsMap.push(item);
170 });
171 }
172 return componentsMap;
173 }, [] as IPublicTypeComponentsMap);
174 }
175
176 /**
177 * 获取项目整体 schema

Callers 1

getSchemaMethod · 0.95

Calls 7

pushMethod · 0.80
reduceMethod · 0.65
getComponentsMapMethod · 0.65
forEachMethod · 0.65
findMethod · 0.65
isProCodeComponentTypeFunction · 0.50
isLowCodeComponentTypeFunction · 0.50

Tested by

no test coverage detected