"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("@aplus-frontend/antdv"),c=require("@aplus-frontend/utils"),l=require("lodash-unified");require("../../config-provider/index.js");const _=require("./style/index.js"),u=require("./utils.js"),q=require("../../config-provider/hooks/use-locale.js"),B=require("../../config-provider/hooks/use-namespace.js"),b=e.defineComponent({name:"ApSummary",__name:"ap-summary",props:{data:{},columns:{},summaryTitle:{},hasSelect:{type:Boolean,default:!0},size:{default:"middle"}},setup(d){const s=d,{t:f}=q.useLocale(),p=e.computed(()=>s.summaryTitle??f("ap.apSummary.total")),y=a=>a===0,x=(a,r)=>{if(!c.isNumeric(a)||r.valueType!=="number")return a;const n=r.fieldProps?.field,t=n?.precision||0;return(l.isNil(n?.thousands)?!0:n?.thousands)?c.toThousand(a,t):c.toFixed(a,t)},k=e.computed(()=>{let a=[];s.hasSelect&&a.push({key:"select",rowSpan:1,align:"left",value:""});const n=u.flattenColumns(s.columns).map((t,i)=>{let o;const T=l.get(s.data,u.formatDataIndex(t.dataIndex||t.key));if(y(i))o=p.value;else if(T&&(t.customRender||t.renderText)){const C=l.get(s.data,u.formatDataIndex(t.dataIndex||t.key));o=(t.customRender||t.renderText)?.({value:C,record:s.data,text:void 0,index:0,renderIndex:0,column:{}})}else o=x(l.get(s.data,u.formatDataIndex(t.dataIndex||t.key)),t);return{key:t.key,rowSpan:1,align:t.align,value:e.createVNode(e.Fragment,null,[o])}});return a.concat(n)}),{b:h,e:g,em:v}=B.useNamespace("ap-summary"),S=_.default("ap-summary");return(a,r)=>(e.openBlock(),e.createBlock(e.unref(m.TableSummaryRow),{class:e.normalizeClass([e.unref(h)(),e.unref(S)])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(n,t)=>(e.openBlock(),e.createBlock(e.unref(m.TableSummaryCell),{key:n.key,class:e.normalizeClass(`${s.size==="small"?e.unref(v)("item","small"):e.unref(g)("item")}`),index:t,style:e.normalizeStyle({textAlign:n.align})},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value)))]),_:2},1032,["class","index","style"]))),128))]),_:1},8,["class"]))}});exports.default=b;
