@duxweb/dvha-pro 1.0.36 → 1.0.38

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 t=require("vue"),y=require("@duxweb/dvha-core"),B=require("@vueuse/core"),L=require("clsx"),s=require("naive-ui"),_=require("../card/card.cjs"),z=t.defineComponent({name:"DuxTreeFilter",props:{title:String,path:String,sortPath:String,params:Object,menus:Array,numField:String,iconField:String,treeOptions:Object,value:Array,defaultValue:Array,onUpdateValue:Function,draggable:Boolean,bordered:{type:Boolean,default:!1}},extends:s.NTree,setup(l,{emit:P,slots:p}){const N=B.useVModel(l,"value",P,{passive:!1,defaultValue:l.defaultValue}),D=t.toRef(l,"params",{}),O=t.toRef(l,"path",""),T=t.toRef(l,"sortPath",""),S=t.ref(),F=t.ref(0),g=t.ref(0),c=t.ref([]),b=t.ref(),{t:k}=y.useI18n(),{options:C,loading:U,expanded:q}=y.useTree({path:O.value,params:D.value,...l.treeOptions});t.watch(C,e=>{c.value=e},{immediate:!0,deep:!0});const v=t.ref(!1),I=t.computed(()=>l.menus?.map(e=>({label:e.label,key:e.value,icon:e?.icon?()=>t.createVNode("div",{class:e?.icon},null):void 0,onSelect:e.onSelect}))||[]),K=e=>{const a=l.menus?.find(n=>n.value===e);a&&a.onSelect(S.value),v.value=!1},j=y.useCustomMutation({path:T.value,method:"POST"}),V=(e,a)=>{for(const n of e)if(n.children){for(const m of n.children)if(m.id===a)return n;const d=V(n.children,a);if(d)return d}},A=({node:e,dragNode:a,dropPosition:n})=>{const d=V(c.value,a.id),m=!d,f=[...c.value];if(m){const r=c.value.findIndex(w=>w.id===a.id);r>=0&&f.splice(r,1)}else{const r=d?.children?.indexOf(a)||0;d?.children?.splice(r,1)}let u=V(f,e.id),x,o=u?.children||f,i=0;switch(n){case"before":i=o.findIndex(r=>r.id===e.id),i>0&&(x=o[i-1].id);break;case"inside":u=e,o=u.children=u.children||[],i=o.length;break;case"after":i=o.findIndex(r=>r.id===e.id)+1,x=e.id;break}o.splice(i,0,a),c.value=f,j.mutate({payload:{parent_id:u?.id,before_id:x,id:a.id}})},h=t.ref([]);t.watch(q,e=>{h?.value?.length>0||(h.value=e)},{immediate:!0});const M=t.computed(()=>{const{title:e,path:a,sortPath:n,params:d,menus:m,numField:f,iconField:u,treeOptions:x,value:o,defaultValue:i,onUpdateValue:r,bordered:w,...R}=l;return R});return()=>t.createVNode(_.DuxCard,{class:"h-full",contentClass:"flex flex-col",bordered:l.bordered},{default:()=>[l?.title&&t.createVNode("div",{class:"px-2 py-3 pb-1 text-base font-bold"},[l.title]),t.createVNode("div",{class:"p-2 flex gap-2 items-center"},[t.createVNode("div",{class:"flex-1"},[p.header?p.header():t.createVNode(s.NInput,{value:b.value,"onUpdate:value":e=>b.value=e,placeholder:k("common.keyword")},null)]),p.tools?.()]),t.createVNode(s.NScrollbar,{class:"flex-1 min-h-0",xScrollable:!0},{default:()=>[t.createVNode("div",{class:"p-2"},[t.createVNode(s.NSpin,{show:U.value,class:"h-full"},{default:()=>[t.createVNode(s.NTree,t.mergeProps(M.value,{data:c.value||[],expandedKeys:h.value,onUpdateExpandedKeys:e=>{h.value=e},blockLine:!0,selectedKeys:N.value,onUpdateSelectedKeys:e=>{N.value=e,l?.onUpdateValue?.(e)},onDrop:A,pattern:b.value,renderPrefix:l?.numField||l?.iconField?({option:e})=>t.createVNode(t.Fragment,null,[l.iconField&&e[l.iconField]&&t.createVNode("div",{class:L(e[l.iconField]||"","size-4")},null),l.numField&&t.createVNode("div",{class:"rounded-full bg-primary px-2 text-xs text-white"},[e[l.numField]||0])]):void 0,nodeProps:({option:e})=>({onContextmenu:a=>{S.value=e,v.value=!0,F.value=a.clientX,g.value=a.clientY,a.preventDefault()}})}),null)]})])]}),t.createVNode(s.NDropdown,{trigger:"manual",placement:"bottom-start",show:v.value,options:I.value,x:F.value,y:g.value,width:100,onSelect:K,onClickoutside:()=>{v.value=!1}},null)]})}});exports.DuxTreeFilter=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),g=require("@duxweb/dvha-core"),_=require("@vueuse/core"),z=require("clsx"),s=require("naive-ui"),X=require("../card/card.cjs"),Y=t.defineComponent({name:"DuxTreeFilter",props:{title:String,path:String,sortPath:String,params:Object,menus:Array,numField:String,iconField:String,treeOptions:Object,value:Array,defaultValue:Array,onUpdateValue:Function,draggable:Boolean,bordered:{type:Boolean,default:!1}},extends:s.NTree,setup(a,{emit:D,slots:b}){const N=_.useVModel(a,"value",D,{passive:!1,defaultValue:a.defaultValue}),O=t.toRef(a,"params",{}),C=t.toRef(a,"path",""),T=t.toRef(a,"sortPath",""),S=t.ref(),w=t.ref(0),F=t.ref(0),i=t.ref([]),y=t.ref(),{t:K}=g.useI18n(),{options:U,loading:q,expanded:A}=g.useTree({path:C.value,params:O.value,...a.treeOptions});t.watch(U,e=>{i.value=e},{immediate:!0,deep:!0});const x=t.ref(!1),I=t.computed(()=>a.menus?.map(e=>({label:e.label,key:e.value,icon:e?.icon?()=>t.createVNode("div",{class:e?.icon},null):void 0,onSelect:e.onSelect}))||[]),E=e=>{const l=a.menus?.find(n=>n.value===e);l&&l.onSelect(S.value),x.value=!1},j=g.useCustomMutation({path:T.value,method:"POST"}),V=(e,l)=>{for(const n of e)if(n.children){for(const r of n.children)if(r.id===l)return n;const d=V(n.children,l);if(d)return d}},B=({node:e,dragNode:l,dropPosition:n})=>{const d=V(i.value,l.id),r=!d,p=[...i.value];if(r){const o=i.value.findIndex(k=>k.id===l.id);o>=0&&p.splice(o,1)}else{const o=d?.children?.indexOf(l)||0;d?.children?.splice(o,1)}let h=V(p,e.id),m,c=h?.children||p,u=0;switch(n){case"before":u=c.findIndex(o=>o.id===e.id),u>0&&(m=c[u-1].id);break;case"inside":h=e,c=h.children=h.children||[],u=c.length;break;case"after":u=c.findIndex(o=>o.id===e.id)+1,m=e.id;break}c.splice(u,0,l),i.value=p,j.mutate({payload:{parent_id:h?.id,before_id:m,id:l.id}})},f=t.ref([]),v=t.ref(!1);t.watch(A,e=>{f?.value?.length>0||(v.value=e.length>0,f.value=e)},{immediate:!0});const P=e=>{const l=[],n=d=>{d.forEach(r=>{r.children&&r.children.length>0&&(l.push(r.key||r.id),n(r.children))})};return n(e),l},M=()=>{v.value?(f.value=[],v.value=!1):(f.value=P(i.value),v.value=!0)},R=t.computed(()=>{const{title:e,path:l,sortPath:n,params:d,menus:r,numField:p,iconField:h,treeOptions:m,value:c,defaultValue:u,onUpdateValue:o,bordered:k,...L}=a;return L});return()=>t.createVNode(X.DuxCard,{class:"h-full",contentClass:"flex flex-col",bordered:a.bordered},{default:()=>[a?.title&&t.createVNode("div",{class:"px-2 py-3 pb-1 text-base font-bold"},[a.title]),t.createVNode("div",{class:"p-2 flex gap-2 items-center"},[t.createVNode(s.NButton,{onClick:M},{icon:()=>t.createVNode("div",{class:v.value?"i-tabler:fold-up":"i-tabler:fold-down"},null)}),t.createVNode("div",{class:"flex-1"},[b.header?b.header():t.createVNode(s.NInput,{value:y.value,"onUpdate:value":e=>y.value=e,placeholder:K("common.keyword")},null)]),b.tools?.()]),t.createVNode(s.NScrollbar,{class:"flex-1 min-h-0",xScrollable:!0},{default:()=>[t.createVNode("div",{class:"p-2"},[t.createVNode(s.NSpin,{show:q.value,class:"h-full"},{default:()=>[t.createVNode(s.NTree,t.mergeProps(R.value,{data:i.value||[],expandedKeys:f.value,onUpdateExpandedKeys:e=>{f.value=e;const l=P(i.value);v.value=l.length>0&&l.every(n=>e.includes(n))},blockLine:!0,selectedKeys:N.value,onUpdateSelectedKeys:e=>{N.value=e,a?.onUpdateValue?.(e)},onDrop:B,pattern:y.value,renderPrefix:a?.numField||a?.iconField?({option:e})=>t.createVNode(t.Fragment,null,[a.iconField&&e[a.iconField]&&t.createVNode("div",{class:z(e[a.iconField]||"","size-4")},null),a.numField&&t.createVNode("div",{class:"rounded-full bg-primary px-2 text-xs text-white"},[e[a.numField]||0])]):void 0,nodeProps:({option:e})=>({onContextmenu:l=>{S.value=e,x.value=!0,w.value=l.clientX,F.value=l.clientY,l.preventDefault()}})}),null)]})])]}),t.createVNode(s.NDropdown,{trigger:"manual",placement:"bottom-start",show:x.value,options:I.value,x:w.value,y:F.value,width:100,onSelect:E,onClickoutside:()=>{x.value=!1}},null)]})}});exports.DuxTreeFilter=Y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("naive-ui"),a=require("./placeholder.cjs"),l=e.defineComponent({name:"DuxImage",props:{},extends:t.NImage,setup(r){return()=>{const c=`size-${r.height}px`,i=e.createVNode("svg",{viewBox:"0 0 100 100",class:c},[e.createVNode("circle",{cx:"50",cy:"50",r:"50",fill:"rgb(var(--ui-color-primary))","fill-opacity":"0.1"},null),e.createVNode("g",{fill:"rgb(var(--ui-color-primary))","fill-opacity":"0.65"},[e.createVNode("circle",{cx:"50",cy:"36",r:"14"},null),e.createVNode("path",{d:"M 50 54 C 30 54 15 69 15 87 L 15 100 L 85 100 L 85 87 C 85 69 70 54 50 54 Z"},null)]),e.createVNode("g",{fill:"rgb(var(--ui-color-primary))","fill-opacity":"0.3"},[e.createVNode("circle",{cx:"20",cy:"20",r:"1.5"},[e.createVNode("animate",{attributeName:"r",values:"1.5;2.5;1.5",dur:"3s",repeatCount:"indefinite"},null)]),e.createVNode("circle",{cx:"80",cy:"25",r:"1"},[e.createVNode("animate",{attributeName:"r",values:"1;2;1",dur:"4s",repeatCount:"indefinite"},null)])])]);return r.src?e.createVNode(t.NImage,e.mergeProps(r,{src:r.src}),{placeholder:()=>e.createVNode(a.DuxPlaceholder,{width:r.width,height:r.height},null),error:()=>e.createVNode(a.DuxPlaceholder,{width:r.width,height:r.height},null)}):e.h(i)}}});exports.DuxImage=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("naive-ui"),i=require("./placeholder.cjs"),l=e.defineComponent({name:"DuxImage",props:{},extends:t.NImage,setup(r){return()=>{const a=`size-${r.height}px`,c=e.createVNode("svg",{viewBox:"0 0 100 100",class:a},[e.createVNode("circle",{cx:"50",cy:"50",r:"50",fill:"rgb(var(--ui-color-primary))","fill-opacity":"0.1"},null),e.createVNode("g",{fill:"rgb(var(--ui-color-primary))","fill-opacity":"0.65"},[e.createVNode("circle",{cx:"50",cy:"36",r:"14"},null),e.createVNode("path",{d:"M 50 54 C 30 54 15 69 15 87 L 15 100 L 85 100 L 85 87 C 85 69 70 54 50 54 Z"},null)]),e.createVNode("g",{fill:"rgb(var(--ui-color-primary))","fill-opacity":"0.3"},[e.createVNode("circle",{cx:"20",cy:"20",r:"1.5"},[e.createVNode("animate",{attributeName:"r",values:"1.5;2.5;1.5",dur:"3s",repeatCount:"indefinite"},null)]),e.createVNode("circle",{cx:"80",cy:"25",r:"1"},[e.createVNode("animate",{attributeName:"r",values:"1;2;1",dur:"4s",repeatCount:"indefinite"},null)])])]);return r.src?e.createVNode(t.NImage,e.mergeProps(r,{src:r.src}),{placeholder:()=>e.createVNode(i.DuxPlaceholder,{width:r.width,height:r.height},null)}):e.h(c)}}});exports.DuxImage=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-from-opacity:100%;--un-text-opacity:100%;--un-bg-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-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-border-opacity:100%;--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-from-opacity:100%;--un-text-opacity:100%;--un-bg-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%;}}
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%;}
@@ -951,6 +951,8 @@ input:where([type='button'], [type='reset'], [type='submit']),
951
951
  .i-tabler\\:eye-off{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10.585 10.587a2 2 0 0 0 2.829 2.828'/%3E%3Cpath d='M16.681 16.673A8.7 8.7 0 0 1 12 18q-5.4 0-9-6q1.908-3.18 4.32-4.674m2.86-1.146A9 9 0 0 1 12 6q5.4 0 9 6q-1 1.665-2.138 2.87M3 3l18 18'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
952
952
  .i-tabler\\:file-export{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14 3v4a1 1 0 0 0 1 1h4'/%3E%3Cpath d='M11.5 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v5m-5 6h7m-3-3l3 3l-3 3'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
953
953
  .i-tabler\\:file-upload{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14 3v4a1 1 0 0 0 1 1h4'/%3E%3Cpath d='M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2m-5-10v6'/%3E%3Cpath d='M9.5 13.5L12 11l2.5 2.5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
954
+ .i-tabler\\:fold-down{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 11v8l3-3m-6 0l3 3M9 7h1m4 0h1m4 0h1M4 7h1'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
955
+ .i-tabler\\:fold-up{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 13V5L9 8m6 0l-3-3M9 17h1m4 0h1m4 0h1M4 17h1'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
954
956
  .i-tabler\\:folder{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
955
957
  .i-tabler\\:forms{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3m7-14h7a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-7M5 7H4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h1m12-5h.01M13 12h.01'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
956
958
  .i-tabler\\:grid-4x4{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 6h18M3 12h18M3 18h18M6 3v18m6-18v18m6-18v18'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
@@ -1,10 +1,10 @@
1
- import { defineComponent as R, toRef as S, ref as u, watch as O, computed as V, createVNode as n, mergeProps as X, Fragment as Y } from "vue";
2
- import { useI18n as q, useTree as G, useCustomMutation as H } from "@duxweb/dvha-core";
3
- import { useVModel as J } from "@vueuse/core";
4
- import Q from "clsx";
5
- import { NTree as k, NInput as W, NScrollbar as Z, NSpin as $, NDropdown as ee } from "naive-ui";
6
- import { DuxCard as te } from "../card/card.js";
7
- const re = /* @__PURE__ */ R({
1
+ import { defineComponent as q, toRef as S, ref as u, watch as V, computed as C, createVNode as n, mergeProps as G, Fragment as H } from "vue";
2
+ import { useI18n as J, useTree as Q, useCustomMutation as W } from "@duxweb/dvha-core";
3
+ import { useVModel as Z } from "@vueuse/core";
4
+ import $ from "clsx";
5
+ import { NTree as K, NButton as ee, NInput as le, NScrollbar as te, NSpin as ne, NDropdown as ae } from "naive-ui";
6
+ import { DuxCard as ie } from "../card/card.js";
7
+ const fe = /* @__PURE__ */ q({
8
8
  name: "DuxTreeFilter",
9
9
  props: {
10
10
  title: String,
@@ -24,111 +24,120 @@ const re = /* @__PURE__ */ R({
24
24
  default: !1
25
25
  }
26
26
  },
27
- extends: k,
27
+ extends: K,
28
28
  setup(t, {
29
- emit: C,
30
- slots: x
29
+ emit: T,
30
+ slots: b
31
31
  }) {
32
- const F = J(t, "value", C, {
32
+ const w = Z(t, "value", T, {
33
33
  passive: !1,
34
34
  defaultValue: t.defaultValue
35
- }), T = S(t, "params", {}), U = S(t, "path", ""), I = S(t, "sortPath", ""), w = u(), g = u(0), P = u(0), s = u([]), b = u(), {
36
- t: K
37
- } = q(), {
38
- options: N,
39
- loading: A,
35
+ }), U = S(t, "params", {}), A = S(t, "path", ""), I = S(t, "sortPath", ""), F = u(), P = u(0), k = u(0), r = u([]), y = u(), {
36
+ t: N
37
+ } = J(), {
38
+ options: E,
39
+ loading: B,
40
40
  expanded: j
41
- } = G({
42
- path: U.value,
43
- params: T.value,
41
+ } = Q({
42
+ path: A.value,
43
+ params: U.value,
44
44
  ...t.treeOptions
45
45
  });
46
- O(N, (e) => {
47
- s.value = e;
46
+ V(E, (e) => {
47
+ r.value = e;
48
48
  }, {
49
49
  immediate: !0,
50
50
  deep: !0
51
51
  });
52
- const v = u(!1), B = V(() => t.menus?.map((e) => ({
52
+ const p = u(!1), L = C(() => t.menus?.map((e) => ({
53
53
  label: e.label,
54
54
  key: e.value,
55
55
  icon: e?.icon ? () => n("div", {
56
56
  class: e?.icon
57
57
  }, null) : void 0,
58
58
  onSelect: e.onSelect
59
- })) || []), L = (e) => {
59
+ })) || []), M = (e) => {
60
60
  const l = t.menus?.find((a) => a.value === e);
61
- l && l.onSelect(w.value), v.value = !1;
62
- }, M = H({
61
+ l && l.onSelect(F.value), p.value = !1;
62
+ }, _ = W({
63
63
  path: I.value,
64
64
  method: "POST"
65
- }), y = (e, l) => {
65
+ }), g = (e, l) => {
66
66
  for (const a of e)
67
67
  if (a.children) {
68
- for (const h of a.children)
69
- if (h.id === l)
68
+ for (const i of a.children)
69
+ if (i.id === l)
70
70
  return a;
71
- const d = y(a.children, l);
72
- if (d)
73
- return d;
71
+ const o = g(a.children, l);
72
+ if (o)
73
+ return o;
74
74
  }
75
- }, _ = ({
75
+ }, z = ({
76
76
  node: e,
77
77
  dragNode: l,
78
78
  dropPosition: a
79
79
  }) => {
80
- const d = y(s.value, l.id), h = !d, f = [...s.value];
81
- if (h) {
82
- const i = s.value.findIndex((D) => D.id === l.id);
83
- i >= 0 && f.splice(i, 1);
80
+ const o = g(r.value, l.id), i = !o, m = [...r.value];
81
+ if (i) {
82
+ const d = r.value.findIndex((O) => O.id === l.id);
83
+ d >= 0 && m.splice(d, 1);
84
84
  } else {
85
- const i = d?.children?.indexOf(l) || 0;
86
- d?.children?.splice(i, 1);
85
+ const d = o?.children?.indexOf(l) || 0;
86
+ o?.children?.splice(d, 1);
87
87
  }
88
- let c = y(f, e.id), p, o = c?.children || f, r = 0;
88
+ let h = g(m, e.id), x, s = h?.children || m, c = 0;
89
89
  switch (a) {
90
90
  case "before":
91
- r = o.findIndex((i) => i.id === e.id), r > 0 && (p = o[r - 1].id);
91
+ c = s.findIndex((d) => d.id === e.id), c > 0 && (x = s[c - 1].id);
92
92
  break;
93
93
  case "inside":
94
- c = e, o = c.children = c.children || [], r = o.length;
94
+ h = e, s = h.children = h.children || [], c = s.length;
95
95
  break;
96
96
  case "after":
97
- r = o.findIndex((i) => i.id === e.id) + 1, p = e.id;
97
+ c = s.findIndex((d) => d.id === e.id) + 1, x = e.id;
98
98
  break;
99
99
  }
100
- o.splice(r, 0, l), s.value = f, M.mutate({
100
+ s.splice(c, 0, l), r.value = m, _.mutate({
101
101
  payload: {
102
- parent_id: c?.id,
103
- before_id: p,
102
+ parent_id: h?.id,
103
+ before_id: x,
104
104
  id: l.id
105
105
  }
106
106
  });
107
- }, m = u([]);
108
- O(j, (e) => {
109
- m?.value?.length > 0 || (m.value = e);
107
+ }, f = u([]), v = u(!1);
108
+ V(j, (e) => {
109
+ f?.value?.length > 0 || (v.value = e.length > 0, f.value = e);
110
110
  }, {
111
111
  immediate: !0
112
112
  });
113
- const z = V(() => {
113
+ const D = (e) => {
114
+ const l = [], a = (o) => {
115
+ o.forEach((i) => {
116
+ i.children && i.children.length > 0 && (l.push(i.key || i.id), a(i.children));
117
+ });
118
+ };
119
+ return a(e), l;
120
+ }, R = () => {
121
+ v.value ? (f.value = [], v.value = !1) : (f.value = D(r.value), v.value = !0);
122
+ }, X = C(() => {
114
123
  const {
115
124
  title: e,
116
125
  path: l,
117
126
  sortPath: a,
118
- params: d,
119
- menus: h,
120
- numField: f,
121
- iconField: c,
122
- treeOptions: p,
123
- value: o,
124
- defaultValue: r,
125
- onUpdateValue: i,
126
- bordered: D,
127
- ...E
127
+ params: o,
128
+ menus: i,
129
+ numField: m,
130
+ iconField: h,
131
+ treeOptions: x,
132
+ value: s,
133
+ defaultValue: c,
134
+ onUpdateValue: d,
135
+ bordered: O,
136
+ ...Y
128
137
  } = t;
129
- return E;
138
+ return Y;
130
139
  });
131
- return () => n(te, {
140
+ return () => n(ie, {
132
141
  class: "h-full",
133
142
  contentClass: "flex flex-col",
134
143
  bordered: t.bordered
@@ -137,39 +146,47 @@ const re = /* @__PURE__ */ R({
137
146
  class: "px-2 py-3 pb-1 text-base font-bold"
138
147
  }, [t.title]), n("div", {
139
148
  class: "p-2 flex gap-2 items-center"
140
- }, [n("div", {
149
+ }, [n(ee, {
150
+ onClick: R
151
+ }, {
152
+ icon: () => n("div", {
153
+ class: v.value ? "i-tabler:fold-up" : "i-tabler:fold-down"
154
+ }, null)
155
+ }), n("div", {
141
156
  class: "flex-1"
142
- }, [x.header ? x.header() : n(W, {
143
- value: b.value,
144
- "onUpdate:value": (e) => b.value = e,
145
- placeholder: K("common.keyword")
146
- }, null)]), x.tools?.()]), n(Z, {
157
+ }, [b.header ? b.header() : n(le, {
158
+ value: y.value,
159
+ "onUpdate:value": (e) => y.value = e,
160
+ placeholder: N("common.keyword")
161
+ }, null)]), b.tools?.()]), n(te, {
147
162
  class: "flex-1 min-h-0",
148
163
  xScrollable: !0
149
164
  }, {
150
165
  default: () => [n("div", {
151
166
  class: "p-2"
152
- }, [n($, {
153
- show: A.value,
167
+ }, [n(ne, {
168
+ show: B.value,
154
169
  class: "h-full"
155
170
  }, {
156
- default: () => [n(k, X(z.value, {
157
- data: s.value || [],
158
- expandedKeys: m.value,
171
+ default: () => [n(K, G(X.value, {
172
+ data: r.value || [],
173
+ expandedKeys: f.value,
159
174
  onUpdateExpandedKeys: (e) => {
160
- m.value = e;
175
+ f.value = e;
176
+ const l = D(r.value);
177
+ v.value = l.length > 0 && l.every((a) => e.includes(a));
161
178
  },
162
179
  blockLine: !0,
163
- selectedKeys: F.value,
180
+ selectedKeys: w.value,
164
181
  onUpdateSelectedKeys: (e) => {
165
- F.value = e, t?.onUpdateValue?.(e);
182
+ w.value = e, t?.onUpdateValue?.(e);
166
183
  },
167
- onDrop: _,
168
- pattern: b.value,
184
+ onDrop: z,
185
+ pattern: y.value,
169
186
  renderPrefix: t?.numField || t?.iconField ? ({
170
187
  option: e
171
- }) => n(Y, null, [t.iconField && e[t.iconField] && n("div", {
172
- class: Q(e[t.iconField] || "", "size-4")
188
+ }) => n(H, null, [t.iconField && e[t.iconField] && n("div", {
189
+ class: $(e[t.iconField] || "", "size-4")
173
190
  }, null), t.numField && n("div", {
174
191
  class: "rounded-full bg-primary px-2 text-xs text-white"
175
192
  }, [e[t.numField] || 0])]) : void 0,
@@ -177,27 +194,27 @@ const re = /* @__PURE__ */ R({
177
194
  option: e
178
195
  }) => ({
179
196
  onContextmenu: (l) => {
180
- w.value = e, v.value = !0, g.value = l.clientX, P.value = l.clientY, l.preventDefault();
197
+ F.value = e, p.value = !0, P.value = l.clientX, k.value = l.clientY, l.preventDefault();
181
198
  }
182
199
  })
183
200
  }), null)]
184
201
  })])]
185
- }), n(ee, {
202
+ }), n(ae, {
186
203
  trigger: "manual",
187
204
  placement: "bottom-start",
188
- show: v.value,
189
- options: B.value,
190
- x: g.value,
191
- y: P.value,
205
+ show: p.value,
206
+ options: L.value,
207
+ x: P.value,
208
+ y: k.value,
192
209
  width: 100,
193
- onSelect: L,
210
+ onSelect: M,
194
211
  onClickoutside: () => {
195
- v.value = !1;
212
+ p.value = !1;
196
213
  }
197
214
  }, null)]
198
215
  });
199
216
  }
200
217
  });
201
218
  export {
202
- re as DuxTreeFilter
219
+ fe as DuxTreeFilter
203
220
  };
@@ -1,15 +1,15 @@
1
- import { defineComponent as c, createVNode as e, h as n, mergeProps as u } from "vue";
1
+ import { defineComponent as a, createVNode as e, h as c, mergeProps as n } from "vue";
2
2
  import { NImage as i } from "naive-ui";
3
- import { DuxPlaceholder as l } from "./placeholder.js";
4
- const g = /* @__PURE__ */ c({
3
+ import { DuxPlaceholder as o } from "./placeholder.js";
4
+ const g = /* @__PURE__ */ a({
5
5
  name: "DuxImage",
6
6
  props: {},
7
7
  extends: i,
8
8
  setup(r) {
9
9
  return () => {
10
- const t = `size-${r.height}px`, a = e("svg", {
10
+ const l = `size-${r.height}px`, t = e("svg", {
11
11
  viewBox: "0 0 100 100",
12
- class: t
12
+ class: l
13
13
  }, [e("circle", {
14
14
  cx: "50",
15
15
  cy: "50",
@@ -47,18 +47,14 @@ const g = /* @__PURE__ */ c({
47
47
  dur: "4s",
48
48
  repeatCount: "indefinite"
49
49
  }, null)])])]);
50
- return r.src ? e(i, u(r, {
50
+ return r.src ? e(i, n(r, {
51
51
  src: r.src
52
52
  }), {
53
- placeholder: () => e(l, {
54
- width: r.width,
55
- height: r.height
56
- }, null),
57
- error: () => e(l, {
53
+ placeholder: () => e(o, {
58
54
  width: r.width,
59
55
  height: r.height
60
56
  }, null)
61
- }) : n(a);
57
+ }) : c(t);
62
58
  };
63
59
  }
64
60
  });
@@ -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-from-opacity:100%;--un-text-opacity:100%;--un-bg-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-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-border-opacity:100%;--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-from-opacity:100%;--un-text-opacity:100%;--un-bg-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%;}}
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%;}
@@ -951,6 +951,8 @@ input:where([type='button'], [type='reset'], [type='submit']),
951
951
  .i-tabler\\:eye-off{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10.585 10.587a2 2 0 0 0 2.829 2.828'/%3E%3Cpath d='M16.681 16.673A8.7 8.7 0 0 1 12 18q-5.4 0-9-6q1.908-3.18 4.32-4.674m2.86-1.146A9 9 0 0 1 12 6q5.4 0 9 6q-1 1.665-2.138 2.87M3 3l18 18'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
952
952
  .i-tabler\\:file-export{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14 3v4a1 1 0 0 0 1 1h4'/%3E%3Cpath d='M11.5 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v5m-5 6h7m-3-3l3 3l-3 3'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
953
953
  .i-tabler\\:file-upload{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14 3v4a1 1 0 0 0 1 1h4'/%3E%3Cpath d='M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2m-5-10v6'/%3E%3Cpath d='M9.5 13.5L12 11l2.5 2.5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
954
+ .i-tabler\\:fold-down{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 11v8l3-3m-6 0l3 3M9 7h1m4 0h1m4 0h1M4 7h1'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
955
+ .i-tabler\\:fold-up{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 13V5L9 8m6 0l-3-3M9 17h1m4 0h1m4 0h1M4 17h1'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
954
956
  .i-tabler\\:folder{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
955
957
  .i-tabler\\:forms{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3m7-14h7a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-7M5 7H4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h1m12-5h.01M13 12h.01'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
956
958
  .i-tabler\\:grid-4x4{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 6h18M3 12h18M3 18h18M6 3v18m6-18v18m6-18v18'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-pro",
3
3
  "type": "module",
4
- "version": "1.0.36",
4
+ "version": "1.0.38",
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.36",
37
- "@duxweb/dvha-naiveui": "^1.0.36",
36
+ "@duxweb/dvha-core": "^1.0.38",
37
+ "@duxweb/dvha-naiveui": "^1.0.38",
38
38
  "@iconify-json/tabler": "^1.2.18",
39
39
  "@overlastic/vue": "^0.8.1",
40
40
  "@tanstack/vue-query": "^5.80.7",