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 ae=Object.defineProperty;var q=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var O=(e,r,a)=>r in e?ae(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,N=(e,r)=>{for(var a in r||(r={}))ne.call(r,a)&&O(e,a,r[a]);if(q)for(var a of q(r))re.call(r,a)&&O(e,a,r[a]);return e};var I=(e,r,a)=>new Promise((V,u)=>{var b=c=>{try{d(a.next(c))}catch(g){u(g)}},v=c=>{try{d(a.throw(c))}catch(g){u(g)}},d=c=>c.done?V(c.value):Promise.resolve(c.value).then(b,v);d((a=a.apply(e,r)).next())});import{S as oe}from"./sortable.esm-6WsHlDA5.js";import{f as w,k as C,g as k,d as ie,a as h,aj as f,fx as ce,ag as ue,ap as M,p as F,i as l,a8 as se,F as L,B as $,A as D,e as i,h as R,af as m,aD as de,cU as he,y as fe,a0 as ve}from"./index-CiUe5cVr.js";import{u as ge}from"./epTheme-CgyYRqcr.js";const pe={width:"32",height:"32",fill:"currentColor","aria-hidden":"true","data-icon":"holder",viewBox:"64 64 896 896"},xe=k("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),me=[xe];function be(e,r){return w(),C("svg",pe,[...me])}const _e={render:be},we={width:"32",height:"32",viewBox:"0 0 24 24"},Ce=k("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),ke=[Ce];function ye(e,r){return w(),C("svg",we,[...ke])}const Ae={render:ye},Be={width:"32",height:"32",viewBox:"0 0 24 24"},Ee=k("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),Me=[Ee];function $e(e,r){return w(),C("svg",Be,[...Me])}const De={render:$e},Re={width:"32",height:"32",viewBox:"0 0 24 24"},Ve=k("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),Se=[Ve];function Te(e,r){return w(),C("svg",Re,[...Se])}const je={render:Te},ze={width:"32",height:"32",viewBox:"0 0 24 24"},He=k("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),Ne=[He];function Fe(e,r){return w(),C("svg",ze,[...Ne])}const Pe={render:Fe};function qe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!de(e)}const Oe={title:{type:String,default:"列表"},tableRef:{type:Object},columns:{type:Array,default:()=>[]},isExpandAll:{type:Boolean,default:!0}},Ie=ie({name:"PureTableBar",props:Oe,emits:["refresh"],setup(e,{emit:r,slots:a,attrs:V}){const u=h("default"),b=h(!1),v=h(!0),d=h(!1),c=h(e.isExpandAll),g=f(e==null?void 0:e.columns).filter(t=>ce(t==null?void 0:t.hide)?!t.hide:!(ue(t==null?void 0:t.hide)&&(t!=null&&t.hide())));let p=M(f(e==null?void 0:e.columns),"label");const y=h(M(f(g),"label")),s=h(f(e==null?void 0:e.columns)),S=F(()=>t=>({background:t===u.value?ge().epThemeColor:"",color:t===u.value?"#fff":"var(--el-text-color-primary)"})),A=F(()=>["text-black","dark:text-white","duration-100","hover:!text-primary","cursor-pointer","outline-none"]),U=F(()=>["flex","justify-between","pt-[3px]","px-[11px]","border-b-[1px]","border-solid","border-[#dcdfe6]","dark:border-[#303030]"]);function W(){b.value=!0,r("refresh"),he(500).then(()=>b.value=!1)}function Z(){c.value=!c.value,P(e.tableRef.data,c.value)}function P(t,o){t.forEach(n=>{e.tableRef.toggleRowExpansion(n,o),n.children!==void 0&&n.children!==null&&P(n.children,o)})}function G(t){y.value=t?p:[],d.value=!1,s.value.map(o=>t?o.hide=!1:o.hide=!0)}function J(t){y.value=t;const o=t.length;v.value=o===p.length,d.value=o>0&&o<p.length}function K(t,o){s.value.filter(n=>m(n.label)===m(o))[0].hide=!t}function Q(){return I(this,null,function*(){v.value=!0,d.value=!1,s.value=f(e==null?void 0:e.columns),p=[],p=yield M(f(e==null?void 0:e.columns),"label"),y.value=M(f(g),"label")})}const X={dropdown:()=>l(i("el-dropdown-menu"),{class:"translation"},{default:()=>[l(i("el-dropdown-item"),{style:S.value("large"),onClick:()=>u.value="large"},{default:()=>[R("宽松")]}),l(i("el-dropdown-item"),{style:S.value("default"),onClick:()=>u.value="default"},{default:()=>[R("默认")]}),l(i("el-dropdown-item"),{style:S.value("small"),onClick:()=>u.value="small"},{default:()=>[R("紧凑")]})]})},Y=t=>{t.preventDefault(),fe(()=>{const o=document.querySelector(".el-checkbox-group>div");oe.create(o,{animation:300,handle:".drag-btn",onEnd:({newIndex:n,oldIndex:x,item:_})=>{const T=_,j=T.parentNode,z=s.value[x],H=s.value[n];if(z!=null&&z.fixed||H!=null&&H.fixed){const E=j.children[x];n>x?j.insertBefore(T,E):j.insertBefore(T,E&&E.nextElementSibling);return}const le=s.value.splice(x,1)[0];s.value.splice(n,0,le)}})})},ee=t=>!!s.value.filter(o=>m(o.label)===m(t))[0].fixed,B=t=>({content:t,offset:[0,18],duration:[300,0],followCursor:!0,hideOnClick:"toggle"}),te={reference:()=>$(l(je,{class:["w-[16px]",A.value]},null),[[D("tippy"),B("列设置")]])};return()=>{var o;let t;return l(L,null,[l("div",se(V,{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(L,null,[$(l(Ae,{class:["w-[16px]",A.value],style:{transform:c.value?"none":"rotate(-90deg)"},onClick:()=>Z()},null),[[D("tippy"),B(c.value?"折叠":"展开")]]),l(i("el-divider"),{direction:"vertical"},null)]):null,$(l(De,{class:["w-[16px]",A.value,b.value?"animate-spin":""],onClick:()=>W()},null),[[D("tippy"),B("刷新")]]),l(i("el-divider"),{direction:"vertical"},null),$(l(i("el-dropdown"),{trigger:"click"},N({default:()=>[l(Pe,{class:["w-[16px]",A.value]},null)]},X)),[[D("tippy"),B("密度")]]),l(i("el-divider"),{direction:"vertical"},null),l(i("el-popover"),{placement:"bottom-start","popper-style":{padding:0},width:"200",trigger:"click"},N({default:()=>[l("div",{class:[U.value]},[l(i("el-checkbox"),{class:"!-mr-1",label:"列展示",modelValue:v.value,"onUpdate:modelValue":n=>v.value=n,indeterminate:d.value,onChange:n=>G(n)},null),l(i("el-button"),{type:"primary",link:!0,onClick:()=>Q()},{default:()=>[R("重置")]})]),l("div",{class:"pt-[6px] pl-[11px]"},[l(i("el-scrollbar"),{"max-height":"36vh"},{default:()=>[l(i("el-checkbox-group"),{modelValue:y.value,onChange:n=>J(n)},{default:()=>[l(i("el-space"),{direction:"vertical",alignment:"flex-start",size:0},qe(t=p.map((n,x)=>l("div",{class:"flex items-center"},[l(_e,{class:["drag-btn w-[16px] mr-2",ee(n)?"!cursor-no-drop":"!cursor-grab"],onMouseenter:_=>Y(_)},null),l(i("el-checkbox"),{key:x,label:n,value:n,onChange:_=>K(_,n)},{default:()=>[l("span",{title:m(n),class:"inline-block w-[120px] truncate hover:text-text_color_primary"},[m(n)])]})])))?t:{default:()=>[t]})]})]})])]},te))])]),a.default({size:u.value,dynamicColumns:s.value})])])}}}),Je=ve(Ie),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"/>'},Ke=Le;export{Je as P,Ke as R};
|