"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("@ant-design/icons-vue"),M=require("@aplus-frontend/antdv/es/theme/internal"),c=require("../../context.js"),O=require("../../../ap-table/utils.js");require("../../../config-provider/index.js");require("../../../render/index.js");const z=require("../../style/custom-header.js"),k=require("../../../config-provider/hooks/use-namespace.js"),G=require("../../../render/render.js"),j=e.defineComponent({__name:"index",props:{params:{}},setup(o){const t=o,{b:g,e:a}=k.useNamespace("ag-custom-header"),{be:C,bem:b}=k.useNamespace("ag-grid"),v=z.default("ag-custom-header"),[,B]=M.useToken(),s=e.computed(()=>t.params?.column?.getColId?.()),{sorter:i,setSorter:x}=c.useInjectSorter(),u=e.computed(()=>t.params.column.sorter);function S(r){return r?r==="asc"?"desc":null:"asc"}function h(){if(!u.value)return;const l=t.params.column.getColId(),T=t.params.column.getSort(),p=S(T),d=t.params.api,V=d.getColumnState().map(f=>({...f,sort:f.colId===l?p:null}));d.applyColumnState({state:V}),x({[l]:p})}const{expandable:y}=c.useInjectExpandable(),I=e.computed(()=>t.params.columnGroup?.getLeafColumns?.()?.some(r=>r.getColDef().columnGroupShow)),m=e.computed(()=>{const r=t.params.columnGroup?.getGroupId?.();return r?y.value[r]??!1:!1});function E(){t.params.setExpanded(!m.value)}const{maskVisible:q,toggleMaskVisible:N}=c.useMaskVisible(s),w=e.computed(()=>t.params.column.mask);return(r,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(g)(),{sortable:u.value},`align-${o.params.column.align||"left"}`,e.unref(v)]),onClick:h},[e.createVNode(e.unref(G.default),{renderer:()=>e.unref(O.getTableTitle)(o.params.column,[e.unref(C)("table-header","title"),o.params.column.tooltip?"":e.unref(b)("table-header","title","single")],o.params.headerCell,e.unref(B).colorTextTertiary)},null,8,["renderer"]),w.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(a)("mask-wrapper")),onClick:l[0]||(l[0]=e.withModifiers(()=>e.unref(N)(),["stop"]))},[e.unref(q)?(e.openBlock(),e.createBlock(e.unref(n.EyeInvisibleOutlined),{key:0})):(e.openBlock(),e.createBlock(e.unref(n.EyeOutlined),{key:1}))],2)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(a)("sort-wrapper"))},[e.createVNode(e.unref(n.CaretUpOutlined),{class:e.normalizeClass({[e.unref(a)("sorter-up")]:!0,active:e.unref(i)[s.value]==="asc"})},null,8,["class"]),e.createVNode(e.unref(n.CaretDownOutlined),{class:e.normalizeClass({[e.unref(a)("sorter-down")]:!0,active:e.unref(i)[s.value]==="desc"})},null,8,["class"])],2)):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(e.unref(a)("expand-wrapper")),onClick:e.withModifiers(E,["stop"])},[m.value?(e.openBlock(),e.createBlock(e.unref(n.CaretLeftOutlined),{key:0})):(e.openBlock(),e.createBlock(e.unref(n.CaretRightOutlined),{key:1}))],2)):e.createCommentVNode("",!0)],2))}});exports.default=j;
