/*!
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{computed as e,watch as t,openBlock as a,createElementBlock as o,createBlock as l,createCommentVNode as n,createElementVNode as i,createVNode as r,createSlots as u,withCtx as s,renderSlot as c,unref as d,renderList as p,normalizeProps as g,guardReactiveProps as m}from"vue";import v from"./components/QueryBar.vue.js";import y from"./components/ActionBar.vue.js";import f from"./components/Pager.vue.js";import h from"./components/DataTable.vue.js";import w from"./components/ColumnSettings.vue.js";import{useGridTable as b}from"./composables/useGridTable.js";import './Grid.css';import './styles/table.css';/* empty css                 *//* empty css         */import S from"../../_virtual/_plugin-vue_export-helper.js";const j={class:"gsc-grid space-y-3"},q={class:"gsc-card gsc-card-pad"},A={class:"gsc-card"},_={key:0,class:"px-4 py-3 gsc-divider-top"},z=/* @__PURE__ */S({__name:"Grid",props:{data:{type:Array,default:()=>[]},request:{type:Function},mode:{type:String,default:"server"},columns:{type:Array,default:()=>[]},pagination:{type:[Boolean,Object],default:()=>({page:1,pageSize:10})},query:{type:Object,default:()=>({})},filterSchema:{type:Array,default:()=>[]},actions:{type:Object,default:()=>({})},rowKey:{type:String,default:"id"},rowSelection:{type:Boolean,default:!1},virtual:{type:Boolean,default:!1},rowHeight:{type:Number,default:40},height:{type:Number,default:400}},emits:["update:query","selection-change","load","cell-change","update:modelValue","info"],setup(S,{emit:z}){const C=S,Q=z,$=e(()=>C.filterSchema||[]),k=e(()=>!!C.rowSelection),B=e(()=>!1!==C.pagination),K=e(()=>{const e=C.actions||{},t=e.left||e.leftActions||[];return Array.isArray(t)?t:[]}),V=e(()=>{const e=C.actions||{},t=e.right||e.rightActions||[];return Array.isArray(t)?t:[]}),x=e(()=>!1!==(C.actions||{}).showColumnSettings),D=b({data:C.data,request:C.request,mode:C.mode,pageSize:C.pagination&&C.pagination.pageSize||10,initialQuery:C.query,columns:C.columns,rowKey:C.rowKey,enableRowSelection:k.value}),G=e(()=>!!D.loading.value),O=e({get:()=>D.query.value||{},set(e){D.setQuery(e||{})}}),U=e({get:()=>D.page.value,set(e){D.page.value=e}}),F=e({get:()=>D.pageSize.value,set(e){D.pageSize.value=e}}),H=e(()=>D.total.value||0);function I(e){const t=e||{};D.setQuery(t),D.load()}function N(e){const t=e||{};D.setQuery(t),D.load()}function R({key:e,value:t}){const a={...D.query.value||{}};null!=t&&""!==t?a[e]=t:delete a[e],D.setQuery(a),D.load()}function T(e){Q("selection-change",e||[])}function P(e){"client"===C.mode?D.setData((D.rows.value||[]).slice()):Q("cell-change",{rowKey:e?.row?.[C.rowKey],column:e?.column,value:e?.value,row:e?.row}),Q("update:modelValue",(D.rows.value||[]).slice())}return t(()=>C.data,e=>{D.setData(e||[])},{deep:!0}),t(()=>C.columns,e=>{D.setColumns(e||[])},{deep:!0}),t(()=>D.query.value,e=>{Q("update:query",e)},{deep:!0}),(e,t)=>(a(),o("div",j,[$.value.length?(a(),l(v,{key:0,modelValue:O.value,"onUpdate:modelValue":t[0]||(t[0]=e=>O.value=e),schema:$.value,loading:G.value,onSearch:I,onReset:N},null,8,["modelValue","schema","loading"])):n("",!0),i("div",q,[r(y,{loading:G.value,"left-actions":K.value,"right-actions":V.value,onInfo:t[1]||(t[1]=t=>e.$emit("info"))},u({right:s(()=>[c(e.$slots,"actions-right",{},()=>[x.value?(a(),l(w,{key:0,table:d(D).table},null,8,["table"])):n("",!0)],!0)]),_:2},[e.$slots["actions-left"]?{name:"left",fn:s(()=>[c(e.$slots,"actions-left",{},void 0,!0)]),key:"0"}:void 0]),1032,["loading","left-actions","right-actions"])]),i("div",A,[r(h,{table:d(D).table,mode:C.mode,loading:G.value,virtual:C.virtual,height:C.height,"row-height":C.rowHeight,"enable-row-selection":k.value,onSelectionChange:T,onCellChange:P,onServerFilterChange:R},u({_:2},[p(e.$slots,(t,a)=>({name:a,fn:s(t=>[c(e.$slots,a,g(m(t)),void 0,!0)])}))]),1032,["table","mode","loading","virtual","height","row-height","enable-row-selection"]),B.value?(a(),o("div",_,[r(f,{page:U.value,"page-size":F.value,total:H.value,"onUpdate:page":t[2]||(t[2]=e=>{U.value=e}),"onUpdate:pageSize":t[3]||(t[3]=e=>{F.value=e})},null,8,["page","page-size","total"])])):n("",!0)])]))}},[["__scopeId","data-v-2d3b7c2e"]]);export{z as default};