UNPKG

@jecloud/func

Version:

JECloud 功能库

1 lines 1.15 kB
import{getFuncCache as o}from"../../func-util";import{FuncChildrenLayoutEnum as t}from"../../data/enum";import{useFuncCommon as n}from"../../func-manager/hooks/use-func-common";import{ref as e}from"vue";import{useInjectFunc as u}from"../../func/src/context";export function useFuncChildren(i){var r,f,c,a=i.props,l=i.context,d=a.layout,m=a.funcCode,h=a.form,p=n({props:a,context:l,funcCode:m}),v=o(m),s=u(),O=v.getData("children"),R=e(null!==(r=O.filter((function(o){return(o.layout||v.info.childLayout)===d})))&&void 0!==r?r:[]);if(R.value.forEach((function(o){s.addFuncChild(o.code,o)})),t.FORM_OUTER_HORIZONTAL===d&&h){var x=v.info.formOptions.title;h.title=x||h.title,R.value.unshift(h),p.setRefMaps(h.code,h.ref)}var M=(null===(c=null===(f=v.info.childHeight)||void 0===f?void 0:f.find((function(o){return"default"===o.code})))||void 0===c?void 0:c.value)||400;return{children:R,$child:p,funcComponent:"JeFunc",computeHeight:function(o){if(t.FORM_OUTER_HORIZONTAL===a.layout)return"100%";if(t.FORM_INNER_VERTICAL===a.layout)return Math.max(o,M)+"px";var n=0;R.value.forEach((function(o){n=Math.max(n,o.height)}));return Math.max(n,M)+38+2+"px"}}}