cnhis-design-vue 3.2.4-beta.10 → 3.2.4-beta.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,reactive as n,computed as i,onMounted as a,watch as r,openBlock as o,createElementBlock as s,Fragment as l,createVNode as d,unref as p,withCtx as u,renderSlot as m,withModifiers as c,createTextVNode as f,toDisplayString as v,mergeProps as y}from"vue";import{isObject as g}from"@vue/shared";import{useMessage as b,NDropdown as h,NButton as I,NIcon as P}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as k}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as S}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as O}from"./api.js";var j=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1}},emits:["success","error","cancel","clickoutside"],setup(t,{expose:j,emit:L}){var E;const D=t,M=b();let N;const C={},V=e(""),B=n({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let R=e([{label:D.printText,key:"printText"},{label:D.previewText,key:"previewText"},{label:D.pdfLoadText,key:"downloadPdf"},{label:D.formatEditText,key:"formatEditText"},...(null==(E=D.externalOptionConfig)?void 0:E.options)||[]]);const z=i((()=>{if(!B.currentFormatId)return{};let t=B.currentFormatId;return B.formatList.find((e=>e.id===t))})),A=i((()=>{var t;return(null==(t=z.value)?void 0:t.name)||"格式选择"})),J=i((()=>{let t=B.formatList.find((t=>t.id===B.currentFormatId));return null==t?void 0:t.templateId})),U=async t=>{if(D.directPrint){if(B.spinning)return;return"button"===t?void await st():at()}return at()},q=t=>d("span",{class:{active:t.key===B.currentFormatId}},[t.label]),K=(t,e)=>{B.spinning=!1;let n={type:e,formatId:B.currentFormatId,templateId:J.value};L("success",t,n)},_=t=>{B.spinning=!1,L("error",t),g(t)&&"notInstalledApp"===t.type&&M.error(t.message)},G=t=>{B.spinning=!1,L("cancel",t)},H=t=>{L("error",{message:"前置条件执行错误",type:t,preExecution:!0})},Y=(t=0)=>{var e;const n=(null==(e=D.printParams)?void 0:e.length)?D.printParams[t]:B.printParams[t];return JSON.stringify({...n||{},...D.token?{token:D.token}:{}})},$=()=>{var t,e;let n={},i={};if(null==(t=B.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(B.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(B.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(B.printParams[0]).forEach((t=>{i[t]=[],B.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(Y(0)),i),JSON.stringify(n)},Q=()=>{let t=B.printParams.length;const e=async e=>{try{--t<=0&&K(e,"print")}catch(t){console.log("error",t)}};D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("print").then((()=>{const t={formatId:B.currentFormatId,templateId:J.value,authorizationKey:V.value,printdlgshow:D.printdlgshow,signature:D.signature,copies:D.printCopies};if("MULTI"===D.strategy)for(let n=0;n<B.printParams.length;n++)n>0&&(t.printdlgshow="0"),N.printDirect({...t,params:Y(n)},e,_,G);else N.printDirect({...t,params:$()},(t=>{K(t,"print")}),_,G)})).catch((()=>{H("print"),B.spinning=!1})).finally((()=>{B.visible=!1})))},W=async(t,e)=>{var n,i;switch(t){case"printText":Q();break;case"previewText":(async()=>{D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("preview").then((()=>{const t="MULTI"===D.strategy?Y():$(),e={formatId:B.currentFormatId,templateId:J.value,authorizationKey:V.value,params:t,btnprint:D.btnprint,signature:D.signature};N.preview(e,(t=>{K(t,"preview")}),_)})).catch((()=>{H("preview"),B.spinning=!1})).finally((()=>{B.visible=!1})))})();break;case"formatEditText":D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("edit").then((()=>{B.identityVerification.visible=!0})).catch((()=>{H("edit")})).finally((()=>{B.visible=!1,B.spinning=!1})));break;case"downloadPdf":(async()=>{D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("download").then((()=>{const t="MULTI"===D.strategy?Y():$(),e={formatId:B.currentFormatId,templateId:J.value,authorizationKey:V.value,print:{print:"1",type:"1"},params:t,signature:D.signature};N.downloadPDF(e,(t=>K(t,"preview")),_)})).catch((()=>{H("download"),B.spinning=!1})).finally((()=>{B.visible=!1})))})();break;default:{B.visible=!1;const a=B.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){B.currentFormatId=t;const[e]=R.value;e.label=(null==a?void 0:a.name)||e.label,await x({formatForms:[{...a}],name:C.name||a.templateName,number:C.number||a.number,templateId:C.templateId||a.templateId,...C.id?{id:C.id}:{}},{token:D.token})}else null==(i=null==(n=D.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},X=()=>{B.visible=!1,L("clickoutside")},Z=()=>(B.isInited=!1,B.spinning=!1,setTimeout((()=>{B.visible=!1}),0),!1),tt=(t,e,n)=>{const i={};return e.forEach((e=>{let a=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=S(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},et=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(tt(n,e,"fieldName"))}})),i=Object.assign({},i,tt(n,e,"key")),i})),nt=async t=>{var e;if(B.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],B.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";const{data:i}=await O({templateId:t[0].templateId},{token:D.token});if("SUCCESS"===i.result){const{formatForms:e=[]}=i.map||{};Object.assign(C,i.map||{});const a=null==(n=null==e?void 0:e[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}const a=t.find((t=>1==t[e]));return(null==a?void 0:a.id)||t[0].id})(B.formatList,"defaultFlag"),!B.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),Z();(()=>{var t;const e=B.formatList.map((t=>({label:t.name,key:t.id})));R.value.unshift({label:A.value,key:"format",children:e}),D.hideButtons.length>0&&(R.value=R.value.filter((t=>!D.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),i=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},a=Object.keys(i);a.includes("RY7.2.21.1.M2.G94181E")||(R.value=R.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(R.value=R.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await D.queryTemplateParams())?void 0:e.obj;if(!n||!J.value)return M.error("获取打印模板失败,请联系管理员!"),Z();B.templateParams=n,B.printParams=et(B.templateParams,D.params)},it=async()=>{var t;if(B.isInited)return!0;B.isInited=!0,B.spinning=!0,(()=>{if(N)return!1;N=new k})();const e=await D.queryPrintFormatByNumber();return await nt(e),(null==(t=e.obj)?void 0:t.length)>0&&(V.value=e.obj[0].authorizationKey||""),B.spinning=!1,!0},at=async(t=!0)=>{var e,n;if(await D.clickPrevFn())if((null==(e=D.params)?void 0:e.length)||(null==(n=D.printParams)?void 0:n.length)){if(!B.visible){if(!await it())return!1}t&&(B.visible=!B.visible)}else M.warning(D.noDataMsg)},rt=()=>{B.watchPrintParamsReformatFn&&B.watchPrintParamsReformatFn(),B.isInited?B.printParams=et(B.templateParams,D.params):B.watchPrintParamsReformatFn=()=>r((()=>B.isInited),(t=>{if(!t)return!1;rt()}))},ot=t=>{if(B.identityVerification.visible=!1,F(B.currentFormatId))return K(null,"edit");const e={formatId:B.currentFormatId,templateId:J.value,params:Y(),token:t};N.editPrintFormat(e,(t=>{K(t,"edit")}),_)};async function st(){await at(!1),Q()}return a((()=>{B.isInited=!1})),r((()=>D.params),(t=>{if(!(null==t?void 0:t.length))return!1;rt()}),{deep:!0}),j({directPrint:st}),(e,n)=>(o(),s(l,null,[d(p(h),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:B.visible,onClickoutside:X,options:p(R),onSelect:W,"render-label":q},{default:u((()=>[m(e.$slots,"button",{handleClickPrintBtn:at,printSpinning:B.spinning,printbtnText:t.btnText,printVisible:B.visible},(()=>[d(p(I),{class:"dropdown-button",loading:t.showLoading&&B.spinning,onClick:n[1]||(n[1]=c((()=>U("button")),["stop"]))},{default:u((()=>[f(v(t.btnText)+" ",1),d(p(P),{component:p(w),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=c((()=>U("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),d(T,y(e.$attrs,{modelValue:B.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>B.identityVerification.visible=t),formatId:B.currentFormatId,templateId:p(J),onSuccess:ot}),null,16,["modelValue","formatId","templateId"])],64))}});export{j as default};
1
+ import{defineComponent as t,ref as e,reactive as n,computed as i,onMounted as a,watch as r,openBlock as o,createElementBlock as s,Fragment as l,createVNode as d,unref as p,withCtx as u,renderSlot as m,withModifiers as c,createTextVNode as f,toDisplayString as v,mergeProps as y}from"vue";import{isObject as g}from"@vue/shared";import{useMessage as b,NDropdown as h,NButton as I,NIcon as P}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as k}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as S}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as O}from"./api.js";var j=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1}},emits:["success","error","cancel","clickoutside"],setup(t,{expose:j,emit:L}){var E;const D=t,M=b();let N;const C={},V=e(""),B=n({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let R=e([{label:D.printText,key:"printText"},{label:D.previewText,key:"previewText"},{label:D.pdfLoadText,key:"downloadPdf"},{label:D.formatEditText,key:"formatEditText"},...(null==(E=D.externalOptionConfig)?void 0:E.options)||[]]);const z=i((()=>{if(!B.currentFormatId)return{};let t=B.currentFormatId;return B.formatList.find((e=>e.id===t))})),A=i((()=>{var t;return(null==(t=z.value)?void 0:t.name)||"格式选择"})),J=i((()=>{let t=B.formatList.find((t=>t.id===B.currentFormatId));return null==t?void 0:t.templateId})),U=async t=>{if(D.directPrint){if(B.spinning)return;return"button"===t?void await st():at()}return at()},q=t=>d("span",{class:{active:t.key===B.currentFormatId}},[t.label]),K=(t,e)=>{B.spinning=!1;let n={type:e,formatId:B.currentFormatId,templateId:J.value};L("success",t,n)},_=t=>{B.spinning=!1,L("error",t),g(t)&&"notInstalledApp"===t.type&&M.error(t.message)},G=t=>{B.spinning=!1,L("cancel",t)},H=t=>{L("error",{message:"前置条件执行错误",type:t,preExecution:!0})},Y=(t=0)=>{var e;const n=(null==(e=D.printParams)?void 0:e.length)?D.printParams[t]:B.printParams[t];return JSON.stringify({...n||{},...D.token?{token:D.token}:{}})},$=()=>{var t,e;let n={},i={};if(null==(t=B.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(B.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(B.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(B.printParams[0]).forEach((t=>{i[t]=[],B.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(Y(0)),i),JSON.stringify(n)},Q=()=>{let t=B.printParams.length;const e=async e=>{try{--t<=0&&K(e,"print")}catch(t){console.log("error",t)}};D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("print").then((()=>{const t={formatId:B.currentFormatId,templateId:J.value,authorizationKey:V.value,printdlgshow:D.printdlgshow,signature:D.signature,copies:D.printCopies};if("MULTI"===D.strategy)for(let n=0;n<B.printParams.length;n++)n>0&&(t.printdlgshow="0"),N.printDirect({...t,params:Y(n)},e,_,G);else N.printDirect({...t,params:$()},(t=>{K(t,"print")}),_,G)})).catch((()=>{H("print"),B.spinning=!1})).finally((()=>{B.visible=!1})))},W=async(t,e)=>{var n,i;switch(t){case"printText":Q();break;case"previewText":(async()=>{D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("preview").then((()=>{const t="MULTI"===D.strategy?Y():$(),e={formatId:B.currentFormatId,templateId:J.value,authorizationKey:V.value,params:t,btnprint:D.btnprint,signature:D.signature};N.preview(e,(t=>{K(t,"preview")}),_)})).catch((()=>{H("preview"),B.spinning=!1})).finally((()=>{B.visible=!1})))})();break;case"formatEditText":D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("edit").then((()=>{B.identityVerification.visible=!0})).catch((()=>{H("edit")})).finally((()=>{B.visible=!1,B.spinning=!1})));break;case"downloadPdf":(async()=>{D.showLoading&&B.spinning||(B.spinning=!0,D.prevFn("download").then((()=>{const t="MULTI"===D.strategy?Y():$(),e={formatId:B.currentFormatId,templateId:J.value,authorizationKey:V.value,print:{print:"1",type:"1"},params:t,signature:D.signature};N.downloadPDF(e,(t=>K(t,"preview")),_)})).catch((()=>{H("download"),B.spinning=!1})).finally((()=>{B.visible=!1})))})();break;default:{B.visible=!1;const a=B.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){B.currentFormatId=t;const[e]=R.value;e.label=(null==a?void 0:a.name)||e.label,await x({formatForms:[{...a}],name:C.name||a.templateName,number:C.number||a.number,templateId:C.templateId||a.templateId,...C.id?{id:C.id}:{}},{token:D.token})}else null==(i=null==(n=D.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},X=()=>{B.visible=!1,L("clickoutside")},Z=()=>(B.isInited=!1,B.spinning=!1,setTimeout((()=>{B.visible=!1}),0),!1),tt=(t,e,n)=>{const i={};return e.forEach((e=>{let a=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=S(e,n[t.type])),i||(null==t?void 0:t.defaultValue)||""})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},et=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(tt(n,e,"fieldName"))}})),i=Object.assign({},i,tt(n,e,"key")),i})),nt=async t=>{var e;if(B.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],B.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";const{data:i}=await O({templateId:t[0].templateId},{token:D.token});if("SUCCESS"===i.result){const{formatForms:e=[]}=i.map||{};Object.assign(C,i.map||{});const a=null==(n=null==e?void 0:e[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}const a=t.find((t=>1==t[e]));return(null==a?void 0:a.id)||t[0].id})(B.formatList,"defaultFlag"),!B.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),Z();(()=>{var t;const e=B.formatList.map((t=>({label:t.name,key:t.id})));R.value.unshift({label:A.value,key:"format",children:e}),D.hideButtons.length>0&&(R.value=R.value.filter((t=>!D.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),i=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},a=Object.keys(i);a.includes("RY7.2.21.1.M2.G94181E")||(R.value=R.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(R.value=R.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await D.queryTemplateParams())?void 0:e.obj;if(!n||!J.value)return M.error("获取打印模板失败,请联系管理员!"),Z();B.templateParams=n,B.printParams=et(B.templateParams,D.params)},it=async()=>{var t;if(B.isInited)return!0;B.isInited=!0,B.spinning=!0,(()=>{if(N)return!1;N=new k})();const e=await D.queryPrintFormatByNumber();return await nt(e),(null==(t=e.obj)?void 0:t.length)>0&&(V.value=e.obj[0].authorizationKey||""),B.spinning=!1,!0},at=async(t=!0)=>{var e,n;if(await D.clickPrevFn())if((null==(e=D.params)?void 0:e.length)||(null==(n=D.printParams)?void 0:n.length)){if(!B.visible){if(!await it())return!1}t&&(B.visible=!B.visible)}else M.warning(D.noDataMsg)},rt=()=>{B.watchPrintParamsReformatFn&&B.watchPrintParamsReformatFn(),B.isInited?B.printParams=et(B.templateParams,D.params):B.watchPrintParamsReformatFn=()=>r((()=>B.isInited),(t=>{if(!t)return!1;rt()}))},ot=t=>{if(B.identityVerification.visible=!1,F(B.currentFormatId))return K(null,"edit");const e={formatId:B.currentFormatId,templateId:J.value,params:Y(),token:t};N.editPrintFormat(e,(t=>{K(t,"edit")}),_)};async function st(){await at(!1),Q()}return a((()=>{B.isInited=!1})),r((()=>D.params),(t=>{if(!(null==t?void 0:t.length))return!1;rt()}),{deep:!0}),j({directPrint:st}),(e,n)=>(o(),s(l,null,[d(p(h),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:B.visible,onClickoutside:X,options:p(R),onSelect:W,"render-label":q},{default:u((()=>[m(e.$slots,"button",{handleClickPrintBtn:at,printSpinning:B.spinning,printbtnText:t.btnText,printVisible:B.visible},(()=>[d(p(I),{class:"dropdown-button",loading:t.showLoading&&B.spinning,onClick:n[1]||(n[1]=c((()=>U("button")),["stop"]))},{default:u((()=>[f(v(t.btnText)+" ",1),d(p(P),{component:p(w),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=c((()=>U("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),d(T,y(e.$attrs,{modelValue:B.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>B.identityVerification.visible=t),formatId:B.currentFormatId,templateId:p(J),onSuccess:ot}),null,16,["modelValue","formatId","templateId"])],64))}});export{j as default};
@@ -457,9 +457,9 @@ declare const _default: import("vue").DefineComponent<{
457
457
  requiredDisable: boolean;
458
458
  hide: boolean;
459
459
  }>;
