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