"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("@aplus-frontend/antdv"),c=require("../../ap-title/index.js");require("../../../config-provider/index.js");const h=require("../hooks/use-ag-grid-instance.js"),S=require("../style/index.js"),C=require("../../../config-provider/hooks/use-locale.js"),b=require("../../../config-provider/hooks/use-namespace.js"),k=e.defineComponent({__name:"index",props:{leftTitle:{type:[String,Object,Number,Boolean,null,Array],default:""},rightContentStyle:{type:[Boolean,null,String,Object,Array]},dividerOffset:{},bordered:{type:Boolean},isReverse:{type:Boolean,default:!0},layoutType:{default:void 0}},setup(l){const{t:u}=C.useLocale(),o=h.useAgGridModalInject(),a=l,n=e.computed(()=>{const t=o?.selectedRows?.value||[];return a.isReverse?[...t].reverse():t}),f=()=>{if(a.dividerOffset!=null)return{"--ag-grid-modal-layout-divider-offset":`${a.dividerOffset}px`}},m=()=>{o?.clearAllSelected()},s=t=>{o?.removeSelected(t)},{e:y,m:r,b:p}=b.useNamespace("ag-grid-modal"),g=S.default("ag-grid-modal");return(t,v)=>l.layoutType==="two-column"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(p)(),e.unref(r)("table-layout"),l.bordered?e.unref(r)("bordered"):"",e.unref(g)]),style:e.normalizeStyle(f())},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(r)("table-layout-left"))},[l.leftTitle?(e.openBlock(),e.createBlock(e.unref(c.ApTitle),{key:0,style:{"margin-bottom":"16px"}},{prefix:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.h(e.Fragment,[l.leftTitle]))))]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(r)("table-layout-left-content"))},[e.renderSlot(t.$slots,"default")],2)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(r)("table-layout-right")),style:e.normalizeStyle(l.rightContentStyle)},[e.createVNode(e.unref(c.ApTitle),null,{prefix:e.withCtx(()=>[e.renderSlot(t.$slots,"rightTitle",{count:n.value.length},()=>[e.createTextVNode(e.toDisplayString(`${e.unref(u)("ap.apTableModal.selected")} (${n.value.length})`),1)])]),suffix:e.withCtx(()=>[e.createVNode(e.unref(d.Button),{type:"link",style:{padding:"0px",height:"22px","border-width":"0px"},onClick:m},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u)("ap.apTableModal.clear")),1)]),_:1})]),_:3}),e.createElementVNode("div",{class:e.normalizeClass(e.unref(r)("table-layout-right-content"))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,i=>e.renderSlot(t.$slots,"renderSelectedItem",{key:i,record:i,actions:{deleteItem:s,deleteCurrent:()=>s(i)}})),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(y)("empty"))},[e.createVNode(e.unref(d.Empty),{image:e.unref(d.Empty).PRESENTED_IMAGE_SIMPLE},null,8,["image"])],2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[e.renderSlot(t.$slots,"rightBottom",{records:n.value,actions:{deleteItem:s}})])],6)],6)):e.renderSlot(t.$slots,"default",{key:1})}});exports.default=k;