460
+ isHighlightRow: boolean;
460
461
  idx: number;
461
462
  isHighlight: boolean;
462
- isHighlightRow: boolean;
463
463
  }>;
464
464
  EditDialog: import("vue").DefineComponent<{
465
465
  visible: {
@@ -575,9 +575,9 @@ declare const _default: import("vue").DefineComponent<{
575
575
  requiredDisable: boolean;
576
576
  hide: boolean;
577
577
  }>;
578
+ isHighlightRow: boolean;
578
579
  idx: number;
579
580
  isHighlight: boolean;
580
- isHighlightRow: boolean;
581
581
  }>;
582
582
  isArray: {
583
583
  (value?: any): value is any[];
@@ -282,8 +282,8 @@ declare const _default: import("vue").DefineComponent<{
282
282
  requiredDisable: boolean;
283
283
  hide: boolean;
284
284
  }>;
285
+ isHighlightRow: boolean;
285
286
  idx: number;
286
287
  isHighlight: boolean;
287
- isHighlightRow: boolean;
288
288
  }>;
289
289
  export default _default;
@@ -1 +1 @@
1
- import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as i,formRenderLog as r}from"../utils/index.js";import{format as l}from"date-fns";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as c}from"./useFormValidator.js";import{transformDateFormat as d}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function u(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig","wordbook"])})}function f(e){return"1"===e||!0===e}function _(_,x){const{createValidatorSchema:h}=c(),b=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==x?void 0:x.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=h(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},g=e=>{var o,t,r,l,s,a,p,c,d,_,x,h,g,v;const y=b(e);e.urlConfig?u(y,e):e.autograph&&m(y,e);const w=!!e.__multiple,C=f(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=f(null!=(l=null==(r=e.componentProps)?void 0:r.selectAll)?l:e.selectAll),A=f(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=f(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(_=null==(d=e.componentProps)?void 0:d.showField)?_:e.show_key,k=null!=(h=null==(x=e.componentProps)?void 0:x.options)?h:e.option,N=null!=(v=i(e.multi_select_value))?v:null==(g=e.componentProps)?void 0:g.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...n(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},v=e=>{var o,t;const n=b(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?u(n,e):e.autograph&&m(n,e),n},y=e=>{const t=b(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},w=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),C=new Map([["LINEBAR",w],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=b(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=b(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=b(e),{decimal_length:t,validate:n,allowSlash:r}=e;return!0!==r&&"1"!==r||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:i(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",g],["REMOTE_SEARCH",g],["DATE",e=>{const o=b(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:d(e.date_format),validate:e.validate}),"current"===o.default&&(o.default=l(new Date,e.date_format||"yyyy-MM-dd")),o}],["TIME",e=>{const o=b(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:d(e.date_format),validate:e.validate}),"current"===o.default&&(o.default=l(new Date,e.date_format||"HH:mm:ss")),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=b(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=b(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=b(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",v],["CHECKBOX",v],["SWITCH",e=>{const o=b(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=b(e);return Object.assign(o["x-component-props"],{step:i(e.step_length),max:i(e.max_length),min:i(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=b(e);Array.isArray(e.properties)&&r("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?k(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),O=e=>{if(e.suffixConfig)return A(e);return(C.get(e.html_type)||y)(e)},A=o=>{if(!o.suffixConfig&&!o.prefixConfig)return O(o);const t=o.suffixConfig?e(o.suffixConfig):[],n=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"}))),{...o,is_show:"1",hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...t.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"})))],i=b(o),r=n.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(i,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...i["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:k(n)}),i},{FieldNormalizeWaterfallHook:E,FieldListNormalizeWaterfallHook:j}=s();function k(o,n={column:9999}){let i=null;return j.call(t(o),n).reduce(((e,o,s)=>{var a;const p=null==(a=(o=E.call(o,n)).validate)?void 0:a.obj_type;return p&&_&&_.collect(p,t(o)),"LINEBAR"===o.html_type?(e[l(o)]=r(w(o),s),i=e[l(o)].properties={}):i?i[l(o)]=r(O(o),s):(i=null,e[l(o)]=r(O(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function l(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:k}}export{_ as useFieldListAdaptor};
1
+ import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as i,formRenderLog as r}from"../utils/index.js";import{useFieldNormalize as l}from"./useFieldNormalize.js";import{fieldKeyEscape as s,createLinebarId as a}from"../utils/schema.js";import{useFormValidator as p}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function d(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function m(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig","wordbook"])})}function u(e){return"1"===e||!0===e}function f(f,_){const{createValidatorSchema:x}=p(),h=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==_?void 0:_.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=x(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},b=e=>{var o,t,r,l,s,a,p,c,f,_,x,b,g,v;const y=h(e);e.urlConfig?m(y,e):e.autograph&&d(y,e);const w=!!e.__multiple,C=u(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=u(null!=(l=null==(r=e.componentProps)?void 0:r.selectAll)?l:e.selectAll),A=u(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=u(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(_=null==(f=e.componentProps)?void 0:f.showField)?_:e.show_key,k=null!=(b=null==(x=e.componentProps)?void 0:x.options)?b:e.option,N=null!=(v=i(e.multi_select_value))?v:null==(g=e.componentProps)?void 0:g.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...n(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},g=e=>{var o,t;const n=h(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?m(n,e):e.autograph&&d(n,e),n},v=e=>{const t=h(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},y=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:a(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),w=new Map([["LINEBAR",y],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=h(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=h(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=h(e),{decimal_length:t,validate:n,allowSlash:r}=e;return!0!==r&&"1"!==r||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:i(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",b],["REMOTE_SEARCH",b],["DATE",e=>{const o=h(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["TIME",e=>{const o=h(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=h(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=h(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=h(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",g],["CHECKBOX",g],["SWITCH",e=>{const o=h(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=h(e);return Object.assign(o["x-component-props"],{step:i(e.step_length),max:i(e.max_length),min:i(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=h(e);Array.isArray(e.properties)&&r("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?j(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),C=e=>{if(e.suffixConfig)return O(e);return(w.get(e.html_type)||v)(e)},O=o=>{if(!o.suffixConfig&&!o.prefixConfig)return C(o);const t=o.suffixConfig?e(o.suffixConfig):[],n=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"}))),{...o,is_show:"1",hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...t.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"})))],i=h(o),r=n.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(i,{type:"void",name:s(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...i["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:j(n)}),i},{FieldNormalizeWaterfallHook:A,FieldListNormalizeWaterfallHook:E}=l();function j(o,n={column:9999}){let i=null;return E.call(t(o),n).reduce(((e,o,s)=>{var a;const p=null==(a=(o=A.call(o,n)).validate)?void 0:a.obj_type;return p&&f&&f.collect(p,t(o)),"LINEBAR"===o.html_type?(e[l(o)]=r(y(o),s),i=e[l(o)].properties={}):i?i[l(o)]=r(C(o),s):(i=null,e[l(o)]=r(C(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function l(o){return o.suffixConfig?s([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:j}}export{f as useFieldListAdaptor};
@@ -1 +1 @@
1
- import{arrayed as e,traverse as t}from"../../../../shared/utils/index.js";import"../../../../shared/utils/tapable/SyncHook.js";import"../../../../shared/utils/tapable/SyncBailHook.js";import l from"../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{isString as o}from"lodash-es";import"../../index.js";import{FIELD_BUSINESS_TYPE as r}from"../constants/index.js";import{FieldListFilter as a,findItemByValCondition as i,parseEnhanceText as s}from"../utils/index.js";import{transformDateFormat as _}from"../utils/business.js";function n(){const n=new l(["fieldList","props"]),p=new l(["fieldItem","props"]);p.tap("__forceClearable",((e,t)=>(t.forceClearable&&(e.componentProps={...e.componentProps,clearable:!0}),e))),p.tap({name:"__fieldAlias",before:"__labelPlacementOverwrite"},(e=>("BOTTOM"===e.inputBorder&&(e.bordered="underline"),e.title_h_layout&&(e.decoratorProps={...e.decoratorProps},"0"===e.title_h_layout?e.decoratorProps.labelPlacement="top":"1"===e.title_h_layout&&(e.decoratorProps.labelPlacement="left")),o(e.lineBarLayoutDirection)&&(e.linebarDirection=e.lineBarLayoutDirection.toLowerCase()),e))),p.tap("__labelPlacementOverwrite",((e,t)=>(t.labelPlacementOverwrite&&(e.decoratorProps={...e.decoratorProps,labelPlacement:void 0}),e))),p.tap("__time",(e=>("DATE"===e.html_type&&"time"===_(e.date_format)&&(e.html_type="TIME"),e))),p.tap("__block",(e=>(["CHECKBOX_BLOCK","RADIO_BLOCK"].includes(e.html_type)&&(e.__vertical=!0),e))),p.tap("__age",(t=>("AGE"===t.html_type&&(t.html_type="INPUT_NUMBER",t.reactions=t.reactions?e(t.reactions):[],t.reactions.push({target:t.val_key_unit,fulfill:{state:{disabled:"{{$self.disabled}}"}}}),t.suffixConfig=[{validate:{obj_type:r.AGE_UNIT},val_key:t.val_key_unit,html_type:"SELECT",option:t.option,urlConfig:t.urlConfig}]),t))),p.tap("__multiple_select",(e=>{const{html_type:t,multi_select:l,__multiple:o}=e;return e.__multiple="SEARCH"!==t&&("SEARCH_MORE"===t||("SELECT"===t?"0"===l:o)),e}));const c=[[["SEARCH","PHONE_TYPE","IDCARD_TYPE","SEARCH_MORE"],"SELECT"],["DIGITAL","INPUT_NUMBER"],["CHECKBOX_BLOCK","CHECKBOX"],["RADIO_BLOCK","RADIO"],[["DATE-INPUT","DATETIME-INPUT"],"DATE"],["SWITCH_COMPONENT","SWITCH"],["SLIDER_COMPONENT","SLIDER"],["LEVEL_SEARCH_CASCADE","LEVEL_SEARCH_CASCADER"],["SEARCH_CASCADE","SEARCH_CASCADER"]];p.tap("__normalize",(e=>(c.some((([t,l])=>(Array.isArray(t)?t.includes(e.html_type):t===e.html_type)&&(e.html_type=l))),e)));const m=new Map([[["SELECT","SEARCH","SEARCH_MORE"],new Map([["H_TILE",e=>e.html_type=e.__multiple?"CHECKBOX":"RADIO"],["V_TILE",e=>{e.html_type=e.__multiple?"CHECKBOX":"RADIO",e.__vertical=!0}]])],["RADIO",new Map([["DROPDOWN",e=>e.html_type="SELECT"]])],["CHECKBOX",new Map([["DROPDOWN",e=>{e.__multiple=!0,e.html_type="SELECT"}]])]]);return p.tap({stage:9999,name:"__show_mode"},(t=>t.show_mode?([...m].some((([l,o])=>{if(!e(l).includes(t.html_type))return;const r=o.get(t.show_mode);return r&&r(t),!0})),t):t)),n.tap("__out_bordered",((e,{column:t,outBordered:l})=>e)),n.tap("__prefix/suffix",(e=>{const l=[];return t(e,(t=>{["prefix","suffix"].forEach((r=>{const a=t[r];if(!o(a))return;const s=a.match("#{(.+)}");if(!s)return;const _=o(s[1])&&i(e,(e=>e.val_key===s[1].trim()));_&&(Reflect.deleteProperty(t,r),t[`${r}Config`]=t[`${r}Config`]||[],t[`${r}Config`].push(_),l.push(_))}))}),["children","properties"]),l.length?a(e,(e=>l.includes(e))):e})),n.tap("__textEnhance",(e=>{const l=[];return t(e,(t=>{if("TEXT"!==t.html_type||!o(t.default_val))return;const r=s(t.default_val);t.__textEnhance=r,r.forEach((o=>{if("text"===o.type)return;const r=i(e,(e=>[e.name,e.val_key].includes(o.content)));r&&(Reflect.deleteProperty(t,"default_val"),l.push(r),o.content=r)}))}),["children","properties"]),a(e,(e=>l.includes(e)))})),{FieldNormalizeWaterfallHook:p,FieldListNormalizeWaterfallHook:n}}export{n as useFieldNormalize};
1
+ import{arrayed as e,traverse as t}from"../../../../shared/utils/index.js";import"../../../../shared/utils/tapable/SyncHook.js";import"../../../../shared/utils/tapable/SyncBailHook.js";import l from"../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{format as a}from"date-fns";import{isString as r}from"lodash-es";import"../../index.js";import{FIELD_BUSINESS_TYPE as o}from"../constants/index.js";import{FieldListFilter as _,findItemByValCondition as i,parseEnhanceText as s}from"../utils/index.js";import{transformDateFormat as n}from"../utils/business.js";function p(){const p=new l(["fieldList","props"]),u=new l(["fieldItem","props"]);u.tap("__forceClearable",((e,t)=>(t.forceClearable&&(e.componentProps={...e.componentProps,clearable:!0}),e))),u.tap({name:"__fieldAlias",before:"__labelPlacementOverwrite"},(e=>("BOTTOM"===e.inputBorder&&(e.bordered="underline"),e.title_h_layout&&(e.decoratorProps={...e.decoratorProps},"0"===e.title_h_layout?e.decoratorProps.labelPlacement="top":"1"===e.title_h_layout&&(e.decoratorProps.labelPlacement="left")),r(e.lineBarLayoutDirection)&&(e.linebarDirection=e.lineBarLayoutDirection.toLowerCase()),e))),u.tap("__labelPlacementOverwrite",((e,t)=>(t.labelPlacementOverwrite&&(e.decoratorProps={...e.decoratorProps,labelPlacement:void 0}),e))),u.tap("__time",(e=>("DATE"===e.html_type&&"time"===n(e.date_format)&&(e.html_type="TIME"),e))),u.tap("__block",(e=>(["CHECKBOX_BLOCK","RADIO_BLOCK"].includes(e.html_type)&&(e.__vertical=!0),e))),u.tap("__age",(t=>("AGE"===t.html_type&&(t.html_type="INPUT_NUMBER",t.reactions=t.reactions?e(t.reactions):[],t.reactions.push({target:t.val_key_unit,fulfill:{state:{disabled:"{{$self.disabled}}"}}}),t.suffixConfig=[{validate:{obj_type:o.AGE_UNIT},val_key:t.val_key_unit,html_type:"SELECT",option:t.option,urlConfig:t.urlConfig}]),t))),u.tap({name:"__multiple_select",before:"__defaultValue"},(e=>{const{html_type:t,multi_select:l,__multiple:a}=e;return e.__multiple="SEARCH"!==t&&("SEARCH_MORE"===t||("SELECT"===t?"0"===l:a)),e})),u.tap("__defaultValue",(e=>{switch(e.html_type){case"TIME":"current"===e.default_val&&(e.default_val=a(new Date,e.date_format||"HH:mm:ss"));break;case"DATE":"current"===e.default_val&&(e.default_val=a(new Date,e.date_format||"yyyy-MM-dd"));break;case"CHECKBOX":case"CHECKBOX_BLOCK":r(e.default_val)&&e.default_val&&(e.default_val=e.default_val.split(","));break;case"SELECT":case"SEARCH":case"SEARCH_MORE":r(e.default_val)&&e.default_val&&(e.default_val=e.__multiple?e.default_val.split(","):e.default_val)}return e}));const c=[[["SEARCH","PHONE_TYPE","IDCARD_TYPE","SEARCH_MORE"],"SELECT"],["DIGITAL","INPUT_NUMBER"],["CHECKBOX_BLOCK","CHECKBOX"],["RADIO_BLOCK","RADIO"],[["DATE-INPUT","DATETIME-INPUT"],"DATE"],["SWITCH_COMPONENT","SWITCH"],["SLIDER_COMPONENT","SLIDER"],["LEVEL_SEARCH_CASCADE","LEVEL_SEARCH_CASCADER"],["SEARCH_CASCADE","SEARCH_CASCADER"]];u.tap("__normalize",(e=>(c.some((([t,l])=>(Array.isArray(t)?t.includes(e.html_type):t===e.html_type)&&(e.html_type=l))),e)));const m=new Map([[["SELECT","SEARCH","SEARCH_MORE"],new Map([["H_TILE",e=>e.html_type=e.__multiple?"CHECKBOX":"RADIO"],["V_TILE",e=>{e.html_type=e.__multiple?"CHECKBOX":"RADIO",e.__vertical=!0}]])],["RADIO",new Map([["DROPDOWN",e=>e.html_type="SELECT"]])],["CHECKBOX",new Map([["DROPDOWN",e=>{e.__multiple=!0,e.html_type="SELECT"}]])]]);return u.tap({stage:9999,name:"__show_mode"},(t=>t.show_mode?([...m].some((([l,a])=>{if(!e(l).includes(t.html_type))return;const r=a.get(t.show_mode);return r&&r(t),!0})),t):t)),p.tap("__out_bordered",((e,{column:t,outBordered:l})=>e)),p.tap("__prefix/suffix",(e=>{const l=[];return t(e,(t=>{["prefix","suffix"].forEach((a=>{const o=t[a];if(!r(o))return;const _=o.match("#{(.+)}");if(!_)return;const s=r(_[1])&&i(e,(e=>e.val_key===_[1].trim()));s&&(Reflect.deleteProperty(t,a),t[`${a}Config`]=t[`${a}Config`]||[],t[`${a}Config`].push(s),l.push(s))}))}),["children","properties"]),l.length?_(e,(e=>l.includes(e))):e})),p.tap("__textEnhance",(e=>{const l=[];return t(e,(t=>{if("TEXT"!==t.html_type||!r(t.default_val))return;const a=s(t.default_val);t.__textEnhance=a,a.forEach((a=>{if("text"===a.type)return;const r=i(e,(e=>[e.name,e.val_key].includes(a.content)));r&&(Reflect.deleteProperty(t,"default_val"),l.push(r),a.content=r)}))}),["children","properties"]),_(e,(e=>l.includes(e)))})),{FieldNormalizeWaterfallHook:u,FieldListNormalizeWaterfallHook:p}}export{p as useFieldNormalize};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.2.4-beta.10",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.4-beta.10",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
1
+ var e="@cnhis-design-vue/shared",i="3.2.4-beta.11",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.4-beta.11",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.2.4-beta.10",
3
+ "version": "3.2.4-beta.11",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -71,5 +71,5 @@
71
71
  "iOS 7",
72
72
  "last 3 iOS versions"
73
73
  ],
74
- "gitHead": "3df290fa4a51de657f6227a9655d7518fdc5a513"
74
+ "gitHead": "a055ab5c25b1a043b5323b4cf8d98ce3f7fe32ce"
75
75
  }