UNPKG

@jecloud/func

Version:

JECloud 功能库

1 lines 2.19 kB
var e=this&&this.__assign||function(){return e=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)},t=this&&this.__rest||function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o};import{isNotEmpty as o,split as n,toNumber as r,toBoolean as i}from"@jecloud/utils";import{FuncFieldTypeEnum as a}from"../../../../data/enum";export{a as FuncFieldTypeEnum};export function parseFieldProps(e){var t=e.field,c=e.$func,p={};["disabled","configInfo","placeholder","selectExp","height","width","querys"].forEach((function(e){o(t[e],!0)&&(p[e]=t[e])}));var l=t.otherConfig,f=l.inputType,s=l.pkName,d=l.winHeight,u=l.winWidth,y=l.cascadeType,h=l.optionalAndInput,E=l.optionalAndQuery;switch(t.xtype){case a.INPUT_SELECT_GRID.type:case a.INPUT_SELECT_TREE.type:case a.INPUT_SELECT_USER.component:p.textarea="textarea"===f,p.editable=i(h),p.selectOptions={idProperty:s,width:u>0?u:void 0,height:d>0?d:void 0,cascadeType:y};break;case a.UPLOAD_INPUT.type:var v=c.getFuncData().info.fileBucket,b=t.otherConfig,g=b.fileSize,m=b.allow,T=b.notallow;p.maxSize=r(g),p.includeSuffix=n(m,","),p.excludeSuffix=n(T,","),p.params={bucket:v};break;case a.INPUT_SELECT_COLOR.type:var I=n(t.configInfo,",");p.colors=I.length?I:void 0;break;case a.DATE_PICKER.type:case a.TIME_PICKER.type:var O=t.otherConfig.dateType;p.format=t.configInfo||void 0,O&&(p.picker=O);break;case a.SELECT.type:p.showSearch=i(E),p.editable=i(h);break;case a.INPUT_NUMBER.type:p.precision=t.configInfo?r(t.configInfo):0}return p}export function useModelValue(e){var t=e.model,o=e.key;return{value:t[o],"onUpdate:value":function(e){t[o]=e}}}export function parseFieldEvents(o){var n=o.field,r=o.type,i=o.$func,a=o.model,c=t(o,["field","type","$func","model"]);return(0,i.action.eventAction.bindFormFieldEvents)(e({field:n,type:r,model:a},c))}