UNPKG

@jecloud/func

Version:

JECloud 功能库

1 lines 1.34 kB
var e=this&&this.__assign||function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)};import{ref as t}from"vue";import{useProvideFuncEdit as n}from"../../../func/src/context";import{getFuncData as o}from"../../../func-util";import{useFuncCommon as r}from"../../../func-manager/hooks/use-func-common";import{FuncRefEnum as c}from"../../../data/enum";import{useInjectFunc as i}from"../../../func/src/context";export function useFuncEdit(u){var a=u.props,f=u.context,s=f.expose,m=t(!0),l=t(!1),d=a.funcCode,p=i(),v={code:d,title:"详细信息",component:"JeFuncForm",ref:t(),events:p.action.eventAction.bindFormEvents({defaultEvents:{}})},F=t(v.code),h=e(e({},r({props:a,context:f,funcCode:d})),{activeItem:F,setTabsVisible:function(e){l.value=!e},setActiveItem:function(e){F.value=e},load:function(e){return m.value=!0,o({funcCode:a.funcCode,cache:!e}).then((function(e){return m.value=!1,F.value=v.code,e}))},reload:function(){return h.load(!0)}});return s(h),n(h),h.setRefMaps(c.FUNC_FORM,v.ref),p.setViewRef(c.FUNC_FORM,v.ref),{$edit:h,hiddenTabs:l,loading:m,activeItem:F,getForm:function(){var e=p.getFuncData().info.formOptions.title;return v.title=e||v.title,v.readOnly=p.store.readOnly,v}}}