UNPKG

@jecloud/func

Version:

JECloud 功能库

1 lines 1.6 kB
var e=this&&this.__assign||function(){return e=Object.assign||function(e){for(var o,t=1,l=arguments.length;t<l;t++)for(var r in o=arguments[t])Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r]);return e},e.apply(this,arguments)};import{resolveComponent as o,h as t}from"vue";import{encode as l,pick as r,toBoolean as i}from"@jecloud/utils";import{parseFieldProps as n,parseFieldEvents as s,useModelValue as a,FuncFieldTypeEnum as f}from"./util";import{useFieldAddon as c}from"./use-field-addon";export function useFormField(p){var u=p.field,y=p.model,d=p.$func,m=p.$form,C=p.$field,g=p.slots,b=p.labelDblclick,h=f.getComponent(u.xtype),v=o(h);if(h!==v){var O=n({field:u,$func:d});switch(u.xtype){case f.FIELDSET.type:O=e(e({cols:u.cols,title:u.label,simple:i(u.otherConfig.noStyle),collapsed:i(u.otherConfig.keepUp)},r(u.otherConfig,["bgColor","titleColor","titleBgColor","borderColor"])),{onTitleDblclick:function(){b(u)}});break;case f.FUNC_CHILD_FIELD.type:var D=O.configInfo.split(","),j=D[0],k=D[1];Object.assign(O,{funcCode:j,fkCode:k,actionColumn:u.otherConfig,field:u});break;case f.RADIO_GROUP.type:case f.CHECKBOX_GROUP.type:var $=u.otherConfig,_={};"gridLayout"==$.layoutStyle?(_.wrap=!0,_.cols=$.showCloum):"singleLayout"==$.layoutStyle||(_.wrap=!0),Object.assign(O,_)}var F=c({$func:d,field:u});return Object.assign(O,F.props),"func"!==(null==m?void 0:m.type)||[f.FUNC_CHILD.type].includes(u.xtype)||Object.assign(O,s({field:u,type:"form",$func:d,$form:m,model:y})),O.ref=C,t(v,e(e(e({},O),a({model:y,key:u.name})),F.props),e(e({},g),F.slots))}return t(o("JeDisplay"),{value:l(u)})}