You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.0 KiB

var T=Object.defineProperty;var c=(I,d,e)=>d in I?T(I,d,{enumerable:!0,configurable:!0,writable:!0,value:e}):I[d]=e;var m=(I,d,e)=>(c(I,typeof d!="symbol"?d+"":d,e),e);import{FieldType as y,UIContralType as h}from"./EnumLab-3cbd0812.js";import{D as r}from"./DataType-33901a1c.js";import{Attr as o}from"./Attr-d5feb8b8.js";import"./index-f4658ae7.js";import"./ParamUtils-cdc24dd6.js";import"./SystemConfig-b93c25b3.js";import"./bignumber-cf158d26.js";import"./ParamsUtils-3cbc5822.js";class B extends Array{constructor(){super(...arguments);m(this,"currGroupName","\u57FA\u672C\u4FE1\u606F")}AddTBString(e,i,a,s,t,l,p,u,D,f){const n=new o;n.Key=e,n.HelperUrl=f||null,n.Field=e,n.DefaultVal=i,n.MyDataType=r.AppString,n.Desc=a||e,n.UIVisible=s||!1,n.UIWidth=u||0,n.UIIsReadonly=t||!1,n.MaxLength=p||50,n.MinLength=l||0,n.MyFieldType=y.Normal,n.UIIsLine=D||!1,n.GroupName=this.currGroupName,this.push(n)}AddTBInt(e,i,a,s,t){const l=new o;l.Key=e,l.Field=e,l.DefaultVal=i,l.MyDataType=r.AppInt,l.MyFieldType=y.Normal,l.Desc=a||"",l.UIVisible=s||!1,l.UIIsReadonly=t||!1,l.GroupName=this.currGroupName,this.push(l)}AddBoolean(e,i,a){const s=new o;s.Key=e,s.Field=e,i?s.DefaultVal=1:s.DefaultVal=0,s.MyDataType=r.AppBoolean,s.Desc=a,s.UIContralType=h.CheckBok,s.UIIsReadonly=!0,s.UIVisible=!0,s.GroupName=this.currGroupName,this.push(s)}AddTBFloat(e,i,a,s,t){const l=new o;l.Key=e,l.Field=e,l.DefaultVal=i,l.MyDataType=r.AppFloat,l.Desc=a||"",l.UIVisible=s||!1,l.UIIsReadonly=t||!1,l.GroupName=this.currGroupName,this.push(l)}AddTBDecimal(e,i,a,s,t){const l=new o;l.Key=e,l.Field=e,l.DefaultVal=i,l.MyDataType=r.AppDouble,l.Desc=a||"",l.UIVisible=s||!1,l.UIIsReadonly=t||!1,l.GroupName=this.currGroupName,this.push(l)}AddTBDateTime(e,i,a,s,t){const l=new o;l.Key=e,l.Field=e,l.DefaultVal=i,l.MyDataType=r.AppDateTime,l.Desc=a||"",l.UIVisible=s||!1,l.UIIsReadonly=t||!1,l.MaxLength=30,l.MinLength=0,l.UIWidth=100,l.GroupName=this.currGroupName,this.push(l)}AddTBImageUpload(e,i,a,s,t){const l=new o;l.Key=e,l.Field=e,l.DefaultVal=i||"",l.MyDataType=r.AppImageUpload,l.Desc=a||"",l.UIVisible=s||!1,l.UIIsReadonly=t||!1,l.MaxLength=30,l.MinLength=0,l.UIWidth=100,l.GroupName=this.currGroupName,this.push(l)}AddDDLSysEnum(e,i,a,s,t,l,p){const u=new o;u.Key=e,u.Field=e,u.DefaultVal=i,u.MyDataType=r.AppInt,u.MyFieldType=y.Enum,u.Desc=a||"",u.UIContralType=h.DDL,u.UIBindKey=l||null,u.UITag=p||null,u.UIVisible=s||!1,u.UIIsReadonly=t||!1,u.GroupName=this.currGroupName,this.push(u)}AddDDLSQL(e,i,a,s,t,l){const p=new o;p.Key=e,p.Field=e,p.DefaultVal=i,p.MyDataType=r.AppString,p.MyFieldType=y.Normal,p.Desc=a||"",p.UIContralType=h.DDL,p.UIBindKey=l||null,p.UITag=l||null,p.UIVisible=s||!1,p.UIIsReadonly=t||!1,p.GroupName=this.currGroupName,this.push(p)}Contains(e){return this.find(i=>i.Key===e)}GetAttrByKey(e){return this.find(i=>i.Key===e)}GetAttrByKeyOfEn(e){return this.find(i=>i.Field===e)}Add(e,i,a){e.Field==null||e.Field==""||(!i&&!a&&(i=!0,a=!1),!(this!=null&&this.find(s=>s.Key===e.Key))&&(e.GroupName=this.currGroupName,this.push(e),i&&this.AddRefAttrText(e),a&&this.AddRefAttrName(e)))}AddRefAttrText(e){var i;if(!(e.MyFieldType==y.Enum&&e.MyDataType==r.AppString)&&(e.MyFieldType==y.FK||e.MyFieldType==y.Enum||e.MyFieldType==y.PKEnum||e.MyFieldType==y.PKFK)){const a=new o;a.MyFieldType=y.RefText,a.MyDataType=r.AppString,a.UIContralType=h.TB,a.UIWidth=e.UIWidth*2,a.Key=e.Key+"Text",a.UIIsReadonly=!0,a.UIBindKey=e.UIBindKey,(a.Desc="\u540D\u79F0").includes("\u7F16\u53F7")?a.Desc=((i=e==null?void 0:e.Desc)==null?void 0:i.replace("\u7F16\u53F7","\u540D\u79F0"))||"":a.Desc=e.Desc+"\u540D\u79F0",e.UIContralType==h.DDL&&(a.UIVisible=!1),e.GroupName=this.currGroupName,this.push(a)}}AddRefAttrName(e){if(e.MyFieldType==y.FK||e.MyFieldType==y.Enum||e.MyFieldType==y.PKEnum||e.MyFieldType==y.PKFK){const i=new o;i.MyFieldType=y.Normal,i.MyDataType=r.AppString,i.UIContralType=h.TB,i.UIWidth=e.UIWidth*2,i.Key=e.Key+"Name",i.Field=e.Key+"Name",i.MaxLength=200,i.MinLength=0,i.UIVisible=!1,i.UIIsReadonly=!0,i.Desc=i.Desc="Name",e.GroupName=this.currGroupName,this.push(i)}}}export{B as Attrs};