mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
2 lines
8.3 KiB
JavaScript
2 lines
8.3 KiB
JavaScript
var le=Object.defineProperty;var q=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var F=(e,r,a)=>r in e?le(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,z=(e,r)=>{for(var a in r||(r={}))ae.call(r,a)&&F(e,a,r[a]);if(q)for(var a of q(r))ne.call(r,a)&&F(e,a,r[a]);return e};var P=(e,r,a)=>new Promise((R,u)=>{var p=c=>{try{s(a.next(c))}catch(m){u(m)}},g=c=>{try{s(a.throw(c))}catch(m){u(m)}},s=c=>c.done?R(c.value):Promise.resolve(c.value).then(p,g);s((a=a.apply(e,r)).next())});import{u as re}from"./epTheme-ChDmoFKo.js";import{e as b,x as _,g as w,d as oe,r as f,ah as v,fG as ie,ae as ce,an as E,c as H,m as l,a6 as ue,F as O,z as B,v as $,k as i,l as M,aE as de,c$ as se,q as he,X as fe}from"./index-DeS8Almj.js";import{S as ve}from"./sortable.esm-6WsHlDA5.js";const ge={width:"32",height:"32",fill:"currentColor","aria-hidden":"true","data-icon":"holder",viewBox:"64 64 896 896"},me=w("path",{d:"M300 276.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97m0 284a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 228a56 56 0 1 0 112 0 56 56 0 0 0-112 0m0 284a56 56 0 1 0 112 0 56 56 0 0 0-112 0M300 844.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 796a56 56 0 1 0 112 0 56 56 0 0 0-112 0"},null,-1),xe=[me];function pe(e,r){return b(),_("svg",ge,[...xe])}const be={render:pe},_e={width:"32",height:"32",viewBox:"0 0 24 24"},we=w("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.5V4z"},null,-1),Ce=[we];function ke(e,r){return b(),_("svg",_e,[...Ce])}const ye={render:ke},Ae={width:"32",height:"32",viewBox:"0 0 24 24"},Ee=w("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=[Ee];function $e(e,r){return b(),_("svg",Ae,[...Be])}const Me={render:$e},Re={width:"32",height:"32",viewBox:"0 0 24 24"},Ve=w("path",{fill:"currentColor",d:"M3.34 17a10 10 0 0 1-.978-2.326 3 3 0 0 0 .002-5.347A10 10 0 0 1 4.865 4.99a3 3 0 0 0 4.631-2.674 10 10 0 0 1 5.007.002 3 3 0 0 0 4.632 2.672A10 10 0 0 1 20.66 7c.433.749.757 1.53.978 2.326a3 3 0 0 0-.002 5.347 10 10 0 0 1-2.501 4.337 3 3 0 0 0-4.631 2.674 10 10 0 0 1-5.007-.002 3 3 0 0 0-4.632-2.672A10 10 0 0 1 3.34 17m5.66.196a5 5 0 0 1 2.25 2.77q.75.071 1.499.001A5 5 0 0 1 15 17.197a5 5 0 0 1 3.525-.565q.435-.614.748-1.298A5 5 0 0 1 18 12c0-1.26.47-2.437 1.273-3.334a8 8 0 0 0-.75-1.298A5 5 0 0 1 15 6.804a5 5 0 0 1-2.25-2.77q-.75-.071-1.499-.001A5 5 0 0 1 9 6.803a5 5 0 0 1-3.525.565 8 8 0 0 0-.748 1.298A5 5 0 0 1 6 12a5 5 0 0 1-1.273 3.334 8 8 0 0 0 .75 1.298A5 5 0 0 1 9 17.196M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6m0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2"},null,-1),De=[Ve];function Se(e,r){return b(),_("svg",Re,[...De])}const Te={render:Se},je={width:"32",height:"32",viewBox:"0 0 24 24"},ze=w("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 2m10 16H7a1 1 0 0 0 0 2h10a1 1 0 0 0 0-2"},null,-1),He=[ze];function Ne(e,r){return b(),_("svg",je,[...He])}const qe={render:Ne};function Fe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!de(e)}const Pe={title:{type:String,default:"列表"},tableRef:{type:Object},columns:{type:Array,default:()=>[]},isExpandAll:{type:Boolean,default:!0}},Oe=oe({name:"PureTableBar",props:Pe,emits:["refresh"],setup(e,{emit:r,slots:a,attrs:R}){const u=f("default"),p=f(!1),g=f(!0),s=f(!1),c=f(e.isExpandAll),m=v(e==null?void 0:e.columns).filter(t=>ie(t==null?void 0:t.hide)?!t.hide:!(ce(t==null?void 0:t.hide)&&(t!=null&&t.hide())));let x=E(v(e==null?void 0:e.columns),"label");const C=f(E(v(m),"label")),d=f(v(e==null?void 0:e.columns)),V=H(()=>t=>({background:t===u.value?re().epThemeColor:"",color:t===u.value?"#fff":"var(--el-text-color-primary)"})),k=H(()=>["text-black","dark:text-white","duration-100","hover:!text-primary","cursor-pointer","outline-none"]),L=H(()=>["flex","justify-between","pt-[3px]","px-[11px]","border-b-[1px]","border-solid","border-[#dcdfe6]","dark:border-[#303030]"]);function I(){p.value=!0,r("refresh"),se(500).then(()=>p.value=!1)}function U(){c.value=!c.value,N(e.tableRef.data,c.value)}function N(t,o){t.forEach(n=>{e.tableRef.toggleRowExpansion(n,o),n.children!==void 0&&n.children!==null&&N(n.children,o)})}function G(t){C.value=t?x:[],s.value=!1,d.value.map(o=>t?o.hide=!1:o.hide=!0)}function W(t){const o=t.length;g.value=o===x.length,s.value=o>0&&o<x.length}function X(t,o){d.value.filter(n=>n.label===o)[0].hide=!t}function Z(){return P(this,null,function*(){g.value=!0,s.value=!1,d.value=v(e==null?void 0:e.columns),x=[],x=yield E(v(e==null?void 0:e.columns),"label"),C.value=E(v(m),"label")})}const J={dropdown:()=>l(i("el-dropdown-menu"),{class:"translation"},{default:()=>[l(i("el-dropdown-item"),{style:V.value("large"),onClick:()=>u.value="large"},{default:()=>[M("宽松")]}),l(i("el-dropdown-item"),{style:V.value("default"),onClick:()=>u.value="default"},{default:()=>[M("默认")]}),l(i("el-dropdown-item"),{style:V.value("small"),onClick:()=>u.value="small"},{default:()=>[M("紧凑")]})]})},K=t=>{t.preventDefault(),he(()=>{const o=document.querySelector(".el-checkbox-group>div");ve.create(o,{animation:300,handle:".drag-btn",onEnd:({newIndex:n,oldIndex:h,item:ee})=>{const D=ee,S=D.parentNode,T=d.value[h],j=d.value[n];if(T!=null&&T.fixed||j!=null&&j.fixed){const A=S.children[h];n>h?S.insertBefore(D,A):S.insertBefore(D,A&&A.nextElementSibling);return}const te=d.value.splice(h,1)[0];d.value.splice(n,0,te)}})})},Q=t=>!!d.value.filter(o=>o.label===t)[0].fixed,y=t=>({content:t,offset:[0,18],duration:[300,0],followCursor:!0,hideOnClick:"toggle"}),Y={reference:()=>B(l(Te,{class:["w-[16px]",k.value]},null),[[$("tippy"),y("列设置")]])};return()=>{var o;let t;return l(O,null,[l("div",ue(R,{class:"w-[99/100] mt-2 px-2 pb-2 bg-bg_color"}),[l("div",{class:"flex justify-between w-full h-[60px] p-4"},[a!=null&&a.title?a.title():l("p",{class:"font-bold truncate"},[e.title]),l("div",{class:"flex items-center justify-around"},[a!=null&&a.buttons?l("div",{class:"flex mr-4"},[a.buttons()]):null,(o=e.tableRef)!=null&&o.size?l(O,null,[B(l(ye,{class:["w-[16px]",k.value],style:{transform:c.value?"none":"rotate(-90deg)"},onClick:()=>U()},null),[[$("tippy"),y(c.value?"折叠":"展开")]]),l(i("el-divider"),{direction:"vertical"},null)]):null,B(l(Me,{class:["w-[16px]",k.value,p.value?"animate-spin":""],onClick:()=>I()},null),[[$("tippy"),y("刷新")]]),l(i("el-divider"),{direction:"vertical"},null),B(l(i("el-dropdown"),{trigger:"click"},z({default:()=>[l(qe,{class:["w-[16px]",k.value]},null)]},J)),[[$("tippy"),y("密度")]]),l(i("el-divider"),{direction:"vertical"},null),l(i("el-popover"),{placement:"bottom-start","popper-style":{padding:0},width:"200",trigger:"click"},z({default:()=>[l("div",{class:[L.value]},[l(i("el-checkbox"),{class:"!-mr-1",label:"列展示",modelValue:g.value,"onUpdate:modelValue":n=>g.value=n,indeterminate:s.value,onChange:n=>G(n)},null),l(i("el-button"),{type:"primary",link:!0,onClick:()=>Z()},{default:()=>[M("重置")]})]),l("div",{class:"pt-[6px] pl-[11px]"},[l(i("el-scrollbar"),{"max-height":"36vh"},{default:()=>[l(i("el-checkbox-group"),{modelValue:C.value,"onUpdate:modelValue":n=>C.value=n,onChange:n=>W(n)},{default:()=>[l(i("el-space"),{direction:"vertical",alignment:"flex-start",size:0},Fe(t=x.map(n=>l("div",{class:"flex items-center"},[l(be,{class:["drag-btn w-[16px] mr-2",Q(n)?"!cursor-no-drop":"!cursor-grab"],onMouseenter:h=>K(h)},null),l(i("el-checkbox"),{key:n,value:n,onChange:h=>X(h,n)},{default:()=>[l("span",{title:n,class:"inline-block w-[120px] truncate hover:text-text_color_primary"},[n])]})])))?t:{default:()=>[t]})]})]})])]},Y))])]),a.default({size:u.value,dynamicColumns:d.value})])])}}}),Xe=fe(Oe),Le={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=Le;export{Xe as P,Ze as R};
|