2 lines
6.7 KiB
JavaScript
2 lines
6.7 KiB
JavaScript
import{d as e,b as t,a as l,F as r,ax as a,f as n,r as i,a9 as o,z as s,x as p,N as c,bF as u,O as d,bG as y,bH as f,bI as h,bJ as m,bK as g,y as w,h as b,v as k,b2 as x,c as v,e as S,w as C,m as _,al as A,bL as $,a7 as F,a8 as T,J as z,t as E,Q as N,an as L,bC as O,bM as R,bN as H,g as j}from"./index.1759140438764CipgG_TB.js";import{E as I}from"./el-link.1759140438764Cr0kjxUf.js";const P=e({name:"ElSpaceItem",props:t({prefixCls:{type:String}}),setup(e,{slots:t}){const i=l("space"),o=r(()=>`${e.prefixCls||i.b()}__item`);return()=>a("div",{class:o.value},n(t,"default"))}}),G={small:8,default:12,large:16};const W=k(e({name:"ElSpace",props:t({direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},class:{type:b([String,Object,Array]),default:""},style:{type:b([String,Array,Object]),default:""},alignment:{type:b(String),default:"center"},prefixCls:{type:String},spacer:{type:b([Object,String,Number,Array]),default:null,validator:e=>y(e)||p(e)||w(e)},wrap:Boolean,fill:Boolean,fillRatio:{type:Number,default:100},size:{type:[String,Array,Number],values:g,validator:e=>p(e)||s(e)&&2===e.length&&e.every(p)}}),setup(e,{slots:t}){const{classes:a,containerStyle:g,itemStyle:w}=function(e){const t=l("space"),a=r(()=>[t.b(),t.m(e.direction),e.class]),n=i(0),c=i(0),u=r(()=>[e.wrap||e.fill?{flexWrap:"wrap"}:{},{alignItems:e.alignment},{rowGap:`${c.value}px`,columnGap:`${n.value}px`},e.style]),d=r(()=>e.fill?{flexGrow:1,minWidth:`${e.fillRatio}%`}:{});return o(()=>{const{size:t="small",wrap:l,direction:r,fill:a}=e;if(s(t)){const[e=0,l=0]=t;n.value=e,c.value=l}else{let e;e=p(t)?t:G[t||"small"]||G.small,(l||a)&&"horizontal"===r?n.value=c.value=e:"horizontal"===r?(n.value=e,c.value=0):(c.value=e,n.value=0)}}),{classes:a,containerStyle:u,itemStyle:d}}(e);function b(t,l="",r=[]){const{prefixCls:a}=e;return t.forEach((e,t)=>{f(e)?s(e.children)&&e.children.forEach((e,t)=>{f(e)&&s(e.children)?b(e.children,`${l+t}-`,r):y(e)&&(null==e?void 0:e.type)===h?r.push(e):r.push(c(P,{style:w.value,prefixCls:a,key:`nested-${l+t}`},{default:()=>[e]},u.PROPS|u.STYLE,["style","prefixCls"]))}):m(e)&&r.push(c(P,{style:w.value,prefixCls:a,key:`LoopKey${l+t}`},{default:()=>[e]},u.PROPS|u.STYLE,["style","prefixCls"]))}),r}return()=>{var l;const{spacer:r,direction:i}=e,o=n(t,"default",{key:0},()=>[]);if(0===(null!=(l=o.children)?l:[]).length)return null;if(s(o.children)){let e=b(o.children);if(r){const t=e.length-1;e=e.reduce((e,l,a)=>{const n=[...e,l];return a!==t&&n.push(c("span",{style:[w.value,"vertical"===i?"width: 100%":null],key:a},[y(r)?r:d(r,u.TEXT)],u.STYLE)),n},[])}return c("div",{class:a.value,style:g.value},e,u.STYLE|u.CLASS)}return o.children}}})),Y={key:0},B={key:4},J=["onClick"],K={key:9},D=x({__name:"comTable",props:{config:{type:Object,default:()=>{}},tableHeader:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]}},emits:["link-click","selection-change","row-click","sort-change","slot-click"],setup(e,{emit:t}){const l=e,r=t,a=(e,t)=>{r("link-click",e,t)},i=e=>{r("selection-change",e)},o=e=>{l.config.isRowClick&&r("row-click",e)},s=e=>{e.order&&r("sort-change",e)},p=e=>{var t=String(e).indexOf(".");-1!=t&&(String(e).substring(t+1,e.length).length>2&&(e=e.toFixed(2)));return String(e).replace(/\d+/,function(e){return e.replace(/(\d)(?=(?:\d{3})+$)/g,"$1,")})};return(t,l)=>{const r=$,u=I,y=L,f=O,h=R,m=W,g=H;return S(),v("div",null,[c(g,z({style:[{width:"100%"},`height:${e.config.tableHeight}rem;`],"max-height":e.config.tableHeight,border:""},t.$attrs,{onRowClick:o,stripe:e.config.isStripe,"show-summary":e.config.isShowSummary,onSortChange:s,onSelectionChange:i}),{default:C(()=>[e.config.isSelection?(S(),_(r,{key:0,align:"center",type:"selection",width:"55"})):A("",!0),(S(!0),v(F,null,T(e.tableHeader.filter(e=>!e.noShow),(e,l)=>(S(),_(r,z({align:"center",key:l,prop:e.prop,"min-width":e.minWidth,width:e.width,label:e.label,sortable:!!e.isSort&&"custom","show-overflow-tooltip":""},{ref_for:!0},e.columnAttrs),{default:C(l=>["customIndex"===e.type?(S(),v("span",Y,E(l.row[e.prop]),1)):"link"===e.type?(S(),_(u,{key:1,type:"primary",onClick:N(t=>a(l.row,e.title),["stop"])},{default:C(()=>[d(E(l.row[e.prop]),1)]),_:2},1032,["onClick"])):"button"===e.type?(S(),_(y,{key:2,type:"primary",size:"small","h-22px":"","line-height-22px":"","pl-5px":"","pr-5px":"",onClick:N(t=>a(l.row,e.title),["stop"])},{default:C(()=>[d(E(e.btnText+l.row[e.btntag]),1)]),_:2},1032,["onClick"])):"tag"===e.type?(S(),v(F,{key:3},[l.row[e.prop]?(S(),_(f,z({key:0,type:l.row[e.prop]?"primary":"danger"},{ref_for:!0},e.controlAttrsFunc&&e.controlAttrsFunc(l.row)),{default:C(()=>[d(E(l.row[e.prop]),1)]),_:2},1040,["type"])):(S(),v(F,{key:1},[d(" - ")],64))],64)):"price"===e.type?(S(),v("span",B,E(p(Number(l.row[e.prop]))),1)):"priceLink"===e.type?(S(),_(u,{key:5,type:"primary",onClick:N(t=>a(l.row,e.title),["stop"])},{default:C(()=>[d(E(p(Number(l.row[e.prop]))),1)]),_:2},1032,["onClick"])):"process"===e.type?(S(),v("span",{key:6,onClick:N(t=>a(l.row,e.title),["stop"])},[c(h,{percentage:e.isRide?10*Number(l.row[e.prop])/10*100:10*Number(l.row[e.prop])/10,"text-inside":!0,"stroke-width":13},null,8,["percentage"])],8,J)):"slot"===e.type?n(t.$slots,e.prop,{key:7,row:l.row,index:l.$index},void 0,!0):!e.type&&e.children?(S(),_(m,{key:8,size:"small","line-height-23px":"","h-23px":""},{default:C(()=>[(S(!0),v(F,null,T(e.children.filter(e=>{var t;let r=!0;const a=e.controlAttrsFunc&&e.controlAttrsFunc(l.row);return a&&"none"===(null==(t=a.style)?void 0:t.display)&&(r=!1),r}),(e,t)=>(S(),v(F,{key:t},["button"===e.type?(S(),_(y,z({key:0,type:"primary",size:"small","h-22px":"","line-height-22px":"","pl-5px":"","pr-5px":"",onClick:N(t=>a(l.row,e.title),["stop"])},{ref_for:!0},e.controlAttrsFunc&&e.controlAttrsFunc(l.row)),{default:C(()=>{var t;return[d(E((null==(t=e.controlAttrsFunc&&e.controlAttrsFunc(l.row))?void 0:t.btnText)||e.btnText),1)]}),_:2},1040,["onClick"])):A("",!0)],64))),128))]),_:2},1024)):(S(),v("span",K,E((null===l.row[e.prop]?"":l.row[e.prop])+""||"-"),1))]),_:2},1040,["prop","min-width","width","label","sortable"]))),128))]),_:3},16,["style","max-height","stripe","show-summary"])])}}},[["__scopeId","data-v-c3418808"]]),M={__name:"demo",setup(e){let t=i([{name:"张三",remark:"123",filetotal:10},{name:"李四",remark:"123",filetotal:10},{name:"王五",remark:"123",filetotal:10},{name:"赵六",remark:"123",filetotal:10}]);const l={tableHeight:480,isSelection:!1,isRowClick:!1,isStripe:!0,isShowSummary:!1,isIndex:!0,isNeedPagination:!0},r=[{label:"名称",prop:"name",width:200},{label:"备注",prop:"remark",width:200},{label:"操作",prop:"",title:"附件",btntag:"filetotal",btnText:"附件",type:"button",colWidth:100,isSort:!1}];return(e,a)=>{const n=D;return S(),v("div",null,[c(n,{data:j(t),config:l,tableHeader:r},null,8,["data"])])}}};export{M as default};
|