@duxweb/dvha-pro 1.0.14 → 1.0.15
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.
- package/dist/cjs/components/editor/aiEditor.cjs +1 -1
- package/dist/cjs/components/upload/manager.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +1 -1
- package/dist/esm/components/editor/aiEditor.js +65 -63
- package/dist/esm/components/upload/manager.js +37 -37
- package/dist/esm/theme/uno.css.js +1 -1
- package/dist/types/components/editor/aiEditor.d.ts +4 -4
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),d=require("@duxweb/dvha-core"),H=require("@vueuse/core"),k=require("aieditor"),w=require("naive-ui"),A=u.defineComponent({name:"DuxAiEditor",props:{value:String,defaultValue:String,uploadPath:String,uploadHeaders:Object,aiPath:String,height:{type:String,default:"500px"},onUpdateValue:Function},setup(e,{emit:P}){const r=u.ref();let o=null;const m=d.useTheme(),{config:v}=d.useManage(),U=d.useGetAuth(),{t:y}=d.useI18n(),S=w.useMessage(),c=H.useVModel(e,"value",P,{passive:!0}),s=u.computed(()=>{var a;return e.uploadPath||((a=v.apiPath)==null?void 0:a.upload)||"upload"}),h=d.useUpload({path:s.value,autoUpload:!1});u.watch(c,a=>{var t;o&&(o.setContent(a||""),(t=e.onUpdateValue)==null||t.call(e,c.value||""))},{immediate:!0});const g=a=>new Promise((t,n)=>{h.addFiles([a],"file").then(()=>{h.trigger().then(i=>{i.forEach(l=>{var f;const p=(f=l==null?void 0:l.data)==null?void 0:f.data;t({errorCode:0,data:{src:p==null?void 0:p.url,alt:l==null?void 0:l.filename}})})}).catch(i=>{S.error(i.message),n(i)}).finally(()=>{h.clearFiles()})})});return u.onMounted(()=>{var a;o=new k.AiEditor({theme:m.isDark.value?"dark":"light",element:r.value,placeholder:y("components.editor.placeholder"),content:e.defaultValue||"",onBlur:t=>{c.value=t.getHtml()},image:{uploadUrl:s.value,uploadHeaders:e.uploadHeaders||{},uploader:g},video:{uploadUrl:s.value,uploadHeaders:e.uploadHeaders||{},uploader:g},attachment:{uploadUrl:s.value,uploadHeaders:e.uploadHeaders||{},uploader:g},ai:{models:{custom:{url:e.aiPath||((a=v.apiPath)==null?void 0:a.ai)||"ai",headers:()=>({"Content-Type":"application/json",Authorization:U.token}),wrapPayload:t=>JSON.stringify({prompt:t}),parseMessage:t=>{const n=JSON.parse(t);return{role:"assistant",content:n.message,index:n.number,status:n.status}},protocol:"sse"}}}})}),u.onUnmounted(()=>{o==null||o.destroy()}),u.watch(m.isDark,a=>{r.value&&(r.value.classList.remove("aie-theme-dark","aie-theme-light"),r.value.classList.add(a?"aie-theme-dark":"aie-theme-light"))},{immediate:!0}),()=>u.createVNode("div",{ref:r,style:`height: ${e.height}; width:100%`},null)}});exports.DuxAiEditor=A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("@duxweb/dvha-core"),ae=require("lodash-es"),u=require("naive-ui");require("vue-router");const le=require("../../hooks/dialog.cjs");require("@overlastic/vue");require("clsx");require("vue-echarts");require("@vueuse/core");require("vue-cropper");require("jinrishici");require("vue-draggable-plus");const te=require("../draw/drawEmpty.cjs");require("aieditor");require("vee-validate");require("@vee-validate/i18n");require("colorizr");require("echarts");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("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("mime");const oe=require("../../hooks/download.cjs");require("@tanstack/vue-query");require("pinia");const K=require("./manage/item.cjs");function w(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const ne=e.defineComponent({name:"DuxFileManage",props:{path:String,type:String,onConfirm:Function,onClose:Function,multiple:Boolean,page:{type:Boolean,default:!0},handle:String,uploadParams:Object},setup(o){const b=e.ref(!1),k=e.ref(0),C=e.ref(0),{t}=N.useI18n(),r=e.ref([]),y=le.useDialog(),M=N.useClient(),g=u.useMessage(),Q=oe.useDownload(),P=N.useManage(),s=e.ref({type:o.type||"all"}),V=e.ref(),x=e.computed(()=>{var d,c;return o.path||((c=(d=P.config)==null?void 0:d.apiPath)==null?void 0:c.uploadManager)||"uploadManage"}),W=e.computed(()=>{var d,c,f;return((d=o.uploadParams)==null?void 0:d.path)||((f=(c=P.config)==null?void 0:c.apiPath)==null?void 0:f.upload)||"upload"}),q=N.useUpload({...o.uploadParams,path:W.value,autoUpload:!0}),Z=e.ref({page:1,pageSize:20}),i=N.useInfiniteList({path:x.value,pagination:Z.value,filters:s.value}),$=d=>{if(!d){g.error(t("components.uploadManage.namePlaceholder")||"");return}M.request({path:x.value,method:"POST",payload:{name:d,folder:s.value.folder}}).then(()=>{i.refetch(),r.value=[]}).catch(()=>{g.error(t("components.uploadManage.createError")||"")})},ee=(d,c,f)=>{if(!c){g.error(t("components.uploadManage.namePlaceholder")||"");return}M.request({path:x.value,method:"PUT",payload:{name:c,id:f,type:d}}).then(()=>{i.refetch(),r.value=[]}).catch(()=>{g.error(t("components.uploadManage.editError")||"")})},S=(d,c)=>{M.request({path:`${x.value}/batch`,method:"DELETE",payload:{ids:Array.isArray(c)?c:[c],type:d}}).then(()=>{i.refetch(),r.value=[]}).catch(()=>{g.error(t("components.uploadManage.delError")||"")})},h=e.computed(()=>!!(o.type&&o.type!=="all"));return()=>{var T,j,I;let d,c,f;return e.createVNode("div",{class:"flex flex-col gap-2 h-500px max-h-500px"},[e.createVNode("div",{class:["flex-none flex justify-between items-center border-b border-muted p-3",o.handle]},[e.createVNode("div",{class:"flex-none"},[e.createVNode(u.NTabs,{type:"segment",animated:!0,size:"small",tabClass:"!px-4",defaultValue:"all",value:s.value.type,onUpdateValue:a=>{h.value||(s.value.type=a,r.value=[])}},{default:()=>[e.createVNode(u.NTab,{tab:t("components.uploadManage.all"),name:"all",disabled:h.value},null),e.createVNode(u.NTab,{tab:t("components.uploadManage.image"),name:"image",disabled:h.value},null),e.createVNode(u.NTab,{tab:t("components.uploadManage.media"),name:"media",disabled:h.value},null),e.createVNode(u.NTab,{tab:t("components.uploadManage.docs"),name:"docs",disabled:h.value},null)]})]),e.createVNode("div",{class:"flex gap-2"},[e.createVNode(u.NButton,{type:"default",ghost:!0,onClick:()=>{y.prompt({title:t("components.uploadManage.namePlaceholder")||"",formSchema:[{tag:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("@duxweb/dvha-core"),ae=require("lodash-es"),u=require("naive-ui");require("vue-router");const le=require("../../hooks/dialog.cjs");require("@overlastic/vue");require("clsx");require("vue-echarts");require("@vueuse/core");require("vue-cropper");require("jinrishici");require("vue-draggable-plus");const te=require("../draw/drawEmpty.cjs");require("aieditor");require("vee-validate");require("@vee-validate/i18n");require("colorizr");require("echarts");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("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("mime");const oe=require("../../hooks/download.cjs");require("@tanstack/vue-query");require("pinia");const K=require("./manage/item.cjs");function w(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const ne=e.defineComponent({name:"DuxFileManage",props:{path:String,type:String,onConfirm:Function,onClose:Function,multiple:Boolean,page:{type:Boolean,default:!0},handle:String,uploadParams:Object},setup(o){const b=e.ref(!1),k=e.ref(0),C=e.ref(0),{t}=N.useI18n(),r=e.ref([]),y=le.useDialog(),M=N.useClient(),g=u.useMessage(),Q=oe.useDownload(),P=N.useManage(),s=e.ref({type:o.type||"all"}),V=e.ref(),x=e.computed(()=>{var d,c;return o.path||((c=(d=P.config)==null?void 0:d.apiPath)==null?void 0:c.uploadManager)||"uploadManage"}),W=e.computed(()=>{var d,c,f;return((d=o.uploadParams)==null?void 0:d.path)||((f=(c=P.config)==null?void 0:c.apiPath)==null?void 0:f.upload)||"upload"}),q=N.useUpload({...o.uploadParams,path:W.value,autoUpload:!0}),Z=e.ref({page:1,pageSize:20}),i=N.useInfiniteList({path:x.value,pagination:Z.value,filters:s.value}),$=d=>{if(!d){g.error(t("components.uploadManage.namePlaceholder")||"");return}M.request({path:x.value,method:"POST",payload:{name:d,folder:s.value.folder}}).then(()=>{i.refetch(),r.value=[]}).catch(()=>{g.error(t("components.uploadManage.createError")||"")})},ee=(d,c,f)=>{if(!c){g.error(t("components.uploadManage.namePlaceholder")||"");return}M.request({path:x.value,method:"PUT",payload:{name:c,id:f,type:d}}).then(()=>{i.refetch(),r.value=[]}).catch(()=>{g.error(t("components.uploadManage.editError")||"")})},S=(d,c)=>{M.request({path:`${x.value}/batch`,method:"DELETE",payload:{ids:Array.isArray(c)?c:[c],type:d}}).then(()=>{i.refetch(),r.value=[]}).catch(()=>{g.error(t("components.uploadManage.delError")||"")})},h=e.computed(()=>!!(o.type&&o.type!=="all"));return()=>{var T,j,I;let d,c,f;return e.createVNode("div",{class:"flex flex-col gap-2 h-500px max-h-500px"},[e.createVNode("div",{class:["flex-none flex justify-between items-center border-b border-muted p-3",o.handle]},[e.createVNode("div",{class:"flex-none"},[e.createVNode(u.NTabs,{type:"segment",animated:!0,size:"small",tabClass:"!px-4",defaultValue:"all",value:s.value.type,onUpdateValue:a=>{h.value||(s.value.type=a,r.value=[])}},{default:()=>[e.createVNode(u.NTab,{tab:t("components.uploadManage.all"),name:"all",disabled:h.value},null),e.createVNode(u.NTab,{tab:t("components.uploadManage.image"),name:"image",disabled:h.value},null),e.createVNode(u.NTab,{tab:t("components.uploadManage.media"),name:"media",disabled:h.value},null),e.createVNode(u.NTab,{tab:t("components.uploadManage.docs"),name:"docs",disabled:h.value},null)]})]),e.createVNode("div",{class:"flex gap-2"},[e.createVNode(u.NButton,{type:"default",ghost:!0,onClick:()=>{y.prompt({title:t("components.uploadManage.namePlaceholder")||"",formSchema:[{tag:u.NInput,attrs:{"v-model:value":"form.name"}}]}).then(a=>{$(a==null?void 0:a.name)})},renderIcon:()=>e.createVNode("div",{class:"i-tabler:plus"},null)},w(d=t("components.button.create"))?d:{default:()=>[d]}),e.createVNode(u.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}%)`])]}),o.page&&e.createVNode(u.NButton,{type:"default",ghost:!0,onClick:()=>{var a;(a=o.onClose)==null||a.call(o)},renderIcon:()=>e.createVNode("div",{class:"i-tabler:x"},null)},null)])]),e.createVNode("div",{class:"flex-1 min-h-1"},[e.createVNode(u.NInfiniteScroll,{distance:10,onLoad:()=>{i.hasNextPage.value&&i.fetchNextPage()},scrollbarProps:{contentClass:"p-4"}},{default:()=>{var a,l,m,E,F,B,U,_,O,L,D,z,A,R,X;return[i.isLoading.value&&e.createVNode(u.NSpin,{class:"h-full absolute w-full bg-gray-1/50"},null),((m=(l=(a=i.data)==null?void 0:a.value)==null?void 0:l.data)==null?void 0:m.length)>0?e.createVNode("div",{class:"grid grid-cols-3 lg:grid-cols-[repeat(auto-fit,minmax(150px,1fr))] text-sm items-start justify-start"},[((E=s.value)==null?void 0:E.folder)&&((F=s.value)==null?void 0:F.folder)!==((U=(B=i.data.value)==null?void 0:B.meta)==null?void 0:U.folder)&&e.createVNode(K.DuxFileManageItem,{key:`parent-${(O=(_=i.data.value)==null?void 0:_.meta)==null?void 0:O.folder}`,type:"folder",name:t("components.uploadManage.parentLevel"),onSelect:()=>{var n,p;r.value=[],s.value.folder=(p=(n=i.data.value)==null?void 0:n.meta)==null?void 0:p.folder}},null),(D=(L=i.data.value)==null?void 0:L.data)==null?void 0:D.map(n=>e.createVNode(u.NTooltip,{placement:"bottom",key:`${n.url?"file":"folder"}-${n.id}`,trigger:n.url?"hover":"manual"},{default:()=>n.filesize,trigger:()=>{var p,Y;return e.createVNode(K.DuxFileManageItem,{onContextmenu:v=>{V.value=n,b.value=!1,e.nextTick().then(()=>{b.value=!0,k.value=v.clientX,C.value=v.clientY}),v.preventDefault()},value:o.page?!!((Y=(p=r.value)==null?void 0:p.find)!=null&&Y.call(p,v=>v.id===n.id)):!1,type:n.url?"file":"folder",mime:n.filetype,name:n.filename,url:n.url,time:n.created_at,onSelect:v=>{var G,H,J;if(!n.url){r.value=[],s.value.folder=n.id;return}o.page&&(v?o.multiple?(G=r.value)==null||G.push(n):r.value=[n]:o.multiple?(J=r.value)==null||J.splice((H=r.value)==null?void 0:H.indexOf(n),1):r.value=[])}},null)}}))]):e.createVNode("div",{class:"w-full h-100 flex flex-justify-center justify-center items-center text-sm text-gray-6"},[e.createVNode("div",{class:"flex flex-col items-center gap-2"},[e.createVNode("div",{class:"w-26"},[e.createVNode(te.DuxDrawEmpty,null,null)]),e.createVNode("div",null,[t("components.uploadManage.empty")]),((z=s.value)==null?void 0:z.folder)&&((A=s.value)==null?void 0:A.folder)!==((X=(R=i.data.value)==null?void 0:R.meta)==null?void 0:X.folder)&&e.createVNode("div",{class:"text-xs text-gray-6"},[e.createVNode(u.NButton,{type:"default",ghost:!0,onClick:()=>{var n,p;r.value=[],s.value.folder=(p=(n=i.data.value)==null?void 0:n.meta)==null?void 0:p.folder}},w(c=t("components.uploadManage.back"))?c:{default:()=>[c]})])])])]}})]),e.createVNode(u.NDropdown,{x:k.value,y:C.value,placement:"bottom-start",trigger:"manual",show:b.value,onClickoutside:()=>{b.value=!1},onUpdateShow:a=>{a||(V.value=void 0)},onSelect:a=>{const l=ae.cloneDeep(V.value);switch(a){case"download":Q.url(l==null?void 0:l.url);break;case"rename":y.prompt({title:t("components.uploadManage.namePlaceholder"),formSchema:[{tag:u.NInput,attrs:{"v-model:value":"form.name"}}],defaultValue:{name:(l==null?void 0:l.filename)||(l==null?void 0:l.name)}}).then(m=>{ee(l==null?void 0:l.type,m==null?void 0:m.name,l==null?void 0:l.id)});break;case"delete":y.confirm({title:t("components.uploadManage.delTitle"),content:t("components.uploadManage.delDesc")}).then(()=>{S(l==null?void 0:l.type,l==null?void 0:l.id)});break}},options:[((T=V.value)==null?void 0:T.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),o.page&&e.createVNode("div",{class:"flex justify-end gap-2 border-t border-muted p-3"},[e.createVNode("div",null,[((j=r.value)==null?void 0:j.length)>0&&e.createVNode(u.NButton,{type:"error",secondary:!0,onClick:()=>{y.confirm({title:t("components.uploadManage.delTitle"),content:t("components.uploadManage.delDesc")}).then(()=>{var a;S("file",(a=r.value)==null?void 0:a.map(l=>l.id))})}},w(f=t("components.button.delete"))?f:{default:()=>[f]})]),e.createVNode("div",null,[e.createVNode(u.NButton,{type:"primary",disabled:!((I=r.value)!=null&&I.length),onClick:()=>{var a;(a=o.onConfirm)==null||a.call(o,r.value)}},{default:()=>{var a;return[t("components.button.select"),e.createTextVNode("("),((a=r.value)==null?void 0:a.length)||0,e.createTextVNode(")")]}})])])])}}});exports.default=ne;
|
|
@@ -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-
|
|
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:0;--un-border-style:solid;--un-divide-x-reverse:0;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-border-opacity:100%;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;}}
|
|
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,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { AiEditor as
|
|
5
|
-
import { useMessage as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as y, ref as S, computed as k, watch as f, onMounted as V, onUnmounted as w, createVNode as x } from "vue";
|
|
2
|
+
import { useTheme as A, useManage as M, useGetAuth as C, useI18n as D, useUpload as E } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as F } from "@vueuse/core";
|
|
4
|
+
import { AiEditor as N } from "aieditor";
|
|
5
|
+
import { useMessage as O } from "naive-ui";
|
|
6
|
+
const z = /* @__PURE__ */ y({
|
|
7
7
|
name: "DuxAiEditor",
|
|
8
8
|
props: {
|
|
9
9
|
value: String,
|
|
10
10
|
defaultValue: String,
|
|
11
|
-
|
|
11
|
+
uploadPath: String,
|
|
12
12
|
uploadHeaders: Object,
|
|
13
|
-
|
|
13
|
+
aiPath: String,
|
|
14
14
|
height: {
|
|
15
15
|
type: String,
|
|
16
16
|
default: "500px"
|
|
@@ -18,91 +18,93 @@ const T = /* @__PURE__ */ P({
|
|
|
18
18
|
onUpdateValue: Function
|
|
19
19
|
},
|
|
20
20
|
setup(e, {
|
|
21
|
-
emit:
|
|
21
|
+
emit: v
|
|
22
22
|
}) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = C(), y = N(), s = E(e, "value", U, {
|
|
23
|
+
const u = S();
|
|
24
|
+
let o = null;
|
|
25
|
+
const m = A(), {
|
|
26
|
+
config: p
|
|
27
|
+
} = M(), P = C(), {
|
|
28
|
+
t: U
|
|
29
|
+
} = D(), H = O(), s = F(e, "value", v, {
|
|
31
30
|
passive: !0
|
|
32
|
-
}),
|
|
33
|
-
|
|
31
|
+
}), n = k(() => {
|
|
32
|
+
var a;
|
|
33
|
+
return e.uploadPath || ((a = p.apiPath) == null ? void 0 : a.upload) || "upload";
|
|
34
|
+
}), i = E({
|
|
35
|
+
path: n.value,
|
|
34
36
|
autoUpload: !1
|
|
35
37
|
});
|
|
36
|
-
f(s, (
|
|
37
|
-
var
|
|
38
|
-
|
|
38
|
+
f(s, (a) => {
|
|
39
|
+
var t;
|
|
40
|
+
o && (o.setContent(a || ""), (t = e.onUpdateValue) == null || t.call(e, s.value || ""));
|
|
39
41
|
}, {
|
|
40
42
|
immediate: !0
|
|
41
43
|
});
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const h = (a) => new Promise((t, r) => {
|
|
45
|
+
i.addFiles([a], "file").then(() => {
|
|
46
|
+
i.trigger().then((d) => {
|
|
47
|
+
d.forEach((l) => {
|
|
46
48
|
var g;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
+
const c = (g = l == null ? void 0 : l.data) == null ? void 0 : g.data;
|
|
50
|
+
t({
|
|
49
51
|
errorCode: 0,
|
|
50
52
|
data: {
|
|
51
|
-
src:
|
|
52
|
-
alt:
|
|
53
|
+
src: c == null ? void 0 : c.url,
|
|
54
|
+
alt: l == null ? void 0 : l.filename
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
57
|
});
|
|
56
|
-
}).catch((
|
|
57
|
-
|
|
58
|
+
}).catch((d) => {
|
|
59
|
+
H.error(d.message), r(d);
|
|
58
60
|
}).finally(() => {
|
|
59
|
-
|
|
61
|
+
i.clearFiles();
|
|
60
62
|
});
|
|
61
63
|
});
|
|
62
64
|
});
|
|
63
|
-
return
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
theme:
|
|
67
|
-
element:
|
|
68
|
-
placeholder:
|
|
65
|
+
return V(() => {
|
|
66
|
+
var a;
|
|
67
|
+
o = new N({
|
|
68
|
+
theme: m.isDark.value ? "dark" : "light",
|
|
69
|
+
element: u.value,
|
|
70
|
+
placeholder: U("components.editor.placeholder"),
|
|
69
71
|
content: e.defaultValue || "",
|
|
70
|
-
onBlur: (
|
|
71
|
-
s.value =
|
|
72
|
+
onBlur: (t) => {
|
|
73
|
+
s.value = t.getHtml();
|
|
72
74
|
},
|
|
73
75
|
image: {
|
|
74
|
-
uploadUrl:
|
|
76
|
+
uploadUrl: n.value,
|
|
75
77
|
uploadHeaders: e.uploadHeaders || {},
|
|
76
|
-
uploader:
|
|
78
|
+
uploader: h
|
|
77
79
|
},
|
|
78
80
|
video: {
|
|
79
|
-
uploadUrl:
|
|
81
|
+
uploadUrl: n.value,
|
|
80
82
|
uploadHeaders: e.uploadHeaders || {},
|
|
81
|
-
uploader:
|
|
83
|
+
uploader: h
|
|
82
84
|
},
|
|
83
85
|
attachment: {
|
|
84
|
-
uploadUrl:
|
|
86
|
+
uploadUrl: n.value,
|
|
85
87
|
uploadHeaders: e.uploadHeaders || {},
|
|
86
|
-
uploader:
|
|
88
|
+
uploader: h
|
|
87
89
|
},
|
|
88
90
|
ai: {
|
|
89
91
|
models: {
|
|
90
92
|
custom: {
|
|
91
|
-
url: e.
|
|
93
|
+
url: e.aiPath || ((a = p.apiPath) == null ? void 0 : a.ai) || "ai",
|
|
92
94
|
headers: () => ({
|
|
93
95
|
"Content-Type": "application/json",
|
|
94
|
-
Authorization:
|
|
96
|
+
Authorization: P.token
|
|
95
97
|
}),
|
|
96
|
-
wrapPayload: (
|
|
97
|
-
prompt:
|
|
98
|
+
wrapPayload: (t) => JSON.stringify({
|
|
99
|
+
prompt: t
|
|
98
100
|
}),
|
|
99
|
-
parseMessage: (
|
|
100
|
-
const
|
|
101
|
+
parseMessage: (t) => {
|
|
102
|
+
const r = JSON.parse(t);
|
|
101
103
|
return {
|
|
102
104
|
role: "assistant",
|
|
103
|
-
content:
|
|
104
|
-
index:
|
|
105
|
-
status:
|
|
105
|
+
content: r.message,
|
|
106
|
+
index: r.number,
|
|
107
|
+
status: r.status
|
|
106
108
|
};
|
|
107
109
|
},
|
|
108
110
|
protocol: "sse"
|
|
@@ -110,18 +112,18 @@ const T = /* @__PURE__ */ P({
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
});
|
|
113
|
-
}),
|
|
114
|
-
|
|
115
|
-
}), f(
|
|
116
|
-
|
|
115
|
+
}), w(() => {
|
|
116
|
+
o == null || o.destroy();
|
|
117
|
+
}), f(m.isDark, (a) => {
|
|
118
|
+
u.value && (u.value.classList.remove("aie-theme-dark", "aie-theme-light"), u.value.classList.add(a ? "aie-theme-dark" : "aie-theme-light"));
|
|
117
119
|
}, {
|
|
118
120
|
immediate: !0
|
|
119
|
-
}), () =>
|
|
120
|
-
ref:
|
|
121
|
+
}), () => x("div", {
|
|
122
|
+
ref: u,
|
|
121
123
|
style: `height: ${e.height}; width:100%`
|
|
122
124
|
}, null);
|
|
123
125
|
}
|
|
124
126
|
});
|
|
125
127
|
export {
|
|
126
|
-
|
|
128
|
+
z as DuxAiEditor
|
|
127
129
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import { cloneDeep as
|
|
4
|
-
import { useMessage as
|
|
1
|
+
import { defineComponent as ne, ref as f, computed as S, createVNode as e, nextTick as ue, createTextVNode as Q, isVNode as re } from "vue";
|
|
2
|
+
import { useI18n as de, useClient as ie, useManage as se, useUpload as ce, useInfiniteList as pe } from "@duxweb/dvha-core";
|
|
3
|
+
import { cloneDeep as me } from "lodash-es";
|
|
4
|
+
import { useMessage as fe, NTabs as ve, NTab as C, NButton as g, NInput as W, NInfiniteScroll as ge, NSpin as he, NTooltip as be, NDropdown as ye } from "naive-ui";
|
|
5
5
|
import "vue-router";
|
|
6
|
-
import { useDialog as
|
|
6
|
+
import { useDialog as xe } from "../../hooks/dialog.js";
|
|
7
7
|
import "@overlastic/vue";
|
|
8
8
|
import "clsx";
|
|
9
9
|
import "vue-echarts";
|
|
@@ -11,7 +11,7 @@ import "@vueuse/core";
|
|
|
11
11
|
import "vue-cropper";
|
|
12
12
|
import "jinrishici";
|
|
13
13
|
import "vue-draggable-plus";
|
|
14
|
-
import { DuxDrawEmpty as
|
|
14
|
+
import { DuxDrawEmpty as Me } from "../draw/drawEmpty.js";
|
|
15
15
|
import "aieditor";
|
|
16
16
|
import "vee-validate";
|
|
17
17
|
import "@vee-validate/i18n";
|
|
@@ -27,14 +27,14 @@ import "vue-command-palette";
|
|
|
27
27
|
import "@duxweb/dvha-naiveui";
|
|
28
28
|
import "../../pages/page404.js";
|
|
29
29
|
import "mime";
|
|
30
|
-
import { useDownload as
|
|
30
|
+
import { useDownload as ke } from "../../hooks/download.js";
|
|
31
31
|
import "@tanstack/vue-query";
|
|
32
32
|
import "pinia";
|
|
33
|
-
import { DuxFileManageItem as
|
|
33
|
+
import { DuxFileManageItem as Z } from "./manage/item.js";
|
|
34
34
|
function N(o) {
|
|
35
|
-
return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !
|
|
35
|
+
return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !re(o);
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const la = /* @__PURE__ */ ne({
|
|
38
38
|
name: "DuxFileManage",
|
|
39
39
|
props: {
|
|
40
40
|
path: String,
|
|
@@ -52,26 +52,26 @@ const ta = /* @__PURE__ */ ue({
|
|
|
52
52
|
setup(o) {
|
|
53
53
|
const y = f(!1), T = f(0), j = f(0), {
|
|
54
54
|
t
|
|
55
|
-
} =
|
|
55
|
+
} = de(), u = f([]), x = xe(), P = ie(), h = fe(), ee = ke(), F = se(), s = f({
|
|
56
56
|
type: o.type || "all"
|
|
57
57
|
}), M = f(), k = S(() => {
|
|
58
58
|
var r, d;
|
|
59
59
|
return o.path || ((d = (r = F.config) == null ? void 0 : r.apiPath) == null ? void 0 : d.uploadManager) || "uploadManage";
|
|
60
|
-
}),
|
|
60
|
+
}), ae = S(() => {
|
|
61
61
|
var r, d, p;
|
|
62
62
|
return ((r = o.uploadParams) == null ? void 0 : r.path) || ((p = (d = F.config) == null ? void 0 : d.apiPath) == null ? void 0 : p.upload) || "upload";
|
|
63
|
-
}), w =
|
|
63
|
+
}), w = ce({
|
|
64
64
|
...o.uploadParams,
|
|
65
|
-
path:
|
|
65
|
+
path: ae.value,
|
|
66
66
|
autoUpload: !0
|
|
67
|
-
}),
|
|
67
|
+
}), le = f({
|
|
68
68
|
page: 1,
|
|
69
69
|
pageSize: 20
|
|
70
|
-
}), i =
|
|
70
|
+
}), i = pe({
|
|
71
71
|
path: k.value,
|
|
72
|
-
pagination:
|
|
72
|
+
pagination: le.value,
|
|
73
73
|
filters: s.value
|
|
74
|
-
}),
|
|
74
|
+
}), te = (r) => {
|
|
75
75
|
if (!r) {
|
|
76
76
|
h.error(t("components.uploadManage.namePlaceholder") || "");
|
|
77
77
|
return;
|
|
@@ -88,7 +88,7 @@ const ta = /* @__PURE__ */ ue({
|
|
|
88
88
|
}).catch(() => {
|
|
89
89
|
h.error(t("components.uploadManage.createError") || "");
|
|
90
90
|
});
|
|
91
|
-
},
|
|
91
|
+
}, oe = (r, d, p) => {
|
|
92
92
|
if (!d) {
|
|
93
93
|
h.error(t("components.uploadManage.namePlaceholder") || "");
|
|
94
94
|
return;
|
|
@@ -129,7 +129,7 @@ const ta = /* @__PURE__ */ ue({
|
|
|
129
129
|
class: ["flex-none flex justify-between items-center border-b border-muted p-3", o.handle]
|
|
130
130
|
}, [e("div", {
|
|
131
131
|
class: "flex-none"
|
|
132
|
-
}, [e(
|
|
132
|
+
}, [e(ve, {
|
|
133
133
|
type: "segment",
|
|
134
134
|
animated: !0,
|
|
135
135
|
size: "small",
|
|
@@ -166,13 +166,13 @@ const ta = /* @__PURE__ */ ue({
|
|
|
166
166
|
x.prompt({
|
|
167
167
|
title: t("components.uploadManage.namePlaceholder") || "",
|
|
168
168
|
formSchema: [{
|
|
169
|
-
tag:
|
|
169
|
+
tag: W,
|
|
170
170
|
attrs: {
|
|
171
171
|
"v-model:value": "form.name"
|
|
172
172
|
}
|
|
173
173
|
}]
|
|
174
174
|
}).then((a) => {
|
|
175
|
-
|
|
175
|
+
te(a == null ? void 0 : a.name);
|
|
176
176
|
});
|
|
177
177
|
},
|
|
178
178
|
renderIcon: () => e("div", {
|
|
@@ -206,7 +206,7 @@ const ta = /* @__PURE__ */ ue({
|
|
|
206
206
|
}, null)
|
|
207
207
|
}, null)])]), e("div", {
|
|
208
208
|
class: "flex-1 min-h-1"
|
|
209
|
-
}, [e(
|
|
209
|
+
}, [e(ge, {
|
|
210
210
|
distance: 10,
|
|
211
211
|
onLoad: () => {
|
|
212
212
|
i.hasNextPage.value && i.fetchNextPage();
|
|
@@ -216,12 +216,12 @@ const ta = /* @__PURE__ */ ue({
|
|
|
216
216
|
}
|
|
217
217
|
}, {
|
|
218
218
|
default: () => {
|
|
219
|
-
var a, l, v, L, O, _, $, q, z, B, D,
|
|
220
|
-
return [i.isLoading.value && e(
|
|
219
|
+
var a, l, v, L, O, _, $, q, z, B, D, A, R, X, Y;
|
|
220
|
+
return [i.isLoading.value && e(he, {
|
|
221
221
|
class: "h-full absolute w-full bg-gray-1/50"
|
|
222
222
|
}, null), ((v = (l = (a = i.data) == null ? void 0 : a.value) == null ? void 0 : l.data) == null ? void 0 : v.length) > 0 ? e("div", {
|
|
223
223
|
class: "grid grid-cols-3 lg:grid-cols-[repeat(auto-fit,minmax(150px,1fr))] text-sm items-start justify-start"
|
|
224
|
-
}, [((L = s.value) == null ? void 0 : L.folder) && ((O = s.value) == null ? void 0 : O.folder) !== (($ = (_ = i.data.value) == null ? void 0 : _.meta) == null ? void 0 : $.folder) && e(
|
|
224
|
+
}, [((L = s.value) == null ? void 0 : L.folder) && ((O = s.value) == null ? void 0 : O.folder) !== (($ = (_ = i.data.value) == null ? void 0 : _.meta) == null ? void 0 : $.folder) && e(Z, {
|
|
225
225
|
key: `parent-${(z = (q = i.data.value) == null ? void 0 : q.meta) == null ? void 0 : z.folder}`,
|
|
226
226
|
type: "folder",
|
|
227
227
|
name: t("components.uploadManage.parentLevel"),
|
|
@@ -229,7 +229,7 @@ const ta = /* @__PURE__ */ ue({
|
|
|
229
229
|
var n, c;
|
|
230
230
|
u.value = [], s.value.folder = (c = (n = i.data.value) == null ? void 0 : n.meta) == null ? void 0 : c.folder;
|
|
231
231
|
}
|
|
232
|
-
}, null), (D = (B = i.data.value) == null ? void 0 : B.data) == null ? void 0 : D.map((n) => e(
|
|
232
|
+
}, null), (D = (B = i.data.value) == null ? void 0 : B.data) == null ? void 0 : D.map((n) => e(be, {
|
|
233
233
|
placement: "bottom",
|
|
234
234
|
key: `${n.url ? "file" : "folder"}-${n.id}`,
|
|
235
235
|
trigger: n.url ? "hover" : "manual"
|
|
@@ -237,9 +237,9 @@ const ta = /* @__PURE__ */ ue({
|
|
|
237
237
|
default: () => n.filesize,
|
|
238
238
|
trigger: () => {
|
|
239
239
|
var c, G;
|
|
240
|
-
return e(
|
|
240
|
+
return e(Z, {
|
|
241
241
|
onContextmenu: (m) => {
|
|
242
|
-
M.value = n, y.value = !1,
|
|
242
|
+
M.value = n, y.value = !1, ue().then(() => {
|
|
243
243
|
y.value = !0, T.value = m.clientX, j.value = m.clientY;
|
|
244
244
|
}), m.preventDefault();
|
|
245
245
|
},
|
|
@@ -265,7 +265,7 @@ const ta = /* @__PURE__ */ ue({
|
|
|
265
265
|
class: "flex flex-col items-center gap-2"
|
|
266
266
|
}, [e("div", {
|
|
267
267
|
class: "w-26"
|
|
268
|
-
}, [e(
|
|
268
|
+
}, [e(Me, null, null)]), e("div", null, [t("components.uploadManage.empty")]), ((A = s.value) == null ? void 0 : A.folder) && ((R = s.value) == null ? void 0 : R.folder) !== ((Y = (X = i.data.value) == null ? void 0 : X.meta) == null ? void 0 : Y.folder) && e("div", {
|
|
269
269
|
class: "text-xs text-gray-6"
|
|
270
270
|
}, [e(g, {
|
|
271
271
|
type: "default",
|
|
@@ -278,7 +278,7 @@ const ta = /* @__PURE__ */ ue({
|
|
|
278
278
|
default: () => [d]
|
|
279
279
|
})])])])];
|
|
280
280
|
}
|
|
281
|
-
})]), e(
|
|
281
|
+
})]), e(ye, {
|
|
282
282
|
x: T.value,
|
|
283
283
|
y: j.value,
|
|
284
284
|
placement: "bottom-start",
|
|
@@ -291,16 +291,16 @@ const ta = /* @__PURE__ */ ue({
|
|
|
291
291
|
a || (M.value = void 0);
|
|
292
292
|
},
|
|
293
293
|
onSelect: (a) => {
|
|
294
|
-
const l =
|
|
294
|
+
const l = me(M.value);
|
|
295
295
|
switch (a) {
|
|
296
296
|
case "download":
|
|
297
|
-
|
|
297
|
+
ee.url(l == null ? void 0 : l.url);
|
|
298
298
|
break;
|
|
299
299
|
case "rename":
|
|
300
300
|
x.prompt({
|
|
301
301
|
title: t("components.uploadManage.namePlaceholder"),
|
|
302
302
|
formSchema: [{
|
|
303
|
-
tag:
|
|
303
|
+
tag: W,
|
|
304
304
|
attrs: {
|
|
305
305
|
"v-model:value": "form.name"
|
|
306
306
|
}
|
|
@@ -309,7 +309,7 @@ const ta = /* @__PURE__ */ ue({
|
|
|
309
309
|
name: (l == null ? void 0 : l.filename) || (l == null ? void 0 : l.name)
|
|
310
310
|
}
|
|
311
311
|
}).then((v) => {
|
|
312
|
-
|
|
312
|
+
oe(l == null ? void 0 : l.type, v == null ? void 0 : v.name, l == null ? void 0 : l.id);
|
|
313
313
|
});
|
|
314
314
|
break;
|
|
315
315
|
case "delete":
|
|
@@ -367,12 +367,12 @@ const ta = /* @__PURE__ */ ue({
|
|
|
367
367
|
}, {
|
|
368
368
|
default: () => {
|
|
369
369
|
var a;
|
|
370
|
-
return [t("components.button.select"),
|
|
370
|
+
return [t("components.button.select"), Q("("), ((a = u.value) == null ? void 0 : a.length) || 0, Q(")")];
|
|
371
371
|
}
|
|
372
372
|
})])])]);
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
375
|
});
|
|
376
376
|
export {
|
|
377
|
-
|
|
377
|
+
la as default
|
|
378
378
|
};
|
|
@@ -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-
|
|
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:0;--un-border-style:solid;--un-divide-x-reverse:0;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-border-opacity:100%;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;}}
|
|
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%;}
|
|
@@ -2,9 +2,9 @@ import type { PropType } from 'vue';
|
|
|
2
2
|
export declare const DuxAiEditor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
3
|
value: StringConstructor;
|
|
4
4
|
defaultValue: StringConstructor;
|
|
5
|
-
|
|
5
|
+
uploadPath: StringConstructor;
|
|
6
6
|
uploadHeaders: PropType<Record<string, any>>;
|
|
7
|
-
|
|
7
|
+
aiPath: StringConstructor;
|
|
8
8
|
height: {
|
|
9
9
|
type: StringConstructor;
|
|
10
10
|
default: string;
|
|
@@ -13,9 +13,9 @@ export declare const DuxAiEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
13
13
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
14
14
|
value: StringConstructor;
|
|
15
15
|
defaultValue: StringConstructor;
|
|
16
|
-
|
|
16
|
+
uploadPath: StringConstructor;
|
|
17
17
|
uploadHeaders: PropType<Record<string, any>>;
|
|
18
|
-
|
|
18
|
+
aiPath: StringConstructor;
|
|
19
19
|
height: {
|
|
20
20
|
type: StringConstructor;
|
|
21
21
|
default: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duxweb/dvha-pro",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.15",
|
|
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.
|
|
37
|
-
"@duxweb/dvha-naiveui": "^1.0.
|
|
36
|
+
"@duxweb/dvha-core": "^1.0.15",
|
|
37
|
+
"@duxweb/dvha-naiveui": "^1.0.15",
|
|
38
38
|
"@iconify-json/tabler": "^1.2.18",
|
|
39
39
|
"@overlastic/vue": "^0.8.1",
|
|
40
40
|
"@tanstack/vue-query": "^5.80.7",
|