@farris/ui-vue 1.7.2-beta.1 → 1.7.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/components/avatar/index.esm.js +155 -148
  2. package/components/avatar/index.umd.cjs +1 -1
  3. package/components/button-edit/index.esm.js +1 -1
  4. package/components/button-edit/index.umd.cjs +1 -1
  5. package/components/calendar/index.esm.js +226 -224
  6. package/components/calendar/index.umd.cjs +3 -3
  7. package/components/collection-property-editor/index.esm.js +225 -223
  8. package/components/collection-property-editor/index.umd.cjs +2 -2
  9. package/components/combo-list/index.esm.js +76 -71
  10. package/components/combo-list/index.umd.cjs +1 -1
  11. package/components/comment/index.esm.js +169 -167
  12. package/components/comment/index.umd.cjs +6 -6
  13. package/components/component/index.esm.js +3691 -3043
  14. package/components/component/index.umd.cjs +2 -2
  15. package/components/condition/index.esm.js +2015 -1352
  16. package/components/condition/index.umd.cjs +2 -2
  17. package/components/data-grid/index.esm.js +407 -430
  18. package/components/data-grid/index.umd.cjs +1 -1
  19. package/components/data-view/index.esm.js +3082 -3196
  20. package/components/data-view/index.umd.cjs +1 -1
  21. package/components/designer-canvas/index.esm.js +3364 -2713
  22. package/components/designer-canvas/index.umd.cjs +1 -1
  23. package/components/drawer/index.esm.js +66 -64
  24. package/components/drawer/index.umd.cjs +2 -2
  25. package/components/dynamic-form/index.esm.js +1176 -524
  26. package/components/dynamic-form/index.umd.cjs +1 -1
  27. package/components/dynamic-resolver/index.esm.js +182 -180
  28. package/components/dynamic-resolver/index.umd.cjs +2 -2
  29. package/components/dynamic-view/index.esm.js +531 -455
  30. package/components/dynamic-view/index.umd.cjs +1 -1
  31. package/components/events-editor/index.esm.js +2352 -1700
  32. package/components/events-editor/index.umd.cjs +3 -3
  33. package/components/expression-editor/index.esm.js +8 -3
  34. package/components/expression-editor/index.umd.cjs +2 -2
  35. package/components/filter-bar/index.esm.js +422 -413
  36. package/components/filter-bar/index.umd.cjs +2 -2
  37. package/components/filter-condition-editor/index.esm.js +8 -3
  38. package/components/filter-condition-editor/index.umd.cjs +1 -1
  39. package/components/image/index.esm.js +363 -354
  40. package/components/image/index.umd.cjs +2 -2
  41. package/components/language-textbox/index.esm.js +189 -187
  42. package/components/language-textbox/index.umd.cjs +2 -2
  43. package/components/list-view/index.esm.js +388 -389
  44. package/components/list-view/index.umd.cjs +5 -5
  45. package/components/mapping-editor/index.esm.js +1465 -1488
  46. package/components/mapping-editor/index.umd.cjs +1 -1
  47. package/components/number-range/index.esm.js +180 -173
  48. package/components/number-range/index.umd.cjs +1 -1
  49. package/components/order/index.esm.js +815 -811
  50. package/components/order/index.umd.cjs +5 -5
  51. package/components/property-panel/index.esm.js +429 -420
  52. package/components/property-panel/index.umd.cjs +3 -3
  53. package/components/query-solution/index.esm.js +4746 -4085
  54. package/components/query-solution/index.umd.cjs +7 -7
  55. package/components/schema-selector/index.esm.js +1401 -1402
  56. package/components/schema-selector/index.umd.cjs +5 -5
  57. package/components/section/index.esm.js +102 -100
  58. package/components/section/index.umd.cjs +2 -2
  59. package/components/sort-condition-editor/index.esm.js +8 -3
  60. package/components/sort-condition-editor/index.umd.cjs +1 -1
  61. package/components/transfer/index.esm.js +537 -538
  62. package/components/transfer/index.umd.cjs +5 -5
  63. package/components/tree-grid/index.esm.js +280 -283
  64. package/components/tree-grid/index.umd.cjs +1 -1
  65. package/components/tree-view/index.esm.js +200 -202
  66. package/components/tree-view/index.umd.cjs +1 -1
  67. package/components/uploader/index.esm.js +533 -519
  68. package/components/uploader/index.umd.cjs +2 -2
  69. package/designer/data-grid/index.esm.js +3806 -3905
  70. package/designer/data-grid/index.umd.cjs +9 -9
  71. package/designer/drawer/index.esm.js +188 -186
  72. package/designer/drawer/index.umd.cjs +2 -2
  73. package/designer/dynamic-form/index.esm.js +1562 -1073
  74. package/designer/dynamic-form/index.umd.cjs +2 -2
  75. package/designer/farris-designer.all.esm.js +9793 -8613
  76. package/designer/farris-designer.all.umd.cjs +8 -8
  77. package/designer/list-view/index.esm.js +564 -564
  78. package/designer/list-view/index.umd.cjs +6 -6
  79. package/designer/radio-group/index.esm.js +236 -229
  80. package/designer/radio-group/index.umd.cjs +1 -1
  81. package/designer/response-layout-editor/index.esm.js +178 -171
  82. package/designer/response-layout-editor/index.umd.cjs +1 -1
  83. package/designer/tabs/index.esm.js +3154 -2508
  84. package/designer/tabs/index.umd.cjs +2 -2
  85. package/designer/time-picker/index.esm.js +193 -186
  86. package/designer/time-picker/index.umd.cjs +1 -1
  87. package/designer/tree-grid/index.esm.js +444 -447
  88. package/designer/tree-grid/index.umd.cjs +1 -1
  89. package/farris.all.esm.js +60126 -59649
  90. package/farris.all.umd.cjs +30 -30
  91. package/index.css +1 -1
  92. package/package.json +1 -1
  93. package/types/components.d.ts +1 -1
  94. package/types/condition/src/composition/condition-value/dropdown-value.d.ts +4 -0
  95. package/types/data-grid/index.d.ts +2 -5
  96. package/types/data-grid/src/data-grid.component.d.ts +1 -2
  97. package/types/data-view/components/row/hierarchy-row.component.d.ts +2 -2
  98. package/types/data-view/composition/appearance/use-cell-position.d.ts +1 -1
  99. package/types/data-view/composition/types.d.ts +0 -4
  100. package/types/data-view/composition/visualization/use-virtual-scroll.d.ts +2 -2
  101. package/types/data-view/composition/visualization/use-visual-data-bound.d.ts +2 -3
  102. package/types/data-view/composition/visualization/use-visual-data-row.d.ts +1 -2
  103. package/types/designer-canvas/src/composition/dg-control.d.ts +24 -0
  104. package/types/dynamic-form/designer.d.ts +0 -1
  105. package/types/dynamic-form/index.d.ts +4 -3
  106. package/types/dynamic-form/src/designer/dynamic-form.design.component.d.ts +8 -0
  107. package/types/dynamic-form/src/designer/response-form.design.props.d.ts +14 -0
  108. package/types/dynamic-form/src/designer/use-dynamic-form-rules.d.ts +2 -0
  109. package/types/dynamic-form/src/dynamic-form.component.d.ts +8 -0
  110. package/types/dynamic-form/src/response-form.props.d.ts +13 -1
  111. package/types/dynamic-form/src/schema/response-form-schema-resolver.d.ts +1 -0
  112. package/types/dynamic-form/src/types.d.ts +1 -0
  113. package/types/dynamic-resolver/src/types.d.ts +1 -0
  114. package/types/dynamic-view/index.d.ts +43 -3
  115. package/types/dynamic-view/src/components/maps.d.ts +6 -6
  116. package/types/dynamic-view/src/composition/index.d.ts +5 -0
  117. package/types/dynamic-view/src/composition/use-utils.d.ts +12 -0
  118. package/types/dynamic-view/src/dynamic-view.component.d.ts +6 -6
  119. package/types/language-textbox/index.d.ts +3 -3
  120. package/types/language-textbox/src/components/language-contents.component.d.ts +1 -1
  121. package/types/language-textbox/src/language-textbox.component.d.ts +1 -1
  122. package/types/lookup/src/components/favorite/lookup-favorite.component.d.ts +1 -1
  123. package/types/lookup/src/components/popup-container.component.d.ts +3 -3
  124. package/types/property-panel/src/property-panel.component.d.ts +3 -3
  125. package/types/tree-grid/src/components/data/data-area.component.d.ts +2 -2
  126. package/types/tree-grid/src/tree-grid.props.d.ts +0 -1
  127. package/types/tree-view/src/components/data/tree-area.component.d.ts +1 -1
  128. package/types/tree-view/src/tree-view.props.d.ts +0 -1
