@duxweb/dvha-pro 1.0.34 → 1.0.35

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@duxweb/dvha-core"),l=require("vue"),d=a=>{const e=o.useManage(),r=l.computed(()=>a?.uploadPath||e.config?.apiPath?.upload||"upload"),u=l.computed(()=>a?.managePath||e.config?.apiPath?.uploadManager||"uploadManager"),n=l.computed(()=>a?.driver==="s3"?o.createS3UploadDriver({signPath:a?.signPath||e.config?.apiPath?.upload||r.value||"",signCallback:a?.signCallback||e.config?.upload?.signCallback||(t=>({uploadUrl:t.data?.uploadUrl,url:t.data?.url,params:t.data?.params}))}):o.createLocalUploadDriver());return{uploadPath:r,managePath:u,driver:n}};exports.useUploadConfig=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@duxweb/dvha-core"),o=require("vue");function i(a){const e=u.useManage(),d=o.computed(()=>a?.uploadPath||e.config?.apiPath?.upload||"upload"),l=o.computed(()=>a?.managePath||e.config?.apiPath?.uploadManager||"uploadManager"),n=o.computed(()=>a?.driver||e.config?.upload?.driver||"local"),r=o.computed(()=>a?.method||e.config?.upload?.method||"POST"),c=o.computed(()=>n.value==="s3"?u.createS3UploadDriver({signPath:a?.signPath||e.config?.apiPath?.upload||d.value||"",signCallback:a?.signCallback||e.config?.upload?.signCallback||(t=>({uploadUrl:t.data?.uploadUrl,url:t.data?.url,params:t.data?.params}))}):u.createLocalUploadDriver());return{uploadPath:d,managePath:l,driver:c,method:r}}exports.useUploadConfig=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("@duxweb/dvha-core"),x=require("@vueuse/core"),D=require("mime"),u=require("naive-ui");require("vue-router");require("@overlastic/vue");const k=require("../media/media.cjs");require("vue-echarts");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("clsx");require("jinrishici");require("lodash-es");require("vue-draggable-plus");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");require("aieditor");const M=require("../../hooks/modal.cjs"),U=require("./config.cjs");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");require("dayjs");require("@tanstack/vue-query");require("pinia");function h(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!e.isVNode(r)}const c={"image/*":"JPG, PNG, GIF, BMP, WEBP","video/*":"MP4, AVI, MOV, WMV, FLV","audio/*":"MP3, WAV, AAC, FLAC","text/*":"TXT, CSV, JSON, XML","application/pdf":"PDF","application/msword":"DOC","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.ms-excel":"XLS","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"},i={container:"flex flex-col gap-2",dropZone:{base:"flex items-center justify-center p-6 rounded bg-muted border border-dashed transition-all cursor-pointer group",active:"border-primary bg-primary/5",hover:"border-accented hover:bg-primary/5 hover:border-primary"},content:"flex flex-col items-center gap-1",icon:{wrapper:"size-10 flex items-center justify-center rounded-full border border-dashed border-accented group-hover:border-primary transition-all cursor-pointer",icon:"i-tabler:device-desktop-up size-5"},text:{title:"mt-3 text-base font-medium",desc:"text-sm text-muted text-center",highlight:"text-primary font-medium"},table:{empty:"flex items-center justify-center h-full text-muted",actions:"flex gap-2"}},A=e.defineComponent({name:"DuxFileUpload",props:{path:{type:String,default:""},managePath:{type:String,default:""},signPath:{type:String,default:""},signCallback:Function,driver:{type:String,default:"local"},maxNum:Number,maxSize:Number,multiple:Boolean,manager:Boolean,accept:String,value:[String,Array],defaultValue:[String,Array],onUpdateValue:Function},setup(r,{emit:b}){const d=x.useVModel(r,"value",b,{passive:!0,deep:!0,defaultValue:r.defaultValue}),y=u.useMessage(),{t:a}=v.useI18n(),p=e.ref(),s=e.computed(()=>r.maxSize||5),N=M.useModal(),{uploadPath:m,managePath:V,driver:F}=U.useUploadConfig({driver:r?.driver,signPath:r?.signPath,signCallback:r?.signCallback,uploadPath:r?.path,managePath:r?.managePath}),n=v.useUpload({path:m.value,multiple:r.multiple,maxFileCount:r.maxNum,maxFileSize:s.value*1024*1024,autoUpload:!0,accept:r.accept,onError:t=>y.error(t.message||a("components.upload.error")),driver:F.value}),{isOverDropZone:f}=x.useDropZone(p,{onDrop:t=>{t&&t.length>0&&n.addFiles(Array.from(t),"file")}});e.watch(n.dataFiles,t=>{const o=r.multiple?t:t[0];d.value=o,r.onUpdateValue?.(o)});const q=e.computed(()=>r.accept?r.accept.split(",").map(t=>{const o=t.trim();if(c[o])return c[o];if(o.includes("*")){const z=o.split("/")[0];return c[o]||a("common.fileExtension",{ext:z.toUpperCase()})}const l=D.getExtension(o);return l?l.toUpperCase():o}).filter(Boolean).join(", "):""),P=e.computed(()=>({pending:e.createVNode("div",{class:"text-info"},[a("components.upload.status.pending")]),uploading:e.createVNode("div",{class:"text-info"},[a("components.upload.status.uploading")]),success:e.createVNode("div",{class:"text-success"},[a("components.upload.status.success")]),error:e.createVNode("div",{class:"text-error"},[a("components.upload.status.error")])})),S=e.computed(()=>[i.dropZone.base,f.value?i.dropZone.active:i.dropZone.hover]),C=e.computed(()=>[n.uploadFiles.value.length===0&&"border-b border-muted"]),g=e.ref(!1);return e.watch(d,t=>{if(!t||!t?.length||g.value)return;g.value=!0;const o=Array.isArray(t)?t:[t];n.addDataFiles(o)},{immediate:!0}),()=>e.createVNode("div",{class:i.container},[e.createVNode("div",{ref:p,class:S.value,onClick:()=>n.open()},[e.createVNode("div",{class:i.content},[e.createVNode("div",{class:i.icon.wrapper,onClick:t=>{r.manager&&(t.stopPropagation(),N.show({title:a("components.upload.title"),width:800,component:()=>Promise.resolve().then(()=>require("./manager.cjs")),componentProps:{path:V.value,multiple:r.multiple,uploadParams:{path:m.value,accept:r.accept,maxNum:r.maxNum,maxSize:s.value}}}).then(o=>{n.addDataFiles(o)}))}},[e.createVNode("div",{class:i.icon.icon},null)]),e.createVNode("div",{class:i.text.title},[a("components.upload.desc")]),e.createVNode("div",{class:i.text.desc},[f.value?e.createVNode("span",{class:i.text.highlight},[a("components.upload.dropHere")]):e.createVNode(e.Fragment,null,[q.value?a("components.upload.supportFormats",{formats:q.value}):a("components.upload.allFormats"),e.createTextVNode(",")," ",a("components.upload.maxSize",{size:s.value})])])])]),e.createVNode(u.NDataTable,{bordered:!1,class:C.value,columns:[{key:"filename",title:a("components.upload.file.name"),minWidth:200,render:t=>e.createVNode(k.DuxMedia,{title:t.filename,desc:t.filetype},null)},{key:"filesizeText",title:a("components.upload.file.size"),width:120},{key:"status",title:a("components.upload.file.status"),width:120,render:t=>t.status==="uploading"?e.createVNode("div",{class:"flex items-center"},[e.createVNode(u.NProgress,{type:"line",style:{width:"24px",height:"24px"},color:"rgb(var(--ui-color-primary))","indicator-placement":"inside",percentage:t.progress?.percent,showIndicator:!1,height:14},null)]):P.value[t.status]},{key:"actions",title:a("components.upload.actions"),width:120,render:t=>{let o,l;return e.createVNode("div",{class:i.table.actions},[e.createVNode(u.NButton,{type:"warning",size:"small",text:!0,disabled:["success","error","cancelled"].includes(t.status),onClick:()=>n.cancelFiles([t.id])},h(o=a("components.upload.cancel"))?o:{default:()=>[o]}),e.createVNode(u.NButton,{type:"error",size:"small",text:!0,onClick:()=>n.removeFiles([t.id])},h(l=a("components.upload.delete"))?l:{default:()=>[l]})])}}],data:n.uploadFiles.value},{empty:()=>e.createVNode("div",{class:i.table.empty},[a("components.upload.empty")])})])}});exports.DuxFileUpload=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),h=require("@duxweb/dvha-core"),x=require("@vueuse/core"),k=require("mime"),u=require("naive-ui");require("vue-router");require("@overlastic/vue");const M=require("../media/media.cjs");require("vue-echarts");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("clsx");require("jinrishici");require("lodash-es");require("vue-draggable-plus");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");require("aieditor");const U=require("../../hooks/modal.cjs"),A=require("./config.cjs");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");require("dayjs");require("@tanstack/vue-query");require("pinia");function b(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!e.isVNode(r)}const c={"image/*":"JPG, PNG, GIF, BMP, WEBP","video/*":"MP4, AVI, MOV, WMV, FLV","audio/*":"MP3, WAV, AAC, FLAC","text/*":"TXT, CSV, JSON, XML","application/pdf":"PDF","application/msword":"DOC","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.ms-excel":"XLS","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"},i={container:"flex flex-col gap-2",dropZone:{base:"flex items-center justify-center p-6 rounded bg-muted border border-dashed transition-all cursor-pointer group",active:"border-primary bg-primary/5",hover:"border-accented hover:bg-primary/5 hover:border-primary"},content:"flex flex-col items-center gap-1",icon:{wrapper:"size-10 flex items-center justify-center rounded-full border border-dashed border-accented group-hover:border-primary transition-all cursor-pointer",icon:"i-tabler:device-desktop-up size-5"},text:{title:"mt-3 text-base font-medium",desc:"text-sm text-muted text-center",highlight:"text-primary font-medium"},table:{empty:"flex items-center justify-center h-full text-muted",actions:"flex gap-2"}},w=e.defineComponent({name:"DuxFileUpload",props:{path:{type:String,default:""},managePath:{type:String,default:""},signPath:{type:String,default:""},signCallback:Function,driver:{type:String,default:"local"},maxNum:Number,maxSize:Number,multiple:Boolean,manager:Boolean,accept:String,value:[String,Array],defaultValue:[String,Array],onUpdateValue:Function,method:String},setup(r,{emit:y}){const d=x.useVModel(r,"value",y,{passive:!0,deep:!0,defaultValue:r.defaultValue}),N=u.useMessage(),{t:a}=h.useI18n(),m=e.ref(),s=e.computed(()=>r.maxSize||5),V=U.useModal(),{uploadPath:p,managePath:F,driver:P,method:f}=A.useUploadConfig({driver:r?.driver,signPath:r?.signPath,signCallback:r?.signCallback,uploadPath:r?.path,managePath:r?.managePath,method:r?.method}),n=h.useUpload({path:p.value,multiple:r.multiple,maxFileCount:r.maxNum,maxFileSize:s.value*1024*1024,autoUpload:!0,accept:r.accept,onError:t=>N.error(t.message||a("components.upload.error")),driver:P.value,method:f.value}),{isOverDropZone:q}=x.useDropZone(m,{onDrop:t=>{t&&t.length>0&&n.addFiles(Array.from(t),"file")}});e.watch(n.dataFiles,t=>{const o=r.multiple?t:t[0];d.value=o,r.onUpdateValue?.(o)});const g=e.computed(()=>r.accept?r.accept.split(",").map(t=>{const o=t.trim();if(c[o])return c[o];if(o.includes("*")){const D=o.split("/")[0];return c[o]||a("common.fileExtension",{ext:D.toUpperCase()})}const l=k.getExtension(o);return l?l.toUpperCase():o}).filter(Boolean).join(", "):""),S=e.computed(()=>({pending:e.createVNode("div",{class:"text-info"},[a("components.upload.status.pending")]),uploading:e.createVNode("div",{class:"text-info"},[a("components.upload.status.uploading")]),success:e.createVNode("div",{class:"text-success"},[a("components.upload.status.success")]),error:e.createVNode("div",{class:"text-error"},[a("components.upload.status.error")])})),C=e.computed(()=>[i.dropZone.base,q.value?i.dropZone.active:i.dropZone.hover]),z=e.computed(()=>[n.uploadFiles.value.length===0&&"border-b border-muted"]),v=e.ref(!1);return e.watch(d,t=>{if(!t||!t?.length||v.value)return;v.value=!0;const o=Array.isArray(t)?t:[t];n.addDataFiles(o)},{immediate:!0}),()=>e.createVNode("div",{class:i.container},[e.createVNode("div",{ref:m,class:C.value,onClick:()=>n.open()},[e.createVNode("div",{class:i.content},[e.createVNode("div",{class:i.icon.wrapper,onClick:t=>{r.manager&&(t.stopPropagation(),V.show({title:a("components.upload.title"),width:800,component:()=>Promise.resolve().then(()=>require("./manager.cjs")),componentProps:{path:F.value,multiple:r.multiple,uploadParams:{path:p.value,accept:r.accept,maxNum:r.maxNum,maxSize:s.value,method:f.value}}}).then(o=>{n.addDataFiles(o)}))}},[e.createVNode("div",{class:i.icon.icon},null)]),e.createVNode("div",{class:i.text.title},[a("components.upload.desc")]),e.createVNode("div",{class:i.text.desc},[q.value?e.createVNode("span",{class:i.text.highlight},[a("components.upload.dropHere")]):e.createVNode(e.Fragment,null,[g.value?a("components.upload.supportFormats",{formats:g.value}):a("components.upload.allFormats"),e.createTextVNode(",")," ",a("components.upload.maxSize",{size:s.value})])])])]),e.createVNode(u.NDataTable,{bordered:!1,class:z.value,columns:[{key:"filename",title:a("components.upload.file.name"),minWidth:200,render:t=>e.createVNode(M.DuxMedia,{title:t.filename,desc:t.filetype},null)},{key:"filesizeText",title:a("components.upload.file.size"),width:120},{key:"status",title:a("components.upload.file.status"),width:120,render:t=>t.status==="uploading"?e.createVNode("div",{class:"flex items-center"},[e.createVNode(u.NProgress,{type:"line",style:{width:"24px",height:"24px"},color:"rgb(var(--ui-color-primary))","indicator-placement":"inside",percentage:t.progress?.percent,showIndicator:!1,height:14},null)]):S.value[t.status]},{key:"actions",title:a("components.upload.actions"),width:120,render:t=>{let o,l;return e.createVNode("div",{class:i.table.actions},[e.createVNode(u.NButton,{type:"warning",size:"small",text:!0,disabled:["success","error","cancelled"].includes(t.status),onClick:()=>n.cancelFiles([t.id])},b(o=a("components.upload.cancel"))?o:{default:()=>[o]}),e.createVNode(u.NButton,{type:"error",size:"small",text:!0,onClick:()=>n.removeFiles([t.id])},b(l=a("components.upload.delete"))?l:{default:()=>[l]})])}}],data:n.uploadFiles.value},{empty:()=>e.createVNode("div",{class:i.table.empty},[a("components.upload.empty")])})])}});exports.DuxFileUpload=w;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),m=require("@duxweb/dvha-core"),z=require("@vueuse/core"),C=require("clsx"),o=require("naive-ui"),F=require("vue-draggable-plus");require("vue-router");require("@overlastic/vue");require("vue-echarts");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("jinrishici");require("lodash-es");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");require("aieditor");const S=require("../../hooks/modal.cjs");require("mime");const U=require("./config.cjs");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");require("dayjs");const k=require("../../hooks/image.cjs");require("@tanstack/vue-query");require("pinia");const w=e.defineComponent({name:"DuxImageUpload",props:{path:{type:String,default:"upload"},signPath:{type:String,default:""},signCallback:Function,managePath:{type:String,default:""},driver:{type:String,default:"local"},maxNum:Number,maxSize:{type:Number,default:0},multiple:Boolean,manager:Boolean,value:[String,Array],defaultValue:[String,Array],onUpdateValue:Function},setup(a,{emit:g}){const n=z.useVModel(a,"value",g,{passive:!0,deep:!0,defaultValue:a.defaultValue}),q=o.useMessage(),p=k.useImagePreview(),{t:s}=m.useI18n(),l={container:"flex gap-2",imageItem:"size-80px rounded border border-muted relative group draggable flex items-center",imageOverlay:"z-1 size-full inset-0 absolute flex items-center justify-center bg-default/80 transition-all opacity-0 group-hover:opacity-100 rounded",uploadArea:"relative size-80px text-sm rounded flex flex-col border border-dashed bg-elevated border-muted dark:border-accented hover:bg-accented/50 hover:border-accented dark:hover:bg-accented/50 dark:hover:border-accented cursor-pointer",uploadContent:"flex-1 flex flex-col justify-center items-center gap-1 relative",progressContainer:"size-80px flex items-center justify-center rounded",progressBar:"absolute left-2 right-2 bottom-2"},v=e.computed(()=>a.maxSize),{uploadPath:d,managePath:h,driver:b}=U.useUploadConfig({driver:a?.driver,signPath:a?.signPath,signCallback:a?.signCallback,uploadPath:a?.path,managePath:a?.managePath}),t=m.useUpload({path:d.value,multiple:a.multiple,maxFileCount:a.maxNum,maxFileSize:v.value*1024*1024,autoUpload:!0,accept:"image/*",onError:r=>{q.error(r.message||s("components.upload.error"))},driver:b.value});e.watch(t.dataFiles,r=>{const u=a.multiple?r?.map(i=>i.url):r?.[0]?.url;n.value=u,a.onUpdateValue?.(u)});const f=e.computed(()=>t.progress.value.totalPercent),x=e.computed(()=>t.isUploading.value),N=async()=>{t.open()},y=e.computed(()=>a.multiple?a.maxNum&&t.uploadFiles.value.length>=a.maxNum:!0),V=e.computed(()=>t.dataFiles.value?.map(r=>r.url)),P=S.useModal(),c=e.ref(!1);return e.watch(n,r=>{if(!r||!r?.length||c.value)return;c.value=!0;const u=typeof r=="string"?[r]:Array.isArray(r)?r:[];t.addDataFiles(u.map(i=>({url:i})))},{immediate:!0}),()=>e.createVNode("div",null,[e.createVNode(F.VueDraggable,{modelValue:t.uploadFiles.value,"onUpdate:modelValue":r=>t.uploadFiles.value=r,class:l.container,draggable:".draggable"},{default:()=>[t.uploadFiles.value?.map((r,u)=>{const i=r.url||URL.createObjectURL(r.file);return e.createVNode("div",{key:u,class:C(l.imageItem)},[e.createVNode(o.NImage,{class:"z-0 rounded",objectFit:"scale-down",width:78,height:78,previewDisabled:!0,src:i},null),e.createVNode("div",{class:l.imageOverlay},[r.status==="success"&&e.createVNode(o.NButton,{quaternary:!0,circle:!0,size:"small",renderIcon:()=>e.createVNode("div",{class:"n-icon i-tabler:eye"},null),onClick:()=>p.show(V.value,u)},null),e.createVNode(o.NButton,{quaternary:!0,circle:!0,size:"small",renderIcon:()=>e.createVNode("div",{class:"n-icon i-tabler:trash"},null),onClick:()=>{t.removeFiles([r.id])}},null)])])}),(t.uploadFiles.value.length===0||!y.value)&&e.createVNode("div",{class:l.uploadArea,onClick:()=>{N()}},[a.manager&&e.createVNode("div",{class:" py-1 text-xs bg-muted border-b border-dashed border-accented flex items-center justify-center",onClick:r=>{r.stopPropagation(),P.show({title:s("components.upload.title"),width:"800px",component:()=>Promise.resolve().then(()=>require("./manager.cjs")),componentProps:{path:h.value,type:"image",multiple:a.multiple,uploadParams:{path:d.value,accept:"image/*",maxNum:a.maxNum,maxSize:a.maxSize}}}).then(u=>{t.addDataFiles(u)})}},[e.createVNode("div",{class:"i-tabler:folder size-4"},null)]),e.createVNode("div",{class:l.uploadContent},[x.value?e.createVNode("div",{class:l.progressContainer},[e.createVNode("div",{class:"i-tabler:photo size-6"},null),e.createVNode("div",{class:l.progressBar},[e.createVNode(o.NProgress,{type:"line",percentage:f.value,showIndicator:!1,height:4},null)])]):e.createVNode("div",{class:"i-tabler:plus size-4"},null)])])]})])}});exports.DuxImageUpload=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),g=require("@duxweb/dvha-core"),C=require("@vueuse/core"),F=require("clsx"),o=require("naive-ui"),S=require("vue-draggable-plus");require("vue-router");require("@overlastic/vue");require("vue-echarts");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("jinrishici");require("lodash-es");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");require("aieditor");const U=require("../../hooks/modal.cjs");require("mime");const k=require("./config.cjs");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");require("dayjs");const w=require("../../hooks/image.cjs");require("@tanstack/vue-query");require("pinia");const I=e.defineComponent({name:"DuxImageUpload",props:{path:{type:String,default:"upload"},signPath:{type:String,default:""},signCallback:Function,managePath:{type:String,default:""},driver:{type:String},maxNum:Number,maxSize:{type:Number,default:0},multiple:Boolean,manager:Boolean,value:[String,Array],defaultValue:[String,Array],onUpdateValue:Function,method:String},setup(a,{emit:q}){const n=C.useVModel(a,"value",q,{passive:!0,deep:!0,defaultValue:a.defaultValue}),p=o.useMessage(),v=w.useImagePreview(),{t:d}=g.useI18n(),l={container:"flex gap-2",imageItem:"size-80px rounded border border-muted relative group draggable flex items-center",imageOverlay:"z-1 size-full inset-0 absolute flex items-center justify-center bg-default/80 transition-all opacity-0 group-hover:opacity-100 rounded",uploadArea:"relative size-80px text-sm rounded flex flex-col border border-dashed bg-elevated border-muted dark:border-accented hover:bg-accented/50 hover:border-accented dark:hover:bg-accented/50 dark:hover:border-accented cursor-pointer",uploadContent:"flex-1 flex flex-col justify-center items-center gap-1 relative",progressContainer:"size-80px flex items-center justify-center rounded",progressBar:"absolute left-2 right-2 bottom-2"},h=e.computed(()=>a.maxSize),{uploadPath:s,managePath:b,driver:f,method:c}=k.useUploadConfig({driver:a?.driver,signPath:a?.signPath,signCallback:a?.signCallback,uploadPath:a?.path,managePath:a?.managePath,method:a?.method}),t=g.useUpload({path:s.value,multiple:a.multiple,maxFileCount:a.maxNum,maxFileSize:h.value*1024*1024,autoUpload:!0,accept:"image/*",method:c.value,onError:r=>{p.error(r.message||d("components.upload.error"))},driver:f.value});e.watch(t.dataFiles,r=>{const u=a.multiple?r?.map(i=>i.url):r?.[0]?.url;n.value=u,a.onUpdateValue?.(u)});const x=e.computed(()=>t.progress.value.totalPercent),N=e.computed(()=>t.isUploading.value),y=async()=>{t.open()},V=e.computed(()=>a.multiple?a.maxNum&&t.uploadFiles.value.length>=a.maxNum:!0),P=e.computed(()=>t.dataFiles.value?.map(r=>r.url)),z=U.useModal(),m=e.ref(!1);return e.watch(n,r=>{if(!r||!r?.length||m.value)return;m.value=!0;const u=typeof r=="string"?[r]:Array.isArray(r)?r:[];t.addDataFiles(u.map(i=>({url:i})))},{immediate:!0}),()=>e.createVNode("div",null,[e.createVNode(S.VueDraggable,{modelValue:t.uploadFiles.value,"onUpdate:modelValue":r=>t.uploadFiles.value=r,class:l.container,draggable:".draggable"},{default:()=>[t.uploadFiles.value?.map((r,u)=>{const i=r.url||URL.createObjectURL(r.file);return e.createVNode("div",{key:u,class:F(l.imageItem)},[e.createVNode(o.NImage,{class:"z-0 rounded",objectFit:"scale-down",width:78,height:78,previewDisabled:!0,src:i},null),e.createVNode("div",{class:l.imageOverlay},[r.status==="success"&&e.createVNode(o.NButton,{quaternary:!0,circle:!0,size:"small",renderIcon:()=>e.createVNode("div",{class:"n-icon i-tabler:eye"},null),onClick:()=>v.show(P.value,u)},null),e.createVNode(o.NButton,{quaternary:!0,circle:!0,size:"small",renderIcon:()=>e.createVNode("div",{class:"n-icon i-tabler:trash"},null),onClick:()=>{t.removeFiles([r.id])}},null)])])}),(t.uploadFiles.value.length===0||!V.value)&&e.createVNode("div",{class:l.uploadArea,onClick:()=>{y()}},[a.manager&&e.createVNode("div",{class:" py-1 text-xs bg-muted border-b border-dashed border-accented flex items-center justify-center",onClick:r=>{r.stopPropagation(),z.show({title:d("components.upload.title"),width:"800px",component:()=>Promise.resolve().then(()=>require("./manager.cjs")),componentProps:{path:b.value,type:"image",multiple:a.multiple,uploadParams:{path:s.value,accept:"image/*",maxNum:a.maxNum,maxSize:a.maxSize,method:c.value}}}).then(u=>{t.addDataFiles(u)})}},[e.createVNode("div",{class:"i-tabler:folder size-4"},null)]),e.createVNode("div",{class:l.uploadContent},[N.value?e.createVNode("div",{class:l.progressContainer},[e.createVNode("div",{class:"i-tabler:photo size-6"},null),e.createVNode("div",{class:l.progressBar},[e.createVNode(o.NProgress,{type:"line",percentage:x.value,showIndicator:!1,height:4},null)])]):e.createVNode("div",{class:"i-tabler:plus size-4"},null)])])]})])}});exports.DuxImageUpload=I;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("@duxweb/dvha-core"),j=require("lodash-es"),o=require("naive-ui");require("vue-router");const F=require("../../hooks/dialog.cjs");require("@overlastic/vue");require("clsx");require("vue-echarts");require("@vueuse/core");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("jinrishici");require("vue-draggable-plus");const B=require("../draw/drawEmpty.cjs");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");require("aieditor");require("mime");const U=require("./config.cjs");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");const O=require("../../hooks/download.cjs");require("@tanstack/vue-query");require("pinia");const P=require("./manage/item.cjs");function y(l){return typeof l=="function"||Object.prototype.toString.call(l)==="[object Object]"&&!e.isVNode(l)}const _=e.defineComponent({name:"DuxFileManage",props:{path:String,type:String,onConfirm:Function,onClose:Function,multiple:Boolean,page:{type:Boolean,default:!1},handle:String,uploadParams:Object},setup(l){const m=e.ref(!1),V=e.ref(0),x=e.ref(0),{t}=N.useI18n(),r=e.ref([]),v=F.useDialog(),b=N.useClient(),s=o.useMessage(),C=O.useDownload(),i=e.ref({manager:!0,type:l.type||"all",folder:null}),g=e.ref(),{uploadPath:k,managePath:h,driver:D}=U.useUploadConfig({driver:l.uploadParams?.driver,signPath:l.uploadParams?.signPath,signCallback:l.uploadParams?.signCallback,uploadPath:l.uploadParams?.path,managePath:l.path}),w=e.ref({page:1,pageSize:20}),n=N.useInfiniteList({path:h.value,pagination:w.value,filters:i.value}),S=e.computed(()=>{const{driver:d,signPath:c,signCallback:p,...a}=l.uploadParams||{};return a}),q=N.useUpload({...S.value,path:k.value,autoUpload:!0,driver:D.value,params:i.value,onSuccess:()=>{r.value=[],n.refetch()},onError:d=>{s.error(d?.message||t("components.uploadManage.uploadError")||"")}}),T=d=>{if(!d){s.error(t("components.uploadManage.namePlaceholder")||"");return}b.request({path:h.value,method:"POST",payload:{name:d,folder:i.value.folder}}).then(()=>{n.refetch(),r.value=[]}).catch(()=>{s.error(t("components.uploadManage.createError")||"")})},E=(d,c,p)=>{if(!c){s.error(t("components.uploadManage.namePlaceholder")||"");return}b.request({path:h.value,method:"PUT",payload:{name:c,id:p,type:d}}).then(()=>{n.refetch(),r.value=[]}).catch(()=>{s.error(t("components.uploadManage.editError")||"")})},M=(d,c)=>{b.request({path:`${h.value}/batch`,method:"DELETE",payload:{data:Array.isArray(c)?c:[c],type:d}}).then(()=>{n.refetch(),r.value=[]}).catch(()=>{s.error(t("components.uploadManage.delError")||"")})},f=e.computed(()=>!!(l.type&&l.type!=="all"));return()=>{let d,c,p;return e.createVNode("div",{class:["flex flex-col gap-2",l.page?"h-full":"h-500px max-h-500px"]},[e.createVNode("div",{class:["flex-none flex justify-between items-center border-b border-muted p-3",l.handle]},[e.createVNode("div",{class:"flex-none"},[e.createVNode(o.NTabs,{type:"segment",animated:!0,size:"small",tabClass:"!px-4",defaultValue:"all",value:i.value.type,onUpdateValue:a=>{f.value||(i.value.type=a,r.value=[])}},{default:()=>[e.createVNode(o.NTab,{tab:t("components.uploadManage.all"),name:"all",disabled:f.value},null),e.createVNode(o.NTab,{tab:t("components.uploadManage.image"),name:"image",disabled:f.value},null),e.createVNode(o.NTab,{tab:t("components.uploadManage.media"),name:"media",disabled:f.value},null),e.createVNode(o.NTab,{tab:t("components.uploadManage.docs"),name:"docs",disabled:f.value},null)]})]),e.createVNode("div",{class:"flex gap-2"},[e.createVNode(o.NButton,{type:"default",ghost:!0,onClick:()=>{v.prompt({title:t("components.uploadManage.namePlaceholder")||"",formSchema:[{tag:o.NInput,attrs:{"v-model:value":"form.name"}}]}).then(a=>{T(a?.name)}).catch(()=>{})},renderIcon:()=>e.createVNode("div",{class:"i-tabler:plus"},null)},y(d=t("components.button.create"))?d:{default:()=>[d]}),e.createVNode(o.NButton,{type:"primary",ghost:!0,onClick:()=>{q.open()},loading:q.isUploading.value,renderIcon:()=>e.createVNode("div",{class:"i-tabler:upload"},null)},{default:()=>[e.createVNode("div",{class:"flex gap-2"},[t("components.uploadManage.upload"),q.progress.value.totalPercent>0&&`(${q.progress.value.totalPercent}%)`])]}),!l.page&&e.createVNode(o.NButton,{type:"default",ghost:!0,onClick:()=>{l.onClose?.()},renderIcon:()=>e.createVNode("div",{class:"i-tabler:x"},null)},null)])]),e.createVNode("div",{class:"flex-1 min-h-1"},[n.data?.value?.data?.length>0&&e.createVNode(o.NInfiniteScroll,{distance:10,onLoad:()=>{n.hasNextPage.value&&n.fetchNextPage()},scrollbarProps:{contentClass:"p-4"}},{default:()=>[e.createVNode("div",{class:["grid grid-cols-3 md:grid-cols-4 text-sm items-start justify-start",n.data.value?.data?.length>=4&&!l.page?" lg:grid-cols-[repeat(auto-fit,minmax(150px,1fr))]":"lg:grid-cols-[repeat(auto-fit,minmax(150px,150px))]"]},[i.value?.folder&&i.value?.folder!==n.data.value?.meta?.folder&&e.createVNode(P.DuxFileManageItem,{key:`parent-${n.data.value?.meta?.folder}`,type:"folder",name:t("components.uploadManage.parentLevel"),page:l.page,onSelect:()=>{r.value=[],i.value.folder=n.data.value?.meta?.folder}},null),n.data.value?.data?.map(a=>e.createVNode(o.NTooltip,{placement:"bottom",key:`${a.url?"file":"folder"}-${a.id}`,trigger:a.url?"hover":"manual"},{default:()=>a.filesize,trigger:()=>e.createVNode(P.DuxFileManageItem,{page:l.page,onContextmenu:u=>{g.value=a,m.value=!1,e.nextTick().then(()=>{m.value=!0,V.value=u.clientX,x.value=u.clientY}),u.preventDefault()},value:l.page?!1:!!r.value?.find?.(u=>u.id===a.id),type:a.url?"file":"folder",mime:a.filetype,name:a.filename,url:a.url,time:a.time,onSelect:u=>{if(!a.url){r.value=[],n.data.value=void 0,i.value.folder=a.id;return}l.page||(u?l.multiple?r.value?.push(a):r.value=[a]:l.multiple?r.value?.splice(r.value?.indexOf(a),1):r.value=[])}},null)}))])]}),n.isLoading.value?e.createVNode(o.NSpin,{class:"h-full absolute w-full bg-gray-1/50"},null):!n.data.value?.data?.length&&e.createVNode("div",{class:"size-full flex justify-center items-center text-sm text-gray-6"},[e.createVNode("div",{class:"flex flex-col items-center"},[e.createVNode("div",{class:"w-26 mb-2"},[e.createVNode(B.DuxDrawEmpty,null,null)]),e.createVNode("div",{class:"text-base"},[t("components.uploadManage.empty")]),e.createVNode("div",{class:"text-sm text-muted"},[t("components.uploadManage.emptyDesc")]),i.value?.folder&&i.value?.folder!==n.data.value?.meta?.folder&&e.createVNode("div",{class:"text-xs text-gray-6"},[e.createVNode(o.NButton,{type:"default",ghost:!0,onClick:()=>{r.value=[],i.value.folder=n.data.value?.meta?.folder}},y(c=t("components.uploadManage.back"))?c:{default:()=>[c]})])])])]),e.createVNode(o.NDropdown,{x:V.value,y:x.value,placement:"bottom-start",trigger:"manual",show:m.value,onClickoutside:()=>{m.value=!1},onUpdateShow:a=>{a||(g.value=void 0)},onSelect:a=>{const u=j.cloneDeep(g.value);switch(m.value=!1,a){case"download":C.url(u?.url);break;case"rename":v.prompt({title:t("components.uploadManage.namePlaceholder"),formSchema:[{tag:o.NInput,attrs:{"v-model:value":"form.name"}}],defaultValue:{name:u?.filename||u?.name}}).then(I=>{E(u?.type,I?.name,u?.id)});break;case"delete":v.confirm({title:t("components.uploadManage.delTitle"),content:t("components.uploadManage.delDesc")}).then(()=>{M(u?.type,u?.id)});break}},options:[g.value?.url&&{label:t("components.button.download"),key:"download",icon:()=>e.createVNode("div",{class:"i-tabler:download"},null)},{label:t("components.button.rename"),key:"rename",icon:()=>e.createVNode("div",{class:"i-tabler:cursor-text"},null)},{label:t("components.button.delete"),key:"delete",icon:()=>e.createVNode("div",{class:"i-tabler:trash"},null)}].filter(a=>a)},null),!l.page&&e.createVNode("div",{class:"flex justify-end gap-2 border-t border-muted p-3"},[e.createVNode("div",null,[r.value?.length>0&&e.createVNode(o.NButton,{type:"error",secondary:!0,onClick:()=>{v.confirm({title:t("components.uploadManage.delTitle"),content:t("components.uploadManage.delDesc")}).then(()=>{M("file",r.value?.map(a=>a.id))})}},y(p=t("components.button.delete"))?p:{default:()=>[p]})]),e.createVNode("div",null,[e.createVNode(o.NButton,{type:"primary",disabled:!r.value?.length,onClick:()=>{l.onConfirm?.(r.value)}},{default:()=>[t("components.button.select"),e.createTextVNode("("),r.value?.length||0,e.createTextVNode(")")]})])])])}}});exports.default=_;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("@duxweb/dvha-core"),F=require("lodash-es"),o=require("naive-ui");require("vue-router");const B=require("../../hooks/dialog.cjs");require("@overlastic/vue");require("clsx");require("vue-echarts");require("@vueuse/core");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("jinrishici");require("vue-draggable-plus");const U=require("../draw/drawEmpty.cjs");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");require("aieditor");require("mime");const O=require("./config.cjs");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");const _=require("../../hooks/download.cjs");require("@tanstack/vue-query");require("pinia");const P=require("./manage/item.cjs");function y(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const L=e.defineComponent({name:"DuxFileManage",props:{path:String,type:String,onConfirm:Function,onClose:Function,multiple:Boolean,page:{type:Boolean,default:!1},handle:String,uploadParams:Object},setup(t){const m=e.ref(!1),V=e.ref(0),x=e.ref(0),{t:l}=N.useI18n(),r=e.ref([]),v=B.useDialog(),b=N.useClient(),s=o.useMessage(),C=_.useDownload(),i=e.ref({manager:!0,type:t.type||"all",folder:null}),g=e.ref(),{uploadPath:k,managePath:h,driver:D,method:w}=O.useUploadConfig({driver:t.uploadParams?.driver,signPath:t.uploadParams?.signPath,signCallback:t.uploadParams?.signCallback,uploadPath:t.uploadParams?.path,managePath:t.path,method:t.uploadParams?.method}),S=e.ref({page:1,pageSize:20}),n=N.useInfiniteList({path:h.value,pagination:S.value,filters:i.value}),T=e.computed(()=>{const{driver:d,signPath:c,signCallback:p,...a}=t.uploadParams||{};return a}),q=N.useUpload({...T.value,path:k.value,autoUpload:!0,driver:D.value,params:i.value,method:w.value,onSuccess:()=>{r.value=[],n.refetch()},onError:d=>{s.error(d?.message||l("components.uploadManage.uploadError")||"")}}),E=d=>{if(!d){s.error(l("components.uploadManage.namePlaceholder")||"");return}b.request({path:h.value,method:"POST",payload:{name:d,folder:i.value.folder}}).then(()=>{n.refetch(),r.value=[]}).catch(()=>{s.error(l("components.uploadManage.createError")||"")})},I=(d,c,p)=>{if(!c){s.error(l("components.uploadManage.namePlaceholder")||"");return}b.request({path:h.value,method:"PUT",payload:{name:c,id:p,type:d}}).then(()=>{n.refetch(),r.value=[]}).catch(()=>{s.error(l("components.uploadManage.editError")||"")})},M=(d,c)=>{b.request({path:`${h.value}/batch`,method:"DELETE",payload:{data:Array.isArray(c)?c:[c],type:d}}).then(()=>{n.refetch(),r.value=[]}).catch(()=>{s.error(l("components.uploadManage.delError")||"")})},f=e.computed(()=>!!(t.type&&t.type!=="all"));return()=>{let d,c,p;return e.createVNode("div",{class:["flex flex-col gap-2",t.page?"h-full":"h-500px max-h-500px"]},[e.createVNode("div",{class:["flex-none flex justify-between items-center border-b border-muted p-3",t.handle]},[e.createVNode("div",{class:"flex-none"},[e.createVNode(o.NTabs,{type:"segment",animated:!0,size:"small",tabClass:"!px-4",defaultValue:"all",value:i.value.type,onUpdateValue:a=>{f.value||(i.value.type=a,r.value=[])}},{default:()=>[e.createVNode(o.NTab,{tab:l("components.uploadManage.all"),name:"all",disabled:f.value},null),e.createVNode(o.NTab,{tab:l("components.uploadManage.image"),name:"image",disabled:f.value},null),e.createVNode(o.NTab,{tab:l("components.uploadManage.media"),name:"media",disabled:f.value},null),e.createVNode(o.NTab,{tab:l("components.uploadManage.docs"),name:"docs",disabled:f.value},null)]})]),e.createVNode("div",{class:"flex gap-2"},[e.createVNode(o.NButton,{type:"default",ghost:!0,onClick:()=>{v.prompt({title:l("components.uploadManage.namePlaceholder")||"",formSchema:[{tag:o.NInput,attrs:{"v-model:value":"form.name"}}]}).then(a=>{E(a?.name)}).catch(()=>{})},renderIcon:()=>e.createVNode("div",{class:"i-tabler:plus"},null)},y(d=l("components.button.create"))?d:{default:()=>[d]}),e.createVNode(o.NButton,{type:"primary",ghost:!0,onClick:()=>{q.open()},loading:q.isUploading.value,renderIcon:()=>e.createVNode("div",{class:"i-tabler:upload"},null)},{default:()=>[e.createVNode("div",{class:"flex gap-2"},[l("components.uploadManage.upload"),q.progress.value.totalPercent>0&&`(${q.progress.value.totalPercent}%)`])]}),!t.page&&e.createVNode(o.NButton,{type:"default",ghost:!0,onClick:()=>{t.onClose?.()},renderIcon:()=>e.createVNode("div",{class:"i-tabler:x"},null)},null)])]),e.createVNode("div",{class:"flex-1 min-h-1"},[n.data?.value?.data?.length>0&&e.createVNode(o.NInfiniteScroll,{distance:10,onLoad:()=>{n.hasNextPage.value&&n.fetchNextPage()},scrollbarProps:{contentClass:"p-4"}},{default:()=>[e.createVNode("div",{class:["grid grid-cols-3 md:grid-cols-4 text-sm items-start justify-start",n.data.value?.data?.length>=4&&!t.page?" lg:grid-cols-[repeat(auto-fit,minmax(150px,1fr))]":"lg:grid-cols-[repeat(auto-fit,minmax(150px,150px))]"]},[i.value?.folder&&i.value?.folder!==n.data.value?.meta?.folder&&e.createVNode(P.DuxFileManageItem,{key:`parent-${n.data.value?.meta?.folder}`,type:"folder",name:l("components.uploadManage.parentLevel"),page:t.page,onSelect:()=>{r.value=[],i.value.folder=n.data.value?.meta?.folder}},null),n.data.value?.data?.map(a=>e.createVNode(o.NTooltip,{placement:"bottom",key:`${a.url?"file":"folder"}-${a.id}`,trigger:a.url?"hover":"manual"},{default:()=>a.filesize,trigger:()=>e.createVNode(P.DuxFileManageItem,{page:t.page,onContextmenu:u=>{g.value=a,m.value=!1,e.nextTick().then(()=>{m.value=!0,V.value=u.clientX,x.value=u.clientY}),u.preventDefault()},value:t.page?!1:!!r.value?.find?.(u=>u.id===a.id),type:a.url?"file":"folder",mime:a.filetype,name:a.filename,url:a.url,time:a.time,onSelect:u=>{if(!a.url){r.value=[],n.data.value=void 0,i.value.folder=a.id;return}t.page||(u?t.multiple?r.value?.push(a):r.value=[a]:t.multiple?r.value?.splice(r.value?.indexOf(a),1):r.value=[])}},null)}))])]}),n.isLoading.value?e.createVNode(o.NSpin,{class:"h-full absolute w-full bg-gray-1/50"},null):!n.data.value?.data?.length&&e.createVNode("div",{class:"size-full flex justify-center items-center text-sm text-gray-6"},[e.createVNode("div",{class:"flex flex-col items-center"},[e.createVNode("div",{class:"w-26 mb-2"},[e.createVNode(U.DuxDrawEmpty,null,null)]),e.createVNode("div",{class:"text-base"},[l("components.uploadManage.empty")]),e.createVNode("div",{class:"text-sm text-muted"},[l("components.uploadManage.emptyDesc")]),i.value?.folder&&i.value?.folder!==n.data.value?.meta?.folder&&e.createVNode("div",{class:"text-xs text-gray-6"},[e.createVNode(o.NButton,{type:"default",ghost:!0,onClick:()=>{r.value=[],i.value.folder=n.data.value?.meta?.folder}},y(c=l("components.uploadManage.back"))?c:{default:()=>[c]})])])])]),e.createVNode(o.NDropdown,{x:V.value,y:x.value,placement:"bottom-start",trigger:"manual",show:m.value,onClickoutside:()=>{m.value=!1},onUpdateShow:a=>{a||(g.value=void 0)},onSelect:a=>{const u=F.cloneDeep(g.value);switch(m.value=!1,a){case"download":C.url(u?.url);break;case"rename":v.prompt({title:l("components.uploadManage.namePlaceholder"),formSchema:[{tag:o.NInput,attrs:{"v-model:value":"form.name"}}],defaultValue:{name:u?.filename||u?.name}}).then(j=>{I(u?.type,j?.name,u?.id)});break;case"delete":v.confirm({title:l("components.uploadManage.delTitle"),content:l("components.uploadManage.delDesc")}).then(()=>{M(u?.type,u?.id)});break}},options:[g.value?.url&&{label:l("components.button.download"),key:"download",icon:()=>e.createVNode("div",{class:"i-tabler:download"},null)},{label:l("components.button.rename"),key:"rename",icon:()=>e.createVNode("div",{class:"i-tabler:cursor-text"},null)},{label:l("components.button.delete"),key:"delete",icon:()=>e.createVNode("div",{class:"i-tabler:trash"},null)}].filter(a=>a)},null),!t.page&&e.createVNode("div",{class:"flex justify-end gap-2 border-t border-muted p-3"},[e.createVNode("div",null,[r.value?.length>0&&e.createVNode(o.NButton,{type:"error",secondary:!0,onClick:()=>{v.confirm({title:l("components.uploadManage.delTitle"),content:l("components.uploadManage.delDesc")}).then(()=>{M("file",r.value?.map(a=>a.id))})}},y(p=l("components.button.delete"))?p:{default:()=>[p]})]),e.createVNode("div",null,[e.createVNode(o.NButton,{type:"primary",disabled:!r.value?.length,onClick:()=>{t.onConfirm?.(r.value)}},{default:()=>[l("components.button.select"),e.createTextVNode("("),r.value?.length||0,e.createTextVNode(")")]})])])])}}});exports.default=L;
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=`/* layer: properties */
2
- @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-border-opacity:100%;--un-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;}}
2
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-border-opacity:100%;--un-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-to-opacity:100%;--un-fill-opacity:100%;--un-outline-style:solid;}}
3
3
  @property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
4
4
  @property --un-outline-style{syntax:"*";inherits:false;initial-value:solid;}
5
5
  @property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
@@ -1,20 +1,21 @@
1
- import { useManage as u, createS3UploadDriver as d, createLocalUploadDriver as e } from "@duxweb/dvha-core";
2
- import { computed as r } from "vue";
3
- const p = (a) => {
4
- const t = u(), o = r(() => a?.uploadPath || t.config?.apiPath?.upload || "upload"), n = r(() => a?.managePath || t.config?.apiPath?.uploadManager || "uploadManager"), i = r(() => a?.driver === "s3" ? d({
5
- signPath: a?.signPath || t.config?.apiPath?.upload || o.value || "",
6
- signCallback: a?.signCallback || t.config?.upload?.signCallback || ((l) => ({
1
+ import { useManage as u, createS3UploadDriver as c, createLocalUploadDriver as g } from "@duxweb/dvha-core";
2
+ import { computed as t } from "vue";
3
+ function h(a) {
4
+ const o = u(), n = t(() => a?.uploadPath || o.config?.apiPath?.upload || "upload"), r = t(() => a?.managePath || o.config?.apiPath?.uploadManager || "uploadManager"), d = t(() => a?.driver || o.config?.upload?.driver || "local"), e = t(() => a?.method || o.config?.upload?.method || "POST"), i = t(() => d.value === "s3" ? c({
5
+ signPath: a?.signPath || o.config?.apiPath?.upload || n.value || "",
6
+ signCallback: a?.signCallback || o.config?.upload?.signCallback || ((l) => ({
7
7
  uploadUrl: l.data?.uploadUrl,
8
8
  url: l.data?.url,
9
9
  params: l.data?.params
10
10
  }))
11
- }) : e());
11
+ }) : g());
12
12
  return {
13
- uploadPath: o,
14
- managePath: n,
15
- driver: i
13
+ uploadPath: n,
14
+ managePath: r,
15
+ driver: i,
16
+ method: e
16
17
  };
17
- };
18
+ }
18
19
  export {
19
- p as useUploadConfig
20
+ h as useUploadConfig
20
21
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as M, ref as v, computed as s, watch as h, createVNode as o, Fragment as A, createTextVNode as U, isVNode as w } from "vue";
2
- import { useI18n as Z, useUpload as j } from "@duxweb/dvha-core";
3
- import { useVModel as O, useDropZone as B } from "@vueuse/core";
4
- import X from "mime";
5
- import { useMessage as E, NDataTable as L, NProgress as T, NButton as b } from "naive-ui";
1
+ import { defineComponent as A, ref as x, computed as s, watch as b, createVNode as o, Fragment as U, createTextVNode as w, isVNode as Z } from "vue";
2
+ import { useI18n as j, useUpload as O } from "@duxweb/dvha-core";
3
+ import { useVModel as B, useDropZone as X } from "@vueuse/core";
4
+ import E from "mime";
5
+ import { useMessage as L, NDataTable as T, NProgress as I, NButton as y } from "naive-ui";
6
6
  import "vue-router";
7
7
  import "@overlastic/vue";
8
- import { DuxMedia as I } from "../media/media.js";
8
+ import { DuxMedia as W } from "../media/media.js";
9
9
  import "vue-echarts";
10
10
  import "vue3-ace-editor";
11
11
  import "ace-builds/src-noconflict/mode-vue";
@@ -52,18 +52,18 @@ import "@duxweb/dvha-naiveui";
52
52
  import "../../pages/page404.js";
53
53
  import "short-unique-id";
54
54
  import "aieditor";
55
- import { useModal as W } from "../../hooks/modal.js";
56
- import { useUploadConfig as G } from "./config.js";
55
+ import { useModal as G } from "../../hooks/modal.js";
56
+ import { useUploadConfig as _ } from "./config.js";
57
57
  import "@iconify-json/tabler/icons.json";
58
58
  import "../posterEditor/elements/index.js";
59
59
  import "fabric";
60
60
  import "dayjs";
61
61
  import "@tanstack/vue-query";
62
62
  import "pinia";
63
- function y(t) {
64
- return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !w(t);
63
+ function F(t) {
64
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Z(t);
65
65
  }
66
- const m = {
66
+ const p = {
67
67
  "image/*": "JPG, PNG, GIF, BMP, WEBP",
68
68
  "video/*": "MP4, AVI, MOV, WMV, FLV",
69
69
  "audio/*": "MP3, WAV, AAC, FLAC",
@@ -94,7 +94,7 @@ const m = {
94
94
  empty: "flex items-center justify-center h-full text-muted",
95
95
  actions: "flex gap-2"
96
96
  }
97
- }, $e = /* @__PURE__ */ M({
97
+ }, et = /* @__PURE__ */ A({
98
98
  name: "DuxFileUpload",
99
99
  props: {
100
100
  path: {
@@ -121,59 +121,63 @@ const m = {
121
121
  accept: String,
122
122
  value: [String, Array],
123
123
  defaultValue: [String, Array],
124
- onUpdateValue: Function
124
+ onUpdateValue: Function,
125
+ method: String
125
126
  },
126
127
  setup(t, {
127
- emit: F
128
+ emit: P
128
129
  }) {
129
- const c = O(t, "value", F, {
130
+ const c = B(t, "value", P, {
130
131
  passive: !0,
131
132
  deep: !0,
132
133
  defaultValue: t.defaultValue
133
- }), P = E(), {
134
+ }), S = L(), {
134
135
  t: a
135
- } = Z(), d = v(), p = s(() => t.maxSize || 5), C = W(), {
136
+ } = j(), d = x(), m = s(() => t.maxSize || 5), C = G(), {
136
137
  uploadPath: u,
137
- managePath: S,
138
- driver: N
139
- } = G({
138
+ managePath: N,
139
+ driver: V,
140
+ method: f
141
+ } = _({
140
142
  driver: t?.driver,
141
143
  signPath: t?.signPath,
142
144
  signCallback: t?.signCallback,
143
145
  uploadPath: t?.path,
144
- managePath: t?.managePath
145
- }), n = j({
146
+ managePath: t?.managePath,
147
+ method: t?.method
148
+ }), n = O({
146
149
  path: u.value,
147
150
  multiple: t.multiple,
148
151
  maxFileCount: t.maxNum,
149
- maxFileSize: p.value * 1024 * 1024,
152
+ maxFileSize: m.value * 1024 * 1024,
150
153
  autoUpload: !0,
151
154
  accept: t.accept,
152
- onError: (e) => P.error(e.message || a("components.upload.error")),
153
- driver: N.value
155
+ onError: (e) => S.error(e.message || a("components.upload.error")),
156
+ driver: V.value,
157
+ method: f.value
154
158
  }), {
155
- isOverDropZone: f
156
- } = B(d, {
159
+ isOverDropZone: g
160
+ } = X(d, {
157
161
  onDrop: (e) => {
158
162
  e && e.length > 0 && n.addFiles(Array.from(e), "file");
159
163
  }
160
164
  });
161
- h(n.dataFiles, (e) => {
165
+ b(n.dataFiles, (e) => {
162
166
  const i = t.multiple ? e : e[0];
163
167
  c.value = i, t.onUpdateValue?.(i);
164
168
  });
165
- const g = s(() => t.accept ? t.accept.split(",").map((e) => {
169
+ const h = s(() => t.accept ? t.accept.split(",").map((e) => {
166
170
  const i = e.trim();
167
- if (m[i]) return m[i];
171
+ if (p[i]) return p[i];
168
172
  if (i.includes("*")) {
169
- const D = i.split("/")[0];
170
- return m[i] || a("common.fileExtension", {
171
- ext: D.toUpperCase()
173
+ const M = i.split("/")[0];
174
+ return p[i] || a("common.fileExtension", {
175
+ ext: M.toUpperCase()
172
176
  });
173
177
  }
174
- const l = X.getExtension(i);
178
+ const l = E.getExtension(i);
175
179
  return l ? l.toUpperCase() : i;
176
- }).filter(Boolean).join(", ") : ""), V = s(() => ({
180
+ }).filter(Boolean).join(", ") : ""), z = s(() => ({
177
181
  pending: o("div", {
178
182
  class: "text-info"
179
183
  }, [a("components.upload.status.pending")]),
@@ -186,11 +190,11 @@ const m = {
186
190
  error: o("div", {
187
191
  class: "text-error"
188
192
  }, [a("components.upload.status.error")])
189
- })), z = s(() => [r.dropZone.base, f.value ? r.dropZone.active : r.dropZone.hover]), k = s(() => [n.uploadFiles.value.length === 0 && "border-b border-muted"]), x = v(!1);
190
- return h(c, (e) => {
191
- if (!e || !e?.length || x.value)
193
+ })), k = s(() => [r.dropZone.base, g.value ? r.dropZone.active : r.dropZone.hover]), D = s(() => [n.uploadFiles.value.length === 0 && "border-b border-muted"]), v = x(!1);
194
+ return b(c, (e) => {
195
+ if (!e || !e?.length || v.value)
192
196
  return;
193
- x.value = !0;
197
+ v.value = !0;
194
198
  const i = Array.isArray(e) ? e : [e];
195
199
  n.addDataFiles(i);
196
200
  }, {
@@ -199,7 +203,7 @@ const m = {
199
203
  class: r.container
200
204
  }, [o("div", {
201
205
  ref: d,
202
- class: z.value,
206
+ class: k.value,
203
207
  onClick: () => n.open()
204
208
  }, [o("div", {
205
209
  class: r.content
@@ -211,13 +215,14 @@ const m = {
211
215
  width: 800,
212
216
  component: () => import("./manager.js"),
213
217
  componentProps: {
214
- path: S.value,
218
+ path: N.value,
215
219
  multiple: t.multiple,
216
220
  uploadParams: {
217
221
  path: u.value,
218
222
  accept: t.accept,
219
223
  maxNum: t.maxNum,
220
- maxSize: p.value
224
+ maxSize: m.value,
225
+ method: f.value
221
226
  }
222
227
  }
223
228
  }).then((i) => {
@@ -230,20 +235,20 @@ const m = {
230
235
  class: r.text.title
231
236
  }, [a("components.upload.desc")]), o("div", {
232
237
  class: r.text.desc
233
- }, [f.value ? o("span", {
238
+ }, [g.value ? o("span", {
234
239
  class: r.text.highlight
235
- }, [a("components.upload.dropHere")]) : o(A, null, [g.value ? a("components.upload.supportFormats", {
236
- formats: g.value
237
- }) : a("components.upload.allFormats"), U(","), " ", a("components.upload.maxSize", {
238
- size: p.value
239
- })])])])]), o(L, {
240
+ }, [a("components.upload.dropHere")]) : o(U, null, [h.value ? a("components.upload.supportFormats", {
241
+ formats: h.value
242
+ }) : a("components.upload.allFormats"), w(","), " ", a("components.upload.maxSize", {
243
+ size: m.value
244
+ })])])])]), o(T, {
240
245
  bordered: !1,
241
- class: k.value,
246
+ class: D.value,
242
247
  columns: [{
243
248
  key: "filename",
244
249
  title: a("components.upload.file.name"),
245
250
  minWidth: 200,
246
- render: (e) => o(I, {
251
+ render: (e) => o(W, {
247
252
  title: e.filename,
248
253
  desc: e.filetype
249
254
  }, null)
@@ -257,7 +262,7 @@ const m = {
257
262
  width: 120,
258
263
  render: (e) => e.status === "uploading" ? o("div", {
259
264
  class: "flex items-center"
260
- }, [o(T, {
265
+ }, [o(I, {
261
266
  type: "line",
262
267
  style: {
263
268
  width: "24px",
@@ -268,7 +273,7 @@ const m = {
268
273
  percentage: e.progress?.percent,
269
274
  showIndicator: !1,
270
275
  height: 14
271
- }, null)]) : V.value[e.status]
276
+ }, null)]) : z.value[e.status]
272
277
  }, {
273
278
  key: "actions",
274
279
  title: a("components.upload.actions"),
@@ -277,20 +282,20 @@ const m = {
277
282
  let i, l;
278
283
  return o("div", {
279
284
  class: r.table.actions
280
- }, [o(b, {
285
+ }, [o(y, {
281
286
  type: "warning",
282
287
  size: "small",
283
288
  text: !0,
284
289
  disabled: ["success", "error", "cancelled"].includes(e.status),
285
290
  onClick: () => n.cancelFiles([e.id])
286
- }, y(i = a("components.upload.cancel")) ? i : {
291
+ }, F(i = a("components.upload.cancel")) ? i : {
287
292
  default: () => [i]
288
- }), o(b, {
293
+ }), o(y, {
289
294
  type: "error",
290
295
  size: "small",
291
296
  text: !0,
292
297
  onClick: () => n.removeFiles([e.id])
293
- }, y(l = a("components.upload.delete")) ? l : {
298
+ }, F(l = a("components.upload.delete")) ? l : {
294
299
  default: () => [l]
295
300
  })]);
296
301
  }
@@ -304,5 +309,5 @@ const m = {
304
309
  }
305
310
  });
306
311
  export {
307
- $e as DuxFileUpload
312
+ et as DuxFileUpload
308
313
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as S, computed as m, watch as p, ref as U, createVNode as a } from "vue";
2
- import { useI18n as k, useUpload as w } from "@duxweb/dvha-core";
3
- import { useVModel as I } from "@vueuse/core";
4
- import V from "clsx";
5
- import { useMessage as j, NImage as A, NButton as c, NProgress as D } from "naive-ui";
6
- import { VueDraggable as B } from "vue-draggable-plus";
1
+ import { defineComponent as U, computed as m, watch as c, ref as k, createVNode as a } from "vue";
2
+ import { useI18n as w, useUpload as I } from "@duxweb/dvha-core";
3
+ import { useVModel as V } from "@vueuse/core";
4
+ import j from "clsx";
5
+ import { useMessage as A, NImage as D, NButton as g, NProgress as B } from "naive-ui";
6
+ import { VueDraggable as M } from "vue-draggable-plus";
7
7
  import "vue-router";
8
8
  import "@overlastic/vue";
9
9
  import "vue-echarts";
@@ -50,17 +50,17 @@ import "@duxweb/dvha-naiveui";
50
50
  import "../../pages/page404.js";
51
51
  import "short-unique-id";
52
52
  import "aieditor";
53
- import { useModal as M } from "../../hooks/modal.js";
53
+ import { useModal as L } from "../../hooks/modal.js";
54
54
  import "mime";
55
- import { useUploadConfig as L } from "./config.js";
55
+ import { useUploadConfig as O } from "./config.js";
56
56
  import "@iconify-json/tabler/icons.json";
57
57
  import "../posterEditor/elements/index.js";
58
58
  import "fabric";
59
59
  import "dayjs";
60
- import { useImagePreview as O } from "../../hooks/image.js";
60
+ import { useImagePreview as q } from "../../hooks/image.js";
61
61
  import "@tanstack/vue-query";
62
62
  import "pinia";
63
- const Te = /* @__PURE__ */ S({
63
+ const We = /* @__PURE__ */ U({
64
64
  name: "DuxImageUpload",
65
65
  props: {
66
66
  path: {
@@ -77,8 +77,7 @@ const Te = /* @__PURE__ */ S({
77
77
  default: ""
78
78
  },
79
79
  driver: {
80
- type: String,
81
- default: "local"
80
+ type: String
82
81
  },
83
82
  maxNum: Number,
84
83
  maxSize: {
@@ -89,18 +88,19 @@ const Te = /* @__PURE__ */ S({
89
88
  manager: Boolean,
90
89
  value: [String, Array],
91
90
  defaultValue: [String, Array],
92
- onUpdateValue: Function
91
+ onUpdateValue: Function,
92
+ method: String
93
93
  },
94
94
  setup(t, {
95
- emit: g
95
+ emit: v
96
96
  }) {
97
- const n = I(t, "value", g, {
97
+ const n = V(t, "value", v, {
98
98
  passive: !0,
99
99
  deep: !0,
100
100
  defaultValue: t.defaultValue
101
- }), v = j(), f = O(), {
101
+ }), h = A(), f = q(), {
102
102
  t: u
103
- } = k(), l = {
103
+ } = w(), l = {
104
104
  container: "flex gap-2",
105
105
  imageItem: "size-80px rounded border border-muted relative group draggable flex items-center",
106
106
  imageOverlay: "z-1 size-full inset-0 absolute flex items-center justify-center bg-default/80 transition-all opacity-0 group-hover:opacity-100 rounded",
@@ -108,46 +108,49 @@ const Te = /* @__PURE__ */ S({
108
108
  uploadContent: "flex-1 flex flex-col justify-center items-center gap-1 relative",
109
109
  progressContainer: "size-80px flex items-center justify-center rounded",
110
110
  progressBar: "absolute left-2 right-2 bottom-2"
111
- }, h = m(() => t.maxSize), {
111
+ }, b = m(() => t.maxSize), {
112
112
  uploadPath: s,
113
- managePath: b,
114
- driver: x
115
- } = L({
113
+ managePath: x,
114
+ driver: y,
115
+ method: d
116
+ } = O({
116
117
  driver: t?.driver,
117
118
  signPath: t?.signPath,
118
119
  signCallback: t?.signCallback,
119
120
  uploadPath: t?.path,
120
- managePath: t?.managePath
121
- }), r = w({
121
+ managePath: t?.managePath,
122
+ method: t?.method
123
+ }), r = I({
122
124
  path: s.value,
123
125
  multiple: t.multiple,
124
126
  maxFileCount: t.maxNum,
125
- maxFileSize: h.value * 1024 * 1024,
127
+ maxFileSize: b.value * 1024 * 1024,
126
128
  autoUpload: !0,
127
129
  accept: "image/*",
130
+ method: d.value,
128
131
  onError: (e) => {
129
- v.error(e.message || u("components.upload.error"));
132
+ h.error(e.message || u("components.upload.error"));
130
133
  },
131
- driver: x.value
134
+ driver: y.value
132
135
  });
133
- p(r.dataFiles, (e) => {
136
+ c(r.dataFiles, (e) => {
134
137
  const o = t.multiple ? e?.map((i) => i.url) : e?.[0]?.url;
135
138
  n.value = o, t.onUpdateValue?.(o);
136
139
  });
137
- const y = m(() => r.progress.value.totalPercent), z = m(() => r.isUploading.value), F = async () => {
140
+ const z = m(() => r.progress.value.totalPercent), F = m(() => r.isUploading.value), P = async () => {
138
141
  r.open();
139
- }, P = m(() => t.multiple ? t.maxNum && r.uploadFiles.value.length >= t.maxNum : !0), C = m(() => r.dataFiles.value?.map((e) => e.url)), N = M(), d = U(!1);
140
- return p(n, (e) => {
141
- if (!e || !e?.length || d.value)
142
+ }, C = m(() => t.multiple ? t.maxNum && r.uploadFiles.value.length >= t.maxNum : !0), S = m(() => r.dataFiles.value?.map((e) => e.url)), N = L(), p = k(!1);
143
+ return c(n, (e) => {
144
+ if (!e || !e?.length || p.value)
142
145
  return;
143
- d.value = !0;
146
+ p.value = !0;
144
147
  const o = typeof e == "string" ? [e] : Array.isArray(e) ? e : [];
145
148
  r.addDataFiles(o.map((i) => ({
146
149
  url: i
147
150
  })));
148
151
  }, {
149
152
  immediate: !0
150
- }), () => a("div", null, [a(B, {
153
+ }), () => a("div", null, [a(M, {
151
154
  modelValue: r.uploadFiles.value,
152
155
  "onUpdate:modelValue": (e) => r.uploadFiles.value = e,
153
156
  class: l.container,
@@ -157,8 +160,8 @@ const Te = /* @__PURE__ */ S({
157
160
  const i = e.url || URL.createObjectURL(e.file);
158
161
  return a("div", {
159
162
  key: o,
160
- class: V(l.imageItem)
161
- }, [a(A, {
163
+ class: j(l.imageItem)
164
+ }, [a(D, {
162
165
  class: "z-0 rounded",
163
166
  objectFit: "scale-down",
164
167
  width: 78,
@@ -167,15 +170,15 @@ const Te = /* @__PURE__ */ S({
167
170
  src: i
168
171
  }, null), a("div", {
169
172
  class: l.imageOverlay
170
- }, [e.status === "success" && a(c, {
173
+ }, [e.status === "success" && a(g, {
171
174
  quaternary: !0,
172
175
  circle: !0,
173
176
  size: "small",
174
177
  renderIcon: () => a("div", {
175
178
  class: "n-icon i-tabler:eye"
176
179
  }, null),
177
- onClick: () => f.show(C.value, o)
178
- }, null), a(c, {
180
+ onClick: () => f.show(S.value, o)
181
+ }, null), a(g, {
179
182
  quaternary: !0,
180
183
  circle: !0,
181
184
  size: "small",
@@ -186,10 +189,10 @@ const Te = /* @__PURE__ */ S({
186
189
  r.removeFiles([e.id]);
187
190
  }
188
191
  }, null)])]);
189
- }), (r.uploadFiles.value.length === 0 || !P.value) && a("div", {
192
+ }), (r.uploadFiles.value.length === 0 || !C.value) && a("div", {
190
193
  class: l.uploadArea,
191
194
  onClick: () => {
192
- F();
195
+ P();
193
196
  }
194
197
  }, [t.manager && a("div", {
195
198
  class: " py-1 text-xs bg-muted border-b border-dashed border-accented flex items-center justify-center",
@@ -199,14 +202,15 @@ const Te = /* @__PURE__ */ S({
199
202
  width: "800px",
200
203
  component: () => import("./manager.js"),
201
204
  componentProps: {
202
- path: b.value,
205
+ path: x.value,
203
206
  type: "image",
204
207
  multiple: t.multiple,
205
208
  uploadParams: {
206
209
  path: s.value,
207
210
  accept: "image/*",
208
211
  maxNum: t.maxNum,
209
- maxSize: t.maxSize
212
+ maxSize: t.maxSize,
213
+ method: d.value
210
214
  }
211
215
  }
212
216
  }).then((o) => {
@@ -217,15 +221,15 @@ const Te = /* @__PURE__ */ S({
217
221
  class: "i-tabler:folder size-4"
218
222
  }, null)]), a("div", {
219
223
  class: l.uploadContent
220
- }, [z.value ? a("div", {
224
+ }, [F.value ? a("div", {
221
225
  class: l.progressContainer
222
226
  }, [a("div", {
223
227
  class: "i-tabler:photo size-6"
224
228
  }, null), a("div", {
225
229
  class: l.progressBar
226
- }, [a(D, {
230
+ }, [a(B, {
227
231
  type: "line",
228
- percentage: y.value,
232
+ percentage: z.value,
229
233
  showIndicator: !1,
230
234
  height: 4
231
235
  }, null)])]) : a("div", {
@@ -235,5 +239,5 @@ const Te = /* @__PURE__ */ S({
235
239
  }
236
240
  });
237
241
  export {
238
- Te as DuxImageUpload
242
+ We as DuxImageUpload
239
243
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as $, ref as s, computed as w, createVNode as e, nextTick as z, createTextVNode as S, isVNode as _ } from "vue";
2
- import { useI18n as q, useClient as B, useInfiniteList as A, useUpload as R } from "@duxweb/dvha-core";
3
- import { cloneDeep as X } from "lodash-es";
4
- import { useMessage as Y, NTabs as G, NTab as x, NButton as c, NInput as N, NInfiniteScroll as H, NTooltip as J, NSpin as K, NDropdown as Q } from "naive-ui";
1
+ import { defineComponent as z, ref as s, computed as w, createVNode as e, nextTick as _, createTextVNode as S, isVNode as q } from "vue";
2
+ import { useI18n as B, useClient as A, useInfiniteList as R, useUpload as X } from "@duxweb/dvha-core";
3
+ import { cloneDeep as Y } from "lodash-es";
4
+ import { useMessage as G, NTabs as H, NTab as x, NButton as c, NInput as N, NInfiniteScroll as J, NTooltip as K, NSpin as Q, NDropdown as W } from "naive-ui";
5
5
  import "vue-router";
6
- import { useDialog as W } from "../../hooks/dialog.js";
6
+ import { useDialog as Z } from "../../hooks/dialog.js";
7
7
  import "@overlastic/vue";
8
8
  import "clsx";
9
9
  import "vue-echarts";
@@ -22,7 +22,7 @@ import "ace-builds/src-noconflict/mode-snippets";
22
22
  import "vue-cropper";
23
23
  import "jinrishici";
24
24
  import "vue-draggable-plus";
25
- import { DuxDrawEmpty as Z } from "../draw/drawEmpty.js";
25
+ import { DuxDrawEmpty as ee } from "../draw/drawEmpty.js";
26
26
  import "@vee-validate/i18n";
27
27
  import "colorizr";
28
28
  import "echarts";
@@ -53,18 +53,18 @@ import "../../pages/page404.js";
53
53
  import "short-unique-id";
54
54
  import "aieditor";
55
55
  import "mime";
56
- import { useUploadConfig as ee } from "./config.js";
56
+ import { useUploadConfig as ae } from "./config.js";
57
57
  import "@iconify-json/tabler/icons.json";
58
58
  import "../posterEditor/elements/index.js";
59
59
  import "fabric";
60
- import { useDownload as ae } from "../../hooks/download.js";
60
+ import { useDownload as te } from "../../hooks/download.js";
61
61
  import "@tanstack/vue-query";
62
62
  import "pinia";
63
63
  import { DuxFileManageItem as T } from "./manage/item.js";
64
- function P(l) {
65
- return typeof l == "function" || Object.prototype.toString.call(l) === "[object Object]" && !_(l);
64
+ function M(t) {
65
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !q(t);
66
66
  }
67
- const pa = /* @__PURE__ */ $({
67
+ const pa = /* @__PURE__ */ z({
68
68
  name: "DuxFileManage",
69
69
  props: {
70
70
  path: String,
@@ -79,56 +79,59 @@ const pa = /* @__PURE__ */ $({
79
79
  handle: String,
80
80
  uploadParams: Object
81
81
  },
82
- setup(l) {
82
+ setup(t) {
83
83
  const f = s(!1), k = s(0), C = s(0), {
84
- t
85
- } = q(), o = s([]), g = W(), M = B(), p = Y(), E = ae(), i = s({
84
+ t: l
85
+ } = B(), o = s([]), g = Z(), P = A(), m = G(), E = te(), i = s({
86
86
  manager: !0,
87
- type: l.type || "all",
87
+ type: t.type || "all",
88
88
  folder: null
89
89
  }), h = s(), {
90
90
  uploadPath: j,
91
91
  managePath: b,
92
- driver: F
93
- } = ee({
94
- driver: l.uploadParams?.driver,
95
- signPath: l.uploadParams?.signPath,
96
- signCallback: l.uploadParams?.signCallback,
97
- uploadPath: l.uploadParams?.path,
98
- managePath: l.path
99
- }), I = s({
92
+ driver: F,
93
+ method: I
94
+ } = ae({
95
+ driver: t.uploadParams?.driver,
96
+ signPath: t.uploadParams?.signPath,
97
+ signCallback: t.uploadParams?.signCallback,
98
+ uploadPath: t.uploadParams?.path,
99
+ managePath: t.path,
100
+ method: t.uploadParams?.method
101
+ }), U = s({
100
102
  page: 1,
101
103
  pageSize: 20
102
- }), n = A({
104
+ }), n = R({
103
105
  path: b.value,
104
- pagination: I.value,
106
+ pagination: U.value,
105
107
  filters: i.value
106
- }), U = w(() => {
108
+ }), V = w(() => {
107
109
  const {
108
110
  driver: u,
109
111
  signPath: d,
110
- signCallback: m,
112
+ signCallback: p,
111
113
  ...a
112
- } = l.uploadParams || {};
114
+ } = t.uploadParams || {};
113
115
  return a;
114
- }), y = R({
115
- ...U.value,
116
+ }), y = X({
117
+ ...V.value,
116
118
  path: j.value,
117
119
  autoUpload: !0,
118
120
  driver: F.value,
119
121
  params: i.value,
122
+ method: I.value,
120
123
  onSuccess: () => {
121
124
  o.value = [], n.refetch();
122
125
  },
123
126
  onError: (u) => {
124
- p.error(u?.message || t("components.uploadManage.uploadError") || "");
127
+ m.error(u?.message || l("components.uploadManage.uploadError") || "");
125
128
  }
126
- }), V = (u) => {
129
+ }), L = (u) => {
127
130
  if (!u) {
128
- p.error(t("components.uploadManage.namePlaceholder") || "");
131
+ m.error(l("components.uploadManage.namePlaceholder") || "");
129
132
  return;
130
133
  }
131
- M.request({
134
+ P.request({
132
135
  path: b.value,
133
136
  method: "POST",
134
137
  payload: {
@@ -138,28 +141,28 @@ const pa = /* @__PURE__ */ $({
138
141
  }).then(() => {
139
142
  n.refetch(), o.value = [];
140
143
  }).catch(() => {
141
- p.error(t("components.uploadManage.createError") || "");
144
+ m.error(l("components.uploadManage.createError") || "");
142
145
  });
143
- }, L = (u, d, m) => {
146
+ }, O = (u, d, p) => {
144
147
  if (!d) {
145
- p.error(t("components.uploadManage.namePlaceholder") || "");
148
+ m.error(l("components.uploadManage.namePlaceholder") || "");
146
149
  return;
147
150
  }
148
- M.request({
151
+ P.request({
149
152
  path: b.value,
150
153
  method: "PUT",
151
154
  payload: {
152
155
  name: d,
153
- id: m,
156
+ id: p,
154
157
  type: u
155
158
  }
156
159
  }).then(() => {
157
160
  n.refetch(), o.value = [];
158
161
  }).catch(() => {
159
- p.error(t("components.uploadManage.editError") || "");
162
+ m.error(l("components.uploadManage.editError") || "");
160
163
  });
161
164
  }, D = (u, d) => {
162
- M.request({
165
+ P.request({
163
166
  path: `${b.value}/batch`,
164
167
  method: "DELETE",
165
168
  payload: {
@@ -169,18 +172,18 @@ const pa = /* @__PURE__ */ $({
169
172
  }).then(() => {
170
173
  n.refetch(), o.value = [];
171
174
  }).catch(() => {
172
- p.error(t("components.uploadManage.delError") || "");
175
+ m.error(l("components.uploadManage.delError") || "");
173
176
  });
174
- }, v = w(() => !!(l.type && l.type !== "all"));
177
+ }, v = w(() => !!(t.type && t.type !== "all"));
175
178
  return () => {
176
- let u, d, m;
179
+ let u, d, p;
177
180
  return e("div", {
178
- class: ["flex flex-col gap-2", l.page ? "h-full" : "h-500px max-h-500px"]
181
+ class: ["flex flex-col gap-2", t.page ? "h-full" : "h-500px max-h-500px"]
179
182
  }, [e("div", {
180
- class: ["flex-none flex justify-between items-center border-b border-muted p-3", l.handle]
183
+ class: ["flex-none flex justify-between items-center border-b border-muted p-3", t.handle]
181
184
  }, [e("div", {
182
185
  class: "flex-none"
183
- }, [e(G, {
186
+ }, [e(H, {
184
187
  type: "segment",
185
188
  animated: !0,
186
189
  size: "small",
@@ -192,19 +195,19 @@ const pa = /* @__PURE__ */ $({
192
195
  }
193
196
  }, {
194
197
  default: () => [e(x, {
195
- tab: t("components.uploadManage.all"),
198
+ tab: l("components.uploadManage.all"),
196
199
  name: "all",
197
200
  disabled: v.value
198
201
  }, null), e(x, {
199
- tab: t("components.uploadManage.image"),
202
+ tab: l("components.uploadManage.image"),
200
203
  name: "image",
201
204
  disabled: v.value
202
205
  }, null), e(x, {
203
- tab: t("components.uploadManage.media"),
206
+ tab: l("components.uploadManage.media"),
204
207
  name: "media",
205
208
  disabled: v.value
206
209
  }, null), e(x, {
207
- tab: t("components.uploadManage.docs"),
210
+ tab: l("components.uploadManage.docs"),
208
211
  name: "docs",
209
212
  disabled: v.value
210
213
  }, null)]
@@ -215,7 +218,7 @@ const pa = /* @__PURE__ */ $({
215
218
  ghost: !0,
216
219
  onClick: () => {
217
220
  g.prompt({
218
- title: t("components.uploadManage.namePlaceholder") || "",
221
+ title: l("components.uploadManage.namePlaceholder") || "",
219
222
  formSchema: [{
220
223
  tag: N,
221
224
  attrs: {
@@ -223,14 +226,14 @@ const pa = /* @__PURE__ */ $({
223
226
  }
224
227
  }]
225
228
  }).then((a) => {
226
- V(a?.name);
229
+ L(a?.name);
227
230
  }).catch(() => {
228
231
  });
229
232
  },
230
233
  renderIcon: () => e("div", {
231
234
  class: "i-tabler:plus"
232
235
  }, null)
233
- }, P(u = t("components.button.create")) ? u : {
236
+ }, M(u = l("components.button.create")) ? u : {
234
237
  default: () => [u]
235
238
  }), e(c, {
236
239
  type: "primary",
@@ -245,19 +248,19 @@ const pa = /* @__PURE__ */ $({
245
248
  }, {
246
249
  default: () => [e("div", {
247
250
  class: "flex gap-2"
248
- }, [t("components.uploadManage.upload"), y.progress.value.totalPercent > 0 && `(${y.progress.value.totalPercent}%)`])]
249
- }), !l.page && e(c, {
251
+ }, [l("components.uploadManage.upload"), y.progress.value.totalPercent > 0 && `(${y.progress.value.totalPercent}%)`])]
252
+ }), !t.page && e(c, {
250
253
  type: "default",
251
254
  ghost: !0,
252
255
  onClick: () => {
253
- l.onClose?.();
256
+ t.onClose?.();
254
257
  },
255
258
  renderIcon: () => e("div", {
256
259
  class: "i-tabler:x"
257
260
  }, null)
258
261
  }, null)])]), e("div", {
259
262
  class: "flex-1 min-h-1"
260
- }, [n.data?.value?.data?.length > 0 && e(H, {
263
+ }, [n.data?.value?.data?.length > 0 && e(J, {
261
264
  distance: 10,
262
265
  onLoad: () => {
263
266
  n.hasNextPage.value && n.fetchNextPage();
@@ -267,29 +270,29 @@ const pa = /* @__PURE__ */ $({
267
270
  }
268
271
  }, {
269
272
  default: () => [e("div", {
270
- class: ["grid grid-cols-3 md:grid-cols-4 text-sm items-start justify-start", n.data.value?.data?.length >= 4 && !l.page ? " lg:grid-cols-[repeat(auto-fit,minmax(150px,1fr))]" : "lg:grid-cols-[repeat(auto-fit,minmax(150px,150px))]"]
273
+ class: ["grid grid-cols-3 md:grid-cols-4 text-sm items-start justify-start", n.data.value?.data?.length >= 4 && !t.page ? " lg:grid-cols-[repeat(auto-fit,minmax(150px,1fr))]" : "lg:grid-cols-[repeat(auto-fit,minmax(150px,150px))]"]
271
274
  }, [i.value?.folder && i.value?.folder !== n.data.value?.meta?.folder && e(T, {
272
275
  key: `parent-${n.data.value?.meta?.folder}`,
273
276
  type: "folder",
274
- name: t("components.uploadManage.parentLevel"),
275
- page: l.page,
277
+ name: l("components.uploadManage.parentLevel"),
278
+ page: t.page,
276
279
  onSelect: () => {
277
280
  o.value = [], i.value.folder = n.data.value?.meta?.folder;
278
281
  }
279
- }, null), n.data.value?.data?.map((a) => e(J, {
282
+ }, null), n.data.value?.data?.map((a) => e(K, {
280
283
  placement: "bottom",
281
284
  key: `${a.url ? "file" : "folder"}-${a.id}`,
282
285
  trigger: a.url ? "hover" : "manual"
283
286
  }, {
284
287
  default: () => a.filesize,
285
288
  trigger: () => e(T, {
286
- page: l.page,
289
+ page: t.page,
287
290
  onContextmenu: (r) => {
288
- h.value = a, f.value = !1, z().then(() => {
291
+ h.value = a, f.value = !1, _().then(() => {
289
292
  f.value = !0, k.value = r.clientX, C.value = r.clientY;
290
293
  }), r.preventDefault();
291
294
  },
292
- value: l.page ? !1 : !!o.value?.find?.((r) => r.id === a.id),
295
+ value: t.page ? !1 : !!o.value?.find?.((r) => r.id === a.id),
293
296
  type: a.url ? "file" : "folder",
294
297
  mime: a.filetype,
295
298
  name: a.filename,
@@ -300,11 +303,11 @@ const pa = /* @__PURE__ */ $({
300
303
  o.value = [], n.data.value = void 0, i.value.folder = a.id;
301
304
  return;
302
305
  }
303
- l.page || (r ? l.multiple ? o.value?.push(a) : o.value = [a] : l.multiple ? o.value?.splice(o.value?.indexOf(a), 1) : o.value = []);
306
+ t.page || (r ? t.multiple ? o.value?.push(a) : o.value = [a] : t.multiple ? o.value?.splice(o.value?.indexOf(a), 1) : o.value = []);
304
307
  }
305
308
  }, null)
306
309
  }))])]
307
- }), n.isLoading.value ? e(K, {
310
+ }), n.isLoading.value ? e(Q, {
308
311
  class: "h-full absolute w-full bg-gray-1/50"
309
312
  }, null) : !n.data.value?.data?.length && e("div", {
310
313
  class: "size-full flex justify-center items-center text-sm text-gray-6"
@@ -312,11 +315,11 @@ const pa = /* @__PURE__ */ $({
312
315
  class: "flex flex-col items-center"
313
316
  }, [e("div", {
314
317
  class: "w-26 mb-2"
315
- }, [e(Z, null, null)]), e("div", {
318
+ }, [e(ee, null, null)]), e("div", {
316
319
  class: "text-base"
317
- }, [t("components.uploadManage.empty")]), e("div", {
320
+ }, [l("components.uploadManage.empty")]), e("div", {
318
321
  class: "text-sm text-muted"
319
- }, [t("components.uploadManage.emptyDesc")]), i.value?.folder && i.value?.folder !== n.data.value?.meta?.folder && e("div", {
322
+ }, [l("components.uploadManage.emptyDesc")]), i.value?.folder && i.value?.folder !== n.data.value?.meta?.folder && e("div", {
320
323
  class: "text-xs text-gray-6"
321
324
  }, [e(c, {
322
325
  type: "default",
@@ -324,9 +327,9 @@ const pa = /* @__PURE__ */ $({
324
327
  onClick: () => {
325
328
  o.value = [], i.value.folder = n.data.value?.meta?.folder;
326
329
  }
327
- }, P(d = t("components.uploadManage.back")) ? d : {
330
+ }, M(d = l("components.uploadManage.back")) ? d : {
328
331
  default: () => [d]
329
- })])])])]), e(Q, {
332
+ })])])])]), e(W, {
330
333
  x: k.value,
331
334
  y: C.value,
332
335
  placement: "bottom-start",
@@ -339,14 +342,14 @@ const pa = /* @__PURE__ */ $({
339
342
  a || (h.value = void 0);
340
343
  },
341
344
  onSelect: (a) => {
342
- const r = X(h.value);
345
+ const r = Y(h.value);
343
346
  switch (f.value = !1, a) {
344
347
  case "download":
345
348
  E.url(r?.url);
346
349
  break;
347
350
  case "rename":
348
351
  g.prompt({
349
- title: t("components.uploadManage.namePlaceholder"),
352
+ title: l("components.uploadManage.namePlaceholder"),
350
353
  formSchema: [{
351
354
  tag: N,
352
355
  attrs: {
@@ -356,14 +359,14 @@ const pa = /* @__PURE__ */ $({
356
359
  defaultValue: {
357
360
  name: r?.filename || r?.name
358
361
  }
359
- }).then((O) => {
360
- L(r?.type, O?.name, r?.id);
362
+ }).then(($) => {
363
+ O(r?.type, $?.name, r?.id);
361
364
  });
362
365
  break;
363
366
  case "delete":
364
367
  g.confirm({
365
- title: t("components.uploadManage.delTitle"),
366
- content: t("components.uploadManage.delDesc")
368
+ title: l("components.uploadManage.delTitle"),
369
+ content: l("components.uploadManage.delDesc")
367
370
  }).then(() => {
368
371
  D(r?.type, r?.id);
369
372
  });
@@ -371,47 +374,47 @@ const pa = /* @__PURE__ */ $({
371
374
  }
372
375
  },
373
376
  options: [h.value?.url && {
374
- label: t("components.button.download"),
377
+ label: l("components.button.download"),
375
378
  key: "download",
376
379
  icon: () => e("div", {
377
380
  class: "i-tabler:download"
378
381
  }, null)
379
382
  }, {
380
- label: t("components.button.rename"),
383
+ label: l("components.button.rename"),
381
384
  key: "rename",
382
385
  icon: () => e("div", {
383
386
  class: "i-tabler:cursor-text"
384
387
  }, null)
385
388
  }, {
386
- label: t("components.button.delete"),
389
+ label: l("components.button.delete"),
387
390
  key: "delete",
388
391
  icon: () => e("div", {
389
392
  class: "i-tabler:trash"
390
393
  }, null)
391
394
  }].filter((a) => a)
392
- }, null), !l.page && e("div", {
395
+ }, null), !t.page && e("div", {
393
396
  class: "flex justify-end gap-2 border-t border-muted p-3"
394
397
  }, [e("div", null, [o.value?.length > 0 && e(c, {
395
398
  type: "error",
396
399
  secondary: !0,
397
400
  onClick: () => {
398
401
  g.confirm({
399
- title: t("components.uploadManage.delTitle"),
400
- content: t("components.uploadManage.delDesc")
402
+ title: l("components.uploadManage.delTitle"),
403
+ content: l("components.uploadManage.delDesc")
401
404
  }).then(() => {
402
405
  D("file", o.value?.map((a) => a.id));
403
406
  });
404
407
  }
405
- }, P(m = t("components.button.delete")) ? m : {
406
- default: () => [m]
408
+ }, M(p = l("components.button.delete")) ? p : {
409
+ default: () => [p]
407
410
  })]), e("div", null, [e(c, {
408
411
  type: "primary",
409
412
  disabled: !o.value?.length,
410
413
  onClick: () => {
411
- l.onConfirm?.(o.value);
414
+ t.onConfirm?.(o.value);
412
415
  }
413
416
  }, {
414
- default: () => [t("components.button.select"), S("("), o.value?.length || 0, S(")")]
417
+ default: () => [l("components.button.select"), S("("), o.value?.length || 0, S(")")]
415
418
  })])])]);
416
419
  };
417
420
  }
@@ -1,5 +1,5 @@
1
1
  const r = `/* layer: properties */
2
- @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-border-opacity:100%;--un-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;}}
2
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-border-opacity:100%;--un-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-to-opacity:100%;--un-fill-opacity:100%;--un-outline-style:solid;}}
3
3
  @property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
