@duxweb/dvha-naiveui 1.0.22 → 1.0.24
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/autoComplete/autoComplete.cjs +1 -1
- package/dist/cjs/components/mention/mention.cjs +1 -1
- package/dist/cjs/components/select/select.cjs +1 -1
- package/dist/cjs/components/transfer/transfer.cjs +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -1
- package/dist/cjs/hooks/menu.cjs +1 -1
- package/dist/cjs/hooks/table.cjs +1 -1
- package/dist/cjs/hooks/upload.cjs +1 -1
- package/dist/esm/components/autoComplete/autoComplete.js +32 -35
- package/dist/esm/components/mention/mention.js +28 -29
- package/dist/esm/components/select/select.js +96 -115
- package/dist/esm/components/transfer/transfer.js +34 -35
- package/dist/esm/components/tree/tree.js +27 -28
- package/dist/esm/hooks/menu.js +16 -16
- package/dist/esm/hooks/table.js +47 -48
- package/dist/esm/hooks/upload.js +28 -29
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),c=require("@duxweb/dvha-core"),s=require("@vueuse/core"),u=require("naive-ui"),p=t.defineComponent({name:"DuxAutoComplete",props:{path:String,params:Object,pagination:{type:Boolean,default:!0},valueField:{type:String,default:"id"},labelField:{type:String,default:"name"},multiple:Boolean},extends:u.NAutoComplete,setup(e,{emit:o,slots:n}){const a=s.useVModel(e,"value",o,{passive:!0,defaultValue:e.defaultValue||void 0}),i=t.toRef(e,"path"),d=t.toRef(e,"params",{}),{onSearch:r,loading:m,options:v}=c.useSelect({path:i.value||"",params:d.value,pagination:e.pagination,optionValue:e.valueField||"id"});return t.watch(a,()=>{r(a.value||"")},{immediate:!0}),()=>t.createVNode(u.NAutoComplete,t.mergeProps(e,{loading:m.value,clearable:!0,options:v.value?.map(l=>({label:l[e.labelField||"name"],value:l[e.valueField||"id"]})),showEmpty:!0,value:a.value,"onUpdate:value":l=>a.value=l}),{...n})}});exports.DuxAutoComplete=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),h=require("@duxweb/dvha-core"),y=require("@vueuse/core"),r=require("naive-ui"),g=a.defineComponent({name:"DuxMention",props:{path:String,params:Object,labelField:{type:String,default:"name"},valueField:{type:String,default:"name"}},extends:r.NMention,setup(e,{emit:s,slots:d}){const u=y.useVModel(e,"value",s,{passive:!0,defaultValue:e.defaultValue}),t=a.ref([]),l=a.ref(!1),o=a.toRef(e,"path"),v=a.toRef(e,"params",{}),{mutateAsync:c}=h.useCustomMutation({path:o.value,query:v.value,method:"GET"}),m=n=>{if(!o.value||!n){t.value=[];return}l.value=!0,c({query:{keyword:n,limit:10}}).then(f=>{t.value=f?.data?.map(i=>({label:i[e.labelField||"name"],value:i[e.valueField||"name"]}))||[]}).catch(()=>{t.value=[]}).finally(()=>{l.value=!1})};return()=>a.createVNode(r.NMention,a.mergeProps(e,{value:u.value,"onUpdate:value":n=>u.value=n,options:t.value,onSearch:m,loading:l.value}),{...d})}});exports.DuxMention=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),F=require("@duxweb/dvha-core"),z=require("@vueuse/core"),l=require("naive-ui");function j(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const R=a.defineComponent({name:"DuxSelect",props:{path:String,params:Object,pagination:{type:Boolean,default:!0},avatarField:{type:String},imageField:{type:String},descField:{type:String},multiple:Boolean},extends:l.NSelect,setup(e,{emit:r,slots:n}){const i=a.toRef(e,"params",{}),s=a.toRef(e,"path"),g=z.useVModel(e,"value",r,{passive:!0,defaultValue:e.defaultValue}),u=a.toRef(e,"labelField","name"),S=a.toRef(e,"valueField","id"),d=a.toRef(e,"avatarField",""),o=a.toRef(e,"imageField",""),c=a.toRef(e,"descField",""),{onSearch:p,loading:V,pagination:f,options:w,pageCount:h}=F.useSelect({path:s.value||"",params:i.value,defaultValue:g.value,pagination:e.pagination,optionLabel:u.value,optionValue:S.value}),y=a.computed(()=>{const{labelField:t,valueField:N,avatarField:v,imageField:x,descField:C,...b}=e;return b});return()=>a.createVNode(l.NSelect,a.mergeProps(y.value,{onSearch:p,loading:V.value,filterable:!!e.pagination,clearable:!0,remote:!0,options:w.value,value:g.value,"onUpdate:value":t=>g.value=t,multiple:e.multiple,onClear:()=>{p("")},renderLabel:t=>o.value||c.value?a.createVNode(l.NSpace,{align:"center",size:"small",wrapItem:!1,style:{padding:"6px 0"}},{default:()=>[o.value&&a.createVNode(l.NImage,{src:t?.raw?.[o.value],objectFit:"cover",width:32,height:32},null),d.value&&a.createVNode(l.NAvatar,{round:!0,src:t?.raw?.[d.value],size:32},{default:()=>[t?.raw?.[u.value]?.charAt?.(0)]}),a.createVNode(l.NSpace,{vertical:!0,size:0,wrapItem:!1},{default:()=>[a.createVNode("div",null,[t?.raw?.[u.value]]),c.value&&a.createVNode("div",{style:{opacity:.6}},[t?.raw?.[c.value]])]})]}):t?.raw?.[u.value],renderTag:({option:t,handleClose:N})=>{let v;return e.multiple?a.createVNode(l.NTag,{type:"primary",size:e.size,closable:!0,round:!0,onClose:()=>{N()},style:{"--n-padding":"0"}},j(v=m(t,u.value,o.value,d.value,c.value))?v:{default:()=>[v]}):m(t,u.value,o.value,d.value,c.value)}}),{action:()=>e.pagination?a.createVNode(l.NPagination,{size:"small",page:f.value.page,"onUpdate:page":t=>f.value.page=t,pageSlot:3,pageCount:h.value,pageSize:f.value.pageSize},null):null,...n})}});function m(e,r,n,i,s){return n||s||i?a.createVNode(l.NSpace,{align:"center",size:"small",style:{padding:"6px 0"},wrapItem:!1},{default:()=>[n&&a.createVNode(l.NImage,{src:e?.raw?.[n],objectFit:"cover",width:22,height:22},null),i&&a.createVNode(l.NAvatar,{round:!0,src:e?.raw?.[i]||"",size:22},{default:()=>[e?.raw?.[r]?.charAt?.(0)]}),a.createVNode("div",null,[e?.raw?.[r]])]}):e?.raw?.[r]||""}exports.DuxSelect=R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),f=require("@duxweb/dvha-core"),m=require("@vueuse/core"),l=require("naive-ui"),o=a.defineComponent({name:"DuxTransfer",props:{path:String,params:{type:Object},labelField:{type:String,default:"name"},valueField:{type:String,default:"id"},imageField:{type:String},descField:{type:String}},extends:l.NTransfer,setup(e,{emit:n}){const d=m.useVModel(e,"value",n,{passive:!0,defaultValue:e.defaultValue||[]}),u=a.toRef(e,"path",""),s=a.toRef(e,"params",{}),r=a.ref([]),{data:c,isLoading:v}=f.useList({path:u.value,filters:s.value});return a.watch(c,t=>{r.value=t?.value?.data?.map(i=>({label:i[e.labelField||"name"],value:i[e.valueField||"id"],raw:i}))||[]},{immediate:!0}),()=>a.createVNode("div",{class:"w-full"},[a.createVNode(l.NSpin,{show:v.value},{default:()=>[a.createVNode(l.NTransfer,a.mergeProps(e,{value:d.value,"onUpdate:value":t=>d.value=t,options:r.value,renderTargetLabel:({option:t})=>e.imageField||e.descField?a.createVNode("div",{style:{padding:"0 6px",display:"flex",alignItems:"center",gap:"4px"}},[e.imageField&&a.createVNode(l.NAvatar,{round:!0,src:t?.raw[e.imageField],size:32},null),a.createVNode("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center"}},[a.createVNode("div",null,[t?.raw[e.labelField||"name"]]),e.descField&&a.createVNode("div",{style:{opacity:.6}},[t?.raw[e.descField||"desc"]])])]):t?.raw[e.labelField||"name"]}),null)]})])}});exports.DuxTransfer=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("@duxweb/dvha-core"),f=require("@vueuse/core"),r=require("naive-ui"),x=e.defineComponent({name:"DuxTree",props:{path:String,params:Object,height:String,value:Array,defaultValue:Array,hookProps:Object},extends:r.NTree,setup(a,{emit:l}){const d=e.toRef(a,"params",{}),n=e.toRef(a,"path",""),o=f.useVModel(a,"value",l,{passive:!0,deep:!0,defaultValue:a.defaultValue||[]}),u=e.ref([]),{options:s,loading:c,expanded:h}=v.useTree({path:n.value,params:d.value,...a.hookProps});e.watch(h,t=>{u.value=t});const i=e.computed(()=>{const{hookProps:t,height:g,...p}=a;return p});return()=>e.createVNode(r.NSpin,{show:c.value},{default:()=>[e.createVNode(r.NScrollbar,{style:{height:a.height||"300px"}},{default:()=>[e.createVNode(r.NTree,e.mergeProps(i.value,{cascade:!0,checkable:!0,defaultExpandAll:!0,selectable:!1,expandedKeys:u.value,onUpdateExpandedKeys:t=>{u.value=t},data:s.value||[],checkedKeys:o.value||[],onUpdateCheckedKeys:t=>{o.value=t,a.onUpdateValue?.(t)}}),null)]})]})}});exports.DuxTree=x;
|
package/dist/cjs/hooks/menu.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@duxweb/dvha-core"),r=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@duxweb/dvha-core"),r=require("vue"),a=require("vue-router");function s(t){const n=o.useMenu(t);return{options:r.computed(()=>{const u=n.getMenu(!0).map(e=>({...e,key:e.name,icon:e?.icon?()=>r.h("div",{class:`${e.icon} size-5`}):void 0,labelName:e.label,label:()=>e.path?r.h(a.RouterLink,{to:{path:e.path}},{default:()=>e.label}):e.label}));return o.arrayToTree(u,{idKey:"key",parentKey:"parent",childrenKey:"children",sortKey:"sort"},void 0)}),...n}}exports.useNaiveMenu=s;
|
package/dist/cjs/hooks/table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("@duxweb/dvha-core"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("@duxweb/dvha-core"),m=require("@vueuse/core"),C=require("lodash-es"),o=require("vue");function E(l){const d=o.toRef(l,"filters",{}),v=o.toRef(l,"sorters",{}),i=o.toRef(l,"columns",[]),u=o.ref({}),p=o.ref([]),c=o.ref({...d.value,...u.value});m.watchDebounced([d,u],([e,n])=>{Object.keys(c.value).forEach(t=>{delete c.value[t]}),Object.assign(c.value,e,n)},{debounce:300,deep:!0});const a=U.useExtendList({...l,filters:c.value,sorters:v.value}),r=o.ref([]);o.watch(i,e=>{r.value=e},{immediate:!0});const f=o.computed(()=>r.value.filter(e=>e.show!==!1&&"key"in e).map(e=>e.key)),g=e=>{const n=C.cloneDeep(i.value)?.map(t=>(!("key"in t)||!t?.key||!("title"in t)||!t?.title||e.includes(t.key)||(t.show=!1),t));r.value=[...n]},h=e=>{a.checkeds.value=e},y=e=>{const n=Array.isArray(e)?e:[e],t={};n?.forEach(s=>{s?.columnKey&&s.order&&(t[s.columnKey]=s.order==="ascend"?"asc":"desc")}),a.onUpdateSorters(t)},b=e=>{const n={...u.value};Object.entries(e).forEach(([t,s])=>{n[t]=s}),u.value=n},S=e=>{p.value=e},w=o.computed(()=>({page:a.page.value,pageSize:a.pageSize.value,pageCount:a.pageCount.value,pageSizes:a.pageSizes,pageSlot:5,onUpdatePage:a.onUpdatePage,onUpdatePageSize:a.onUpdatePageSize,showSizePicker:!0,showQuickJumper:!0})),k=o.computed(()=>({remote:!0,checkedRowKeys:a.checkeds.value,expandedRowKeys:p.value,onUpdateCheckedRowKeys:h,onUpdateExpandedRowKeys:S,onUpdateSorter:y,onUpdateFilters:b,loading:a.isLoading.value,data:a.list.value,columns:r.value.filter(e=>e.show!==!1)}));return{...a,tablePagination:w,table:k,columns:r,columnSelected:f,onUpdateColumnSelected:g}}exports.useNaiveTable=E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@duxweb/dvha-core"),p=require("vue");function g(a){const r=l.useUpload(a),t=new Map;return p.watch(()=>r.uploadFiles.value,n=>{n.forEach(e=>{const s=t.get(e.id);s&&(e.status==="uploading"&&e.progress&&s.onProgress?s.onProgress({percent:e.progress.percent||0}):e.status==="success"?(s.onFinish?.(),t.delete(e.id)):e.status==="error"&&(s.onError?.(),t.delete(e.id)))})},{deep:!0}),{...r,request:n=>{const{file:e,onFinish:s,onError:o,onProgress:c}=n,i=e.file;if(!i){o?.();return}r.addFiles([i],"file").then(()=>{const u=r.uploadFiles.value.find(d=>d.file===i);if(!u){o?.();return}t.set(u.id,{onFinish:s,onError:o,onProgress:c}),r.trigger().catch(()=>{t.delete(u.id),o?.()})}).catch(()=>{o?.()})}}}exports.useNaiveUpload=g;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useSelect as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { NAutoComplete as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as v, toRef as l, watch as f, createVNode as s, mergeProps as c } from "vue";
|
|
2
|
+
import { useSelect as g } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as h } from "@vueuse/core";
|
|
4
|
+
import { NAutoComplete as o } from "naive-ui";
|
|
5
|
+
const x = /* @__PURE__ */ v({
|
|
6
6
|
name: "DuxAutoComplete",
|
|
7
7
|
props: {
|
|
8
8
|
path: String,
|
|
@@ -21,46 +21,43 @@ const y = /* @__PURE__ */ f({
|
|
|
21
21
|
},
|
|
22
22
|
multiple: Boolean
|
|
23
23
|
},
|
|
24
|
-
extends:
|
|
24
|
+
extends: o,
|
|
25
25
|
setup(e, {
|
|
26
|
-
emit:
|
|
27
|
-
slots:
|
|
26
|
+
emit: u,
|
|
27
|
+
slots: n
|
|
28
28
|
}) {
|
|
29
|
-
const a =
|
|
29
|
+
const a = h(e, "value", u, {
|
|
30
30
|
passive: !0,
|
|
31
31
|
defaultValue: e.defaultValue || void 0
|
|
32
|
-
}),
|
|
33
|
-
onSearch:
|
|
34
|
-
loading:
|
|
35
|
-
options:
|
|
36
|
-
} =
|
|
37
|
-
path:
|
|
38
|
-
params:
|
|
32
|
+
}), i = l(e, "path"), m = l(e, "params", {}), {
|
|
33
|
+
onSearch: d,
|
|
34
|
+
loading: r,
|
|
35
|
+
options: p
|
|
36
|
+
} = g({
|
|
37
|
+
path: i.value || "",
|
|
38
|
+
params: m.value,
|
|
39
39
|
pagination: e.pagination,
|
|
40
40
|
optionValue: e.valueField || "id"
|
|
41
41
|
});
|
|
42
|
-
return
|
|
43
|
-
|
|
42
|
+
return f(a, () => {
|
|
43
|
+
d(a.value || "");
|
|
44
44
|
}, {
|
|
45
45
|
immediate: !0
|
|
46
|
-
}), () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
...i
|
|
60
|
-
});
|
|
61
|
-
};
|
|
46
|
+
}), () => s(o, c(e, {
|
|
47
|
+
loading: r.value,
|
|
48
|
+
clearable: !0,
|
|
49
|
+
options: p.value?.map((t) => ({
|
|
50
|
+
label: t[e.labelField || "name"],
|
|
51
|
+
value: t[e.valueField || "id"]
|
|
52
|
+
})),
|
|
53
|
+
showEmpty: !0,
|
|
54
|
+
value: a.value,
|
|
55
|
+
"onUpdate:value": (t) => a.value = t
|
|
56
|
+
}), {
|
|
57
|
+
...n
|
|
58
|
+
});
|
|
62
59
|
}
|
|
63
60
|
});
|
|
64
61
|
export {
|
|
65
|
-
|
|
62
|
+
x as DuxAutoComplete
|
|
66
63
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCustomMutation as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { NMention as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as h, ref as i, toRef as m, createVNode as y, mergeProps as g } from "vue";
|
|
2
|
+
import { useCustomMutation as M } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as S } from "@vueuse/core";
|
|
4
|
+
import { NMention as r } from "naive-ui";
|
|
5
|
+
const q = /* @__PURE__ */ h({
|
|
6
6
|
name: "DuxMention",
|
|
7
7
|
props: {
|
|
8
8
|
path: String,
|
|
@@ -16,53 +16,52 @@ const C = /* @__PURE__ */ y({
|
|
|
16
16
|
default: "name"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
extends:
|
|
19
|
+
extends: r,
|
|
20
20
|
setup(e, {
|
|
21
|
-
emit:
|
|
22
|
-
slots:
|
|
21
|
+
emit: d,
|
|
22
|
+
slots: s
|
|
23
23
|
}) {
|
|
24
|
-
const
|
|
24
|
+
const n = S(e, "value", d, {
|
|
25
25
|
passive: !0,
|
|
26
26
|
defaultValue: e.defaultValue
|
|
27
|
-
}), a =
|
|
28
|
-
mutateAsync:
|
|
29
|
-
} =
|
|
30
|
-
path:
|
|
31
|
-
query:
|
|
27
|
+
}), a = i([]), l = i(!1), u = m(e, "path"), v = m(e, "params", {}), {
|
|
28
|
+
mutateAsync: c
|
|
29
|
+
} = M({
|
|
30
|
+
path: u.value,
|
|
31
|
+
query: v.value,
|
|
32
32
|
method: "GET"
|
|
33
|
-
}),
|
|
34
|
-
if (!
|
|
33
|
+
}), f = (t) => {
|
|
34
|
+
if (!u.value || !t) {
|
|
35
35
|
a.value = [];
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
l.value = !0,
|
|
38
|
+
l.value = !0, c({
|
|
39
39
|
query: {
|
|
40
40
|
keyword: t,
|
|
41
41
|
limit: 10
|
|
42
42
|
}
|
|
43
|
-
}).then((
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}))) || [];
|
|
43
|
+
}).then((p) => {
|
|
44
|
+
a.value = p?.data?.map((o) => ({
|
|
45
|
+
label: o[e.labelField || "name"],
|
|
46
|
+
value: o[e.valueField || "name"]
|
|
47
|
+
})) || [];
|
|
49
48
|
}).catch(() => {
|
|
50
49
|
a.value = [];
|
|
51
50
|
}).finally(() => {
|
|
52
51
|
l.value = !1;
|
|
53
52
|
});
|
|
54
53
|
};
|
|
55
|
-
return () =>
|
|
56
|
-
value:
|
|
57
|
-
"onUpdate:value": (t) =>
|
|
54
|
+
return () => y(r, g(e, {
|
|
55
|
+
value: n.value,
|
|
56
|
+
"onUpdate:value": (t) => n.value = t,
|
|
58
57
|
options: a.value,
|
|
59
|
-
onSearch:
|
|
58
|
+
onSearch: f,
|
|
60
59
|
loading: l.value
|
|
61
60
|
}), {
|
|
62
|
-
...
|
|
61
|
+
...s
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
});
|
|
66
65
|
export {
|
|
67
|
-
|
|
66
|
+
q as DuxMention
|
|
68
67
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useSelect as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { NSelect as
|
|
5
|
-
function
|
|
6
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
1
|
+
import { defineComponent as C, toRef as t, computed as I, createVNode as l, mergeProps as A, isVNode as O } from "vue";
|
|
2
|
+
import { useSelect as P } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as T } from "@vueuse/core";
|
|
4
|
+
import { NSelect as S, NTag as B, NSpace as m, NImage as F, NAvatar as y, NPagination as D } from "naive-ui";
|
|
5
|
+
function L(e) {
|
|
6
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !O(e);
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const E = /* @__PURE__ */ C({
|
|
9
9
|
name: "DuxSelect",
|
|
10
10
|
props: {
|
|
11
11
|
path: String,
|
|
@@ -25,130 +25,117 @@ const G = /* @__PURE__ */ O({
|
|
|
25
25
|
},
|
|
26
26
|
multiple: Boolean
|
|
27
27
|
},
|
|
28
|
-
extends:
|
|
28
|
+
extends: S,
|
|
29
29
|
setup(e, {
|
|
30
|
-
emit:
|
|
31
|
-
slots:
|
|
30
|
+
emit: n,
|
|
31
|
+
slots: r
|
|
32
32
|
}) {
|
|
33
|
-
const
|
|
33
|
+
const i = t(e, "params", {}), s = t(e, "path"), g = T(e, "value", n, {
|
|
34
34
|
passive: !0,
|
|
35
35
|
defaultValue: e.defaultValue
|
|
36
|
-
}),
|
|
37
|
-
onSearch:
|
|
38
|
-
loading:
|
|
39
|
-
pagination:
|
|
40
|
-
options:
|
|
41
|
-
pageCount:
|
|
42
|
-
} =
|
|
43
|
-
path:
|
|
44
|
-
params:
|
|
45
|
-
defaultValue:
|
|
36
|
+
}), u = t(e, "labelField", "name"), b = t(e, "valueField", "id"), c = t(e, "avatarField", ""), o = t(e, "imageField", ""), d = t(e, "descField", ""), {
|
|
37
|
+
onSearch: f,
|
|
38
|
+
loading: z,
|
|
39
|
+
pagination: p,
|
|
40
|
+
options: N,
|
|
41
|
+
pageCount: V
|
|
42
|
+
} = P({
|
|
43
|
+
path: s.value || "",
|
|
44
|
+
params: i.value,
|
|
45
|
+
defaultValue: g.value,
|
|
46
46
|
pagination: e.pagination,
|
|
47
|
-
optionLabel:
|
|
48
|
-
optionValue:
|
|
49
|
-
}),
|
|
47
|
+
optionLabel: u.value,
|
|
48
|
+
optionValue: b.value
|
|
49
|
+
}), j = I(() => {
|
|
50
50
|
const {
|
|
51
51
|
labelField: a,
|
|
52
|
-
valueField:
|
|
53
|
-
avatarField:
|
|
54
|
-
imageField:
|
|
55
|
-
descField:
|
|
56
|
-
...
|
|
52
|
+
valueField: w,
|
|
53
|
+
avatarField: v,
|
|
54
|
+
imageField: U,
|
|
55
|
+
descField: _,
|
|
56
|
+
...x
|
|
57
57
|
} = e;
|
|
58
|
-
return
|
|
58
|
+
return x;
|
|
59
59
|
});
|
|
60
|
-
return () => l(
|
|
61
|
-
onSearch:
|
|
62
|
-
loading:
|
|
60
|
+
return () => l(S, A(j.value, {
|
|
61
|
+
onSearch: f,
|
|
62
|
+
loading: z.value,
|
|
63
63
|
filterable: !!e.pagination,
|
|
64
64
|
clearable: !0,
|
|
65
65
|
remote: !0,
|
|
66
|
-
options:
|
|
67
|
-
value:
|
|
68
|
-
"onUpdate:value": (a) =>
|
|
66
|
+
options: N.value,
|
|
67
|
+
value: g.value,
|
|
68
|
+
"onUpdate:value": (a) => g.value = a,
|
|
69
69
|
multiple: e.multiple,
|
|
70
70
|
onClear: () => {
|
|
71
|
-
|
|
71
|
+
f("");
|
|
72
72
|
},
|
|
73
|
-
renderLabel: (a) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
renderLabel: (a) => o.value || d.value ? l(m, {
|
|
74
|
+
align: "center",
|
|
75
|
+
size: "small",
|
|
76
|
+
wrapItem: !1,
|
|
77
|
+
style: {
|
|
78
|
+
padding: "6px 0"
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
default: () => [o.value && l(F, {
|
|
82
|
+
src: a?.raw?.[o.value],
|
|
83
|
+
objectFit: "cover",
|
|
84
|
+
width: 32,
|
|
85
|
+
height: 32
|
|
86
|
+
}, null), c.value && l(y, {
|
|
87
|
+
round: !0,
|
|
88
|
+
src: a?.raw?.[c.value],
|
|
89
|
+
size: 32
|
|
82
90
|
}, {
|
|
83
|
-
default: () =>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var g, t, z;
|
|
97
|
-
return [(z = (t = (g = a == null ? void 0 : a.raw) == null ? void 0 : g[r.value]) == null ? void 0 : t.charAt) == null ? void 0 : z.call(t, 0)];
|
|
98
|
-
}
|
|
99
|
-
}), l(p, {
|
|
100
|
-
vertical: !0,
|
|
101
|
-
size: 0,
|
|
102
|
-
wrapItem: !1
|
|
103
|
-
}, {
|
|
104
|
-
default: () => {
|
|
105
|
-
var g, t;
|
|
106
|
-
return [l("div", null, [(g = a == null ? void 0 : a.raw) == null ? void 0 : g[r.value]]), u.value && l("div", {
|
|
107
|
-
style: {
|
|
108
|
-
opacity: 0.6
|
|
109
|
-
}
|
|
110
|
-
}, [(t = a == null ? void 0 : a.raw) == null ? void 0 : t[u.value]])];
|
|
111
|
-
}
|
|
112
|
-
})];
|
|
113
|
-
}
|
|
114
|
-
}) : (S = a == null ? void 0 : a.raw) == null ? void 0 : S[r.value];
|
|
115
|
-
},
|
|
91
|
+
default: () => [a?.raw?.[u.value]?.charAt?.(0)]
|
|
92
|
+
}), l(m, {
|
|
93
|
+
vertical: !0,
|
|
94
|
+
size: 0,
|
|
95
|
+
wrapItem: !1
|
|
96
|
+
}, {
|
|
97
|
+
default: () => [l("div", null, [a?.raw?.[u.value]]), d.value && l("div", {
|
|
98
|
+
style: {
|
|
99
|
+
opacity: 0.6
|
|
100
|
+
}
|
|
101
|
+
}, [a?.raw?.[d.value]])]
|
|
102
|
+
})]
|
|
103
|
+
}) : a?.raw?.[u.value],
|
|
116
104
|
renderTag: ({
|
|
117
105
|
option: a,
|
|
118
|
-
handleClose:
|
|
106
|
+
handleClose: w
|
|
119
107
|
}) => {
|
|
120
|
-
let
|
|
121
|
-
return e.multiple ? l(
|
|
108
|
+
let v;
|
|
109
|
+
return e.multiple ? l(B, {
|
|
122
110
|
type: "primary",
|
|
123
111
|
size: e.size,
|
|
124
112
|
closable: !0,
|
|
125
113
|
round: !0,
|
|
126
114
|
onClose: () => {
|
|
127
|
-
|
|
115
|
+
w();
|
|
128
116
|
},
|
|
129
117
|
style: {
|
|
130
118
|
"--n-padding": "0"
|
|
131
119
|
}
|
|
132
|
-
},
|
|
133
|
-
default: () => [
|
|
134
|
-
}) :
|
|
120
|
+
}, L(v = h(a, u.value, o.value, c.value, d.value)) ? v : {
|
|
121
|
+
default: () => [v]
|
|
122
|
+
}) : h(a, u.value, o.value, c.value, d.value);
|
|
135
123
|
}
|
|
136
124
|
}), {
|
|
137
|
-
action: () => e.pagination ? l(
|
|
125
|
+
action: () => e.pagination ? l(D, {
|
|
138
126
|
size: "small",
|
|
139
|
-
page:
|
|
140
|
-
"onUpdate:page": (a) =>
|
|
127
|
+
page: p.value.page,
|
|
128
|
+
"onUpdate:page": (a) => p.value.page = a,
|
|
141
129
|
pageSlot: 3,
|
|
142
|
-
pageCount:
|
|
143
|
-
pageSize:
|
|
130
|
+
pageCount: V.value,
|
|
131
|
+
pageSize: p.value.pageSize
|
|
144
132
|
}, null) : null,
|
|
145
|
-
...
|
|
133
|
+
...r
|
|
146
134
|
});
|
|
147
135
|
}
|
|
148
136
|
});
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
return f || F || o ? l(p, {
|
|
137
|
+
function h(e, n, r, i, s) {
|
|
138
|
+
return r || s || i ? l(m, {
|
|
152
139
|
align: "center",
|
|
153
140
|
size: "small",
|
|
154
141
|
style: {
|
|
@@ -156,26 +143,20 @@ function V(e, i, f, o, F) {
|
|
|
156
143
|
},
|
|
157
144
|
wrapItem: !1
|
|
158
145
|
}, {
|
|
159
|
-
default: () => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
var n, u, w;
|
|
173
|
-
return [(w = (u = (n = e == null ? void 0 : e.raw) == null ? void 0 : n[i]) == null ? void 0 : u.charAt) == null ? void 0 : w.call(u, 0)];
|
|
174
|
-
}
|
|
175
|
-
}), l("div", null, [(d = e == null ? void 0 : e.raw) == null ? void 0 : d[i]])];
|
|
176
|
-
}
|
|
177
|
-
}) : ((s = e == null ? void 0 : e.raw) == null ? void 0 : s[i]) || "";
|
|
146
|
+
default: () => [r && l(F, {
|
|
147
|
+
src: e?.raw?.[r],
|
|
148
|
+
objectFit: "cover",
|
|
149
|
+
width: 22,
|
|
150
|
+
height: 22
|
|
151
|
+
}, null), i && l(y, {
|
|
152
|
+
round: !0,
|
|
153
|
+
src: e?.raw?.[i] || "",
|
|
154
|
+
size: 22
|
|
155
|
+
}, {
|
|
156
|
+
default: () => [e?.raw?.[n]?.charAt?.(0)]
|
|
157
|
+
}), l("div", null, [e?.raw?.[n]])]
|
|
158
|
+
}) : e?.raw?.[n] || "";
|
|
178
159
|
}
|
|
179
160
|
export {
|
|
180
|
-
|
|
161
|
+
E as DuxSelect
|
|
181
162
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useList as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { NTransfer as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as v, toRef as n, ref as g, watch as o, createVNode as l, mergeProps as F } from "vue";
|
|
2
|
+
import { useList as y } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as x } from "@vueuse/core";
|
|
4
|
+
import { NTransfer as u, NSpin as b, NAvatar as h } from "naive-ui";
|
|
5
|
+
const V = /* @__PURE__ */ v({
|
|
6
6
|
name: "DuxTransfer",
|
|
7
7
|
props: {
|
|
8
8
|
path: String,
|
|
@@ -24,50 +24,49 @@ const C = /* @__PURE__ */ F({
|
|
|
24
24
|
type: String
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
extends:
|
|
28
|
-
setup(
|
|
29
|
-
emit:
|
|
27
|
+
extends: u,
|
|
28
|
+
setup(e, {
|
|
29
|
+
emit: r
|
|
30
30
|
}) {
|
|
31
|
-
const
|
|
31
|
+
const i = x(e, "value", r, {
|
|
32
32
|
passive: !0,
|
|
33
|
-
defaultValue:
|
|
34
|
-
}),
|
|
35
|
-
data:
|
|
36
|
-
isLoading:
|
|
37
|
-
} =
|
|
38
|
-
path:
|
|
39
|
-
filters:
|
|
33
|
+
defaultValue: e.defaultValue || []
|
|
34
|
+
}), m = n(e, "path", ""), s = n(e, "params", {}), d = g([]), {
|
|
35
|
+
data: f,
|
|
36
|
+
isLoading: c
|
|
37
|
+
} = y({
|
|
38
|
+
path: m.value,
|
|
39
|
+
filters: s.value
|
|
40
40
|
});
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
value: t[a.valueField || "id"],
|
|
41
|
+
return o(f, (a) => {
|
|
42
|
+
d.value = a?.value?.data?.map((t) => ({
|
|
43
|
+
label: t[e.labelField || "name"],
|
|
44
|
+
value: t[e.valueField || "id"],
|
|
46
45
|
raw: t
|
|
47
|
-
}))
|
|
46
|
+
})) || [];
|
|
48
47
|
}, {
|
|
49
48
|
immediate: !0
|
|
50
49
|
}), () => l("div", {
|
|
51
50
|
class: "w-full"
|
|
52
|
-
}, [l(
|
|
53
|
-
show:
|
|
51
|
+
}, [l(b, {
|
|
52
|
+
show: c.value
|
|
54
53
|
}, {
|
|
55
|
-
default: () => [l(
|
|
56
|
-
value:
|
|
57
|
-
"onUpdate:value": (
|
|
58
|
-
options:
|
|
54
|
+
default: () => [l(u, F(e, {
|
|
55
|
+
value: i.value,
|
|
56
|
+
"onUpdate:value": (a) => i.value = a,
|
|
57
|
+
options: d.value,
|
|
59
58
|
renderTargetLabel: ({
|
|
60
|
-
option:
|
|
61
|
-
}) =>
|
|
59
|
+
option: a
|
|
60
|
+
}) => e.imageField || e.descField ? l("div", {
|
|
62
61
|
style: {
|
|
63
62
|
padding: "0 6px",
|
|
64
63
|
display: "flex",
|
|
65
64
|
alignItems: "center",
|
|
66
65
|
gap: "4px"
|
|
67
66
|
}
|
|
68
|
-
}, [
|
|
67
|
+
}, [e.imageField && l(h, {
|
|
69
68
|
round: !0,
|
|
70
|
-
src:
|
|
69
|
+
src: a?.raw[e.imageField],
|
|
71
70
|
size: 32
|
|
72
71
|
}, null), l("div", {
|
|
73
72
|
style: {
|
|
@@ -76,15 +75,15 @@ const C = /* @__PURE__ */ F({
|
|
|
76
75
|
flexDirection: "column",
|
|
77
76
|
justifyContent: "center"
|
|
78
77
|
}
|
|
79
|
-
}, [l("div", null, [
|
|
78
|
+
}, [l("div", null, [a?.raw[e.labelField || "name"]]), e.descField && l("div", {
|
|
80
79
|
style: {
|
|
81
80
|
opacity: 0.6
|
|
82
81
|
}
|
|
83
|
-
}, [
|
|
82
|
+
}, [a?.raw[e.descField || "desc"]])])]) : a?.raw[e.labelField || "name"]
|
|
84
83
|
}), null)]
|
|
85
84
|
})]);
|
|
86
85
|
}
|
|
87
86
|
});
|
|
88
87
|
export {
|
|
89
|
-
|
|
88
|
+
V as DuxTransfer
|
|
90
89
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTree as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { NTree as
|
|
5
|
-
const U = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as f, toRef as l, ref as v, watch as x, computed as g, createVNode as r, mergeProps as y } from "vue";
|
|
2
|
+
import { useTree as k } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as V } from "@vueuse/core";
|
|
4
|
+
import { NTree as u, NSpin as b, NScrollbar as K } from "naive-ui";
|
|
5
|
+
const U = /* @__PURE__ */ f({
|
|
6
6
|
name: "DuxTree",
|
|
7
7
|
props: {
|
|
8
8
|
path: String,
|
|
@@ -12,43 +12,43 @@ const U = /* @__PURE__ */ v({
|
|
|
12
12
|
defaultValue: Array,
|
|
13
13
|
hookProps: Object
|
|
14
14
|
},
|
|
15
|
-
extends:
|
|
15
|
+
extends: u,
|
|
16
16
|
setup(e, {
|
|
17
|
-
emit:
|
|
17
|
+
emit: d
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
19
|
+
const n = l(e, "params", {}), s = l(e, "path", ""), o = V(e, "value", d, {
|
|
20
20
|
passive: !0,
|
|
21
21
|
deep: !0,
|
|
22
22
|
defaultValue: e.defaultValue || []
|
|
23
|
-
}), t =
|
|
24
|
-
options:
|
|
25
|
-
loading:
|
|
26
|
-
expanded:
|
|
27
|
-
} =
|
|
28
|
-
path:
|
|
29
|
-
params:
|
|
23
|
+
}), t = v([]), {
|
|
24
|
+
options: p,
|
|
25
|
+
loading: c,
|
|
26
|
+
expanded: h
|
|
27
|
+
} = k({
|
|
28
|
+
path: s.value,
|
|
29
|
+
params: n.value,
|
|
30
30
|
...e.hookProps
|
|
31
31
|
});
|
|
32
|
-
|
|
32
|
+
x(h, (a) => {
|
|
33
33
|
t.value = a;
|
|
34
34
|
});
|
|
35
|
-
const
|
|
35
|
+
const m = g(() => {
|
|
36
36
|
const {
|
|
37
37
|
hookProps: a,
|
|
38
|
-
height:
|
|
39
|
-
...
|
|
38
|
+
height: P,
|
|
39
|
+
...i
|
|
40
40
|
} = e;
|
|
41
|
-
return
|
|
41
|
+
return i;
|
|
42
42
|
});
|
|
43
|
-
return () =>
|
|
44
|
-
show:
|
|
43
|
+
return () => r(b, {
|
|
44
|
+
show: c.value
|
|
45
45
|
}, {
|
|
46
|
-
default: () => [
|
|
46
|
+
default: () => [r(K, {
|
|
47
47
|
style: {
|
|
48
48
|
height: e.height || "300px"
|
|
49
49
|
}
|
|
50
50
|
}, {
|
|
51
|
-
default: () => [u
|
|
51
|
+
default: () => [r(u, y(m.value, {
|
|
52
52
|
cascade: !0,
|
|
53
53
|
checkable: !0,
|
|
54
54
|
defaultExpandAll: !0,
|
|
@@ -57,11 +57,10 @@ const U = /* @__PURE__ */ v({
|
|
|
57
57
|
onUpdateExpandedKeys: (a) => {
|
|
58
58
|
t.value = a;
|
|
59
59
|
},
|
|
60
|
-
data:
|
|
61
|
-
checkedKeys:
|
|
60
|
+
data: p.value || [],
|
|
61
|
+
checkedKeys: o.value || [],
|
|
62
62
|
onUpdateCheckedKeys: (a) => {
|
|
63
|
-
|
|
64
|
-
r.value = a, (l = e.onUpdateValue) == null || l.call(e, a);
|
|
63
|
+
o.value = a, e.onUpdateValue?.(a);
|
|
65
64
|
}
|
|
66
65
|
}), null)]
|
|
67
66
|
})]
|
package/dist/esm/hooks/menu.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { useMenu as
|
|
1
|
+
import { useMenu as a, arrayToTree as u } from "@duxweb/dvha-core";
|
|
2
2
|
import { computed as l, h as o } from "vue";
|
|
3
3
|
import { RouterLink as p } from "vue-router";
|
|
4
|
-
function
|
|
5
|
-
const
|
|
4
|
+
function y(n) {
|
|
5
|
+
const r = a(n);
|
|
6
6
|
return {
|
|
7
7
|
options: l(() => {
|
|
8
|
-
const
|
|
9
|
-
...
|
|
10
|
-
key:
|
|
11
|
-
icon:
|
|
12
|
-
class: `${
|
|
8
|
+
const t = r.getMenu(!0).map((e) => ({
|
|
9
|
+
...e,
|
|
10
|
+
key: e.name,
|
|
11
|
+
icon: e?.icon ? () => o("div", {
|
|
12
|
+
class: `${e.icon} size-5`
|
|
13
13
|
}) : void 0,
|
|
14
|
-
labelName:
|
|
15
|
-
label: () =>
|
|
14
|
+
labelName: e.label,
|
|
15
|
+
label: () => e.path ? o(
|
|
16
16
|
p,
|
|
17
17
|
{
|
|
18
18
|
to: {
|
|
19
|
-
path:
|
|
19
|
+
path: e.path
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
{ default: () =>
|
|
23
|
-
) :
|
|
22
|
+
{ default: () => e.label }
|
|
23
|
+
) : e.label
|
|
24
24
|
}));
|
|
25
|
-
return u(
|
|
25
|
+
return u(t, {
|
|
26
26
|
idKey: "key",
|
|
27
27
|
parentKey: "parent",
|
|
28
28
|
childrenKey: "children",
|
|
29
29
|
sortKey: "sort"
|
|
30
30
|
}, void 0);
|
|
31
31
|
}),
|
|
32
|
-
...
|
|
32
|
+
...r
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
y as useNaiveMenu
|
|
37
37
|
};
|
package/dist/esm/hooks/table.js
CHANGED
|
@@ -1,81 +1,80 @@
|
|
|
1
|
-
import { useExtendList as
|
|
2
|
-
import { watchDebounced as
|
|
3
|
-
import { cloneDeep as
|
|
4
|
-
import { toRef as d, ref as c, watch as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
...
|
|
8
|
-
...
|
|
1
|
+
import { useExtendList as x } from "@duxweb/dvha-core";
|
|
2
|
+
import { watchDebounced as z } from "@vueuse/core";
|
|
3
|
+
import { cloneDeep as C } from "lodash-es";
|
|
4
|
+
import { toRef as d, ref as c, watch as E, computed as i } from "vue";
|
|
5
|
+
function j(l) {
|
|
6
|
+
const p = d(l, "filters", {}), g = d(l, "sorters", {}), f = d(l, "columns", []), r = c({}), v = c([]), u = c({
|
|
7
|
+
...p.value,
|
|
8
|
+
...r.value
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
Object.keys(u.value).forEach((
|
|
12
|
-
delete u.value[
|
|
13
|
-
}), Object.assign(u.value, e,
|
|
10
|
+
z([p, r], ([e, o]) => {
|
|
11
|
+
Object.keys(u.value).forEach((t) => {
|
|
12
|
+
delete u.value[t];
|
|
13
|
+
}), Object.assign(u.value, e, o);
|
|
14
14
|
}, {
|
|
15
15
|
debounce: 300,
|
|
16
16
|
deep: !0
|
|
17
17
|
});
|
|
18
|
-
const
|
|
19
|
-
...
|
|
18
|
+
const a = x({
|
|
19
|
+
...l,
|
|
20
20
|
filters: u.value,
|
|
21
21
|
sorters: g.value
|
|
22
22
|
}), s = c([]);
|
|
23
|
-
|
|
23
|
+
E(f, (e) => {
|
|
24
24
|
s.value = e;
|
|
25
25
|
}, {
|
|
26
26
|
immediate: !0
|
|
27
27
|
});
|
|
28
|
-
const h =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
s.value = [...t];
|
|
28
|
+
const h = i(() => s.value.filter((e) => e.show !== !1 && "key" in e).map((e) => e.key)), w = (e) => {
|
|
29
|
+
const o = C(f.value)?.map((t) => (!("key" in t) || !t?.key || !("title" in t) || !t?.title || e.includes(t.key) || (t.show = !1), t));
|
|
30
|
+
s.value = [...o];
|
|
32
31
|
}, y = (e) => {
|
|
33
|
-
|
|
32
|
+
a.checkeds.value = e;
|
|
34
33
|
}, k = (e) => {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
40
|
-
const
|
|
41
|
-
...
|
|
34
|
+
const o = Array.isArray(e) ? e : [e], t = {};
|
|
35
|
+
o?.forEach((n) => {
|
|
36
|
+
n?.columnKey && n.order && (t[n.columnKey] = n.order === "ascend" ? "asc" : "desc");
|
|
37
|
+
}), a.onUpdateSorters(t);
|
|
38
|
+
}, m = (e) => {
|
|
39
|
+
const o = {
|
|
40
|
+
...r.value
|
|
42
41
|
};
|
|
43
|
-
Object.entries(e).forEach(([
|
|
44
|
-
t
|
|
45
|
-
}),
|
|
46
|
-
},
|
|
42
|
+
Object.entries(e).forEach(([t, n]) => {
|
|
43
|
+
o[t] = n;
|
|
44
|
+
}), r.value = o;
|
|
45
|
+
}, S = (e) => {
|
|
47
46
|
v.value = e;
|
|
48
|
-
},
|
|
49
|
-
page:
|
|
50
|
-
pageSize:
|
|
51
|
-
pageCount:
|
|
52
|
-
pageSizes:
|
|
47
|
+
}, U = i(() => ({
|
|
48
|
+
page: a.page.value,
|
|
49
|
+
pageSize: a.pageSize.value,
|
|
50
|
+
pageCount: a.pageCount.value,
|
|
51
|
+
pageSizes: a.pageSizes,
|
|
53
52
|
pageSlot: 5,
|
|
54
|
-
onUpdatePage:
|
|
55
|
-
onUpdatePageSize:
|
|
53
|
+
onUpdatePage: a.onUpdatePage,
|
|
54
|
+
onUpdatePageSize: a.onUpdatePageSize,
|
|
56
55
|
showSizePicker: !0,
|
|
57
56
|
showQuickJumper: !0
|
|
58
|
-
})),
|
|
57
|
+
})), b = i(() => ({
|
|
59
58
|
remote: !0,
|
|
60
|
-
checkedRowKeys:
|
|
59
|
+
checkedRowKeys: a.checkeds.value,
|
|
61
60
|
expandedRowKeys: v.value,
|
|
62
61
|
onUpdateCheckedRowKeys: y,
|
|
63
|
-
onUpdateExpandedRowKeys:
|
|
62
|
+
onUpdateExpandedRowKeys: S,
|
|
64
63
|
onUpdateSorter: k,
|
|
65
|
-
onUpdateFilters:
|
|
66
|
-
loading:
|
|
67
|
-
data:
|
|
64
|
+
onUpdateFilters: m,
|
|
65
|
+
loading: a.isLoading.value,
|
|
66
|
+
data: a.list.value,
|
|
68
67
|
columns: s.value.filter((e) => e.show !== !1)
|
|
69
68
|
}));
|
|
70
69
|
return {
|
|
71
|
-
...
|
|
72
|
-
tablePagination:
|
|
73
|
-
table:
|
|
70
|
+
...a,
|
|
71
|
+
tablePagination: U,
|
|
72
|
+
table: b,
|
|
74
73
|
columns: s,
|
|
75
74
|
columnSelected: h,
|
|
76
75
|
onUpdateColumnSelected: w
|
|
77
76
|
};
|
|
78
77
|
}
|
|
79
78
|
export {
|
|
80
|
-
|
|
79
|
+
j as useNaiveTable
|
|
81
80
|
};
|
package/dist/esm/hooks/upload.js
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import { useUpload as
|
|
2
|
-
import { watch as
|
|
3
|
-
function F(
|
|
4
|
-
const
|
|
5
|
-
return
|
|
6
|
-
() =>
|
|
7
|
-
(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}) : s.status === "success" ? ((e = t.onFinish) == null || e.call(t), u.delete(s.id)) : s.status === "error" && ((n = t.onError) == null || n.call(t), u.delete(s.id)));
|
|
1
|
+
import { useUpload as l } from "@duxweb/dvha-core";
|
|
2
|
+
import { watch as p } from "vue";
|
|
3
|
+
function F(u) {
|
|
4
|
+
const r = l(u), t = /* @__PURE__ */ new Map();
|
|
5
|
+
return p(
|
|
6
|
+
() => r.uploadFiles.value,
|
|
7
|
+
(n) => {
|
|
8
|
+
n.forEach((e) => {
|
|
9
|
+
const s = t.get(e.id);
|
|
10
|
+
s && (e.status === "uploading" && e.progress && s.onProgress ? s.onProgress({
|
|
11
|
+
percent: e.progress.percent || 0
|
|
12
|
+
}) : e.status === "success" ? (s.onFinish?.(), t.delete(e.id)) : e.status === "error" && (s.onError?.(), t.delete(e.id)));
|
|
14
13
|
});
|
|
15
14
|
},
|
|
16
15
|
{ deep: !0 }
|
|
17
16
|
), {
|
|
18
|
-
...
|
|
19
|
-
request: (
|
|
20
|
-
const { file:
|
|
21
|
-
if (!
|
|
22
|
-
|
|
17
|
+
...r,
|
|
18
|
+
request: (n) => {
|
|
19
|
+
const { file: e, onFinish: s, onError: o, onProgress: c } = n, i = e.file;
|
|
20
|
+
if (!i) {
|
|
21
|
+
o?.();
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
|
|
24
|
+
r.addFiles([i], "file").then(() => {
|
|
25
|
+
const a = r.uploadFiles.value.find((d) => d.file === i);
|
|
26
|
+
if (!a) {
|
|
27
|
+
o?.();
|
|
29
28
|
return;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
onFinish:
|
|
33
|
-
onError:
|
|
34
|
-
onProgress:
|
|
35
|
-
}),
|
|
36
|
-
|
|
30
|
+
t.set(a.id, {
|
|
31
|
+
onFinish: s,
|
|
32
|
+
onError: o,
|
|
33
|
+
onProgress: c
|
|
34
|
+
}), r.trigger().catch(() => {
|
|
35
|
+
t.delete(a.id), o?.();
|
|
37
36
|
});
|
|
38
37
|
}).catch(() => {
|
|
39
|
-
|
|
38
|
+
o?.();
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
41
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duxweb/dvha-naiveui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.24",
|
|
5
5
|
"author": "DuxWeb",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"pinia": "^3.0.3",
|
|
34
34
|
"vue": "^3.5.0",
|
|
35
35
|
"vue-router": "^4.5.1",
|
|
36
|
-
"@duxweb/dvha-core": "1.0.
|
|
36
|
+
"@duxweb/dvha-core": "1.0.24"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"clean": "rimraf dist",
|