@@ -1,2 +1,2 @@
1
- (function(F,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("../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","../designer-canvas/index.umd.js"],e):(F=typeof globalThis<"u"?globalThis:F||self,e(F.uploader={},F.Vue,F.dynamicResolver,F.common,F.locale,F.designerCanvas))})(this,function(F,e,L,ce,oe,ke){"use strict";var Je=Object.defineProperty;var Ze=(F,e,L)=>e in F?Je(F,e,{enumerable:!0,configurable:!0,writable:!0,value:L}):F[e]=L;var I=(F,e,L)=>Ze(F,typeof e!="symbol"?e+"":e,L);const Ee={checked:{type:Boolean,default:!1},id:{type:String,default:""},disabled:{type:Boolean,default:!1}},Be={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:""}},Ae=e.defineComponent({name:"FUploadProgress",props:Be,setup(n,t){const{showInfo:l,status:o,maxWidth:i,percent:a}=e.toRefs(n);return()=>e.createVNode("div",{class:["f-progress upload-progress","upload-progress-status-"+o.value,"f-progress-status-"+o.value,"upload-progress-line",l.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:a.value+"%"}},null)])]),l.value?e.createVNode("span",{class:"upload-progress-text"},[o.value==="error"||o.value==="success"?e.createVNode("span",{class:["upload-progress-text-icon f-icon","f-icon-"+o.value]},null):e.createVNode(e.Fragment,null,[a.value,e.createTextVNode("%")])]):""])}}),ue=e.defineComponent({name:"FPreviewCheckbox",props:Ee,emits:["checkedChange"],setup(n,t){const{disabled:l}=e.toRefs(n),o=e.ref(n.checked),i=a=>{a.stopPropagation(),l.value||(o.value=!o.value,t.emit("checkedChange",{checked:o.value,id:n.id}))};return e.watch(()=>n.checked,a=>{o.value=a}),()=>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:l.value,checked:o.value},null),e.createVNode("label",{class:"custom-control-label",onClick:a=>i(a),onMousedown:a=>a.stopPropagation()},null)])])}}),pe=e.defineComponent({name:"FFileSelect",props:He,emits:["change","stateChange"],setup(n,t){const l=e.inject("uploaderService");l.setUploadContext(t);const o=e.getCurrentInstance(),i=e.ref("*");let a;const c=()=>{a.files&&(t.emit("change",a.files),l.handleFiles(a.files),a.value=null)};function d(){a.value=null,l.reset()}e.watch(()=>n.disabled,()=>{d()}),e.watch(()=>n.uploadedCount,f=>{l.setOptions({uploadedCount:f})}),e.watch(()=>n.extendConfig,f=>{l.setExtendServerConfig(f)});function m(f){f&&f.stopPropagation(),a.click()}function N(f){l.handleUploadEvent(f)}return e.onMounted(()=>{var f,T;a=(f=o==null?void 0:o.proxy)==null?void 0:f.$refs.uploadInput,d(),l.setOptions(n.options),l.setExtendServerConfig(n.extendConfig),i.value=(((T=n.options)==null?void 0:T.allowedContentTypes)||["*"]).join(",")}),e.onUnmounted(()=>{}),t.expose({handleUploadEvent:N}),()=>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:()=>c(),style:"width: 10px",title:"uploadInput"},null),e.createVNode("div",{class:["upload-container",n.disabled?"f-state-disabled":""],onClick:f=>m(f),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"]},Me=new Map([["appearance",L.resolveAppearance]]);function Pe(n,t,l){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:[]}}}}}},ee={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=L.createPropsResolver(ee,De,Me,Pe,Re);var j=(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))(j||{});class fe{constructor(t={},l={}){I(this,"uploadConfig");I(this,"removeConfig");const o={type:"config",url:"",timeout:0,headers:null,data:{}};this.uploadConfig=Object.assign({},o,t),this.removeConfig=Object.assign({},o,l)}}function se(n,t){const{formatTo:l}=ce.useDateFormat();return l(n,t)}function me(n,t){if(!t)return"";let l="";return n.indexOf(".")===-1&&t.hasOwnProperty(n)?l=t[n]:l=n.split(".").reduce((o,i)=>o?o[i]:null,t),l}function Oe(n){return(t,l)=>{if(!t.hasOwnProperty(n)||t[n]===void 0||t[n]===null)return 1;if(!l.hasOwnProperty(n)||l[n]===void 0||l[n]===null)return-1;if(n!=="createTime"){let a="",c="";return n.indexOf(".")>-1?(a=me(n,t),c=me(n,l)):(a=t[n],c=l[n]),a>c?1:-1}const o=new Date(t[n]),i=new Date(l[n]);return o.getTime()>i.getTime()?-1:1}}function he(n){return(n||[]).findIndex(l=>l==="*")===-1}function ge(n){return n!=="0 Byte"}function W(n){if(n===0)return"0 Byte";const t=1024,l=["Bytes","KB","MB","GB","TB","PB"],o=Math.floor(Math.log(n)/Math.log(t));return parseFloat((n/t**o).toFixed(2))+" "+l[o]}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=W(1024*1024*(parseInt(String(n.maxFileSize),10)||1)))),t}function ye(n){let t="ffilepreview--filetype";if(!n)return t+"-any";const l=n.lastIndexOf(".");let o="";switch(l>-1&&(o=n.substring(l+1).toLocaleLowerCase()),o){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===j.Uploading){const l=((t=n.file.progress.data)==null?void 0:t.percentage)||5;return l>5?l:5}return 5}return 5}function je(n){let t=n;return n?(typeof n=="string"&&(t=parseInt(n,10)),W(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:j.Queue,data:{percentage:0,speed:0,speedHuman:`${W(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(l=>{const o={id:"",name:"",size:0,type:"",extend:null,extendHeaders:null,createTime:""};for(const i in o){const a=i.replace("extend","response").replace("createTime","lastModifiedDate");l.hasOwnProperty(a)&&(a==="lastModifiedDate"?o[i]=se(l[a],"yyyy-MM-dd HH:mm:ss"):o[i]=l[a])}t.push(o)}),t}function Ie(n,t){return n?t<=n*1024*1024:!0}function ze(n){return n.find(t=>t==="*")!==void 0}function Le(n,t){if(!n||n.length===0||ze(n))return!0;if(t.lastIndexOf(".")<0)return!1;const l=t.substr(t.lastIndexOf("."));return n.findIndex(o=>o.toLowerCase()===l.toLowerCase())>-1}function qe(n){if(n)return n.split(`
2
- `).map(t=>t.split(/: */,2)).filter(t=>t[0]).reduce((t,l)=>(t[l[0]]=l[1],t),{})}function xe(n){return new Date(n*1e3).toISOString().substr(11,8)}class $e extends fe{upload(t,l,o,i){const a=t[0];return new Promise((c,d)=>{var R,b;const m=l.url||o.url||"",N=l.method||"POST",f=l.data||{},T=l.headers||{},g=new XMLHttpRequest,E=new Date().getTime();let S=((R=a.progress)==null?void 0:R.data)&&a.progress.data.startTime||E,k=0,w=null;g.upload.addEventListener("progress",v=>{var B;if(v.lengthComputable){const C=Math.round(v.loaded*100/v.total),U=new Date().getTime()-E;k=Math.round(v.loaded/U*1e3),S=((B=a.progress)==null?void 0:B.data)&&a.progress.data.startTime||new Date().getTime(),w=Math.ceil((v.total-v.loaded)/k),a.progress={status:j.Uploading,data:{percentage:C,speed:k,speedHuman:`${W(k)}/s`,startTime:S,endTime:null,eta:w,etaHuman:xe(w)}},i({type:"uploading",files:[a]})}},!1),g.upload.addEventListener("error",v=>{d(v)}),g.onreadystatechange=()=>{if(g.readyState===XMLHttpRequest.DONE){const v=Math.round(a.size/(new Date().getTime()-S)*1e3);a.progress={status:j.Done,data:{percentage:100,speed:v,speedHuman:`${W(v)}/s`,startTime:S,endTime:new Date().getTime(),eta:w,etaHuman:xe(w||0)}},a.responseStatus=g.status;try{a.response=JSON.parse(g.response)}catch{a.response=g.response}a.responseHeaders=qe(g.getAllResponseHeaders()),c({type:"done",files:[a]})}},g.open(N,m,!0),g.withCredentials=!!l.withCredentials;try{const v=a.nativeFile;Object.keys(T).forEach(C=>g.setRequestHeader(C,T[C]));let B;l.includeWebKitFormBoundary!==!1?(Object.keys(f).forEach(C=>{var U;return(U=a.form)==null?void 0:U.append(C,f[C])}),(b=a.form)==null||b.append(l.fieldName||"file",v,v.name),B=a.form):B=v,g.send(B)}catch(v){d(v)}return()=>{g.abort()}})}remove(t,l,o,i){return new Promise((a,c)=>{a({type:"removed",files:t})})}}const _e={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}},Qe={showCloseButton:{type:Boolean,default:!0},animate:{type:String,default:"fadeIn"},options:{type:Object}},re=e.defineComponent({name:"Toast",props:Qe,emits:["close","click"],setup:(n,t)=>{const l=e.ref(n.animate),o="fadeOut",i=e.computed(()=>n.options),a=e.ref(!1),c=e.computed(()=>i.value.title&&i.value.message),d=e.computed(()=>!i.value.title&&i.value.message),m=e.computed(()=>{const b={animated:a.value,toast:!0,"toast--only-content":!c.value};return b[n.animate]=!1,b[o]=a.value,b["toasty-type-"+i.value.type]=!0,i.value.theme&&(b[i.value.theme]=!0),b}),N=e.computed(()=>{const B=`f-icon-${i.value&&i.value.type?i.value.type.replace("toasty-type-",""):"default"}`,C={"f-icon":!0};return C[B]=!0,C}),f=e.computed(()=>i.value.title||i.value.message),T=e.computed(()=>n.showCloseButton),g=e.computed(()=>!!i.value.buttons||!!t.slots.default),E=e.computed(()=>oe.LocaleService.getLocale()==="en"?{wordBreak:"keep-all",overflowWrap:"break-word"}:{});function S(b){b.stopPropagation(),b.preventDefault(),a.value=!1,setTimeout(()=>{t.emit("close",i.value)},200)}function k(b,v){}function w(b){return`f-preten-link ${b.customClass?b.customClass:""}`}e.watch(l,()=>{l.value});const R=()=>{var b;return e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"after-toast-msg text-right"},[!t.slots.default&&((b=i.value.buttons)==null?void 0:b.map(v=>e.createVNode("span",{class:w(v),onClick:B=>void 0},[v.text]))),t.slots.default&&t.slots.default()])])};return()=>e.createVNode("div",{class:m.value,style:"min-height:44px"},[T.value&&e.createVNode("button",{title:oe.LocaleService.getLocaleValue("messageBox.close"),class:"toast-close f-btn-icon f-bare",onClick:S},[e.createVNode("span",{class:"f-icon modal_close"},null)]),f.value&&e.createVNode("section",{class:"modal-tips"},[!c.value&&e.createVNode("div",{class:"float-left modal-tips-iconwrap"},[e.createVNode("span",{class:N.value},null)]),e.createVNode("div",{class:"modal-tips-content"},[c.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),g.value&&R()]),d.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"},[R()])]):e.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",style:E.value,innerHTML:i.value.message},null))])])])}}),te=e.defineComponent({name:"Notify",props:_e,emits:["close","empty"],setup(n,t){const l=e.computed(()=>({"farris-notify":!0})),o={left:12,right:12,top:20,bottom:12},i=e.ref(),a=e.ref(n.options),c=e.ref(n.showCloseButton),d=e.computed(()=>n.position||"bottom-right"),m=e.computed(()=>n.timeout!=null?n.timeout:3e3),N=e.computed(()=>{const g=n.bottom?n.bottom:o.bottom,E=n.top?n.top:o.top,S={transition:"all 0.2s ease",left:d.value.indexOf("left")>-1?`${n.left?n.left:o.left}px`:"",right:d.value.indexOf("right")>-1?`${n.right?n.right:o.right}px`:"",top:d.value.indexOf("top")>-1?`${E}px`:"",bottom:d.value.indexOf("bottom")>-1?`${g}px`:""};return d.value.indexOf("center")>-1&&(S.left="50%",S.marginLeft="calc(-24rem / 2)",d.value==="center-center"&&(S.top="50%",S.transform="translate(-50%, -50%)")),S});function f(g){t.emit("close")}m.value&&setTimeout(()=>{f()},m.value),t.expose({closeToast:f,container:i,notifyPosition:d});function T(g,E){f()}return()=>e.createVNode("div",{class:l.value,style:N.value,ref:i},[e.createVNode(re,{options:a.value,showCloseButton:c.value,animate:n.animate,onClose:g=>T(g,a.value)},null)])}});class Ve{constructor(){I(this,"notifyRefs",[]);I(this,"globalConfig",e.reactive({}))}escapeAllHtml(t){if(typeof t!="string"||!t)return"";const l=document.createElement("div");return l.textContent=t||"",l.innerHTML.replace(/\\n/g,"<br>").replace(/\\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/\\r/g,"")}createNotifyInstance(t){const l=this,i=Object.assign({timeout:3e3,position:"bottom-right",showCloseButton:!0,safeHtml:!0},this.globalConfig,{...t}),a=document.createElement("div");a.style.display="contents";const c=e.createApp({setup(){var N;const d=e.ref();function m(){d.value.container.style.transform="scale(0)",setTimeout(()=>{l.updateNotifyPositionForClose(i,d),c.unmount()},220)}if(i.position.indexOf("top")>-1){const f=l.getNotifyInstances(i.position),T=f[f.length-1];if(T){const g=T.value.container.getBoundingClientRect();i.top=g.bottom}}return i.safeHtml&&((N=i.options)!=null&&N.message)&&(i.options.message=l.escapeAllHtml(i.options.message)),e.onUnmounted(()=>{document.body.removeChild(a)}),e.onMounted(()=>{l.updateNotifyPositionForCreate(i,d)}),()=>e.createVNode(e.Transition,{mode:"out-in",name:"fade",appear:!0},{default:()=>[e.createVNode(te,e.mergeProps({ref:d},i,{onClose:m}),null)]})}});return c.provide("NotifyService",this),document.body.appendChild(a),c.use(oe.LocaleService.i18n),c.mount(a),c}getNotifyInstances(t){return this.notifyRefs.filter(l=>l.value.notifyPosition===t)}updateNotifyPositionForCreate(t,l){if(this.notifyRefs&&this.notifyRefs.length){const o=window.innerHeight;t.position.indexOf("bottom")>-1&&this.getNotifyInstances(t.position).forEach(i=>{const a=i.value.container.getBoundingClientRect();i.value.container.style.bottom=a.height+o-a.bottom+"px"})}this.notifyRefs=[...this.notifyRefs,l]}updateNotifyPositionForClose(t,l){const o=this.notifyRefs.indexOf(l);if(t.position.indexOf("top")>-1){const i=this.getNotifyInstances(t.position),a=i.indexOf(l);i.slice(a+1).forEach(c=>{c.value.container.style.top=c.value.container.offsetTop-c.value.container.offsetHeight+"px"})}o>-1&&this.notifyRefs.splice(o,1)}show(t){return this.createNotifyInstance(t)}buildNotifyProps(t,l){let o="",i="",a,c,d;typeof l=="string"?o=l:l&&(o=l.message||"",i=l.title||"",c=l.position||null,d=l.showCloseButton!=null?l.showCloseButton:null,a=l.timeout!=null?l.timeout:null);const N={options:{type:t,message:o,title:i}};return c!=null&&(N.position=c),d!=null&&(N.showCloseButton=d),a!=null&&(N.timeout=a),N}info(t){const l=this.buildNotifyProps("info",t);return this.show(l)}success(t){const l=this.buildNotifyProps("success",t);return this.show(l)}warning(t){const l=this.buildNotifyProps("warning",t);return this.show(l)}error(t){const l=this.buildNotifyProps("error",t);return this.show(l)}close(t){t&&t.unmount()}closeAll(){this.notifyRefs.forEach(t=>{t==null||t.value.closeToast()}),this.notifyRefs.length=0}}const Ke=Symbol("NOTIFY_SERVICE_TOKEN");te.install=n=>{n.component(te.name,te),n.component(re.name,re);const t=new Ve;n.provide(Ke,t),n.provide("FNotifyService",t)};const Ce={getNotify:(n="")=>{let t;return n&&e.inject(n,null)&&(t=e.inject(n)),t||(t=new Ve),t},getServerAPI:(n="")=>{let t;if(n&&e.inject(n,null)){const l=e.inject(n);l&&l()&&(t=l())}return t||(t=new $e),t}};function Te(n,t,l){const o=Ce.getNotify(n.notifyServiceToken),i=e.ref(n.fileInfos),{disabled:a,uploadVisible:c,uploadDisabled:d,previewVisible:m,orderField:N,previewEnableMulti:f,downloadButtonDisable:T,previewColumns:g,uploadEnableMulti:E,previewButtonDisable:S}=e.toRefs(n),k=e.ref(!1),w=e.ref([]),R=e.computed(()=>w.value.length),b=e.ref([]),v=e.ref("");function B(s){(!s.length||w.value.length!==s.length)&&(k.value=!1);const h=[...s.map(y=>(y.hasOwnProperty("size")||(y.size=void 0),y.hasOwnProperty("createTime")||(y.createTime=void 0),f.value&&(y.checked=!!w.value.find(O=>O.id===y.id)||k.value),y))];return h.sort(Oe(N.value)),f.value&&(w.value=[...h].filter(y=>y.checked)),h}const C=e.ref(B(i.value));e.watch(()=>n.fileInfos,s=>{C.value=B(s)});const U=(s,u)=>{s.stopImmediatePropagation(),t.emit("fileDownloadEvent",{fileInfos:[u],name:""})},X=(s,u)=>{s.stopImmediatePropagation(),!S.value&&t.emit("filePreviewEvent",u)},G=(s,u,h)=>{u.checked&&(w.value=w.value.filter(y=>y.id!==u.id)),t.emit("fileRemoveEvent",u),h.handleUploadEvent({type:"remove",file:u})},$=(s,u="preview")=>s.formatter?!0:u==="preview"?["state","name","action","size","createTime"].findIndex(y=>y===s.field)>-1:u==="upload"?["state","name","size"].findIndex(y=>y===s.field)>-1:!1,_=s=>!(s.field==="state"&&(d.value||!c.value)),J=s=>s.lastIndexOf(".")>0?s.substring(0,s.lastIndexOf(".")):"",Q=s=>{if(s.stopImmediatePropagation(),R.value>1){let u="";u=J(w.value[0].name),t.emit("fileDownloadEvent",{fileInfos:w.value,name:u})}},q=s=>{s.stopImmediatePropagation(),t.emit("fileRemoveEvent",w.value)},K=s=>{const u=C.value;s.checked?(u.forEach(h=>{h.checked=!0}),w.value=[...C.value],k.value=!0):(w.value=[],u.forEach(h=>{h.checked=!1}),k.value=!1),t.emit("previewMultiSelectedEvent",w.value)},H=(s,u)=>{s&&(s.stopImmediatePropagation(),s.stopPropagation()),(!v.value||u.id!==v.value)&&(v.value=u.id,t.emit("selectedEvent",u))},x=s=>{const u=w.value.findIndex(O=>O.id===s.id),h=u>-1,y=C.value.find(O=>O.id===s.id);y&&(y.checked=s.checked),s.checked&&!h&&y&&w.value.push(y),!s.checked&&h&&w.value.splice(u,1),C.value.length>0&&(w.value.length===C.value.length?k.value=!0:k.value=!1),H(null,y),t.emit("previewMultiSelectedEvent",w.value)},M=s=>{var u;(u=l==null?void 0:l.value)==null||u.handleUploadEvent(s)},Z=s=>{M({type:"upload",file:s})},A=(s,u)=>{let h=[];s.files&&s.files.length>0?h=s.files:typeof s.file<"u"&&(h=[s.file]),u=u||s.type,h.map(y=>{const O=b.value.findIndex(z=>{var ae;return typeof y<"u"&&((ae=z==null?void 0:z.file)==null?void 0:ae.id)===y.id});O>-1&&(b.value[O]={type:u,file:y})})},de=s=>{if(s.files){const u=s.files.map(h=>h.id);b.value=b.value.filter(h=>!(u.findIndex(O=>{var z;return O===((z=h==null?void 0:h.file)==null?void 0:z.id)})>-1)),M({type:"hide",id:u.join(",")})}},ne=s=>{let u="warning";(s.type==="cancelled"||s.type==="removed")&&(u="success");const h=s.hasOwnProperty("message")?s.message:"";o.show({options:{type:u,message:h},position:"top-center"})},le=s=>{if(s.type==="addedToQueue"&&typeof s.file<"u")b.value.push({type:s.type,file:s.file}),Z(s.file);else if(s.type==="start")A(s,"start");else if(s.type==="done"){A(s,"done");const u=(s.files||[]).map(h=>({checked:!1,id:h.id,name:h.name,size:h.size,createTime:se(new Date,"yyyy-MM-dd HH:mm:ss")}));i.value=[...u,...C.value],de(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(h=>s.files&&s.files.findIndex(y=>h.id===y.id)<0);i.value=[...u],ne(s)}else s.type==="rejected"&&typeof s.file<"u"&&ne(s)};return e.onUnmounted(()=>{}),{disabled:a,uploadVisible:c,uploadDisabled:d,downloadButtonDisable:T,previewVisible:m,previewColumns:g,uploadFiles:b,innerFileInfos:C,previewEnableMulti:f,previewMultiSelectedLength:R,previewSelectAllBtnChecked:k,uploadEnableMulti:E,previewCurrentId:v,multiFileRemoveHandler:q,previewMultiSelectChangeHandler:x,fileMultiDownloadHandler:Q,selectOrCancelAllHandler:K,hasColumnHtmlFunc:$,showPreviewStateColumn:_,rowSelectedHandler:H,fileDownloadHandler:U,filePreviewHandler:X,fileRemoveHandler:G,handleStateChange:le}}class We{constructor(t,l){I(this,"queue");I(this,"uploadOpts",{allowedContentTypes:["*"],maxUploads:0,maxFileSize:12,concurrency:Number.POSITIVE_INFINITY,uploadedCount:0});I(this,"extendServerConfig",null);I(this,"uploadServerSer");I(this,"uploadContext",null);this.stateChangeRecord=t,this.serverToken=l,this.queue=[],this.uploadServerSer=Ce.getServerAPI(this.serverToken)}setUploadContext(t){this.uploadContext=t}handleResultFromServer(t){var l,o;switch(t.type){case"removed":this.queue=this.queue.filter(i=>{var a;return((a=i.progress)==null?void 0:a.status)!==j.Remove}),t.hasOwnProperty("message")||(t.message="被删除"),this.stateChangeRecord.value=t;break;case"error":this.queue=this.queue.filter(i=>t.files&&t.files.findIndex(a=>i.id===a.id)<0),(l=this.uploadContext)==null||l.emit("stateChange",t);break;default:(o=this.uploadContext)==null||o.emit("stateChange",t)}}setOptions(t){t&&(this.uploadOpts=Object.assign(this.uploadOpts,t))}handleFiles(t){var o;const l=Array.from(t).reduce((i,a,c)=>{var N;const d=i.length+this.queue.length+1,m=this.rejectedReason(a.name,d,a.size);if(m.allowed)i=i.concat(a);else{const f=ve(a,c);(N=this.uploadContext)==null||N.emit("stateChange",{type:"rejected",file:f,message:m.message})}return i},[]);[].map.call(l,(i,a)=>{var d;const c=ve(i,a);this.queue.push(c),(d=this.uploadContext)==null||d.emit("stateChange",{type:"addedToQueue",file:c})}),(o=this.uploadContext)==null||o.emit("stateChange",{type:"allAddedToQueue"})}rejectedReason(t,l,o){let i=!1,a="";return this.queue.findIndex(d=>d.name===t)>-1?a="上传失败:已存在同名文件":this.uploadOpts.allowedContentTypes&&!Le(this.uploadOpts.allowedContentTypes,t)?a=`上传失败:只允许上传${this.uploadOpts.allowedContentTypes.join(",")}类型的文档`:this.exceedMaxUpload(l)?a=`上传失败:文件总个数超出${this.uploadOpts.maxUploads}限制`:Ie(this.uploadOpts.maxFileSize,o)?o===0?a="上传失败:不允许文件为空":i=!0:a=`上传失败:单个文件大小超出${this.uploadOpts.maxFileSize}MB的限制`,{allowed:i,message:a}}exceedMaxUpload(t=0){if(!this.uploadOpts||!this.uploadOpts.maxUploads)return!1;const l=this.uploadOpts.uploadedCount||0;return this.uploadOpts.maxUploads>0&&(this.uploadOpts.maxUploads<=l||t+l>this.uploadOpts.maxUploads)}handleUploadEvent(t){var l,o;switch(t.type){case"upload":const i=this.queue.findIndex(d=>d===t.file);i!==-1&&t.file&&this.serverMethod({files:[this.queue[i]],event:t});break;case"remove":if(!((l=t==null?void 0:t.file)!=null&&l.id))return;const a=this.queue.findIndex(d=>{var m;return d.id===((m=t==null?void 0:t.file)==null?void 0:m.id)});if(a!==-1&&this.queue[a]&&this.queue[a].progress){const{progress:d}=this.queue[a];d&&(d.status=j.Remove)}this.serverMethod({files:[t.file],event:t});break;case"removeAll":const c=this.queue.filter(d=>{var m;return((m=d==null?void 0:d.progress)==null?void 0:m.status)===j.Queue});c.length&&((o=this.uploadContext)==null||o.emit("stateChange",{type:"cancelled",files:c,message:"删除附件成功"}),this.queue=this.queue.filter(d=>{var m;return((m=d==null?void 0:d.progress)==null?void 0:m.status)!==j.Queue})),this.queue.length&&(t.type="remove",this.queue.forEach(d=>{d.progress&&(d.progress.status=j.Remove)}),this.serverMethod({files:this.queue,event:t}));break}}setExtendServerConfig(t){this.extendServerConfig=t}serverMethod(t){let l;switch(t.event.type){case"upload":l=this.upload(t.files,t.event,o=>this.handleResultFromServer(o));break;case"removeAll":case"remove":l=this.remove(t.files,t.event,o=>this.handleResultFromServer(o));break;default:l=null}l&&l.then(o=>{this.handleResultFromServer(o)}).catch(o=>{this.handleResultFromServer(o)})}upload(t,l,o){var i;return(i=this.uploadContext)==null||i.emit("stateChange",{type:"start",files:t}),this.uploadServerSer.upload(t,l,this.extendServerConfig,o)}remove(t,l,o){return this.uploadServerSer.remove(t,l,this.extendServerConfig,o)}reset(){this.queue=[]}destroyed(){this.reset()}}const Y=e.defineComponent({name:"FUploader",components:{"f-upload-progress":Ae,"f-preview-checkbox":ue,"f-file-select":pe},props:ee,emits:["filePreviewEvent","fileDownloadEvent","previewMultiSelectedEvent","selectedEvent","fileRemoveEvent","fileRemovedEvent","fUploadDoneEvent","uploadDoneEvent"],setup(n,t){const l=e.ref(),o=new We(l,n.uploadServerToken);e.provide("uploaderService",o);const i=e.ref(n.customInfo),a=we(n.uploadOptions,{allowedContentTypes:["*"],maxUploads:0,maxFileSize:"12MB"}),c=e.ref(null),{disabled:d,uploadVisible:m,uploadDisabled:N,downloadButtonDisable:f,previewVisible:T,previewColumns:g,uploadFiles:E,innerFileInfos:S,previewEnableMulti:k,previewMultiSelectedLength:w,previewSelectAllBtnChecked:R,uploadEnableMulti:b,previewCurrentId:v,multiFileRemoveHandler:B,previewMultiSelectChangeHandler:C,fileMultiDownloadHandler:U,selectOrCancelAllHandler:X,rowSelectedHandler:G,hasColumnHtmlFunc:$,showPreviewStateColumn:_,fileDownloadHandler:J,filePreviewHandler:Q,fileRemoveHandler:q,handleStateChange:K}=Te(n,t,c);e.watch(l,r=>{switch(K(r),r.type){case"removed":t.emit("fileRemovedEvent",r.files[0]);break}});const H=e.computed(()=>S.value.length>0);function x(){var r;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;"},[(r=a.allowedContentTypes)==null?void 0:r.join(""),e.createTextVNode(",")])]):""}function M(){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(",   ")])]):""}function Z(){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("个")])])}function A(){return m.value&&!N.value&&!d.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"},[x(),M(),Z()])]):null}function de(r){var p,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(((p=r.file)==null?void 0:p.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 ne(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:p=>Q(p,r)},[r.name])])])}function le(r,p,V){return e.createVNode("div",{class:"uploadAndpreview--filesize-container"},[r==="preview"&&V?e.createVNode("span",null,[je(V.size)]):null,r==="upload"&&p?e.createVNode("span",null,[be(p)]):null])}function s(r,p){return p&&p.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"?p&&p.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 u(r){return e.createVNode("div",{class:"uploadAndpreview--action-container"},[f.value?"":e.createVNode("button",{class:"btn preview-btn",title:"下载",onClick:p=>J(p,r)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_download"},null)]),n.previewButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"预览",onClick:p=>Q(p,r)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_browse"},null)]),n.deleteButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"删除",onClick:p=>q(p,r,o)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_delete",style:"top: -1px"},null)])])}function h(r){return e.createVNode("div",{class:"uploadAndpreview--date-container"},[r.createTime||""])}function y(r,p,V,P){let D;if(r=r||"preview",P.formatter)return D=P.formatter(V[P.field]||"",r,r==="preview"?V:p,P),D;if(r==="preview"&&V)switch(P.field){case"state":D=s("preview",null);break;case"name":D=ne(V);break;case"action":D=u(V);break;case"size":D=le(r,p,V);break;case"createTime":D=h(V);break;default:D=`<div>${V[P.field]||""} </div>`}if(r==="upload"&&p)switch(P.field){case"state":D=s("upload",p);break;case"name":D=de(p);break;case"size":D=le(r,p,V);break;default:D=""}return D}function O(){return m.value?e.createVNode("div",{class:"header--left-container"},[e.createVNode(e.resolveComponent("f-file-select"),{ref:c,disabled:N.value,selectText:n.selectText,uploadedCount:n.uploadedCount,uploadServerToken:n.uploadServerToken,enableMulti:b.value,options:n.uploadOptions,extendConfig:n.extendConfig,onStateChange:r=>K(r)},null)]):null}function z(){return!m.value&&T.value&&H.value?e.createVNode("div",{class:"header--left-container header--countInfo"},[e.createVNode("p",{class:"m-0"},[e.createTextVNode("共"),e.createVNode("span",{class:"count"},[E.value.length+S.value.length]),e.createTextVNode("个附件"),w.value>0?e.createVNode(e.Fragment,null,[e.createTextVNode("(已选"),e.createVNode("span",{class:"count-selected"},[w.value]),e.createTextVNode("个)")]):""])]):null}function ae(){return(!f.value||!n.deleteButtonDisable)&&T.value&&H.value?e.createVNode("div",{class:"header--right-container"},[f.value?null:e.createVNode("button",{class:"btn btn-primary f-btn-ml",disabled:w.value===0,onClick:V=>U(V)},[e.createTextVNode("下载")]),n.deleteButtonDisable.value?null:e.createVNode("button",{class:"btn btn-secondary f-btn-ml",disabled:w.value===0,onClick:V=>B(V)},[e.createTextVNode("删除")])]):null}function Fe(){return g.value.map(r=>_(r)?e.createVNode("th",{style:{width:r.width?r.width+"px":"auto"},class:[!d.value&&r.checkbox&&r.checkbox?"td--hascheckbox":""]},[!d.value&&k.value&&r.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox",id:"previewMultiBtn",checked:R.value,onCheckedChange:p=>X(p)},null):null,r.title]):null)}function Ge(){return E.value.map(r=>{var p;return e.createVNode("tr",{class:"uploadAndpreview--upload-item",id:"uploadAndpreview--upload-item"+(((p=r==null?void 0:r.file)==null?void 0:p.id)||"")},[g.value.map(V=>{var P;return e.createVNode("td",{class:[!d.value&&V.checkbox&&V.checkbox?"td--hascheckbox":""]},[k.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:D=>C(D)},null):null,$(V,"upload")?y("upload",r,null,V):null])})])})}function Se(){return S.value.map(r=>e.createVNode("tr",{class:["uploadAndpreview--preview-item",v.value===r.id?"uploadAndpreview--currentfile":""],id:"uploadAndpreview--preview-item"+r.id,onClick:p=>G(p,r)},[g.value.map(p=>_(p)?e.createVNode("td",{class:[!d.value&&p.checkbox&&p.checkbox?"td--hascheckbox":""]},[!d.value&&k.value&&p.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{id:r.id,checked:r.checked,class:"preview-checkbox",onCheckedChange:V=>C(V)},null):null,$(p,"preview")?y("preview",null,r,p):e.createVNode("div",{class:"text-truncate",innerHTML:y("preview",null,r,p)},null)]):null)]))}return()=>d.value?e.createVNode("div",{class:"fv-upload-and-preview"},[H.value?null:A(),T.value?e.createVNode("div",{class:"uploadAndpreview--content"},[H.value?e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[Fe()]),e.createVNode("tbody",null,[Se()])]):e.createVNode("p",{class:"uploadAndpreview--nodata"},[e.createTextVNode("无附件信息")])]):null,H.value?A():null]):e.createVNode("div",{class:"fv-upload-and-preview"},[e.createVNode("div",{class:"uploadAndpreview--header"},[O(),z(),ae()]),H.value?null:A(),T.value||m.value?e.createVNode("div",{class:"uploadAndpreview--content"},[(f.value||!m.value)&&E.value.length===0&&!H.value?e.createVNode("p",{class:"uploadAndpreview--nodata"},[e.createTextVNode("无附件信息")]):"",E.value.length>0||H?e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[Fe()]),e.createVNode("tbody",null,[Ge(),Se()])]):null]):null,H.value?A():null])}}),Ye=e.defineComponent({name:"FUploaderDesign",components:{"f-preview-checkbox":ue,"f-file-select":pe},props:ee,emits:["filePreviewEvent","fileDownloadEvent","previewMultiSelectedEvent","selectedEvent","fileRemoveEvent","fUploadDoneEvent","uploadDoneEvent"],setup(n,t){const l=e.ref(n.customInfo),o=we(n.uploadOptions,{allowedContentTypes:["*"],maxUploads:0,maxFileSize:"12MB"}),i=e.ref(null),a=[{id:"attach01",name:""},{id:"attach02",name:""}],{disabled:c,uploadVisible:d,uploadDisabled:m,downloadButtonDisable:N,previewVisible:f,previewColumns:T,previewEnableMulti:g,previewCurrentId:E,showPreviewStateColumn:S}=Te(n,t,i);function k(){var x;return he((o==null?void 0:o.allowedContentTypes)||[])?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("支持类型:")]),e.createVNode("span",{class:"support-info--item-detail",style:"margin-right:4px;"},[(x=o.allowedContentTypes)==null?void 0:x.join(""),e.createTextVNode(",")])]):null}function w(){return ge((o==null?void 0:o.maxFileSize)||"")?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("单个文件限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[o.maxFileSize,e.createTextVNode(",   ")])]):null}function R(){return((o==null?void 0:o.maxUploads)||0)>0?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("文件总数限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[o.maxUploads,e.createTextVNode("个")])]):null}function b(){return d.value&&!m.value&&!c.value?e.createVNode("div",{class:"ffileupload--support-info"},[l.value?e.createVNode("ul",{class:"support-info--wrapper"},[e.createVNode("li",null,[e.createVNode("span",{class:"support-info--item-detail",innerHTML:l.value},null)])]):e.createVNode("ul",{class:"support-info--wrapper"},[k(),w(),R()])]):null}function v(x){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 B(x){return e.createVNode("div",{class:"uploadAndpreview--filesize-container"},[e.createVNode("span",{class:"ffilepreview--preview-block"},null)])}function C(){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 U(x){return e.createVNode("div",{class:"uploadAndpreview--action-container"},[N.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(x){return e.createVNode("div",{class:"uploadAndpreview--date-container"},[e.createTextVNode(" "),e.createVNode("span",{class:"ffilepreview--preview-block"},null)])}function G(x,M,Z){let A=null;if(x=x||"preview",x==="preview"&&M)switch(Z.field){case"state":A=C();break;case"name":A=v();break;case"action":A=U();break;case"size":A=B();break;case"createTime":A=X();break;default:A=e.createVNode("span",{class:"ffilepreview--preview-block"},null)}return A}function $(){return d.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(!N.value||!n.deleteButtonDisable)&&f.value?e.createVNode("div",{class:"header--right-container"},[N.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 J(){return T.value.map(x=>S(x)?e.createVNode("th",{style:{width:x.width?x.width+"px":"auto"},class:[!c.value&&x.checkbox&&x.checkbox?"td--hascheckbox":""]},[!c.value&&g.value&&x.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox",id:"previewMultiBtn"},null):null,x.title]):null)}function Q(){return a.map(x=>e.createVNode("tr",{class:["uploadAndpreview--preview-item",E.value===x.id?"uploadAndpreview--currentfile":""],id:"uploadAndpreview--preview-item"+x.id},[T.value.map(M=>S(M)?e.createVNode("td",{class:[!c.value&&M.checkbox&&M.checkbox?"td--hascheckbox":""]},[!c.value&&g.value&&M.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox"},null):null,G("preview",x,M)]):null)]))}e.onBeforeMount(()=>{});const q=e.ref(),K=e.inject("design-item-context"),H=ke.useDesignerComponent(q,K);return e.onMounted(()=>{q.value.componentInstance=H}),t.expose(H.value),()=>e.createVNode("div",{class:"fv-upload-and-preview",ref:q},[f.value||d.value?e.createVNode(e.Fragment,null,[c.value?null:e.createVNode("div",{class:"uploadAndpreview--header"},[$(),_()]),e.createVNode("div",{class:"uploadAndpreview--content"},[e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[J()]),e.createVNode("tbody",null,[Q()])])]),b()]):null])}});Y.register=(n,t,l,o)=>{n.uploader=Y,t.uploader=ie},Y.registerDesigner=(n,t,l)=>{n.uploader=Ye,t.uploader=ie};const Xe=ce.withInstall(Y);F.FUploader=Y,F.UploadServerAPI=fe,F.default=Xe,F.propsResolver=ie,F.uploaderProps=ee,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(S,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("../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","../designer-canvas/index.umd.js"],e):(S=typeof globalThis<"u"?globalThis:S||self,e(S.uploader={},S.Vue,S.dynamicResolver,S.common,S.locale,S.designerCanvas))})(this,function(S,e,q,ce,oe,ke){"use strict";var Ze=Object.defineProperty;var et=(S,e,q)=>e in S?Ze(S,e,{enumerable:!0,configurable:!0,writable:!0,value:q}):S[e]=q;var j=(S,e,q)=>et(S,typeof e!="symbol"?e+"":e,q);const Ee={checked:{type:Boolean,default:!1},id:{type:String,default:""},disabled:{type:Boolean,default:!1}},Be={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:""}},Ae=e.defineComponent({name:"FUploadProgress",props:Be,setup(n,t){const{showInfo:l,status:a,maxWidth:i,percent:o}=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",l.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:o.value+"%"}},null)])]),l.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,[o.value,e.createTextVNode("%")])]):""])}}),ue=e.defineComponent({name:"FPreviewCheckbox",props:Ee,emits:["checkedChange"],setup(n,t){const{disabled:l}=e.toRefs(n),a=e.ref(n.checked),i=o=>{o.stopPropagation(),l.value||(a.value=!a.value,t.emit("checkedChange",{checked:a.value,id:n.id}))};return e.watch(()=>n.checked,o=>{a.value=o}),()=>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:l.value,checked:a.value},null),e.createVNode("label",{class:"custom-control-label",onClick:o=>i(o),onMousedown:o=>o.stopPropagation()},null)])])}}),pe=e.defineComponent({name:"FFileSelect",props:He,emits:["change","stateChange"],setup(n,t){const l=e.inject("uploaderService");l.setUploadContext(t);const a=e.getCurrentInstance(),i=e.ref("*");let o;const c=()=>{o.files&&(t.emit("change",o.files),l.handleFiles(o.files),o.value=null)};function d(){o.value=null,l.reset()}e.watch(()=>n.disabled,()=>{d()}),e.watch(()=>n.uploadedCount,f=>{l.setOptions({uploadedCount:f})}),e.watch(()=>n.extendConfig,f=>{l.setExtendServerConfig(f)}),e.watch(()=>n.options,f=>{l.setOptions(f)},{deep:!0});function m(f){f&&f.stopPropagation(),o.click()}function N(f){l.handleUploadEvent(f)}return e.onMounted(()=>{var f,T;o=(f=a==null?void 0:a.proxy)==null?void 0:f.$refs.uploadInput,d(),l.setOptions(n.options),l.setExtendServerConfig(n.extendConfig),i.value=(((T=n.options)==null?void 0:T.allowedContentTypes)||["*"]).join(",")}),e.onUnmounted(()=>{}),t.expose({handleUploadEvent:N}),()=>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:()=>c(),style:"width: 10px",title:"uploadInput"},null),e.createVNode("div",{class:["upload-container",n.disabled?"f-state-disabled":""],onClick:f=>m(f),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"]},Me=new Map([["appearance",q.resolveAppearance]]);function Pe(n,t,l){return t}const Oe={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=q.createPropsResolver(te,De,Me,Pe,Oe);var U=(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))(U||{});class fe{constructor(t={},l={}){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,l)}}function se(n,t){const{formatTo:l}=ce.useDateFormat();return l(n,t)}function me(n,t){if(!t)return"";let l="";return n.indexOf(".")===-1&&t.hasOwnProperty(n)?l=t[n]:l=n.split(".").reduce((a,i)=>a?a[i]:null,t),l}function Re(n){return(t,l)=>{if(!t.hasOwnProperty(n)||t[n]===void 0||t[n]===null)return 1;if(!l.hasOwnProperty(n)||l[n]===void 0||l[n]===null)return-1;if(n!=="createTime"){let o="",c="";return n.indexOf(".")>-1?(o=me(n,t),c=me(n,l)):(o=t[n],c=l[n]),o>c?1:-1}const a=new Date(t[n]),i=new Date(l[n]);return a.getTime()>i.getTime()?-1:1}}function he(n){return(n||[]).findIndex(l=>l==="*")===-1}function ge(n){return n!=="0 Byte"}function K(n){if(n===0)return"0 Byte";const t=1024,l=["Bytes","KB","MB","GB","TB","PB"],a=Math.floor(Math.log(n)/Math.log(t));return parseFloat((n/t**a).toFixed(2))+" "+l[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 l=n.lastIndexOf(".");let a="";switch(l>-1&&(a=n.substring(l+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===U.Uploading){const l=((t=n.file.progress.data)==null?void 0:t.percentage)||5;return l>5?l:5}return 5}return 5}function Ue(n){let t=n;return n?(typeof n=="string"&&(t=parseInt(n,10)),K(t)):"0 Byte"}const je=()=>Math.random().toString(36).substring(7);function ve(n,t){return{fileIndex:t,id:je(),name:n.name,size:n.size,type:n.type,form:new FormData,progress:{status:U.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(l=>{const a={id:"",name:"",size:0,type:"",extend:null,extendHeaders:null,createTime:""};for(const i in a){const o=i.replace("extend","response").replace("createTime","lastModifiedDate");l.hasOwnProperty(o)&&(o==="lastModifiedDate"?a[i]=se(l[o],"yyyy-MM-dd HH:mm:ss"):a[i]=l[o])}t.push(a)}),t}function Ie(n,t){return n?t<=n*1024*1024:!0}function ze(n){return n.find(t=>t==="*")!==void 0}function Le(n,t){if(!n||n.length===0||ze(n))return!0;if(t.lastIndexOf(".")<0)return!1;const l=t.substr(t.lastIndexOf("."));return n.findIndex(a=>a.toLowerCase()===l.toLowerCase())>-1}function qe(n){if(n)return n.split(`
2
+ `).map(t=>t.split(/: */,2)).filter(t=>t[0]).reduce((t,l)=>(t[l[0]]=l[1],t),{})}function xe(n){return new Date(n*1e3).toISOString().substr(11,8)}class $e extends fe{upload(t,l,a,i){const o=t[0];return new Promise((c,d)=>{var H,b;const m=l.url||a.url||"",N=l.method||"POST",f=l.data||{},T=l.headers||{},w=new XMLHttpRequest,E=new Date().getTime();let F=((H=o.progress)==null?void 0:H.data)&&o.progress.data.startTime||E,k=0,y=null;w.upload.addEventListener("progress",v=>{var B;if(v.lengthComputable){const C=Math.round(v.loaded*100/v.total),R=new Date().getTime()-E;k=Math.round(v.loaded/R*1e3),F=((B=o.progress)==null?void 0:B.data)&&o.progress.data.startTime||new Date().getTime(),y=Math.ceil((v.total-v.loaded)/k),o.progress={status:U.Uploading,data:{percentage:C,speed:k,speedHuman:`${K(k)}/s`,startTime:F,endTime:null,eta:y,etaHuman:xe(y)}},i({type:"uploading",files:[o]})}},!1),w.upload.addEventListener("error",v=>{d(v)}),w.onreadystatechange=()=>{if(w.readyState===XMLHttpRequest.DONE){const v=Math.round(o.size/(new Date().getTime()-F)*1e3);o.progress={status:U.Done,data:{percentage:100,speed:v,speedHuman:`${K(v)}/s`,startTime:F,endTime:new Date().getTime(),eta:y,etaHuman:xe(y||0)}},o.responseStatus=w.status;try{o.response=JSON.parse(w.response)}catch{o.response=w.response}o.responseHeaders=qe(w.getAllResponseHeaders()),c({type:"done",files:[o]})}},w.open(N,m,!0),w.withCredentials=!!l.withCredentials;try{const v=o.nativeFile;Object.keys(T).forEach(C=>w.setRequestHeader(C,T[C]));let B;l.includeWebKitFormBoundary!==!1?(Object.keys(f).forEach(C=>{var R;return(R=o.form)==null?void 0:R.append(C,f[C])}),(b=o.form)==null||b.append(l.fieldName||"file",v,v.name),B=o.form):B=v,w.send(B)}catch(v){d(v)}return()=>{w.abort()}})}remove(t,l,a,i){return new Promise((o,c)=>{o({type:"removed",files:t})})}}const _e={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}},Qe={showCloseButton:{type:Boolean,default:!0},animate:{type:String,default:"fadeIn"},options:{type:Object}},re=e.defineComponent({name:"Toast",props:Qe,emits:["close","click"],setup:(n,t)=>{const l=e.ref(n.animate),a="fadeOut",i=e.computed(()=>n.options),o=e.ref(!1),c=e.computed(()=>i.value.title&&i.value.message),d=e.computed(()=>!i.value.title&&i.value.message),m=e.computed(()=>{const b={animated:o.value,toast:!0,"toast--only-content":!c.value};return b[n.animate]=!1,b[a]=o.value,b["toasty-type-"+i.value.type]=!0,i.value.theme&&(b[i.value.theme]=!0),b}),N=e.computed(()=>{const B=`f-icon-${i.value&&i.value.type?i.value.type.replace("toasty-type-",""):"default"}`,C={"f-icon":!0};return C[B]=!0,C}),f=e.computed(()=>i.value.title||i.value.message),T=e.computed(()=>n.showCloseButton),w=e.computed(()=>!!i.value.buttons||!!t.slots.default),E=e.computed(()=>oe.LocaleService.getLocale()==="en"?{wordBreak:"keep-all",overflowWrap:"break-word"}:{});function F(b){b.stopPropagation(),b.preventDefault(),o.value=!1,setTimeout(()=>{t.emit("close",i.value)},200)}function k(b,v){}function y(b){return`f-preten-link ${b.customClass?b.customClass:""}`}e.watch(l,()=>{l.value});const H=()=>{var b;return e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"after-toast-msg text-right"},[!t.slots.default&&((b=i.value.buttons)==null?void 0:b.map(v=>e.createVNode("span",{class:y(v),onClick:B=>void 0},[v.text]))),t.slots.default&&t.slots.default()])])};return()=>e.createVNode("div",{class:m.value,style:"min-height:44px"},[T.value&&e.createVNode("button",{title:oe.LocaleService.getLocaleValue("messageBox.close"),class:"toast-close f-btn-icon f-bare",onClick:F},[e.createVNode("span",{class:"f-icon modal_close"},null)]),f.value&&e.createVNode("section",{class:"modal-tips"},[!c.value&&e.createVNode("div",{class:"float-left modal-tips-iconwrap"},[e.createVNode("span",{class:N.value},null)]),e.createVNode("div",{class:"modal-tips-content"},[c.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),w.value&&H()]),d.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"},[H()])]):e.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",style:E.value,innerHTML:i.value.message},null))])])])}}),ne=e.defineComponent({name:"Notify",props:_e,emits:["close","empty"],setup(n,t){const l=e.computed(()=>({"farris-notify":!0})),a={left:12,right:12,top:20,bottom:12},i=e.ref(),o=e.ref(n.options),c=e.ref(n.showCloseButton),d=e.computed(()=>n.position||"bottom-right"),m=e.computed(()=>n.timeout!=null?n.timeout:3e3),N=e.computed(()=>{const w=n.bottom?n.bottom:a.bottom,E=n.top?n.top:a.top,F={transition:"all 0.2s ease",left:d.value.indexOf("left")>-1?`${n.left?n.left:a.left}px`:"",right:d.value.indexOf("right")>-1?`${n.right?n.right:a.right}px`:"",top:d.value.indexOf("top")>-1?`${E}px`:"",bottom:d.value.indexOf("bottom")>-1?`${w}px`:""};return d.value.indexOf("center")>-1&&(F.left="50%",F.marginLeft="calc(-24rem / 2)",d.value==="center-center"&&(F.top="50%",F.transform="translate(-50%, -50%)")),F});function f(w){t.emit("close")}m.value&&setTimeout(()=>{f()},m.value),t.expose({closeToast:f,container:i,notifyPosition:d});function T(w,E){f()}return()=>e.createVNode("div",{class:l.value,style:N.value,ref:i},[e.createVNode(re,{options:o.value,showCloseButton:c.value,animate:n.animate,onClose:w=>T(w,o.value)},null)])}});class Ve{constructor(){j(this,"notifyRefs",[]);j(this,"globalConfig",e.reactive({}))}escapeAllHtml(t){if(typeof t!="string"||!t)return"";const l=document.createElement("div");return l.textContent=t||"",l.innerHTML.replace(/\\n/g,"<br>").replace(/\\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/\\r/g,"")}createNotifyInstance(t){const l=this,i=Object.assign({timeout:3e3,position:"bottom-right",showCloseButton:!0,safeHtml:!0},this.globalConfig,{...t}),o=document.createElement("div");o.style.display="contents";const c=e.createApp({setup(){var N;const d=e.ref();function m(){d.value.container.style.transform="scale(0)",setTimeout(()=>{l.updateNotifyPositionForClose(i,d),c.unmount()},220)}if(i.position.indexOf("top")>-1){const f=l.getNotifyInstances(i.position),T=f[f.length-1];if(T){const w=T.value.container.getBoundingClientRect();i.top=w.bottom}}return i.safeHtml&&((N=i.options)!=null&&N.message)&&(i.options.message=l.escapeAllHtml(i.options.message)),e.onUnmounted(()=>{document.body.removeChild(o)}),e.onMounted(()=>{l.updateNotifyPositionForCreate(i,d)}),()=>e.createVNode(e.Transition,{mode:"out-in",name:"fade",appear:!0},{default:()=>[e.createVNode(ne,e.mergeProps({ref:d},i,{onClose:m}),null)]})}});return c.provide("NotifyService",this),document.body.appendChild(o),c.use(oe.LocaleService.i18n),c.mount(o),c}getNotifyInstances(t){return this.notifyRefs.filter(l=>l.value.notifyPosition===t)}updateNotifyPositionForCreate(t,l){if(this.notifyRefs&&this.notifyRefs.length){const a=window.innerHeight;t.position.indexOf("bottom")>-1&&this.getNotifyInstances(t.position).forEach(i=>{const o=i.value.container.getBoundingClientRect();i.value.container.style.bottom=o.height+a-o.bottom+"px"})}this.notifyRefs=[...this.notifyRefs,l]}updateNotifyPositionForClose(t,l){const a=this.notifyRefs.indexOf(l);if(t.position.indexOf("top")>-1){const i=this.getNotifyInstances(t.position),o=i.indexOf(l);i.slice(o+1).forEach(c=>{c.value.container.style.top=c.value.container.offsetTop-c.value.container.offsetHeight+"px"})}a>-1&&this.notifyRefs.splice(a,1)}show(t){return this.createNotifyInstance(t)}buildNotifyProps(t,l){let a="",i="",o,c,d;typeof l=="string"?a=l:l&&(a=l.message||"",i=l.title||"",c=l.position||null,d=l.showCloseButton!=null?l.showCloseButton:null,o=l.timeout!=null?l.timeout:null);const N={options:{type:t,message:a,title:i}};return c!=null&&(N.position=c),d!=null&&(N.showCloseButton=d),o!=null&&(N.timeout=o),N}info(t){const l=this.buildNotifyProps("info",t);return this.show(l)}success(t){const l=this.buildNotifyProps("success",t);return this.show(l)}warning(t){const l=this.buildNotifyProps("warning",t);return this.show(l)}error(t){const l=this.buildNotifyProps("error",t);return this.show(l)}close(t){t&&t.unmount()}closeAll(){this.notifyRefs.forEach(t=>{t==null||t.value.closeToast()}),this.notifyRefs.length=0}}const Ke=Symbol("NOTIFY_SERVICE_TOKEN");ne.install=n=>{n.component(ne.name,ne),n.component(re.name,re);const t=new Ve;n.provide(Ke,t),n.provide("FNotifyService",t)};const Ce={getNotify:(n="")=>{let t;return n&&e.inject(n,null)&&(t=e.inject(n)),t||(t=new Ve),t},getServerAPI:(n="")=>{let t;if(n&&e.inject(n,null)){const l=e.inject(n);l&&l()&&(t=l())}return t||(t=new $e),t}};function Te(n,t,l){const a=Ce.getNotify(n.notifyServiceToken),i=e.ref(n.fileInfos),{disabled:o,uploadVisible:c,uploadDisabled:d,previewVisible:m,orderField:N,previewEnableMulti:f,downloadButtonDisable:T,previewColumns:w,uploadEnableMulti:E,previewButtonDisable:F}=e.toRefs(n),k=e.ref(!1),y=e.ref([]),H=e.computed(()=>y.value.length),b=e.ref([]),v=e.ref("");function B(s){(!s.length||y.value.length!==s.length)&&(k.value=!1);const g=[...s.map(x=>(x.hasOwnProperty("size")||(x.size=void 0),x.hasOwnProperty("createTime")||(x.createTime=void 0),f.value&&(x.checked=!!y.value.find(D=>D.id===x.id)||k.value),x))];return g.sort(Re(N.value)),f.value&&(y.value=[...g].filter(x=>x.checked)),g}const C=e.ref(B(i.value));e.watch(()=>n.fileInfos,s=>{C.value=B(s)});const R=(s,u)=>{s.stopImmediatePropagation(),t.emit("fileDownloadEvent",{fileInfos:[u],name:""})},Y=(s,u)=>{s.stopImmediatePropagation(),!F.value&&t.emit("filePreviewEvent",u)},X=(s,u,g)=>{u.checked&&(y.value=y.value.filter(x=>x.id!==u.id)),t.emit("fileRemoveEvent",u),g.handleUploadEvent({type:"remove",file:u})},G=(s,u="preview")=>s.formatter?!0:u==="preview"?["state","name","action","size","createTime"].findIndex(x=>x===s.field)>-1:u==="upload"?["state","name","size"].findIndex(x=>x===s.field)>-1:!1,$=s=>!(s.field==="state"&&(d.value||!c.value)),_=s=>s.lastIndexOf(".")>0?s.substring(0,s.lastIndexOf(".")):"",J=s=>{if(s.stopImmediatePropagation(),H.value>1){let u="";u=_(y.value[0].name),t.emit("fileDownloadEvent",{fileInfos:y.value,name:u})}},I=s=>{s.stopImmediatePropagation(),t.emit("fileRemoveEvent",y.value)},Z=s=>{const u=C.value;s.checked?(u.forEach(g=>{g.checked=!0}),y.value=[...C.value],k.value=!0):(y.value=[],u.forEach(g=>{g.checked=!1}),k.value=!1),t.emit("previewMultiSelectedEvent",y.value)},z=(s,u)=>{s&&(s.stopImmediatePropagation(),s.stopPropagation()),(!v.value||u.id!==v.value)&&(v.value=u.id,t.emit("selectedEvent",u))},h=s=>{const u=y.value.findIndex(D=>D.id===s.id),g=u>-1,x=C.value.find(D=>D.id===s.id);x&&(x.checked=s.checked),s.checked&&!g&&x&&y.value.push(x),!s.checked&&g&&y.value.splice(u,1),C.value.length>0&&(y.value.length===C.value.length?k.value=!0:k.value=!1),z(null,x),t.emit("previewMultiSelectedEvent",y.value)},M=s=>{var u;(u=l==null?void 0:l.value)==null||u.handleUploadEvent(s)},ee=s=>{M({type:"upload",file:s})},O=(s,u)=>{let g=[];s.files&&s.files.length>0?g=s.files:typeof s.file<"u"&&(g=[s.file]),u=u||s.type,g.map(x=>{const D=b.value.findIndex(L=>{var ae;return typeof x<"u"&&((ae=L==null?void 0:L.file)==null?void 0:ae.id)===x.id});D>-1&&(b.value[D]={type:u,file:x})})},Q=s=>{if(s.files){const u=s.files.map(g=>g.id);b.value=b.value.filter(g=>!(u.findIndex(D=>{var L;return D===((L=g==null?void 0:g.file)==null?void 0:L.id)})>-1)),M({type:"hide",id:u.join(",")})}},le=s=>{let u="warning";(s.type==="cancelled"||s.type==="removed")&&(u="success");const g=s.hasOwnProperty("message")?s.message:"";a.show({options:{type:u,message:g},position:"top-center"})},de=s=>{if(s.type==="addedToQueue"&&typeof s.file<"u")b.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(g=>({checked:!1,id:g.id,name:g.name,size:g.size,createTime:se(new Date,"yyyy-MM-dd HH:mm:ss")}));i.value=[...u,...C.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(g=>s.files&&s.files.findIndex(x=>g.id===x.id)<0);i.value=[...u],le(s)}else s.type==="rejected"&&typeof s.file<"u"&&le(s)};return e.onUnmounted(()=>{}),{disabled:o,uploadVisible:c,uploadDisabled:d,downloadButtonDisable:T,previewVisible:m,previewColumns:w,uploadFiles:b,innerFileInfos:C,previewEnableMulti:f,previewMultiSelectedLength:H,previewSelectAllBtnChecked:k,uploadEnableMulti:E,previewCurrentId:v,multiFileRemoveHandler:I,previewMultiSelectChangeHandler:h,fileMultiDownloadHandler:J,selectOrCancelAllHandler:Z,hasColumnHtmlFunc:G,showPreviewStateColumn:$,rowSelectedHandler:z,fileDownloadHandler:R,filePreviewHandler:Y,fileRemoveHandler:X,handleStateChange:de}}class We{constructor(t,l){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=l,this.queue=[],this.uploadServerSer=Ce.getServerAPI(this.serverToken)}setUploadContext(t){this.uploadContext=t}handleResultFromServer(t){var l,a;switch(t.type){case"removed":this.queue=this.queue.filter(i=>{var o;return((o=i.progress)==null?void 0:o.status)!==U.Remove}),t.hasOwnProperty("message")||(t.message="被删除"),this.stateChangeRecord.value=t;break;case"error":this.queue=this.queue.filter(i=>t.files&&t.files.findIndex(o=>i.id===o.id)<0),(l=this.uploadContext)==null||l.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 l=Array.from(t).reduce((i,o,c)=>{var N;const d=i.length+this.queue.length+1,m=this.rejectedReason(o.name,d,o.size);if(m.allowed)i=i.concat(o);else{const f=ve(o,c);(N=this.uploadContext)==null||N.emit("stateChange",{type:"rejected",file:f,message:m.message})}return i},[]);[].map.call(l,(i,o)=>{var d;const c=ve(i,o);this.queue.push(c),(d=this.uploadContext)==null||d.emit("stateChange",{type:"addedToQueue",file:c})}),(a=this.uploadContext)==null||a.emit("stateChange",{type:"allAddedToQueue"})}rejectedReason(t,l,a){let i=!1,o="";return this.queue.findIndex(d=>d.name===t)>-1?o="上传失败:已存在同名文件":this.uploadOpts.allowedContentTypes&&!Le(this.uploadOpts.allowedContentTypes,t)?o=`上传失败:只允许上传${this.uploadOpts.allowedContentTypes.join(",")}类型的文档`:this.exceedMaxUpload(l)?o=`上传失败:文件总个数超出${this.uploadOpts.maxUploads}限制`:Ie(this.uploadOpts.maxFileSize,a)?a===0?o="上传失败:不允许文件为空":i=!0:o=`上传失败:单个文件大小超出${this.uploadOpts.maxFileSize}MB的限制`,{allowed:i,message:o}}exceedMaxUpload(t=0){if(!this.uploadOpts||!this.uploadOpts.maxUploads)return!1;const l=this.uploadOpts.uploadedCount||0;return this.uploadOpts.maxUploads>0&&(this.uploadOpts.maxUploads<=l||t+l>this.uploadOpts.maxUploads)}handleUploadEvent(t){var l,a;switch(t.type){case"upload":const i=this.queue.findIndex(d=>d===t.file);i!==-1&&t.file&&this.serverMethod({files:[this.queue[i]],event:t});break;case"remove":if(!((l=t==null?void 0:t.file)!=null&&l.id))return;const o=this.queue.findIndex(d=>{var m;return d.id===((m=t==null?void 0:t.file)==null?void 0:m.id)});if(o!==-1&&this.queue[o]&&this.queue[o].progress){const{progress:d}=this.queue[o];d&&(d.status=U.Remove)}this.serverMethod({files:[t.file],event:t});break;case"removeAll":const c=this.queue.filter(d=>{var m;return((m=d==null?void 0:d.progress)==null?void 0:m.status)===U.Queue});c.length&&((a=this.uploadContext)==null||a.emit("stateChange",{type:"cancelled",files:c,message:"删除附件成功"}),this.queue=this.queue.filter(d=>{var m;return((m=d==null?void 0:d.progress)==null?void 0:m.status)!==U.Queue})),this.queue.length&&(t.type="remove",this.queue.forEach(d=>{d.progress&&(d.progress.status=U.Remove)}),this.serverMethod({files:this.queue,event:t}));break}}setExtendServerConfig(t){this.extendServerConfig=t}serverMethod(t){let l;switch(t.event.type){case"upload":l=this.upload(t.files,t.event,a=>this.handleResultFromServer(a));break;case"removeAll":case"remove":l=this.remove(t.files,t.event,a=>this.handleResultFromServer(a));break;default:l=null}l&&l.then(a=>{this.handleResultFromServer(a)}).catch(a=>{this.handleResultFromServer(a)})}upload(t,l,a){var i;return(i=this.uploadContext)==null||i.emit("stateChange",{type:"start",files:t}),this.uploadServerSer.upload(t,l,this.extendServerConfig,a)}remove(t,l,a){return this.uploadServerSer.remove(t,l,this.extendServerConfig,a)}reset(){this.queue=[]}destroyed(){this.reset()}}const W=e.defineComponent({name:"FUploader",components:{"f-upload-progress":Ae,"f-preview-checkbox":ue,"f-file-select":pe},props:te,emits:["filePreviewEvent","fileDownloadEvent","previewMultiSelectedEvent","selectedEvent","fileRemoveEvent","fileRemovedEvent","fUploadDoneEvent","uploadDoneEvent"],setup(n,t){const l=e.ref(),a=new We(l,n.uploadServerToken);e.provide("uploaderService",a);const i=e.ref(n.customInfo);function o(){return we(n.uploadOptions,{allowedContentTypes:["*"],maxUploads:0,maxFileSize:"12MB"})}const c=e.ref(o()),d=e.ref(null);e.watch(()=>n.uploadOptions,()=>{c.value=o()},{deep:!0});const{disabled:m,uploadVisible:N,uploadDisabled:f,downloadButtonDisable:T,previewVisible:w,previewColumns:E,uploadFiles:F,innerFileInfos:k,previewEnableMulti:y,previewMultiSelectedLength:H,previewSelectAllBtnChecked:b,uploadEnableMulti:v,previewCurrentId:B,multiFileRemoveHandler:C,previewMultiSelectChangeHandler:R,fileMultiDownloadHandler:Y,selectOrCancelAllHandler:X,rowSelectedHandler:G,hasColumnHtmlFunc:$,showPreviewStateColumn:_,fileDownloadHandler:J,filePreviewHandler:I,fileRemoveHandler:Z,handleStateChange:z}=Te(n,t,d);e.watch(l,r=>{switch(z(r),r.type){case"removed":t.emit("fileRemovedEvent",r.files[0]);break}});const h=e.computed(()=>k.value.length>0);function M(){var r;return he(c.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=c.value.allowedContentTypes)==null?void 0:r.join(""),e.createTextVNode(",")])]):""}function ee(){return ge(c.value.maxFileSize||"")?e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("单个文件限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[c.value.maxFileSize,e.createTextVNode(",   ")])]):""}function O(){return(c.value.maxUploads||0)>0&&e.createVNode("li",null,[e.createVNode("span",null,[e.createTextVNode("文件总数限制:")]),e.createVNode("span",{class:"support-info--item-detail"},[c.value.maxUploads,e.createTextVNode("个")])])}function Q(){return N.value&&!f.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"},[M(),ee(),O()])]):null}function le(r){var p,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(((p=r.file)==null?void 0:p.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:p=>I(p,r)},[r.name])])])}function s(r,p,V){return e.createVNode("div",{class:"uploadAndpreview--filesize-container"},[r==="preview"&&V?e.createVNode("span",null,[Ue(V.size)]):null,r==="upload"&&p?e.createVNode("span",null,[be(p)]):null])}function u(r,p){return p&&p.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"?p&&p.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 g(r){return e.createVNode("div",{class:"uploadAndpreview--action-container"},[T.value?"":e.createVNode("button",{class:"btn preview-btn",title:"下载",onClick:p=>J(p,r)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_download"},null)]),n.previewButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"预览",onClick:p=>I(p,r)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_browse"},null)]),n.deleteButtonDisable?"":e.createVNode("button",{class:"btn preview-btn",title:"删除",onClick:p=>Z(p,r,a)},[e.createVNode("span",{class:"f-icon f-icon-enclosure_delete",style:"top: -1px"},null)])])}function x(r){return e.createVNode("div",{class:"uploadAndpreview--date-container"},[r.createTime||""])}function D(r,p,V,P){let A;if(r=r||"preview",P.formatter)return A=P.formatter(V[P.field]||"",r,r==="preview"?V:p,P),A;if(r==="preview"&&V)switch(P.field){case"state":A=u("preview",null);break;case"name":A=de(V);break;case"action":A=g(V);break;case"size":A=s(r,p,V);break;case"createTime":A=x(V);break;default:A=`<div>${V[P.field]||""} </div>`}if(r==="upload"&&p)switch(P.field){case"state":A=u("upload",p);break;case"name":A=le(p);break;case"size":A=s(r,p,V);break;default:A=""}return A}function L(){return N.value?e.createVNode("div",{class:"header--left-container"},[e.createVNode(e.resolveComponent("f-file-select"),{ref:d,disabled:f.value,selectText:n.selectText,uploadedCount:n.uploadedCount,uploadServerToken:n.uploadServerToken,enableMulti:v.value,options:c.value,extendConfig:n.extendConfig,onStateChange:r=>z(r)},null)]):null}function ae(){return!N.value&&w.value&&h.value?e.createVNode("div",{class:"header--left-container header--countInfo"},[e.createVNode("p",{class:"m-0"},[e.createTextVNode("共"),e.createVNode("span",{class:"count"},[F.value.length+k.value.length]),e.createTextVNode("个附件"),H.value>0?e.createVNode(e.Fragment,null,[e.createTextVNode("(已选"),e.createVNode("span",{class:"count-selected"},[H.value]),e.createTextVNode("个)")]):""])]):null}function Ge(){return(!T.value||!n.deleteButtonDisable)&&w.value&&h.value?e.createVNode("div",{class:"header--right-container"},[T.value?null:e.createVNode("button",{class:"btn btn-primary f-btn-ml",disabled:H.value===0,onClick:V=>Y(V)},[e.createTextVNode("下载")]),n.deleteButtonDisable.value?null:e.createVNode("button",{class:"btn btn-secondary f-btn-ml",disabled:H.value===0,onClick:V=>C(V)},[e.createTextVNode("删除")])]):null}function Fe(){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&&y.value&&r.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox",id:"previewMultiBtn",checked:b.value,onCheckedChange:p=>X(p)},null):null,r.title]):null)}function Je(){return F.value.map(r=>{var p;return e.createVNode("tr",{class:"uploadAndpreview--upload-item",id:"uploadAndpreview--upload-item"+(((p=r==null?void 0:r.file)==null?void 0:p.id)||"")},[E.value.map(V=>{var P;return e.createVNode("td",{class:[!m.value&&V.checkbox&&V.checkbox?"td--hascheckbox":""]},[y.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:A=>R(A)},null):null,$(V,"upload")?D("upload",r,null,V):null])})])})}function Se(){return k.value.map(r=>e.createVNode("tr",{class:["uploadAndpreview--preview-item",B.value===r.id?"uploadAndpreview--currentfile":""],id:"uploadAndpreview--preview-item"+r.id,onClick:p=>G(p,r)},[E.value.map(p=>_(p)?e.createVNode("td",{class:[!m.value&&p.checkbox&&p.checkbox?"td--hascheckbox":""]},[!m.value&&y.value&&p.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{id:r.id,checked:r.checked,class:"preview-checkbox",onCheckedChange:V=>R(V)},null):null,$(p,"preview")?D("preview",null,r,p):e.createVNode("div",{class:"text-truncate",innerHTML:D("preview",null,r,p)},null)]):null)]))}return()=>m.value?e.createVNode("div",{class:"fv-upload-and-preview"},[h.value?null:Q(),w.value?e.createVNode("div",{class:"uploadAndpreview--content"},[h.value?e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[Fe()]),e.createVNode("tbody",null,[Se()])]):e.createVNode("p",{class:"uploadAndpreview--nodata"},[e.createTextVNode("无附件信息")])]):null,h.value?Q():null]):e.createVNode("div",{class:"fv-upload-and-preview"},[e.createVNode("div",{class:"uploadAndpreview--header"},[L(),ae(),Ge()]),h.value?null:Q(),w.value||N.value?e.createVNode("div",{class:"uploadAndpreview--content"},[(T.value||!N.value)&&F.value.length===0&&!h.value?e.createVNode("p",{class:"uploadAndpreview--nodata"},[e.createTextVNode("无附件信息")]):"",F.value.length>0||h?e.createVNode("table",{class:"table table-bordered uploadAndpreview--table"},[e.createVNode("thead",null,[Fe()]),e.createVNode("tbody",null,[Je(),Se()])]):null]):null,h.value?Q():null])}}),Ye=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 l=e.ref(n.customInfo),a=we(n.uploadOptions,{allowedContentTypes:["*"],maxUploads:0,maxFileSize:"12MB"}),i=e.ref(null),o=[{id:"attach01",name:""},{id:"attach02",name:""}],{disabled:c,uploadVisible:d,uploadDisabled:m,downloadButtonDisable:N,previewVisible:f,previewColumns:T,previewEnableMulti:w,previewCurrentId:E,showPreviewStateColumn:F}=Te(n,t,i);function k(){var h;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;"},[(h=a.allowedContentTypes)==null?void 0:h.join(""),e.createTextVNode(",")])]):null}function y(){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 H(){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 b(){return d.value&&!m.value&&!c.value?e.createVNode("div",{class:"ffileupload--support-info"},[l.value?e.createVNode("ul",{class:"support-info--wrapper"},[e.createVNode("li",null,[e.createVNode("span",{class:"support-info--item-detail",innerHTML:l.value},null)])]):e.createVNode("ul",{class:"support-info--wrapper"},[k(),y(),H()])]):null}function v(h){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 B(h){return e.createVNode("div",{class:"uploadAndpreview--filesize-container"},[e.createVNode("span",{class:"ffilepreview--preview-block"},null)])}function C(){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(h){return e.createVNode("div",{class:"uploadAndpreview--action-container"},[N.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 Y(h){return e.createVNode("div",{class:"uploadAndpreview--date-container"},[e.createTextVNode(" "),e.createVNode("span",{class:"ffilepreview--preview-block"},null)])}function X(h,M,ee){let O=null;if(h=h||"preview",h==="preview"&&M)switch(ee.field){case"state":O=C();break;case"name":O=v();break;case"action":O=R();break;case"size":O=B();break;case"createTime":O=Y();break;default:O=e.createVNode("span",{class:"ffilepreview--preview-block"},null)}return O}function G(){return d.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(!N.value||!n.deleteButtonDisable)&&f.value?e.createVNode("div",{class:"header--right-container"},[N.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(h=>F(h)?e.createVNode("th",{style:{width:h.width?h.width+"px":"auto"},class:[!c.value&&h.checkbox&&h.checkbox?"td--hascheckbox":""]},[!c.value&&w.value&&h.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox",id:"previewMultiBtn"},null):null,h.title]):null)}function J(){return o.map(h=>e.createVNode("tr",{class:["uploadAndpreview--preview-item",E.value===h.id?"uploadAndpreview--currentfile":""],id:"uploadAndpreview--preview-item"+h.id},[T.value.map(M=>F(M)?e.createVNode("td",{class:[!c.value&&M.checkbox&&M.checkbox?"td--hascheckbox":""]},[!c.value&&w.value&&M.checkbox?e.createVNode(e.resolveComponent("f-preview-checkbox"),{class:"preview-checkbox"},null):null,X("preview",h,M)]):null)]))}e.onBeforeMount(()=>{});const I=e.ref(),Z=e.inject("design-item-context"),z=ke.useDesignerComponent(I,Z);return e.onMounted(()=>{I.value.componentInstance=z}),t.expose(z.value),()=>e.createVNode("div",{class:"fv-upload-and-preview",ref:I},[f.value||d.value?e.createVNode(e.Fragment,null,[c.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()])])]),b()]):null])}});W.register=(n,t,l,a)=>{n.uploader=W,t.uploader=ie},W.registerDesigner=(n,t,l)=>{n.uploader=Ye,t.uploader=ie};const Xe=ce.withInstall(W);S.FUploader=W,S.UploadServerAPI=fe,S.default=Xe,S.propsResolver=ie,S.uploaderProps=te,Object.defineProperties(S,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});