/*!
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,onMounted as t,openBlock as l,createElementBlock as o,renderSlot as n,unref as a,withDirectives as u,withKeys as c,withModifiers as r,isRef as s,Fragment as p,renderList as i,toDisplayString as d,vModelSelect as m,vModelText as v,createElementVNode as y,createVNode as f,withCtx as k,createTextVNode as g}from"vue";import{GscButton as V}from"../../../Button/index.js";import{useCellEditor as _}from"../composables/useCellEditor.js";import './CellEditor2.css';import './CellEditor.css';/* empty css               *//* empty css               */import C from"../../../_virtual/_plugin-vue_export-helper.js";const x={class:"gsc-cell-editor"},b=["value"],j={key:0},K={class:"mt-2 flex gap-2 justify-end"},w=/* @__PURE__ */C({__name:"CellEditor",props:{modelValue:[String,Number,Date],type:{type:String,default:"text"},options:Array},emits:["update:modelValue","commit","cancel"],setup(C,{emit:w}){const U=C,h=w,{localValue:E,updateLocal:L,commit:$,cancel:H}=_(U,h),I=e(null);function M(e){const t=e.target.innerHTML;L(t)}return t(()=>{"rich-text"===U.type&&I.value&&(I.value.innerHTML=E.value||"")}),(e,t)=>(l(),o("div",x,["custom"===C.type?n(e.$slots,"custom",{key:0,modelValue:C.modelValue,update:a(L),commit:a($),cancel:a(H)},void 0,!0):"select"===C.type?u((l(),o("select",{key:1,"onUpdate:modelValue":t[0]||(t[0]=e=>s(E)?E.value=e:null),class:"gsc-control",onKeydown:[t[1]||(t[1]=c(r((...e)=>a($)&&a($)(...e),["prevent"]),["enter"])),t[2]||(t[2]=c(r((...e)=>a(H)&&a(H)(...e),["prevent"]),["esc"]))]},[(l(!0),o(p,null,i(C.options||[],e=>(l(),o("option",{key:e.value,value:e.value},d(e.label),9,b))),128))],544)),[[m,a(E)]]):"date"===C.type?u((l(),o("input",{key:2,"onUpdate:modelValue":t[3]||(t[3]=e=>s(E)?E.value=e:null),type:"date",class:"gsc-control",onKeydown:[t[4]||(t[4]=c(r((...e)=>a($)&&a($)(...e),["prevent"]),["enter"])),t[5]||(t[5]=c(r((...e)=>a(H)&&a(H)(...e),["prevent"]),["esc"]))]},null,544)),[[v,a(E)]]):"datetime-local"===C.type?u((l(),o("input",{key:3,"onUpdate:modelValue":t[6]||(t[6]=e=>s(E)?E.value=e:null),type:"datetime-local",class:"gsc-control",onKeydown:[t[7]||(t[7]=c(r((...e)=>a($)&&a($)(...e),["prevent"]),["enter"])),t[8]||(t[8]=c(r((...e)=>a(H)&&a(H)(...e),["prevent"]),["esc"]))]},null,544)),[[v,a(E)]]):"number"===C.type?u((l(),o("input",{key:4,"onUpdate:modelValue":t[9]||(t[9]=e=>s(E)?E.value=e:null),type:"number",class:"gsc-control",onKeydown:[t[10]||(t[10]=c(r((...e)=>a($)&&a($)(...e),["prevent"]),["enter"])),t[11]||(t[11]=c(r((...e)=>a(H)&&a(H)(...e),["prevent"]),["esc"]))]},null,544)),[[v,a(E),void 0,{number:!0}]]):"rich-text"===C.type?(l(),o(p,{key:5},[e.$slots.custom?(l(),o("div",j,[n(e.$slots,"custom",{modelValue:a(E),update:a(L),commit:a($),cancel:a(H)},void 0,!0)])):(l(),o("div",{key:1,ref_key:"richRef",ref:I,contenteditable:"",class:"gsc-textarea",onInput:M},d(a(E)),545))],64)):u((l(),o("input",{key:6,"onUpdate:modelValue":t[12]||(t[12]=e=>s(E)?E.value=e:null),class:"gsc-control",onKeydown:[t[13]||(t[13]=c(r((...e)=>a($)&&a($)(...e),["prevent"]),["enter"])),t[14]||(t[14]=c(r((...e)=>a(H)&&a(H)(...e),["prevent"]),["esc"]))]},null,544)),[[v,a(E)]]),y("div",K,[f(a(V),{variant:"primary",onClick:a($)},{default:k(()=>[...t[15]||(t[15]=[g(" OK ",-1)])]),_:1},8,["onClick"]),f(a(V),{variant:"default",onClick:a(H)},{default:k(()=>[...t[16]||(t[16]=[g(" Cancel ",-1)])]),_:1},8,["onClick"])])]))}},[["__scopeId","data-v-3e2da6e3"]]);export{w as default};