MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / findGroupForId

Function findGroupForId

public/iframe/lib/js/commonFun.js:795–813  ·  view source on GitHub ↗
(nowGroupId, templateList = this.templateList)

Source from the content-addressed store, hash-verified

793 return previewTemplateList
794 },
795 findGroupForId(nowGroupId, templateList = this.templateList) {
796 // 根据组id获取组
797 let nowGroupTemplate = null
798 const find = (node) => { // 匿名函数防止this指向错误
799 node.some(item => {
800 const { type, elementId } = item.property
801 if (type === 'group' && elementId === nowGroupId) {
802 nowGroupTemplate = item;
803 return true
804 }
805 if (type === 'group') {
806 // 去组里面找看是否为组嵌套
807 find(item.property.children)
808 }
809 })
810 }
811 find(templateList)
812 return nowGroupTemplate
813 },
814 getParentGroupProperty(template, isIncludeSelf = true, templateList = this.templateList) {
815 // 获取当前组的父组属性之和
816 // templateList 如果传templateList 则按照传的 否则使用this.templateList 预览保存页面时传templateList

Callers

nothing calls this directly

Calls 1

findFunction · 0.70

Tested by

no test coverage detected