mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
2 lines
8.5 KiB
JavaScript
2 lines
8.5 KiB
JavaScript
import{u as K}from"./epTheme.js";import{g,n as m,h as p,d as Q,r as u,U as d,da as W,Y as X,dI as w,G as $,j as e,aq as ee,F as H,c as n,i as y,az as te,aD as le,x as ae,S as ne}from"./index.js";import{S as oe}from"./sortable.esm.js";const re={width:"32",height:"32",fill:"currentColor","aria-hidden":"true","data-icon":"holder",viewBox:"64 64 896 896"},ce=p("path",{d:"M300 276.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97zm0 284a56 56 0 1 0 56-97 56 56 0 0 0-56 97zM640 228a56 56 0 1 0 112 0 56 56 0 0 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 0 0-112 0zM300 844.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97zM640 796a56 56 0 1 0 112 0 56 56 0 0 0-112 0z"},null,-1),ie=[ce];function ue(l,s){return g(),m("svg",re,ie)}const de={render:ue},se={width:"32",height:"32",viewBox:"0 0 24 24"},he=p("path",{fill:"currentColor",d:"M22 4V2H2v2h9v14.17l-5.5-5.5-1.42 1.41L12 22l7.92-7.92-1.42-1.41-5.5 5.5V4h9Z"},null,-1),fe=[he];function ve(l,s){return g(),m("svg",se,fe)}const ge={render:ve},me={width:"32",height:"32",viewBox:"0 0 24 24"},pe=p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},null,-1),be=[pe];function xe(l,s){return g(),m("svg",me,be)}const _e={render:xe},Ce={width:"32",height:"32",viewBox:"0 0 24 24"},ke=p("path",{fill:"currentColor",d:"M3.34 17a10.018 10.018 0 0 1-.978-2.326 3 3 0 0 0 .002-5.347A9.99 9.99 0 0 1 4.865 4.99a3 3 0 0 0 4.631-2.674 9.99 9.99 0 0 1 5.007.002 3 3 0 0 0 4.632 2.672A9.99 9.99 0 0 1 20.66 7c.433.749.757 1.53.978 2.326a3 3 0 0 0-.002 5.347 9.99 9.99 0 0 1-2.501 4.337 3 3 0 0 0-4.631 2.674 9.99 9.99 0 0 1-5.007-.002 3 3 0 0 0-4.632-2.672A10.018 10.018 0 0 1 3.34 17zm5.66.196a4.993 4.993 0 0 1 2.25 2.77c.499.047 1 .048 1.499.001A4.993 4.993 0 0 1 15 17.197a4.993 4.993 0 0 1 3.525-.565c.29-.408.54-.843.748-1.298A4.993 4.993 0 0 1 18 12c0-1.26.47-2.437 1.273-3.334a8.126 8.126 0 0 0-.75-1.298A4.993 4.993 0 0 1 15 6.804a4.993 4.993 0 0 1-2.25-2.77c-.499-.047-1-.048-1.499-.001A4.993 4.993 0 0 1 9 6.803a4.993 4.993 0 0 1-3.525.565 7.99 7.99 0 0 0-.748 1.298A4.993 4.993 0 0 1 6 12a4.99 4.99 0 0 1-1.273 3.334 8.126 8.126 0 0 0 .75 1.298A4.993 4.993 0 0 1 9 17.196zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},null,-1),we=[ke];function ye(l,s){return g(),m("svg",Ce,we)}const ze={render:ye},Ae={width:"32",height:"32",viewBox:"0 0 24 24"},Be=p("path",{fill:"currentColor",d:"M13.79 10.21a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42l-2.5-2.5a1 1 0 0 0-.33-.21 1 1 0 0 0-.76 0 1 1 0 0 0-.33.21l-2.5 2.5a1 1 0 0 0 1.42 1.42l.79-.8v5.18l-.79-.8a1 1 0 0 0-1.42 1.42l2.5 2.5a1 1 0 0 0 .33.21.94.94 0 0 0 .76 0 1 1 0 0 0 .33-.21l2.5-2.5a1 1 0 0 0-1.42-1.42l-.79.8V9.41ZM7 4h10a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2Zm10 16H7a1 1 0 0 0 0 2h10a1 1 0 0 0 0-2Z"},null,-1),Ee=[Be];function Ve(l,s){return g(),m("svg",Ae,Ee)}const Me={render:Ve};function $e(l){return typeof l=="function"||Object.prototype.toString.call(l)==="[object Object]"&&!te(l)}const Re={title:{type:String,default:"列表"},tableRef:{type:Object},columns:{type:Array,default:()=>[]}},De=Q({name:"PureTableBar",props:Re,emits:["refresh"],setup(l,{emit:s,slots:r,attrs:T}){const R=u(),h=u("default"),v=u(!0),z=u(!1),b=u(!0),x=u(!1),D=d(l==null?void 0:l.columns).filter(t=>W(t==null?void 0:t.hide)?!t.hide:!(X(t==null?void 0:t.hide)&&(t!=null&&t.hide())));let f=w(d(l==null?void 0:l.columns),"label");const _=u(w(d(D),"label")),c=u(d(l==null?void 0:l.columns)),A=$(()=>t=>({background:t===h.value?K().epThemeColor:"",color:t===h.value?"#fff":"var(--el-text-color-primary)"})),C=$(()=>["text-black","dark:text-white","duration-100","hover:!text-primary","cursor-pointer","outline-none"]),j=$(()=>["flex","justify-between","pt-[3px]","px-[11px]","border-b-[1px]","border-solid","border-[#dcdfe6]","dark:border-[#303030]"]);function F(){z.value=!0,s("refresh"),le(500).then(()=>z.value=!1)}function N(){v.value=!v.value,S(l.tableRef.data,v.value)}function S(t,o){t.forEach(a=>{l.tableRef.toggleRowExpansion(a,o),a.children!==void 0&&a.children!==null&&S(a.children,o)})}function P(t){_.value=t?f:[],x.value=!1,c.value.map(o=>t?o.hide=!1:o.hide=!0)}function Z(t){const o=t.length;b.value=o===f.length,x.value=o>0&&o<f.length}function I(t,o){c.value.filter(a=>a.label===o)[0].hide=!t}async function L(){b.value=!0,x.value=!1,c.value=d(l==null?void 0:l.columns),f=[],f=await w(d(l==null?void 0:l.columns),"label"),_.value=w(d(D),"label")}const O={dropdown:()=>e(n("el-dropdown-menu"),{class:"translation"},{default:()=>[e(n("el-dropdown-item"),{style:A.value("large"),onClick:()=>h.value="large"},{default:()=>[y("宽松")]}),e(n("el-dropdown-item"),{style:A.value("default"),onClick:()=>h.value="default"},{default:()=>[y("默认")]}),e(n("el-dropdown-item"),{style:A.value("small"),onClick:()=>h.value="small"},{default:()=>[y("紧凑")]})]})},U=t=>{t.preventDefault(),ae(()=>{const o=document.querySelector(".el-checkbox-group>div");oe.create(o,{animation:300,handle:".drag-btn",onEnd:({newIndex:a,oldIndex:i,item:Y})=>{const B=Y,E=B.parentNode,V=c.value[i],M=c.value[a];if(V!=null&&V.fixed||M!=null&&M.fixed){const k=E.children[i];a>i?E.insertBefore(B,k):E.insertBefore(B,k&&k.nextElementSibling);return}const J=c.value.splice(i,1)[0];c.value.splice(a,0,J)}})})},q=t=>!!c.value.filter(o=>o.label===t)[0].fixed,G={reference:()=>e(ze,{class:["w-[16px]",C.value],onMouseover:t=>R.value=t.currentTarget},null)};return()=>{var o;let t;return e(H,null,[e("div",ee(T,{class:"w-[99/100] mt-2 px-2 pb-2 bg-bg_color"}),[e("div",{class:"flex justify-between w-full h-[60px] p-4"},[r!=null&&r.title?r.title():e("p",{class:"font-bold truncate"},[l.title]),e("div",{class:"flex items-center justify-around"},[r!=null&&r.buttons?e("div",{class:"flex mr-4"},[r.buttons()]):null,(o=l.tableRef)!=null&&o.size?e(H,null,[e(n("el-tooltip"),{effect:"dark",content:v.value?"折叠":"展开",placement:"top"},{default:()=>[e(ge,{class:["w-[16px]",C.value],style:{transform:v.value?"none":"rotate(-90deg)"},onClick:()=>N()},null)]}),e(n("el-divider"),{direction:"vertical"},null)]):null,e(n("el-tooltip"),{effect:"dark",content:"刷新",placement:"top"},{default:()=>[e(_e,{class:["w-[16px]",C.value,z.value?"animate-spin":""],onClick:()=>F()},null)]}),e(n("el-divider"),{direction:"vertical"},null),e(n("el-tooltip"),{effect:"dark",content:"密度",placement:"top"},{default:()=>[e(n("el-dropdown"),{trigger:"click"},{default:()=>[e(Me,{class:["w-[16px]",C.value]},null)],...O})]}),e(n("el-divider"),{direction:"vertical"},null),e(n("el-popover"),{placement:"bottom-start","popper-style":{padding:0},width:"200",trigger:"click"},{default:()=>[e("div",{class:[j.value]},[e(n("el-checkbox"),{class:"!-mr-1",label:"列展示",modelValue:b.value,"onUpdate:modelValue":a=>b.value=a,indeterminate:x.value,onChange:a=>P(a)},null),e(n("el-button"),{type:"primary",link:!0,onClick:()=>L()},{default:()=>[y("重置")]})]),e("div",{class:"pt-[6px] pl-[11px]"},[e(n("el-scrollbar"),{"max-height":"36vh"},{default:()=>[e(n("el-checkbox-group"),{modelValue:_.value,"onUpdate:modelValue":a=>_.value=a,onChange:a=>Z(a)},{default:()=>[e(n("el-space"),{direction:"vertical",alignment:"flex-start",size:0},$e(t=f.map(a=>e("div",{class:"flex items-center"},[e(de,{class:["drag-btn w-[16px] mr-2",q(a)?"!cursor-no-drop":"!cursor-grab"],onMouseenter:i=>U(i)},null),e(n("el-checkbox"),{key:a,label:a,onChange:i=>I(i,a)},{default:()=>[e("span",{title:a,class:"inline-block w-[120px] truncate hover:text-text_color_primary"},[a])]})])))?t:{default:()=>[t]})]})]})])],...G})]),e(n("el-tooltip"),{"popper-options":{modifiers:[{name:"computeStyles",options:{adaptive:!1,enabled:!1}}]},placement:"top","virtual-ref":R.value,"virtual-triggering":!0,trigger:"hover",content:"列设置"},null)]),r.default({size:h.value,dynamicColumns:c.value})])])}}}),Ne=ne(De),Se={width:1024,height:1024,body:'<path fill="currentColor" d="M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"/>'},Pe=Se,He={width:1024,height:1024,body:'<path fill="currentColor" d="M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"/>'},Ze=He;export{Pe as D,Ne as P,Ze as R};
|