/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
import{ref as e,computed as t,onMounted as l,onBeforeUnmount as i,openBlock as n,createElementBlock as s,createVNode as c,unref as o,withModifiers as a,withCtx as r,createTextVNode as u,toDisplayString as g,createElementVNode as d,Fragment as p,renderList as m,createCommentVNode as v}from"vue";import{useLocale as f}from"../../../hooks/useLocale.js";import{GscButton as b}from"../../../Button/index.js";import './ColumnSettings.css';/* empty css                   */import h from"../../../_virtual/_plugin-vue_export-helper.js";const k={class:"relative"},x={class:"flex items-center justify-between px-2 py-1"},y={class:"text-sm font-medium text-[rgba(0,0,0,0.88)]"},_={class:"max-h-64 overflow-auto pr-1 mt-1"},C=["checked","onChange"],S=["title"],j={class:"mt-2 flex items-center justify-between gap-2 gsc-divider-top pt-2"},w=/* @__PURE__ */h({__name:"ColumnSettings",props:{table:{type:Object,required:!0}},setup(h){const w=h,E=e(!1),{t:L}=f(),V=t(()=>{try{return w.table.getAllLeafColumns?.()||[]}catch{return[]}});function A(){V.value.forEach(e=>e.toggleVisibility(!0))}function D(){V.value.forEach(e=>e.toggleVisibility(!1))}function I(){E.value=!1}return l(()=>{document.addEventListener("click",I)}),i(()=>{document.removeEventListener("click",I)}),(e,t)=>(n(),s("div",k,[c(o(b),{type:"button",variant:"default",onClick:t[0]||(t[0]=a(e=>E.value=!E.value,["stop"]))},{default:r(()=>[u(g(o(L)("gsc.grid.columnSettings.trigger")),1)]),_:1}),E.value?(n(),s("div",{key:0,class:"gsc-popover absolute right-0 mt-2 w-72 p-2 z-20",onClick:t[2]||(t[2]=a(()=>{},["stop"]))},[d("div",x,[d("div",y,g(o(L)("gsc.grid.columnSettings.title")),1),c(o(b),{type:"button",variant:"text",onClick:t[1]||(t[1]=e=>E.value=!1)},{default:r(()=>[u(g(o(L)("gsc.grid.columnSettings.close")),1)]),_:1})]),d("div",_,[(n(!0),s(p,null,m(V.value,e=>(n(),s("label",{key:e.id,class:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-[rgba(0,0,0,0.02)] cursor-pointer"},[d("input",{type:"checkbox",class:"gsc-checkbox",checked:e.getIsVisible(),onChange:t=>e.toggleVisibility(!!t.target.checked)},null,40,C),d("span",{class:"text-sm truncate",title:String(e.columnDef?.header??e.id)},g(String(e.columnDef?.header??e.id)),9,S)]))),128))]),d("div",j,[c(o(b),{type:"button",variant:"default",class:"px-2",onClick:A},{default:r(()=>[u(g(o(L)("gsc.grid.columnSettings.checkAll")),1)]),_:1}),c(o(b),{type:"button",variant:"default",class:"px-2",onClick:D},{default:r(()=>[u(g(o(L)("gsc.grid.columnSettings.uncheckAll")),1)]),_:1})])])):v("",!0)]))}},[["__scopeId","data-v-e7aee950"]]);export{w as default};