4
4
  @property --un-outline-style{syntax:"*";inherits:false;initial-value:solid;}
5
5
  @property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
@@ -1,13 +1,15 @@
1
- import { IDataProviderResponse, IS3SignData } from '@duxweb/dvha-core';
1
+ import type { IDataProviderResponse, IS3SignData } from '@duxweb/dvha-core';
2
2
  export interface UseUploadConfigProps {
3
3
  driver?: 'local' | 's3';
4
4
  uploadPath?: string;
5
5
  managePath?: string;
6
6
  signPath?: string;
7
7
  signCallback?: (response: IDataProviderResponse) => IS3SignData;
8
+ method?: 'POST' | 'PUT';
8
9
  }
9
- export declare const useUploadConfig: (props?: UseUploadConfigProps) => {
10
+ export declare function useUploadConfig(props?: UseUploadConfigProps): {
10
11
  uploadPath: import("vue").ComputedRef<string>;
11
12
  managePath: import("vue").ComputedRef<string>;
12
13
  driver: import("vue").ComputedRef<import("@duxweb/dvha-core").IUploadDriver>;
14
+ method: import("vue").ComputedRef<"POST" | "PUT">;
13
15
  };
@@ -9,6 +9,7 @@ export interface IUploadProps extends IUploadParams {
9
9
  value?: IUploadValue;
10
10
  defaultValue?: IUploadValue;
11
11
  onUpdateValue?: (value?: IUploadValue) => void;
12
+ method?: 'POST' | 'PUT';
12
13
  manager?: boolean;
13
14
  }
14
15
  export declare const DuxFileUpload: import("vue").DefineComponent<IUploadProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IUploadProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -16,7 +16,6 @@ export declare const DuxImageUpload: import("vue").DefineComponent<import("vue")
16
16
  };
