UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

3 lines (2 loc) 47.6 kB
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("../dynamic-resolver/index.umd.js"),require("../common/index.umd.js"),require("../locale/index.umd.js"),require("bignumber.js"),require("lodash-es"),require("../designer-canvas/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../dynamic-resolver/index.umd.js","../common/index.umd.js","../locale/index.umd.js","bignumber.js","lodash-es","../designer-canvas/index.umd.js"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C.uploader={},C.Vue,C.dynamicResolver,C.common,C.locale,C.BigNumber,C.LodashES,C.designerCanvas))})(this,function(C,e,z,ce,le,it,st,Ee){"use strict";var at=Object.defineProperty;var lt=(C,e,z)=>e in C?at(C,e,{enumerable:!0,configurable:!0,writable:!0,value:z}):C[e]=z;var j=(C,e,z)=>lt(C,typeof e!="symbol"?e+"":e,z);const Be={checked:{type:Boolean,default:!1},id:{type:String,default:""},disabled:{type:Boolean,default:!1}},Ae={showInfo:{type:Boolean,default:!0},status:{type:String,default:"normal"},percent:{type:Number,default:0},maxWidth:{type:Number,default:0}},He={selectText:{type:String,default:"选择文件"},disabled:{type:Boolean,default:!1},enableMulti:{type:Boolean,default:!0},accept:{type:String,default:"*"},options:{type:Object,default:{}},uploadedCount:{type:Number,default:0},extendConfig:{type:Object,default:{}},uploadServerToken:{type:String,default:""}},Me=e.defineComponent({name:"FUploadProgress",props:Ae,setup(n,t){const{showInfo:o,status:a,maxWidth:i,percent:l}=e.toRefs(n);return()=>e.createVNode("div",{class:["f-progress upload-progress","upload-progress-status-"+a.value,"f-progress-status-"+a.value,"upload-progress-line",o.value?"upload-progress-show-info":""]},[e.createVNode("div",{class:"upload-progress-outer",style:{"max-width":i.value>0?i.value+"px":"auto"}},[e.createVNode("div",{class:"upload-progress-inner"},[e.createVNode("div",{class:"upload-progress-bg f-progress-bg",style:{width:l.value+"%"}},null)])]),o.value?e.createVNode("span",{class:"upload-progress-text"},[a.value==="error"||a.value==="success"?e.createVNode("span",{class:["upload-progress-text-icon f-icon","f-icon-"+a.value]},null):e.createVNode(e.Fragment,null,[l.value,e.createTextVNode("%")])]):""])}}),ue=e.defineComponent({name:"FPreviewCheckbox",props:Be,emits:["checkedChange"],setup(n,t){const{disabled:o}=e.toRefs(n),a=e.ref(n.checked),i=l=>{l.stopPropagation(),o.value||(a.value=!a.value,t.emit("checkedChange",{checked:a.value,id:n.id}))};return e.watch(()=>n.checked,l=>{a.value=l}),()=>e.createVNode("div",{class:"preview-checkbox d-inline-flex align-middle"},[e.createVNode("div",{class:"custom-control custom-checkbox f-checkradio-single m-0"},[e.createVNode("input",{title:"custom-control-input",class:"custom-control-input",type:"checkbox",disabled:o.value,checked:a.value},null),e.createVNode("label",{class:"custom-control-label",onClick:l=>i(l),onMousedown:l=>l.stopPropagation()},null)])])}}),pe=e.defineComponent({name:"FFileSelect",props:He,emits:["change","stateChange"],setup(n,t){const o=e.inject("uploaderService");o.setUploadContext(t);const a=e.getCurrentInstance(),i=e.ref("*");let l;const d=()=>{l.files&&(t.emit("change",l.files),o.handleFiles(l.files),l.value=null)};function c(){l.value=null,o.reset()}e.watch(()=>n.disabled,()=>{c()}),e.watch(()=>n.uploadedCount,p=>{o.setOptions({uploadedCount:p})}),e.watch(()=>n.extendConfig,p=>{o.setExtendServerConfig(p)}),e.watch(()=>n.options,p=>{o.setOptions(p)},{deep:!0});function m(p){p&&p.stopPropagation(),l.click()}function v(p){o.handleUploadEvent(p)}return e.onMounted(()=>{var p,T;l=(p=a==null?void 0:a.proxy)==null?void 0:p.$refs.uploadInput,c(),o.setOptions(n.options),o.setExtendServerConfig(n.extendConfig),i.value=(((T=n.options)==null?void 0:T.allowedContentTypes)||["*"]).join(",")}),e.onUnmounted(()=>{}),t.expose({handleUploadEvent:v}),()=>e.createVNode(e.Fragment,null,[e.createVNode("input",{ref:"uploadInput",type:"file",class:"ffileupload--browser",disabled:n.disabled,multiple:n.enableMulti,accept:i.value,onChange:()=>d(),style:"width: 10px",title:"uploadInput"},null),e.createVNode("div",{class:["upload-container",n.disabled?"f-state-disabled":""],onClick:p=>m(p),title:n.selectText},[e.createVNode("i",{class:"f-icon f-icon-upload upload-icon",style:"top: 2px;position: relative;"},null),n.selectText])])}}),De={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/uploader.schema.json",title:"uploader",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for uploader",type:"string"},type:{description:"The type string of uploader",type:"string",default:"uploader"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disable:{type:"boolean",default:!1},placeholder:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"]},Pe=new Map([["appearance",z.resolveAppearance]]);function Oe(n,t,o){return t}const Re={title:"uploader",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}},appearance:{description:"外观",title:"外观",properties:{contentFill:{description:"内容填充",title:"内容填充",type:"boolean"}}},server:{description:"服务器配置",title:"服务器配置",properties:{rootId:{description:"附件服务器根目录",title:"附件服务器根目录",type:"string"},formId:{description:"必填,根据【附件信息】业务字段所在位置区分:1、在子表,二级目录建议绑定主表ID。2:在主表:二级目录建议填写当前表数据ID",title:"二级目录",type:"string"}}},upload:{description:"上传配置",title:"上传配置",properties:{uploadVisible:{description:"上传按钮是否可见",title:"上传是否可见",type:"boolean"},uploadDisabled:{description:"禁用时,上传按钮可见,但不可用",title:"上传是否禁用",type:"boolean"},allowEmpty:{description:"运行时是否允许不上传附件",title:"是否允许为空",type:"boolean"},uploadSelectText:{description:"选择文件按钮文本",title:"选择文件按钮文本",type:"string"},uploadOptions:{description:"附件上传配置",title:"附件上传配置",type:"cascade",isExpand:!0,properties:{maxUploads:{description:"值为0时表示不限制上传个数",title:"最大上传个数",type:"number"},maxFileSize:{description:"单个附件最大值(MB)",title:"单个附件最大值(MB)",type:"number"},allowedContentTypes:{description:"允许上传附件类型",title:"允许上传附件类型",type:"string"},notAllowedCharsInFileName:{description:"文件名禁用字符",title:"文件名禁用字符",type:"string"}}},enableUploadedCount:{description:"是否启用已上传个数限制",title:"是否启用已上传个数限制",type:"select",editor:{type:"waiting for modification",enum:[]}},uploadEnableMulti:{description:"是否启用多选附件上传",title:"是否启用多选附件上传",type:"select",editor:{type:"waiting for modification",enum:[]}},enableSliceUpload:{description:"是否启用分片上传",title:"是否启用分片上传",type:"select",editor:{type:"waiting for modification",enum:[]}},chunkSize:{description:"分片上传时,每片的大小。单位:M",title:"分片大小(M)",type:"number"}}},preview:{description:"附件预览",title:"附件预览",properties:{previewVisible:{description:"预览是否可见",title:"预览是否可见",type:"boolean"},previewReadonly:{description:"预览是否只读",title:"预览是否只读",type:"boolean"},fieldIdKey:{description:"附件ID字段",title:"附件ID字段",type:"string",editor:{type:"field-selector"}},fileNameKey:{description:"附件名称字段",title:"附件名称字段",type:"string",editor:{type:"field-selector"}},previewEnableMulti:{description:"是否启用批量操作",title:"是否启用批量操作",type:"boolean"},noDelete:{description:"是否禁止删除附件",title:"是否禁止删除附件",type:"boolean"},noPreview:{description:"是否禁止预览",title:"是否禁止预览",type:"boolean"},previewDateFormat:{description:"附件上传时间字段的格式化设置,请注意此属性仅针对附件上传时间一个字段,若有自定义预览列,请在预览列编辑器中单独设置时间格式。",title:"附件上传时间格式化",type:"select",editor:{type:"waiting for modification",enum:[]}},fileSortOrderKey:{description:"排序字段",title:"排序字段",type:"string"},orderType:{description:"排序类型",title:"排序类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},te={contentFill:{type:Boolean,default:!1},orderField:{type:String,default:"createTime"},previewColumns:{type:Array,default:[{field:"name",width:200,title:"文件名",checkbox:!0},{field:"size",width:100,title:"大小"},{field:"createTime",width:100,title:"日期"},{field:"state",width:100,title:"状态"},{field:"action",width:100,title:"操作"}]},previewVisible:{type:Boolean,default:!0},previewEnableMulti:{type:Boolean,default:!0},previewDefaultRename:{type:String,default:""},uploadDisabled:{type:Boolean,default:!1},uploadVisible:{type:Boolean,default:!0},uploadSelectText:{type:String,default:"选择文件"},uploadEnableMulti:{type:Boolean,default:!0},uploadedCount:{type:Number,default:0},disabled:{type:Boolean,default:!1},downloadButtonDisable:{type:Boolean,default:!1},previewButtonDisable:{type:Boolean,default:!1},deleteButtonDisable:{type:Boolean,default:!1},customInfo:{type:String,default:""},fileInfos:{type:Array,default:[]},uploadOptions:{type:Object,default:null},extendConfig:{type:Object,default:{}},uploadServerToken:{type:String,default:""},notifyServiceToken:{type:String,default:""}},ie=z.createPropsResolver(te,De,Pe,Oe,Re);var I=(n=>(n[n.Queue=0]="Queue",n[n.Uploading=1]="Uploading",n[n.Done=2]="Done",n[n.Cancelled=3]="Cancelled",n[n.Remove=4]="Remove",n[n.Error=5]="Error",n))(I||{});class fe{constructor(t={},o={}){j(this,"uploadConfig");j(this,"removeConfig");const a={type:"config",url:"",timeout:0,headers:null,data:{}};this.uploadConfig=Object.assign({},a,t),this.removeConfig=Object.assign({},a,o)}}function se(n,t){const{formatTo:o}=ce.useDateFormat();return o(n,t)}function me(n,t){if(!t)return"";let o="";return n.indexOf(".")===-1&&t.hasOwnProperty(n)?o=t[n]:o=n.split(".").reduce((a,i)=>a?a[i]:null,t),o}function Ie(n){return(t,o)=>{if(!t.hasOwnProperty(n)||t[n]===void 0||t[n]===null)return 1;if(!o.hasOwnProperty(n)||o[n]===void 0||o[n]===null)return-1;if(n!=="createTime"){let l="",d="";return n.indexOf(".")>-1?(l=me(n,t),d=me(n,o)):(l=t[n],d=o[n]),l>d?1:-1}const a=new Date(t[n]),i=new Date(o[n]);return a.getTime()>i.getTime()?-1:1}}function he(n){return(n||[]).findIndex(o=>o==="*")===-1}function ge(n){return n!=="0 Byte"}function K(n){if(n===0)return"0 Byte";const t=1024,o=["Bytes","KB","MB","GB","TB","PB"],a=Math.floor(Math.log(n)/Math.log(t));return parseFloat((n/t**a).toFixed(2))+" "+o[a]}function we(n,t){return n&&(n.hasOwnProperty("allowedContentTypes")&&(t.allowedContentTypes=n.allowedContentTypes||["*"],t.allowedContentTypes=t.allowedContentTypes&&t.allowedContentTypes.length>0?t.allowedContentTypes:["*"]),n.hasOwnProperty("maxUploads")&&(t.maxUploads=n.maxUploads||0),n.hasOwnProperty("maxFileSize")&&(t.maxFileSize=K(1024*1024*(parseInt(String(n.maxFileSize),10)||1)))),t}function ye(n){let t="ffilepreview--filetype";if(!n)return t+"-any";const o=n.lastIndexOf(".");let a="";switch(o>-1&&(a=n.substring(o+1).toLocaleLowerCase()),a){case"pdf":t+="-pdf";break;case"jpeg":case"jpg":case"gif":case"svg":case"png":case"bmp":t+="-img";break;case"ppt":case"pptx":t+="-ppt";break;case"doc":case"docx":t+="-doc";break;case"xls":case"xlsx":t+="-xls";break;case"txt":t+="-txt";break;case"zip":t+="-zip";break;case"wps":t+="-wps";break;case"wpt":t+="-wpt";break;default:t+="-any"}return t}function be(n){var t;if(n.type==="done")return 100;if(n.file&&n.file.progress){if(n.file.progress.status===I.Uploading){const o=((t=n.file.progress.data)==null?void 0:t.percentage)||5;return o>5?o:5}return 5}return 5}function je(n){let t=n;return n?(typeof n=="string"&&(t=parseInt(n,10)),K(t)):"0 Byte"}const Ue=()=>Math.random().toString(36).substring(7);function ve(n,t){return{fileIndex:t,id:Ue(),name:n.name,size:n.size,type:n.type,form:new FormData,progress:{status:I.Queue,data:{percentage:0,speed:0,speedHuman:`${K(0)}/s`,startTime:null,endTime:null,eta:null,etaHuman:null}},lastModifiedDate:se(new Date(n.lastModified),"yyyy-MM-dd HH:mm:ss"),nativeFile:n}}function Ne(n){const t=[];return n.forEach(o=>{const a={id:"",name:"",size:0,type:"",extend:null,extendHeaders:null,createTime:""};for(const i in a){const l=i.replace("extend","response").replace("createTime","lastModifiedDate");o.hasOwnProperty(l)&&(l==="lastModifiedDate"?a[i]=se(o[l],"yyyy-MM-dd HH:mm:ss"):a[i]=o[l])}t.push(a)}),t}function qe(n,t){return n?t<=n*1024*1024:!0}function Le(n){return n.find(t=>t==="*")!==void 0}function ze(n,t){if(!n||n.length===0||Le(n))return!0;if(t.lastIndexOf(".")<0)return!1;const o=t.substr(t.lastIndexOf("."));return n.findIndex(a=>a.toLowerCase()===o.toLowerCase())>-1}function $e(n){if(n)return n.split(` `).map(t=>t.split(/: */,2)).filter(t=>t[0]).reduce((t,o)=>(t[o[0]]=o[1],t),{})}function xe(n){return new Date(n*1e3).toISOString().substr(11,8)}class _e extends fe{upload(t,o,a,i){const l=t[0];return new Promise((d,c)=>{var k,g;const m=o.url||a.url||"",v=o.method||"POST",p=o.data||{},T=o.headers||{},x=new XMLHttpRequest,E=new Date().getTime();let B=((k=l.progress)==null?void 0:k.data)&&l.progress.data.startTime||E,S=0,h=null;x.upload.addEventListener("progress",b=>{var A;if(b.lengthComputable){const F=Math.round(b.loaded*100/b.total),R=new Date().getTime()-E;S=Math.round(b.loaded/R*1e3),B=((A=l.progress)==null?void 0:A.data)&&l.progress.data.startTime||new Date().getTime(),h=Math.ceil((b.total-b.loaded)/S),l.progress={status:I.Uploading,data:{percentage:F,speed:S,speedHuman:`${K(S)}/s`,startTime:B,endTime:null,eta:h,etaHuman:xe(h)}},i({type:"uploading",files:[l]})}},!1),x.upload.addEventListener("error",b=>{c(b)}),x.onreadystatechange=()=>{if(x.readyState===XMLHttpRequest.DONE){const b=Math.round(l.size/(new Date().getTime()-B)*1e3);l.progress={status:I.Done,data:{percentage:100,speed:b,speedHuman:`${K(b)}/s`,startTime:B,endTime:new Date().getTime(),eta:h,etaHuman:xe(h||0)}},l.responseStatus=x.status;try{l.response=JSON.parse(x.response)}catch{l.response=x.response}l.responseHeaders=$e(x.getAllResponseHeaders()),d({type:"done",files:[l]})}},x.open(v,m,!0),x.withCredentials=!!o.withCredentials;try{const b=l.nativeFile;Object.keys(T).forEach(F=>x.setRequestHeader(F,T[F]));let A;o.includeWebKitFormBoundary!==!1?(Object.keys(p).forEach(F=>{var R;return(R=l.form)==null?void 0:R.append(F,p[F])}),(g=l.form)==null||g.append(o.fieldName||"file",b,b.name),A=l.form):A=b,x.send(A)}catch(b){c(b)}return()=>{x.abort()}})}remove(t,o,a,i){return new Promise((l,d)=>{l({type:"removed",files:t})})}}const Qe={showCloseButton:{type:Boolean,default:!0},position:{type:String,default:"top-center"},timeout:{type:Number,default:3e3},theme:{type:String,default:"bootstrap"},left:{type:Number},right:{type:Number},top:{type:Number},bottom:{type:Number},id:{type:String},animate:{type:String,default:"fadeIn"},options:{type:Object},safeHtml:{type:Boolean,default:!0}},Ke={showCloseButton:{type:Boolean,default:!0},animate:{type:String,default:"fadeIn"},options:{type:Object}},re=e.defineComponent({name:"Toast",props:Ke,emits:["close","click"],setup:(n,t)=>{const o=e.ref(n.animate),a="fadeOut",i=e.computed(()=>n.options),l=e.ref(!1),d=e.computed(()=>i.value.title&&i.value.message),c=e.computed(()=>!i.value.title&&i.value.message),m=e.computed(()=>{const g={animated:l.value,toast:!0,"toast--only-content":!d.value};return g[n.animate]=!1,g[a]=l.value,g["toasty-type-"+i.value.type]=!0,i.value.theme&&(g[i.value.theme]=!0),g}),v=e.computed(()=>{const A=`f-icon-${i.value&&i.value.type?i.value.type.replace("toasty-type-",""):"default"}`,F={"f-icon":!0};return F[A]=!0,F}),p=e.computed(()=>i.value.title||i.value.message),T=e.computed(()=>n.showCloseButton),x=e.computed(()=>!!i.value.buttons||!!t.slots.default),E=e.computed(()=>le.LocaleService.getLocale()==="en"?{wordBreak:"keep-all",overflowWrap:"break-word"}:{});function B(g){g.stopPropagation(),g.preventDefault(),l.value=!1,setTimeout(()=>{t.emit("close",i.value)},200)}function S(g,b){}function h(g){return`f-preten-link ${g.customClass?g.customClass:""}`}e.watch(o,()=>{o.value});const k=()=>{var g;return e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"after-toast-msg text-right"},[!t.slots.default&&((g=i.value.buttons)==null?void 0:g.map(b=>e.createVNode("span",{class:h(b),onClick:A=>void 0},[b.text]))),t.slots.default&&t.slots.default()])])};return()=>e.createVNode("div",{class:m.value,style:"min-height:44px"},[T.value&&e.createVNode("button",{title:le.LocaleService.getLocaleValue("messageBox.close"),class:"toast-close f-btn-icon f-bare",onClick:B},[e.createVNode("span",{class:"f-icon modal_close"},null)]),p.value&&e.createVNode("section",{class:"modal-tips"},[!d.value&&e.createVNode("div",{class:"float-left modal-tips-iconwrap"},[e.createVNode("span",{class:v.value},null)]),e.createVNode("div",{class:"modal-tips-content"},[d.value&&e.createVNode(e.Fragment,null,[e.createVNode("h5",{class:"toast-title modal-tips-title",innerHTML:i.value.title},null),e.createVNode("p",{class:"toast-msg",innerHTML:i.value.message,style:E.value},null),x.value&&k()]),c.value&&(i.value.buttons?e.createVNode("div",{class:"toast-title-btns-wrapper d-flex"},[e.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",style:E.value,innerHTML:i.value.message},null),e.createVNode("div",{class:"after-toast-title text-right ml-auto"},[k()])]):e.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",style:E.value,innerHTML:i.value.message},null))])])])}}),We=["moz","ms","webkit"];function Xe(){let n=0;return t=>{const o=new Date().getTime(),a=Math.max(0,16-(o-n)),i=setTimeout(()=>{t(o+a)},a);return n=o+a,i}}function Ye(){if(typeof window>"u")return()=>0;if(window.requestAnimationFrame)return window.requestAnimationFrame.bind(window);const n=We.filter(t=>`${t}RequestAnimationFrame`in window)[0];return n?window[`${n}RequestAnimationFrame`]:Xe()}Ye(),e.ref("");function Ve(){if(typeof window>"u"||typeof navigator>"u")return!1;const n=navigator.userAgent||navigator.vendor||window.opera,t=[/iPhone/i,/iPod/i,/Android.*Mobile/i,/webOS/i,/BlackBerry/i,/IEMobile/i,/Opera Mini/i,/Harmony/i],o=[/iPad/i,/Android(?!.*Mobile)/i,/Tablet/i,/PlayBook/i,/Kindle/i,/Silk/i];for(const m of o)if(m.test(n))return!1;for(const m of t)if(m.test(n))return!0;if(typeof screen>"u")return!1;const a="ontouchstart"in window||navigator.maxTouchPoints>0,i=screen.width,l=screen.height,d=Math.min(i,l);return!!(a&&d<=768)}function Ge(){const n=Ve();return n&&document.body.classList.add("f-mobile"),n}typeof document<"u"&&Ge();const ne=e.defineComponent({name:"Notify",props:Qe,emits:["close","empty"],setup(n,t){var S;const o=Ve(),i=`farris-notify-${(S=n.options)!=null&&S.type?n.options.type:"info"}}`,l=e.computed(()=>({"farris-notify":!0,[i]:o})),d={left:12,right:12,top:20,bottom:12},c=e.ref(),m=e.ref(n.options),v=e.ref(n.showCloseButton),p=e.computed(()=>n.position||"bottom-right"),T=e.computed(()=>n.timeout!=null?n.timeout:3e3),x=e.computed(()=>{const h=n.bottom?n.bottom:d.bottom,k=n.top?n.top:d.top,g={transition:"all 0.2s ease",left:p.value.indexOf("left")>-1?`${n.left?n.left:d.left}px`:"",right:p.value.indexOf("right")>-1?`${n.right?n.right:d.right}px`:"",top:p.value.indexOf("top")>-1?`${k}px`:"",bottom:p.value.indexOf("bottom")>-1?`${h}px`:""};return p.value.indexOf("center")>-1&&(g.left="50%",g.marginLeft="calc(-24rem / 2)",p.value==="center-center"&&(g.top="50%",g.transform="translate(-50%, -50%)")),g});function E(h){t.emit("close")}T.value&&setTimeout(()=>{E()},T.value),t.expose({closeToast:E,container:c,notifyPosition:p});function B(h,k){E()}return()=>{var h;return o?e.createVNode("div",{class:l.value,ref:c},[(h=n.options)==null?void 0:h.message]):e.createVNode("div",{class:l.value,style:x.value,ref:c},[e.createVNode(re,{options:m.value,showCloseButton:v.value,animate:n.animate,onClose:k=>B(k,m.value)},null)])}}});class Ce{constructor(){j(this,"notifyRefs",[]);j(this,"globalConfig",e.reactive({}))}escapeAllHtml(t){if(typeof t!="string"||!t)return"";const o=document.createElement("div");return o.textContent=t||"",o.innerHTML.replace(/\\n/g,"<br>").replace(/\\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/\\r/g,"")}createNotifyInstance(t){const o=this,i=Object.assign({timeout:3e3,position:"bottom-right",showCloseButton:!0,safeHtml:!0},this.globalConfig,{...t}),l=document.createElement("div");l.style.display="contents";const d=e.createApp({setup(){var v;const c=e.ref();function m(){c.value.container.style.transform="scale(0)",setTimeout(()=>{o.updateNotifyPositionForClose(i,c),d.unmount()},220)}if(i.position.indexOf("top")>-1){const p=o.getNotifyInstances(i.position),T=p[p.length-1];if(T){const x=T.value.container.getBoundingClientRect();i.top=x.bottom}}return i.safeHtml&&((v=i.options)!=null&&v.message)&&(i.options.message=o.escapeAllHtml(i.options.message)),e.onUnmounted(()=>{document.body.removeChild(l)}),e.onMounted(()=>{o.updateNotifyPositionForCreate(i,c)}),()=>e.createVNode(e.Transition,{mode:"out-in",name:"fade",appear:!0},{default:()=>[e.createVNode(ne,e.mergeProps({ref:c},i,{onClose:m}),null)]})}});return d.provide("NotifyService",this),document.body.appendChild(l),d.use(le.LocaleService.i18n),d.mount(l),d}getNotifyInstances(t){return this.notifyRefs.filter(o=>o.value.notifyPosition===t)}updateNotifyPositionForCreate(t,o){if(this.notifyRefs&&this.notifyRefs.length){const a=window.innerHeight;t.position.indexOf("bottom")>-1&&this.getNotifyInstances(t.position).forEach(i=>{const l=i.value.container.getBoundingClientRect();i.value.container.style.bottom=l.height+a-l.bottom+"px"})}this.notifyRefs=[...this.notifyRefs,o]}updateNotifyPositionForClose(t,o){const a=this.notifyRefs.indexOf(o);if(t.position.indexOf("top")>-1){const i=this.getNotifyInstances(t.position),l=i.indexOf(o);i.slice(l+1).forEach(d=>{d.value.container.style.top=d.value.container.offsetTop-d.value.container.offsetHeight+"px"})}a>-1&&this.notifyRefs.splice(a,1)}show(t){return this.createNotifyInstance(t)}buildNotifyProps(t,o){let a="",i="",l,d,c;typeof o=="string"?a=o:o&&(a=o.message||"",i=o.title||"",d=o.position||null,c=o.showCloseButton!=null?o.showCloseButton:null,l=o.timeout!=null?o.timeout:null);const v={options:{type:t,message:a,title:i}};return d!=null&&(v.position=d),c!=null&&(v.showCloseButton=c),l!=null&&(v.timeout=l),v}info(t){const o=this.buildNotifyProps("info",t);return this.show(o)}success(t){const o=this.buildNotifyProps("success",t);return this.show(o)}warning(t){const o=this.buildNotifyProps("warning",t);return this.show(o)}error(t){const o=this.buildNotifyProps("error",t);return this.show(o)}close(t){t&&t.unmount()}closeAll(){this.notifyRefs.forEach(t=>{t==null||t.value.closeToast()}),this.notifyRefs.length=0}}const Je=Symbol("NOTIFY_SERVICE_TOKEN");ne.install=n=>{n.component(ne.name,ne),n.component(re.name,re);const t=new Ce;n.provide(Je,t),n.provide("FNotifyService",t)};const Te={getNotify:(n="")=>{let t;return n&&e.inject(n,null)&&(t=e.inject(n)),t||(t=new Ce),t},getServerAPI:(n="")=>{let t;if(n&&e.inject(n,null)){const o=e.inject(n);o&&o()&&(t=o())}return t||(t=new _e),t}};function Fe(n,t,o){const a=Te.getNotify(n.notifyServiceToken),i=e.ref(n.fileInfos),{disabled:l,uploadVisible:d,uploadDisabled:c,previewVisible:m,orderField:v,previewEnableMulti:p,downloadButtonDisable:T,previewColumns:x,uploadEnableMulti:E,previewButtonDisable:B}=e.toRefs(n),S=e.ref(!1),h=e.ref([]),k=e.computed(()=>h.value.length),g=e.ref([]),b=e.ref("");function A(s){(!s.length||h.value.length!==s.length)&&(S.value=!1);const y=[...s.map(N=>(N.hasOwnProperty("size")||(N.size=void 0),N.hasOwnProperty("createTime")||(N.createTime=void 0),p.value&&(N.checked=!!h.value.find(M=>M.id===N.id)||S.value),N))];return y.sort(Ie(v.value)),p.value&&(h.value=[...y].filter(N=>N.checked)),y}const F=e.ref(A(i.value));e.watch(()=>n.fileInfos,s=>{F.value=A(s)});const R=(s,u)=>{s.stopImmediatePropagation(),t.emit("fileDownloadEvent",{fileInfos:[u],name:""})},X=(s,u)=>{s.stopImmediatePropagation(),!B.value&&t.emit("filePreviewEvent",u)},Y=(s,u,y)=>{u.checked&&(h.value=h.value.filter(N=>N.id!==u.id)),t.emit("fileRemoveEvent",u),y.handleUploadEvent({type:"remove",file:u})},G=(s,u="preview")=>s.formatter?!0:u==="preview"?["state","name","action","size","createTime"].findIndex(N=>N===s.field)>-1:u==="upload"?["state","name","size"].findIndex(N=>N===s.field)>-1:!1,$=s=>!(s.field==="state"&&(c.value||!d.value)),_=s=>s.lastIndexOf(".")>0?s.substring(0,s.lastIndexOf(".")):"",J=s=>{if(s.stopImmediatePropagation(),k.value>1){let u="";u=_(h.value[0].name),t.emit("fileDownloadEvent",{fileInfos:h.value,name:u})}},U=s=>{s.stopImmediatePropagation(),t.emit("fileRemoveEvent",h.value)},Z=s=>{const u=F.value;s.checked?(u.forEach(y=>{y.checked=!0}),h.value=[...F.value],S.value=!0):(h.value=[],u.forEach(y=>{y.checked=!1}),S.value=!1),t.emit("previewMultiSelectedEvent",h.value)},q=(s,u)=>{s&&(s.stopImmediatePropagation(),s.stopPropagation()),(!b.value||u.id!==b.value)&&(b.value=u.id,t.emit("selectedEvent",u))},w=s=>{const u=h.value.findIndex(M=>M.id===s.id),y=u>-1,N=F.value.find(M=>M.id===s.id);N&&(N.checked=s.checked),s.checked&&!y&&N&&h.value.push(N),!s.checked&&y&&h.value.splice(u,1),F.value.length>0&&(h.value.length===F.value.length?S.value=!0:S.value=!1),q(null,N),t.emit("previewMultiSelectedEvent",h.value)},D=s=>{var u;(u=o==null?void 0:o.value)==null||u.handleUploadEvent(s)},ee=s=>{D({type:"upload",file:s})},O=(s,u)=>{let y=[];s.files&&s.files.length>0?y=s.files:typeof s.file<"u"&&(y=[s.file]),u=u||s.type,y.map(N=>{const M=g.value.findIndex(L=>{var ae;return typeof N<"u"&&((ae=L==null?void 0:L.file)==null?void 0:ae.id)===N.id});M>-1&&(g.value[M]={type:u,file:N})})},Q=s=>{if(s.files){const u=s.files.map(y=>y.id);g.value=g.value.filter(y=>!(u.findIndex(M=>{var L;return M===((L=y==null?void 0:y.file)==null?void 0:L.id)})>-1)),D({type:"hide",id:u.join(",")})}},oe=s=>{let u="warning";(s.type==="cancelled"||s.type==="removed")&&(u="success");const y=s.hasOwnProperty("message")?s.message:"";a.show({options:{type:u,message:y},position:"top-center"})},de=s=>{if(s.type==="addedToQueue"&&typeof s.file<"u")g.value.push({type:s.type,file:s.file}),ee(s.file);else if(s.type==="start")O(s,"start");else if(s.type==="done"){O(s,"done");const u=(s.files||[]).map(y=>({checked:!1,id:y.id,name:y.name,size:y.size,createTime:se(new Date,"yyyy-MM-dd HH:mm:ss")}));i.value=[...u,...F.value],Q(s),t.emit("fUploadDoneEvent",Ne(s.files||[])),t.emit("uploadDoneEvent",Ne(s.files||[]))}else if(s.type==="cancelled"||s.type==="removed"||s.type==="error"){const u=i.value.filter(y=>s.files&&s.files.findIndex(N=>y.id===N.id)<0);i.value=[...u],oe(s)}else s.type==="rejected"&&typeof s.file<"u"&&oe(s)};return e.onUnmounted(()=>{}),{disabled:l,uploadVisible:d,uploadDisabled:c,downloadButtonDisable:T,previewVisible:m,previewColumns:x,uploadFiles:g,innerFileInfos:F,previewEnableMulti:p,previewMultiSelectedLength:k,previewSelectAllBtnChecked:S,uploadEnableMulti:E,previewCurrentId:b,multiFileRemoveHandler:U,previewMultiSelectChangeHandler:w,fileMultiDownloadHandler:J,selectOrCancelAllHandler:Z,hasColumnHtmlFunc:G,showPreviewStateColumn:$,rowSelectedHandler:q,fileDownloadHandler:R,filePreviewHandler:X,fileRemoveHandler:Y,handleStateChange:de}}class Ze{constructor(t,o){j(this,"queue");j(this,"uploadOpts",{allowedContentTypes:["*"],maxUploads:0,maxFileSize:12,concurrency:Number.POSITIVE_INFINITY,uploadedCount:0});j(this,"extendServerConfig",null);j(this,"uploadServerSer");j(this,"uploadContext",null);this.stateChangeRecord=t,this.serverToken=o,this.queue=[],this.uploadServerSer=Te.getServerAPI(this.serverToken)}setUploadContext(t){this.uploadContext=t}handleResultFromServer(t){var o,a;switch(t.type){case"removed":this.queue=this.queue.filter(i=>{var l;return((l=i.progress)==null?void 0:l.status)!==I.Remove}),t.hasOwnProperty("message")||(t.message="被删除"),this.stateChangeRecord.value=t;break;case"error":this.queue=this.queue.filter(i=>t.files&&t.files.findIndex(l=>i.id===l.id)<0),(o=this.uploadContext)==null||o.emit("stateChange",t);break;default:(a=this.uploadContext)==null||a.emit("stateChange",t)}}setOptions(t){t&&(this.uploadOpts=Object.assign(this.uploadOpts,t))}handleFiles(t){var a;const o=Array.from(t).reduce((i,l,d)=>{var v;const c=i.length+this.queue.length+1,m=this.rejectedReason(l.name,c,l.size);if(m.allowed)i=i.concat(l);else{const p=ve(l,d);(v=this.uploadContext)==null||v.emit("stateChange",{type:"rejected",file:p,message:m.message})}return i},[]);[].map.call(o,(i,l)=>{var c;const d=ve(i,l);this.queue.push(d),(c=this.uploadContext)==null||c.emit("stateChange",{type:"addedToQueue",file:d})}),(a=this.uploadContext)==null||a.emit("stateChange",{type:"allAddedToQueue"})}rejectedReason(t,o,a){let i=!1,l="";return this.queue.findIndex(c=>c.name===t)>-1?l="上传失败:已存在同名文件":this.uploadOpts.allowedContentTypes&&!ze(this.uploadOpts.allowedContentTypes,t)?l=`上传失败:只允许上传${this.uploadOpts.allowedContentTypes.join(",")}类型的文档`:this.exceedMaxUpload(o)?l=`上传失败:文件总个数超出${this.uploadOpts.maxUploads}限制`:qe(this.uploadOpts.maxFileSize,a)?a===0?l="上传失败:不允许文件为空":i=!0:l=`上传失败:单个文件大小超出${this.uploadOpts.maxFileSize}MB的限制`,{allowed:i,message:l}}exceedMaxUpload(t=0){if(!this.uploadOpts||!this.uploadOpts.maxUploads)return!1;const o=this.uploadOpts.uploadedCount||0;return this.uploadOpts.maxUploads>0&&(this.uploadOpts.maxUploads<=o||t+o>this.uploadOpts.maxUploads)}handleUploadEvent(t){var o,a;switch(t.type){case"upload":const i=this.queue.findIndex(c=>c===t.file);i!==-1&&t.file&&this.serverMethod({files:[this.queue[i]],event:t});break;case"remove":if(!((o=t==null?void 0:t.file)!=null&&o.id))return;const l=this.queue.findIndex(c=>{var m;return c.id===((m=t==null?void 0:t.file)==null?void 0:m.id)});if(l!==-1&&this.queue[l]&&this.queue[l].progress){const{progress:c}=this.queue[l];c&&(c.status=I.Remove)}this.serverMethod({files:[t.file],event:t});break;case"removeAll":const d=this.queue.filter(c=>{var m;return((m=c==null?void 0:c.progress)==null?void 0:m.status)===I.Queue});d.length&&((a=this.uploadContext)==null||a.emit("stateChange",{type:"cancelled",files:d,message:"删除附件成功"}),this.queue=this.queue.filter(c=>{var m;return((m=c==null?void 0:c.progress)==null?void 0:m.status)!==I.Queue})),this.queue.length&&(t.type="remove",this.queue.forEach(c=>{c.progress&&(c.progress.status=I.Remove)}),this.serverMethod({files:this.queue,event:t}));break}}setExtendServerConfig(t){this.extendServerConfig=t}serverMethod(t){let o;switch(t.event.type){case"upload":o=this.upload(t.files,t.event,a=>this.handleResultFromServer(a));break;case"removeAll":case"remove":o=this.remove(t.files,t.event,a=>this.handleResultFromServer(a));break;default:o=null}o&&o.then(a=>{this.handleResultFromServer(a)}).catch(a=>{this.handleResultFromServer(a)})}upload(t,o,a){var i;return(i=this.uploadContext)==null||i.emit("stateChange",{type:"start",files:t}),this.uploadServerSer.upload(t,o,this.extendServerConfig,a)}remove(t,o,a){return this.uploadServerSer.remove(t,o,this.extendServerConfig,a)}reset(){this.queue=[]}destroyed(){this.reset()}}const W=e.defineComponent({name:"FUploader",components:{"f-upload-progress":Me,"f-preview-checkbox":ue,"f-file-select":pe},props:te,emits:["filePreviewEvent","fileDownloadEvent","previewMultiSelectedEvent","selectedEvent","fileRemoveEvent","fileRemovedEvent","fUploadDoneEvent","uploadDoneEvent"],setup(n,t){const o=e.ref(),a=new Ze(o,n.uploadServerToken);e.provide("uploaderService",a);const i=e.ref(n.customInfo);function l(){return we(n.uploadOptions,{allowedContentTypes:["*"],maxUploads:0,maxFileSize:"12MB"})}const d=e.ref(l()),c=e.ref(null);e.watch(()=>n.uploadOptions,()=>{d.value=l()},{deep:!0});const{disabled:m,uploadVisible:v,uploadDisabled:p,downloadButtonDisable:T,previewVisible:x,previewColumns:E,uploadFiles:B,innerFileInfos:S,previewEnableMulti:h,previewMultiSelectedLength:k,previewSelectAllBtnChecked:g,uploadEnableMulti:b,previewCurrentId:A,multiFileRemoveHandler:F,previewMultiSelectChangeHandler:R,fileMultiDownloadHandler:X,selectOrCancelAllHandler:Y,rowSelectedHandler:G,hasColumnHtmlFunc:$,showPreviewStateColumn:_,fileDownloadHandler:J,filePreviewHandler:U,fileRemoveHandler:Z,handleStateChange:q}=Fe(n,t,c);e.watch(o,r=>{switch(q(r),r.type){case"removed":t.emit("fileRemovedEvent",r.files[0]);break}});const w=e.computed(()=>S.value.length>0);function D(){var r;return he(d.value.allowedContentTypes||[])?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("支持类型:")]),e.createVNode("span",{class:"support-info--item-detail",style:"margin-right:4px;"},[(r=d.value.allowedContentTypes)==null?void 0:r.join(""),e.createTextVNode(",")])]):""}function ee(){return ge(d.value.maxFileSize||"")?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("单个文件限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[d.value.maxFileSize,e.createTextVNode(",   ")])]):""}function O(){return(d.value.maxUploads||0)>0&&e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("文件总数限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[d.value.maxUploads,e.createTextVNode("个")])])}function Q(){return v.value&&!p.value&&!m.value?e.createVNode("div",{class:"ffileupload--support-info"},[i.value?e.createVNode("ul",{class:"support-info--wrapper"},[e.createVNode("li",null,[e.createVNode("span",{class:"support-info--item-detail",innerHTML:i.value},null)])]):e.createVNode("ul",{class:"support-info--wrapper"},[D(),ee(),O()])]):null}function oe(r){var f,V,P;return e.createVNode("div",{class:"uploadAndpreview--title-container"},[e.createVNode("div",{class:"ffilepreview--item-icon"},[e.createVNode("span",{class:["ffilepreview--filetype-icon",ye(((f=r.file)==null?void 0:f.name)||"")]},null)]),e.createVNode("div",{class:"uploadAndpreview--right"},[e.createVNode("a",{class:"item-content--title",title:(V=r.file)==null?void 0:V.name},[((P=r.file)==null?void 0:P.name)||"无名称"]),e.createVNode(e.resolveComponent("f-upload-progress"),{status:r.type==="done"?"success":"active",percent:be(r),maxWidth:300},null)])])}function de(r){return e.createVNode("div",{class:"uploadAndpreview--title-container"},[e.createVNode("div",{class:"ffilepreview--item-icon"},[e.createVNode("span",{class:["ffilepreview--filetype-icon",ye(r.name)]},null)]),e.createVNode("div",{class:"uploadAndpreview--right"},[e.createVNode("a",{class:["item-content--title","previewButtonDisable.value?'no-preview':''"],title:r.name,onClick:f=>U(f,r)},[r.name])])])}function s(r,f,V){return e.createVNode("div",{class:"uploadAndpreview--filesize-container"},[r==="preview"&&V?e.createVNode("span",null,[je(V.size)]):null,r==="upload"&&f?e.createVNode("span",null,[be(f)]):null])}function u(r,f){return f&&f.type==="error"?e.createVNode("div",{class:"uploadAndpreview--state-container"},[e.createVNode("p",{class:"upload-state--uploaded"},[e.createVNode("i",{class:"f-icon f-icon-message_warning text-danger"},null),e.createVNode("span",null,[e.createTextVNode("存在异常")])])]):e.createVNode("div",{class:"uploadAndpreview--state-container"},[r==="upload"?f&&f.type!=="done"?e.createVNode("p",{class:"upload-state--uploading"},[e.createVNode("i",{class:"f-icon f-icon-clock text-warning"},null),e.createVNode("span",null,[e.createTextVNode("正在上传...")])]):e.createVNode("p",{class:"upload-state--uploaded"},[e.createVNode("i",{class:"f-icon f-icon-success text-success"},null),e.createVNode("span",null,[e.createTextVNode("上传成功")])]):r==="preview"?e.createVNode("p",{class:"upload-state--uploaded"},[e.createVNode("i",{class:"f-icon f-icon-success text-success"},null),e.createVNode("span",null,[e.createTextVNode("已上传")])]):""])}function y(r){return e.createVNode("div",{class:"uploadAndpreview--action-container"},[T.value?"":e.createVNode("button",{class:"btn preview-btn",title:"下载",onClick:f=>J(f,r)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_download"},null)]),n.previewButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"预览",onClick:f=>U(f,r)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_browse"},null)]),n.deleteButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"删除",onClick:f=>Z(f,r,a)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_delete",style:"top: -1px"},null)])])}function N(r){return e.createVNode("div",{class:"uploadAndpreview--date-container"},[r.createTime||""])}function M(r,f,V,P){let H;if(r=r||"preview",P.formatter)return H=P.formatter(V[P.field]||"",r,r==="preview"?V:f,P),H;if(r==="preview"&&V)switch(P.field){case"state":H=u("preview",null);break;case"name":H=de(V);break;case"action":H=y(V);break;case"size":H=s(r,f,V);break;case"createTime":H=N(V);break;default:H=`<div>${V[P.field]||""} </div>`}if(r==="upload"&&f)switch(P.field){case"state":H=u("upload",f);break;case"name":H=oe(f);break;case"size":H=s(r,f,V);break;default:H=""}return H}function L(){return v.value?e.createVNode("div",{class:"header--left-container"},[e.createVNode(e.resolveComponent("f-file-select"),{ref:c,disabled:p.value,selectText:n.selectText,uploadedCount:n.uploadedCount,uploadServerToken:n.uploadServerToken,enableMulti:b.value,options:d.value,extendConfig:n.extendConfig,onStateChange:r=>q(r)},null)]):null}function ae(){return!v.value&&x.value&&w.value?e.createVNode("div",{class:"header--left-container header--countInfo"},[e.createVNode("p",{class:"m-0"},[e.createTextVNode("共"),e.createVNode("span",{class:"count"},[B.value.length+S.value.length]),e.createTextVNode("个附件"),k.value>0?e.createVNode(e.Fragment,null,[e.createTextVNode("(已选"),e.createVNode("span",{class:"count-selected"},[k.value]),e.createTextVNode("个)")]):""])]):null}function nt(){return(!T.value||!n.deleteButtonDisable)&&x.value&&w.value?e.createVNode("div",{class:"header--right-container"},[T.value?null:e.createVNode("button",{class:"btn btn-primary f-btn-ml",disabled:k.value===0,onClick:V=>X(V)},[e.createTextVNode("下载")]),n.deleteButtonDisable.value?null:e.createVNode("button",{class:"btn btn-secondary f-btn-ml",disabled:k.value===0,onClick:V=>F(V)},[e.createTextVNode("删除")])]):null}function Se(){return E.value.map(r=>_(r)?e.createVNode("th",{style:{width:r.width?r.width+"px":"auto"},class:[!m.value&&r.checkbox&&r.checkbox?"td--hascheckbox":""]},[!m.value&&h.value&&r.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox",id:"previewMultiBtn",checked:g.value,onCheckedChange:f=>Y(f)},null):null,r.title]):null)}function ot(){return B.value.map(r=>{var f;return e.createVNode("tr",{class:"uploadAndpreview--upload-item",id:"uploadAndpreview--upload-item"+(((f=r==null?void 0:r.file)==null?void 0:f.id)||"")},[E.value.map(V=>{var P;return e.createVNode("td",{class:[!m.value&&V.checkbox&&V.checkbox?"td--hascheckbox":""]},[h.value&&V.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{id:(P=r==null?void 0:r.file)==null?void 0:P.id,checked:r.checked,disabled:r.type!=="done",class:"preview-checkbox",onCheckedChange:H=>R(H)},null):null,$(V,"upload")?M("upload",r,null,V):null])})])})}function ke(){return S.value.map(r=>e.createVNode("tr",{class:["uploadAndpreview--preview-item",A.value===r.id?"uploadAndpreview--currentfile":""],id:"uploadAndpreview--preview-item"+r.id,onClick:f=>G(f,r)},[E.value.map(f=>_(f)?e.createVNode("td",{class:[!m.value&&f.checkbox&&f.checkbox?"td--hascheckbox":""]},[!m.value&&h.value&&f.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{id:r.id,checked:r.checked,class:"preview-checkbox",onCheckedChange:V=>R(V)},null):null,$(f,"preview")?M("preview",null,r,f):e.createVNode("div",{class:"text-truncate",innerHTML:M("preview",null,r,f)},null)]):null)]))}return()=>m.value?e.createVNode("div",{class:"fv-upload-and-preview"},[w.value?null:Q(),x.value?e.createVNode("div",{class:"uploadAndpreview--content"},[w.value?e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[Se()]),e.createVNode("tbody",null,[ke()])]):e.createVNode("p",{class:"uploadAndpreview--nodata"},[e.createTextVNode("无附件信息")])]):null,w.value?Q():null]):e.createVNode("div",{class:"fv-upload-and-preview"},[e.createVNode("div",{class:"uploadAndpreview--header"},[L(),ae(),nt()]),w.value?null:Q(),x.value||v.value?e.createVNode("div",{class:"uploadAndpreview--content"},[(T.value||!v.value)&&B.value.length===0&&!w.value?e.createVNode("p",{class:"uploadAndpreview--nodata"},[e.createTextVNode("无附件信息")]):"",B.value.length>0||w?e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[Se()]),e.createVNode("tbody",null,[ot(),ke()])]):null]):null,w.value?Q():null])}}),et=e.defineComponent({name:"FUploaderDesign",components:{"f-preview-checkbox":ue,"f-file-select":pe},props:te,emits:["filePreviewEvent","fileDownloadEvent","previewMultiSelectedEvent","selectedEvent","fileRemoveEvent","fUploadDoneEvent","uploadDoneEvent"],setup(n,t){const o=e.ref(n.customInfo),a=we(n.uploadOptions,{allowedContentTypes:["*"],maxUploads:0,maxFileSize:"12MB"}),i=e.ref(null),l=[{id:"attach01",name:""},{id:"attach02",name:""}],{disabled:d,uploadVisible:c,uploadDisabled:m,downloadButtonDisable:v,previewVisible:p,previewColumns:T,previewEnableMulti:x,previewCurrentId:E,showPreviewStateColumn:B}=Fe(n,t,i);function S(){var w;return he((a==null?void 0:a.allowedContentTypes)||[])?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("支持类型:")]),e.createVNode("span",{class:"support-info--item-detail",style:"margin-right:4px;"},[(w=a.allowedContentTypes)==null?void 0:w.join(""),e.createTextVNode(",")])]):null}function h(){return ge((a==null?void 0:a.maxFileSize)||"")?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("单个文件限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[a.maxFileSize,e.createTextVNode(",   ")])]):null}function k(){return((a==null?void 0:a.maxUploads)||0)>0?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("文件总数限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[a.maxUploads,e.createTextVNode("个")])]):null}function g(){return c.value&&!m.value&&!d.value?e.createVNode("div",{class:"ffileupload--support-info"},[o.value?e.createVNode("ul",{class:"support-info--wrapper"},[e.createVNode("li",null,[e.createVNode("span",{class:"support-info--item-detail",innerHTML:o.value},null)])]):e.createVNode("ul",{class:"support-info--wrapper"},[S(),h(),k()])]):null}function b(w){return e.createVNode("div",{class:"uploadAndpreview--title-container"},[e.createVNode("div",{class:"ffilepreview--item-icon"},[e.createVNode("span",{class:"ffilepreview--filetype-icon"},null)]),e.createVNode("div",{class:"uploadAndpreview--right"},[e.createVNode("span",{class:"ffilepreview--preview-block"},null)])])}function A(w){return e.createVNode("div",{class:"uploadAndpreview--filesize-container"},[e.createVNode("span",{class:"ffilepreview--preview-block"},null)])}function F(){return e.createVNode("div",{class:"uploadAndpreview--state-container"},[e.createVNode("p",{class:"upload-state--uploaded"},[e.createVNode("i",{class:"f-icon f-icon-success text-success"},null),e.createVNode("span",null,[e.createTextVNode("已上传")])])])}function R(w){return e.createVNode("div",{class:"uploadAndpreview--action-container"},[v.value?"":e.createVNode("button",{class:"btn preview-btn",title:"下载"},[e.createVNode("span",{class:"f-icon f-icon-enclosure_download"},null)]),n.previewButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"预览"},[e.createVNode("span",{class:"f-icon f-icon-enclosure_browse"},null)]),n.deleteButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"删除"},[e.createVNode("span",{class:"f-icon f-icon-enclosure_delete",style:"top: -1px"},null)])])}function X(w){return e.createVNode("div",{class:"uploadAndpreview--date-container"},[e.createTextVNode(" "),e.createVNode("span",{class:"ffilepreview--preview-block"},null)])}function Y(w,D,ee){let O=null;if(w=w||"preview",w==="preview"&&D)switch(ee.field){case"state":O=F();break;case"name":O=b();break;case"action":O=R();break;case"size":O=A();break;case"createTime":O=X();break;default:O=e.createVNode("span",{class:"ffilepreview--preview-block"},null)}return O}function G(){return c.value?e.createVNode("div",{class:"header--left-container"},[e.createVNode(e.resolveComponent("f-file-select"),{ref:i,disabled:m.value,selectText:n.selectText},null)]):null}function $(){return(!v.value||!n.deleteButtonDisable)&&p.value?e.createVNode("div",{class:"header--right-container"},[v.value?null:e.createVNode("button",{class:"btn btn-primary f-btn-ml",disabled:!0},[e.createTextVNode("下载")]),n.deleteButtonDisable.value?null:e.createVNode("button",{class:"btn btn-secondary f-btn-ml",disabled:!0},[e.createTextVNode("删除")])]):null}function _(){return T.value.map(w=>B(w)?e.createVNode("th",{style:{width:w.width?w.width+"px":"auto"},class:[!d.value&&w.checkbox&&w.checkbox?"td--hascheckbox":""]},[!d.value&&x.value&&w.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox",id:"previewMultiBtn"},null):null,w.title]):null)}function J(){return l.map(w=>e.createVNode("tr",{class:["uploadAndpreview--preview-item",E.value===w.id?"uploadAndpreview--currentfile":""],id:"uploadAndpreview--preview-item"+w.id},[T.value.map(D=>B(D)?e.createVNode("td",{class:[!d.value&&D.checkbox&&D.checkbox?"td--hascheckbox":""]},[!d.value&&x.value&&D.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox"},null):null,Y("preview",w,D)]):null)]))}e.onBeforeMount(()=>{});const U=e.ref(),Z=e.inject("design-item-context"),q=Ee.useDesignerComponent(U,Z);return e.onMounted(()=>{U.value.componentInstance=q}),t.expose(q.value),()=>e.createVNode("div",{class:"fv-upload-and-preview",ref:U},[p.value||c.value?e.createVNode(e.Fragment,null,[d.value?null:e.createVNode("div",{class:"uploadAndpreview--header"},[G(),$()]),e.createVNode("div",{class:"uploadAndpreview--content"},[e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[_()]),e.createVNode("tbody",null,[J()])])]),g()]):null])}});W.register=(n,t,o,a)=>{n.uploader=W,t.uploader=ie},W.registerDesigner=(n,t,o)=>{n.uploader=et,t.uploader=ie};const tt=ce.withInstall(W);C.FUploader=W,C.UploadServerAPI=fe,C.default=tt,C.propsResolver=ie,C.uploaderProps=te,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});