"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),S=require("@ant-design/icons-vue"),v=require("@aplus-frontend/antdv"),x=require("../../ap-table/context.js");require("../../ap-button/index.js");require("../../config-provider/index.js");require("./MenuItemGroup.vue.js");const L=require("./style/index.js"),N=require("../../config-provider/hooks/use-namespace.js"),A=require("../../config-provider/hooks/use-locale.js"),G=require("../../config-provider/hooks/use-global-config.js"),f=require("./MenuItemGroup.vue2.js"),R=require("../../ap-button/ap-button.vue.js"),D=e.defineComponent({__name:"ApBatchActionGroup",props:{selectedRows:{},buttonProps:{},menuList:{}},setup(b,{expose:h}){const{b:c}=N.useNamespace("ap-batch-action-group"),_=L.default("ap-batch-action-group"),{t:w}=A.useLocale(),{columns:P,dataSource:y}=x.useInjectApTable(),t=b,g=G.useGlobalConfig("apExportGroup"),C=e.computed(()=>g.value?.hasPermission),p=e.useSlots(),i=e.computed(()=>t?.buttonProps?.dropdownType||"default"),n=e.computed(()=>t?.buttonProps?.type||"borderLink"),d=e.computed(()=>t?.buttonProps?.content||w("ap.apApBatchActionGroup.batchOperation")),k=e.computed(()=>t?.selectedRows||[]),s=e.computed(()=>t?.buttonProps?.disabled??(Array.isArray(t.selectedRows)?k.value.length===0:!1)),B=e.computed(()=>n.value==="borderLink"?s.value?void 0:"var(--ap-button-border-link-color)":void 0),u=e.computed(()=>t?.menuList?.filter(o=>{if(o==="divider")return!0;let a=o?.ifShow;return!o?.ifShow&&o?.auth&&(a=()=>C.value?.(o.auth)),a?.()??!0})||[]);function m(){return t?.buttonProps?{...t.buttonProps,type:n.value==="borderLink"?"default":n.value}:{}}return h({columns:P,dataSource:y}),(o,a)=>u.value.length&&i.value==="dropdown"?(e.openBlock(),e.createBlock(e.unref(v.DropdownButton),e.mergeProps({key:0,class:[e.unref(c)(),e.unref(_)]},{...o.$attrs,...m(),disabled:s.value}),e.createSlots({overlay:e.withCtx(()=>[e.createVNode(f.default,e.mergeProps({...t},{"menu-list":u.value}),null,16,["menu-list"])]),default:e.withCtx(()=>[e.createElementVNode("span",{style:e.normalizeStyle({color:B.value})},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.h("span",[d.value]))))],4)]),_:2},[e.renderList(p,(q,r)=>({name:r,fn:e.withCtx(l=>[e.renderSlot(o.$slots,r,e.normalizeProps(e.guardReactiveProps(l||{})))])}))]),1040,["class"])):u.value.length&&i.value==="default"?(e.openBlock(),e.createBlock(e.unref(v.Dropdown),{key:1,class:e.normalizeClass([e.unref(c)()]),disabled:s.value},e.createSlots({overlay:e.withCtx(()=>[e.createVNode(f.default,e.mergeProps({...t},{"menu-list":u.value}),null,16,["menu-list"])]),default:e.withCtx(()=>[e.createVNode(e.unref(R.default),e.normalizeProps(e.guardReactiveProps({...o.$attrs,...m(),type:n.value})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.h("span",[d.value])))),e.createVNode(e.unref(S.DownOutlined))]),_:1},16)]),_:2},[e.renderList(p,(q,r)=>({name:r,fn:e.withCtx(l=>[e.renderSlot(o.$slots,r,e.normalizeProps(e.guardReactiveProps(l||{})))])}))]),1032,["class","disabled"])):e.createCommentVNode("",!0)}});exports.default=D;
