import{g as i,A as o,P as x,a6 as _,a7 as b,ad as l,a8 as g,H as k,r as u,c as E,n as h}from"./index-DOFLUERq.js";import{_ as w}from"./_plugin-vue_export-helper-DlAUqK2U.js";const S={key:0,class:"editable-text"},V={__name:"EditableInput",props:{text:{type:String,default:""},placeholder:{type:String,default:""},emptyLabel:{type:String,default:""}},emits:["update:modelValue"],setup(p,{emit:d}){const e=p,f=d,t=u(!1),a=u(""),s=u(null),m=E(()=>e.text?e.text:e.emptyLabel?e.emptyLabel:e.placeholder||"点击编辑");async function v(){t.value=!0,a.value=e.text,await h(),s.value?.focus(),s.value?.select()}function n(){t.value&&(f("update:modelValue",a.value),t.value=!1)}function r(){a.value=e.text,t.value=!1}return(B,c)=>(i(),o("span",{class:k(["editable-input",{"is-editing":t.value}]),onDblclick:g(v,["stop"]),onKeydown:[l(n,["enter"]),l(r,["escape"])],tabindex:"0"},[t.value?_((i(),o("input",{key:1,ref_key:"inputRef",ref:s,type:"text",class:"form-control","onUpdate:modelValue":c[0]||(c[0]=y=>a.value=y),onBlur:n,onKeydown:[l(n,["enter"]),l(r,["escape"])]},null,544)),[[b,a.value]]):(i(),o("span",S,x(m.value),1))],34))}},K=w(V,[["__scopeId","data-v-c7790eb2"]]);export{K as default};