17
17
  driver: {
18
18
  type: PropType<"local" | "s3">;
19
- default: string;
20
19
  };
21
20
  maxNum: NumberConstructor;
22
21
  maxSize: {
@@ -58,6 +57,7 @@ export declare const DuxImageUpload: import("vue").DefineComponent<import("vue")
58
57
  readonly [Symbol.species]: ArrayConstructor;
59
58
  })[];
60
59
  onUpdateValue: PropType<(value?: string | string[]) => void>;
60
+ method: PropType<"POST" | "PUT">;
61
61
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
62
62
  path: {
63
63
  type: StringConstructor;
@@ -74,7 +74,6 @@ export declare const DuxImageUpload: import("vue").DefineComponent<import("vue")
74
74
  };
75
75
  driver: {
76
76
  type: PropType<"local" | "s3">;
77
- default: string;
78
77
  };
79
78
  maxNum: NumberConstructor;
80
79
  maxSize: {
@@ -116,10 +115,10 @@ export declare const DuxImageUpload: import("vue").DefineComponent<import("vue")
116
115
  readonly [Symbol.species]: ArrayConstructor;
117
116
  })[];
118
117
  onUpdateValue: PropType<(value?: string | string[]) => void>;
118
+ method: PropType<"POST" | "PUT">;
119
119
  }>> & Readonly<{}>, {
120
120
  path: string;
121
121
  multiple: boolean;
122
- driver: "local" | "s3";
123
122
  manager: boolean;
124
123
  managePath: string;
125
124
  signPath: string;
@@ -9,6 +9,7 @@ export interface IUploadParams {
9
9
  multiple?: boolean;
10
10
  maxNum?: number;
11
11
  maxSize?: number;
12
+ method?: 'POST' | 'PUT';
12
13
  }
13
14
  declare const DuxFileManage: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
14
15
  path: StringConstructor;
@@ -10,6 +10,7 @@ export declare function createDuxPro(): {
10
10
  declare module '@duxweb/dvha-core' {
11
11
  interface IManage {
12
12
  upload?: {
13
+ method?: 'POST' | 'PUT';
13
14
  driver?: 'local' | 's3';
14
15
  signPath?: string;
15
16
  signCallback?: (response: IDataProviderResponse) => IS3SignData;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-pro",
3
3
  "type": "module",
4
- "version": "1.0.34",
4
+ "version": "1.0.35",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ant-design/colors": "^7.2.1",
36
- "@duxweb/dvha-core": "^1.0.34",
37
- "@duxweb/dvha-naiveui": "^1.0.34",
36
+ "@duxweb/dvha-core": "^1.0.35",
37
+ "@duxweb/dvha-naiveui": "^1.0.35",
38
38
  "@iconify-json/tabler": "^1.2.18",
39
39
  "@overlastic/vue": "^0.8.1",
40
40
  "@tanstack/vue-query": "^5.80.7",